diff --git a/inputsource.cpp b/inputsource.cpp index 9b77c91..327ee23 100644 --- a/inputsource.cpp +++ b/inputsource.cpp @@ -37,9 +37,9 @@ void InputSource::cleanupFFTW() { if (m_fftw_out != nullptr) fftwf_free(m_fftw_out); } -void InputSource::GetViewport(float *dest, int x, int y, int width, int height, int zoom) { +void InputSource::getViewport(float *dest, int x, int y, int width, int height, int zoom) { - fftwf_complex *sample_ptr = &m_data[y * GetFFTStride()]; + fftwf_complex *sample_ptr = &m_data[y * getFFTStride()]; for (int i = 0; i < height; i++) { // Abort if sampling more data than is actually available @@ -65,17 +65,17 @@ void InputSource::GetViewport(float *dest, int x, int y, int width, int height, *dest = magdb; dest++; } - sample_ptr += GetFFTStride(); + sample_ptr += getFFTStride(); } } -int InputSource::GetHeight() { - int lines = m_file_size / sizeof(fftwf_complex) / GetFFTStride(); +int InputSource::getHeight() { + int lines = m_file_size / sizeof(fftwf_complex) / getFFTStride(); // Force height to be a multiple of overlap size - return (lines / GetFFTStride()) * GetFFTStride(); + return (lines / getFFTStride()) * getFFTStride(); } -int InputSource::GetWidth() { +int InputSource::getWidth() { return m_fft_size; } @@ -96,7 +96,7 @@ void InputSource::setFFTSize(int size) { m_max_zoom = floor(log2(m_fft_size)); } -bool InputSource::ZoomIn() { +bool InputSource::zoomIn() { m_zoom++; if (m_zoom > m_max_zoom) { m_zoom = m_max_zoom; @@ -105,7 +105,7 @@ bool InputSource::ZoomIn() { return true; } -bool InputSource::ZoomOut() { +bool InputSource::zoomOut() { m_zoom--; if (m_zoom < 0) { m_zoom = 0; @@ -114,6 +114,6 @@ bool InputSource::ZoomOut() { return true; } -int InputSource::GetFFTStride() { +int InputSource::getFFTStride() { return m_fft_size / pow(2, m_zoom); } diff --git a/inputsource.h b/inputsource.h index c48eef4..4588fd1 100644 --- a/inputsource.h +++ b/inputsource.h @@ -19,7 +19,7 @@ private: int m_zoom; int m_max_zoom; - int GetFFTStride(); + int getFFTStride(); void cleanupFFTW(); @@ -27,11 +27,11 @@ public: InputSource(const char *filename, int fft_size); ~InputSource(); - void GetViewport(float *dest, int x, int y, int width, int height, int zoom); - int GetHeight(); - int GetWidth(); + void getViewport(float *dest, int x, int y, int width, int height, int zoom); + int getHeight(); + int getWidth(); void setFFTSize(int size); - bool ZoomIn(); - bool ZoomOut(); + bool zoomIn(); + bool zoomOut(); }; diff --git a/spectrogram.cpp b/spectrogram.cpp index 2c4ec20..f9d524e 100644 --- a/spectrogram.cpp +++ b/spectrogram.cpp @@ -30,7 +30,7 @@ void Spectrogram::pickFile() InputSource *newFile = new InputSource(fileName.toUtf8().constData(), fftSize); delete inputSource; inputSource = newFile; - resize(inputSource->GetWidth(), inputSource->GetHeight()); + resize(inputSource->getWidth(), inputSource->getHeight()); } catch (std::runtime_error e) { // TODO: display error return; @@ -104,12 +104,12 @@ void Spectrogram::paintEvent(QPaintEvent *event) painter.fillRect(rect, Qt::black); if (inputSource != nullptr) { - int width = inputSource->GetWidth(); + int width = inputSource->getWidth(); int height = rect.height(); float *data = (float*)malloc(width * height * sizeof(float)); - inputSource->GetViewport(data, 0, rect.y(), width, height, 0); + inputSource->getViewport(data, 0, rect.y(), width, height, 0); QImage image(width, height, QImage::Format_RGB32); for (int y = 0; y < height; y++) { @@ -140,7 +140,7 @@ void Spectrogram::setFFTSize(int size) if (inputSource != nullptr) { inputSource->setFFTSize(size); update(); - resize(inputSource->GetWidth(), inputSource->GetHeight()); + resize(inputSource->getWidth(), inputSource->getHeight()); } }