Skip to content
Snippets Groups Projects
Commit 8ca55a6f authored by SeeLook's avatar SeeLook :musical_note:
Browse files

Hide/disable debug texts, made some of them more clear before

parent f43d5bbd
No related branches found
No related tags found
No related merge requests found
......@@ -312,6 +312,12 @@ void TexamExecutor::askQuestion(bool isAttempt) {
curQ->lastAttempt()->melodyWasPlayed(); // it was played once for sure
if (m_exercise)
m_melody->clearToFix(melodyLength);
// melody debug output
// QStringList notes;
// for (int i = 0; i < curQ->melody()->length(); ++i)
// notes << curQ->melody()->note(i)->p().toText();
// qDebug() << "\n[TexamExecutor] Question" << m_exam->count() << "attempt" << curQ->attemptsCount();
// qDebug() << "Melody" << notes;
}
// qDebug() << curQ->qa.note.toText() << "Q" << (int)curQ->questionAs
// << "A" << (int)curQ->answerAs << curQ->key.getName()
......@@ -1271,7 +1277,7 @@ void TexamExecutor::stopExamSlot() {
void TexamExecutor::closeExecutor() {
mW->setMessageBg(-1);
mW->setStatusMessage("");
mW->setStatusMessage(QString());
mW->setStatusMessage(tr("Such a pity."), 5000);
m_canvas->clearCanvas();
......@@ -1400,6 +1406,8 @@ void TexamExecutor::connectPlayingFinished() {
void TexamExecutor::noteOfMelodyStarted(const TnoteStruct& n) {
// Tnote nn = n.pitch;
// qDebug() << "[TexamExecutor] note started" << nn.toText();
if (m_melody->wasIndexChanged())
m_exam->curQ()->lastAttempt()->melodyWasPlayed();
m_melody->noteStarted();
......@@ -1411,6 +1419,8 @@ void TexamExecutor::noteOfMelodyStarted(const TnoteStruct& n) {
void TexamExecutor::noteOfMelodyFinished(const TnoteStruct& n) {
// Tnote nn = n.pitch;
// qDebug() << "[TexamExecutor] note finished" << nn.toText();
m_melody->setNote(n);
if (m_melody->currentIndex() == m_exam->curQ()->melody()->length() - 1) {
if (gl->E->expertsAnswerEnable)
......
......@@ -94,7 +94,6 @@ TpitchFinder::TpitchFinder(QObject* parent) :
TpitchFinder::~TpitchFinder()
{
qDebug() << "[TpitchFinder] deleting....";
m_doProcess = false;
m_mutex.lock();
m_mutex.unlock();
......@@ -107,7 +106,6 @@ TpitchFinder::~TpitchFinder()
delete m_aGl;
delete m_thread;
delete m_tokenBuffer;
qDebug() << "[TpitchFinder] deleted";
}
//##########################################################################################################
......
......@@ -78,7 +78,7 @@ void TrtAudio::createRtAudio() {
m_rtAduio = new RtAudio(rtAPI);
m_rtAduio->showWarnings(false);
} catch (RtAudioError& e) {
qDebug() << "Cannot create RtAudio instance" << QString::fromStdString(e.getMessage());
qDebug() << "[TrtAudio] Cannot create RtAudio instance" << QString::fromStdString(e.getMessage());
m_rtAduio = 0;
}
}
......@@ -155,7 +155,7 @@ void TrtAudio::printSupportedFormats(RtAudio::DeviceInfo& devInfo) {
fmt += " RTAUDIO_FLOAT32";
if (devInfo.nativeFormats & 0x20)
fmt += " RTAUDIO_FLOAT64";
qDebug() << "supported sample formats:" << fmt;
qDebug() << "[TrtAudio] supported sample formats:" << fmt;
}
......@@ -163,7 +163,7 @@ void TrtAudio::printSupportedSampleRates(RtAudio::DeviceInfo& devInfo) {
QString sRates;
for (int i = 0; i < devInfo.sampleRates.size(); i++)
sRates += QString("%1 ").arg(devInfo.sampleRates.at(i));
qDebug() << "supported sample rates:"<< sRates;
qDebug() << "[TrtAudio] supported sample rates:"<< sRates;
}
......@@ -253,7 +253,7 @@ void TrtAudio::updateAudioParams() {
RtAudio::DeviceInfo inputInfo;
getDeviceInfo(inputInfo, inDevId);
if (inputInfo.inputChannels <= 0) {
qDebug("wrong default input device");
qDebug("[TrtAudio] wrong default input device");
deleteInParams();
}
}
......@@ -266,7 +266,7 @@ void TrtAudio::updateAudioParams() {
getDeviceInfo(outInfo, outDevId);
if (outDevId > -1) {
if (outInfo.outputChannels <= 0) {
qDebug("wrong default output device");
qDebug("[TrtAudio] wrong default output device");
deleteOutParams();
}
}
......@@ -282,7 +282,7 @@ void TrtAudio::updateAudioParams() {
outDevId = 0;
}
} else {
qDebug() << "No audio devices!";
qDebug() << "[TrtAudio] No audio devices!";
return;
}
// setting device parameters
......@@ -338,7 +338,7 @@ bool TrtAudio::listen() {
}
m_state = e_listening;
rtDevice()->openStream(0, m_inParams, RTAUDIO_SINT16, m_inSR, &m_bufferFrames, &listenCallBack, 0, streamOptions);
// qDebug() << "stream is listening";
// qDebug() << "[TrtAudio] stream is listening";
return true;
}
......@@ -354,7 +354,7 @@ bool TrtAudio::play() {
}
m_state = e_playing;
rtDevice()->openStream(m_outParams, 0, RTAUDIO_SINT16, m_outSR, &m_bufferFrames, &playCallBack, 0, streamOptions);
// qDebug() << "stream is playing";
// qDebug() << "[TrtAudio] stream is playing";
return true;
}
......@@ -370,12 +370,12 @@ bool TrtAudio::openStream() {
else
splitTry = play();
if (!splitTry) {
qDebug() << "Cannot open split stream";
qDebug() << "[TrtAudio] Cannot open split stream";
return false;
}
} else if (!rtDevice()->isStreamOpen()) {
rtDevice()->openStream(m_outParams, m_inParams, RTAUDIO_SINT16, sampleRate(), &m_bufferFrames, m_callBack, 0, streamOptions);
qDebug() << "audio opened in duplex mode";
qDebug() << "[TrtAudio] audio opened in duplex mode";
}
if (rtDevice()->isStreamOpen()) {
......@@ -404,7 +404,7 @@ bool TrtAudio::openStream() {
return false;
}
} catch (RtAudioError& e) {
qDebug() << "can't open stream" << m_inDevName << m_outDevName << "\n" << QString::fromStdString(e.getMessage());
qDebug() << "[TrtAudio] can't open stream" << m_inDevName << m_outDevName << "\n" << QString::fromStdString(e.getMessage());
return false;
}
return true;
......@@ -427,13 +427,12 @@ bool TrtAudio::startStream() {
try {
if (rtDevice() && !rtDevice()->isStreamRunning()) {
rtDevice()->startStream();
// qDebug("stream started");
}
} catch (RtAudioError& e) {
qDebug() << "can't start stream";
qDebug() << "[TrtAudio] can't start stream";
return false;
}
// qDebug("stream started");
// qDebug("[TrtAudio] stream started");
return true;
}
......@@ -442,10 +441,10 @@ void TrtAudio::stopStream() {
try {
if (rtDevice() && rtDevice()->isStreamRunning()) {
rtDevice()->stopStream();
// qDebug("stream stopped");
// qDebug("[TrtAudio] stream stopped");
}
} catch (RtAudioError& e) {
qDebug() << "can't stop stream";
qDebug() << "[TrtAudio] can't stop stream";
}
}
......@@ -456,10 +455,10 @@ void TrtAudio::closeStream() {
if (rtDevice() && rtDevice()->isStreamOpen()) {
rtDevice()->closeStream();
m_state = e_iddle;
// qDebug("stream closed");
// qDebug("[TrtAudio] stream closed");
}
} catch (RtAudioError& e) {
qDebug() << "can't close stream";
qDebug() << "[TrtAudio] can't close stream";
}
}
......@@ -468,11 +467,11 @@ void TrtAudio::abortStream() {
try {
if (rtDevice() && rtDevice()->isStreamRunning()) {
rtDevice()->abortStream();
// qDebug("stream aborted");
// qDebug("[TrtAudio] stream aborted");
}
}
catch (RtAudioError& e) {
qDebug() << "can't abort stream";
qDebug() << "[TrtAudio] can't abort stream";
}
if (areStreamsSplit())
closeStream();
......@@ -511,7 +510,7 @@ bool TrtAudio::getDeviceInfo(RtAudio::DeviceInfo& devInfo, int id) {
devInfo = rtDevice()->getDeviceInfo(id);
}
catch (RtAudioError& e) {
qDebug() << "error when probing audio device" << id;
qDebug() << "[TrtAudio] error when probing audio device" << id;
return false;
}
return true;
......@@ -525,7 +524,7 @@ RtAudio::Api TrtAudio::getCurrentApi() {
api = rtDevice()->getCurrentApi();
}
catch (RtAudioError& e) {
qDebug() << "Cannot determine current API";;
qDebug() << "[TrtAudio] Cannot determine current API";;
}
}
return api;
......@@ -539,7 +538,7 @@ unsigned int TrtAudio::getDeviceCount() {
cnt = rtDevice()->getDeviceCount();
}
catch (RtAudioError& e) {
qDebug() << "Cannot obtain devices number";
qDebug() << "[TrtAudio] Cannot obtain devices number";
}
}
return cnt;
......@@ -553,7 +552,7 @@ int TrtAudio::getDefaultIn() {
inNr = rtDevice()->getDefaultInputDevice();
}
catch (RtAudioError& e) {
qDebug() << "Cannot get default input device";
qDebug() << "[TrtAudio] Cannot get default input device";
}
}
return inNr;
......@@ -567,7 +566,7 @@ int TrtAudio::getDefaultOut() {
inNr = rtDevice()->getDefaultOutputDevice();
}
catch (RtAudioError& e) {
qDebug() << "Cannot get default output device";
qDebug() << "[TrtAudio] Cannot get default output device";
}
}
return inNr;
......
......@@ -129,23 +129,25 @@ void TaudioIN::setMinimalVolume(float minVol) {
}
/** Range of notes is increased semitone down and up.
/**
* Range of notes is increased semitone down and up.
* This 46 and 48 are its sign.
* Normally 47 is offset of midi note to Nootka Tnote. */
* Normally 47 is offset of midi note to Nootka Tnote.
*/
void TaudioIN::setAmbitus(Tnote loNote, Tnote hiNote) {
m_loPitch = loNote.toMidi() - 1;
m_hiPitch = hiNote.toMidi() + 1;
m_loNote = loNote;
m_hiNote = hiNote;
TpitchFinder::Erange range = TpitchFinder::e_middle;
if (loNote.chromatic() > Tnote(6, 0, 0).chromatic())
range = TpitchFinder::e_high;
else if (loNote.chromatic() > Tnote(5, -2, 0).chromatic())
range = TpitchFinder::e_middle;
else
range = TpitchFinder::e_low;
if ((int)range != m_currentRange) {
m_currentRange = (int)range;
TpitchFinder::Erange range = loNote.chromatic() > Tnote(5, -2, 0).chromatic() ? TpitchFinder::e_middle : TpitchFinder::e_low;
// if (loNote.chromatic() > Tnote(6, 0, 0).chromatic())
// range = TpitchFinder::e_high;
// else if (loNote.chromatic() > Tnote(5, -2, 0).chromatic())
// range = TpitchFinder::e_middle;
// else
// range = TpitchFinder::e_low;
if (static_cast<int>(range) != m_currentRange) {
m_currentRange = static_cast<int>(range);
bool isStop = isStoped();
stopListening();
m_pitch->setSampleRate(m_pitch->aGl()->rate, m_currentRange);
......@@ -189,7 +191,7 @@ void TaudioIN::startListening() {
openStream();
if (startStream())
setState(e_listening);
qDebug() << "start listening";
// qDebug() << "start listening";
}
}
}
......@@ -197,7 +199,7 @@ void TaudioIN::startListening() {
void TaudioIN::stopListening() {
if (state() != e_stopped) {
qDebug() << "stop listening";
// qDebug() << "stop listening";
m_volume = 0.0;
m_LastChunkPitch = 0.0;
if (areStreamsSplit() || rtDevice()->getCurrentApi() != RtAudio::LINUX_PULSE)
......@@ -211,8 +213,8 @@ void TaudioIN::stopListening() {
void TaudioIN::pitchInChunkSlot(float pitch) {
if (isPaused())
return;
if (pitch == 0.0)
m_LastChunkPitch = 0.0;
if (pitch == 0.0f)
m_LastChunkPitch = 0.0f;
else
m_LastChunkPitch = pitch - audioParams()->a440diff;
}
......@@ -223,8 +225,10 @@ void TaudioIN::noteStartedSlot(qreal pitch, qreal freq, qreal duration) {
m_lastNote.set(pitch - audioParams()->a440diff, freq, duration);
if (inRange(m_lastNote.pitchF)) {
m_noteWasStarted = true;
// qDebug() << "[TaudioIN] started" << pitch << m_lastNote.pitch.toText();
emit noteStarted(m_lastNote);
}
} // else
// qDebug() << "[TaudioIN] started but out of range";
} else
m_lastNote.set(); // reset last detected note structure
}
......@@ -236,8 +240,10 @@ void TaudioIN::noteFinishedSlot(TnoteStruct* lastNote) {
qreal midiPitch = lastNote->getAverage(3, // non guitar pitch is average of all pitches
Tcore::gl()->instrument == e_noInstrument ? lastNote->pitches()->size() : m_pitch->minChunksNumber());
m_lastNote.set(midiPitch - audioParams()->a440diff, pitch2freq(midiPitch), lastNote->duration);
if (inRange(m_lastNote.pitchF))
if (inRange(m_lastNote.pitchF)) {
// qDebug() << "[TaudioIN] finished" << m_lastNote.pitchF << m_lastNote.pitch.toText();
emit noteFinished(m_lastNote);
}
} else
m_lastNote.set(); // reset last detected note structure
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment