Skip to content

Commit

Permalink
Tidy debug texts
Browse files Browse the repository at this point in the history
  • Loading branch information
donarturo11 committed Jun 26, 2024
1 parent 3bf2fe4 commit 26215c8
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 20 deletions.
12 changes: 10 additions & 2 deletions src/audio/AudioEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,15 @@ void AudioEngine::probeJack()
_audio = new RtAudio(RtAudio::Api::UNIX_JACK);
int deviceCount = _audio->getDeviceCount();
if (!deviceCount) throw -1;
#ifdef DEBUG
std::cerr << "JACK Success\n";
#endif
} catch(...) {
_audio = 0;
success = false;
#ifdef DEBUG
std::cerr << "JACK Failed\n";
#endif
return;
}
if (_audio->getDeviceCount()) {
Expand Down Expand Up @@ -78,9 +82,13 @@ void AudioEngine::probeChoosenDevice(RtAudio::Api api)
if (!_audio) throw 1;
_outputParameters.deviceId = _audio->getDefaultOutputDevice();
_inputParameters.deviceId = _audio->getDefaultInputDevice();
#ifdef DEBUG
fprintf(stderr, "Load SUCCESS\n");
#endif
} catch(...) {
#ifdef DEBUG
fprintf(stderr, "Load FAILED\n");
#endif
}
}

Expand Down Expand Up @@ -128,9 +136,9 @@ int AudioEngine::audioCallback(void * output,
void * obj)
{
AudioEngine *engine = reinterpret_cast<AudioEngine*>(obj);
if (rtOutBuf)
if (output)
engine->readBuffer(output, nFrames);
if (rtInBuf)
if (input)
engine->fillBuffer(input, nFrames);
return 0;
}
8 changes: 6 additions & 2 deletions src/gui/ControllerWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,9 @@ void ControllerWidget::sendNoteOff(int number)

void ControllerWidget::sendFrequencyChange(int number, double frequency)
{
qDebug() << "Synth number " << number << " has frequency " << frequency << "Hz";
#ifdef DEBUG
qDebug() << "Synth number " << number << " has frequency " << frequency << "Hz";
#endif
_synth->sendFrequencyChange(number, frequency);
setFocus();
}
Expand All @@ -141,7 +143,9 @@ void ControllerWidget::loadWave(QString filename, float basefreq)

void ControllerWidget::loadWaveToSynth(std::vector <float> wave)
{
qDebug() << "loadWaveToSynth wave size: " << wave.size();
#ifdef DEBUG
qDebug() << "loadWaveToSynth wave size: " << wave.size();
#endif
_synth->loadWave(wave);
_synth->setBaseFrequency(_base_frequency);
for (int i=0; i < _voices; i++ )
Expand Down
10 changes: 10 additions & 0 deletions src/gui/WaveLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ namespace GUI {
WaveLoader::WaveLoader(QWidget *parent, unsigned int samplerate, unsigned int nChannels)
: QWidget{parent}
{
#ifdef DEBUG
qDebug() << "AudioLoader c-tor";
#endif
_finished = false;
_samplerate = samplerate;
_nChannels = nChannels;
Expand All @@ -12,7 +14,9 @@ WaveLoader::WaveLoader(QWidget *parent, unsigned int samplerate, unsigned int nC

WaveLoader::~WaveLoader()
{
#ifdef DEBUG
qDebug() << "AudioLoader d-tor";
#endif
if (_audioFile->isOpen())
_audioFile->close();
if (_decoder)
Expand Down Expand Up @@ -73,13 +77,17 @@ void WaveLoader::readBuffer()

void WaveLoader::finishedSlot()
{
#ifdef DEBUG
qDebug() << "Finished slot";
#endif
clear();
}

void WaveLoader::clear()
{
#ifdef DEBUG
qDebug() << "clear";
#endif
_decoder->stop();
_audioFile->close();
}
Expand All @@ -95,8 +103,10 @@ void WaveLoader::decodingChanged(QAudioDecoder::State b)
_finished = true;
emit sendWave(_samples);
emit finished();
#ifdef DEBUG
qDebug() << "finished";
qDebug() << "_samples size" << _samples.size();
#endif
}
//_decoder->stop();
}
Expand Down
5 changes: 1 addition & 4 deletions src/gui/controllerwidget/ControllerGroup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@ namespace GUI {

/* --------------- */
ControllerGroup::ControllerGroup(QWidget* parent) : QWidget(parent)
{
std::cerr << "Controller group c-tor\n";

}
{}

ControllerGroup::~ControllerGroup()
{
Expand Down
4 changes: 1 addition & 3 deletions src/gui/controllerwidget/KeyButton.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#include "gui/controllerwidget/KeyButton.h"
#include <iostream>
#include <QWidget>
#include <QDebug>
namespace GUI {
Expand All @@ -16,8 +15,7 @@ KeyButton::KeyButton(QWidget *parent, bool semitone) : QPushButton(parent)
}

KeyButton::~KeyButton()
{
}
{}

void KeyButton::init()
{
Expand Down
6 changes: 1 addition & 5 deletions src/synth/Synthesizer.cpp
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
#include "synth/Synthesizer.h"
#include <iostream>
namespace Synth {
Synthesizer::Synthesizer()
{
fprintf(stderr, "Synthesizer c-tor\n");
}
{}

Synthesizer::Synthesizer(int voices)
{
fprintf(stderr, "Synthesizer c-tor\n");
setPolyphony(voices);
}

Expand Down
4 changes: 0 additions & 4 deletions src/synth/Voice.cpp
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
#include "synth/Voice.h"
#include "stk/LentPitShift.h"
#include <iostream>

namespace Synth {
Voice::Voice(Synthesizer* synth)
{
_wave_size = 0;
_synth = synth;
//_wave_size = synth->wave().size();
//_wave = new WaveContainer();
_index = Voice::index;
_noteOn = false;
fprintf(stderr, "Voice c-tor, index: %i\n", _index);
update();
Voice::index++;
}
Expand Down

0 comments on commit 26215c8

Please sign in to comment.