Skip to content

Commit 72133f7

Browse files
committed
Count silence in frames
1 parent 1b306bd commit 72133f7

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

src/soundio/sounddeviceportaudio.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -889,6 +889,26 @@ int SoundDevicePortAudio::callbackProcessDrift(
889889
//qDebug() << "callbackProcess read:" << (float)readAvailable / outChunkSize << "Buffer empty";
890890
}
891891
}
892+
893+
if (in) {
894+
int silenceCount = 0;
895+
for (SINT i = 0; i < framesPerBuffer * 2; i++) {
896+
if (std::abs(in[i]) < 0.005) {
897+
silenceCount++;
898+
}
899+
}
900+
qDebug() << "In silenceCount" << silenceCount;
901+
902+
/*
903+
904+
QDebug dbg(QtDebugMsg);
905+
906+
for (SINT i = 0; i < framesPerBuffer * 2; i++) {
907+
dbg << out[i];
908+
}
909+
*/
910+
}
911+
892912
return m_callbackResult.load(std::memory_order_acquire);
893913
}
894914

0 commit comments

Comments
 (0)