Permalink
Browse files

Style

  • Loading branch information...
1 parent 5ed888f commit fd73720eab7b523677dbd5df988cf944a1e559e6 @miek committed Feb 29, 2016
Showing with 381 additions and 361 deletions.
  1. +5 −2 fft.h
  2. +4 −2 inputsource.cpp
  3. +3 −1 inputsource.h
  4. +12 −12 main.cpp
  5. +6 −6 mainwindow.h
  6. +210 −200 spectrogram.cpp
  7. +72 −70 spectrogram.h
  8. +47 −47 spectrogramcontrols.cpp
  9. +22 −21 spectrogramcontrols.h
View
@@ -21,12 +21,15 @@
#include <fftw3.h>
-class FFT {
+class FFT
+{
public:
FFT(int size);
~FFT();
void process(void *dest, void *source);
- int getSize() { return fftSize; }
+ int getSize() {
+ return fftSize;
+ }
private:
int fftSize;
View
@@ -27,7 +27,8 @@
#include <stdexcept>
-InputSource::InputSource(const char *filename) {
+InputSource::InputSource(const char *filename)
+{
m_file = fopen(filename, "rb");
if (m_file == nullptr)
throw std::runtime_error("Error opening file");
@@ -43,7 +44,8 @@ InputSource::InputSource(const char *filename) {
throw std::runtime_error("Error mmapping file");
}
-InputSource::~InputSource() {
+InputSource::~InputSource()
+{
munmap(m_data, m_file_size);
fclose(m_file);
}
View
@@ -36,5 +36,7 @@ class InputSource
~InputSource();
bool getSamples(fftwf_complex *dest, off_t start, int length);
- off_t getSampleCount() { return sampleCount; };
+ off_t getSampleCount() {
+ return sampleCount;
+ };
};
View
@@ -35,27 +35,27 @@ int main(int argc, char *argv[])
// Add options
QCommandLineOption rateOption(QStringList() << "r" << "rate",
- QCoreApplication::translate("main", "Set sample rate."),
- QCoreApplication::translate("main", "Hz"));
+ QCoreApplication::translate("main", "Set sample rate."),
+ QCoreApplication::translate("main", "Hz"));
parser.addOption(rateOption);
// Process the actual command line
parser.process(a);
- if (parser.isSet(rateOption)){
- bool ok;
- // Use toDouble just for scientific notation support
- int rate = parser.value(rateOption).toDouble(&ok);
- if(!ok){
- fputs("ERROR: could not parse rate\n", stderr);
- return 1;
- }
- mainWin.changeSampleRate(rate);
+ if (parser.isSet(rateOption)) {
+ bool ok;
+ // Use toDouble just for scientific notation support
+ int rate = parser.value(rateOption).toDouble(&ok);
+ if(!ok) {
+ fputs("ERROR: could not parse rate\n", stderr);
+ return 1;
+ }
+ mainWin.changeSampleRate(rate);
}
const QStringList args = parser.positionalArguments();
if (args.size()>=1)
- mainWin.openFile(args.at(0));
+ mainWin.openFile(args.at(0));
mainWin.show();
return a.exec();
View
@@ -34,18 +34,18 @@ class MainWindow : public QMainWindow
public slots:
void openFile(QString fileName);
- void setSampleRate(QString rate);
- void setFFTSize(int size);
- void setZoomLevel(int zoom);
+ void setSampleRate(QString rate);
+ void setFFTSize(int size);
+ void setZoomLevel(int zoom);
protected:
- bool eventFilter(QObject *obj, QEvent *event);
+ bool eventFilter(QObject *obj, QEvent *event);
private:
QScrollArea scrollArea;
Spectrogram spectrogram;
SpectrogramControls *dock;
- off_t getCenterSample();
- int getScrollPos(off_t sample);
+ off_t getCenterSample();
+ int getScrollPos(off_t sample);
};
Oops, something went wrong.

0 comments on commit fd73720

Please sign in to comment.