mirror of
https://github.com/miek/inspectrum.git
synced 2026-03-06 08:24:29 +01:00
Don't try and set FFT size when no file is loaded, fixes #20
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
Spectrogram::Spectrogram()
|
||||
{
|
||||
inputSource = nullptr;
|
||||
fftSize = 1024;
|
||||
powerMax = 0.0f;
|
||||
powerMin = -50.0f;
|
||||
}
|
||||
@@ -26,7 +27,7 @@ void Spectrogram::pickFile()
|
||||
);
|
||||
if (fileName != nullptr) {
|
||||
try {
|
||||
InputSource *newFile = new InputSource(fileName.toUtf8().constData(), (inputSource != nullptr) ? inputSource->GetWidth() : 1024);
|
||||
InputSource *newFile = new InputSource(fileName.toUtf8().constData(), fftSize);
|
||||
delete inputSource;
|
||||
inputSource = newFile;
|
||||
resize(inputSource->GetWidth(), inputSource->GetHeight());
|
||||
@@ -135,9 +136,12 @@ void Spectrogram::paintEvent(QPaintEvent *event)
|
||||
|
||||
void Spectrogram::setFFTSize(int size)
|
||||
{
|
||||
inputSource->setFFTSize(size);
|
||||
update();
|
||||
resize(inputSource->GetWidth(), inputSource->GetHeight());
|
||||
fftSize = size;
|
||||
if (inputSource != nullptr) {
|
||||
inputSource->setFFTSize(size);
|
||||
update();
|
||||
resize(inputSource->GetWidth(), inputSource->GetHeight());
|
||||
}
|
||||
}
|
||||
|
||||
void Spectrogram::setPowerMax(int power)
|
||||
|
||||
Reference in New Issue
Block a user