Fixedd buffer overflow in audio IO

pull/2/head
Ryzerth 2020-07-20 13:45:05 +02:00
rodzic 379d6f8101
commit d47679c5cf
3 zmienionych plików z 6 dodań i 7 usunięć

Wyświetl plik

@ -39,7 +39,7 @@ namespace io {
outputParams.hostApiSpecificStreamInfo = NULL;
outputParams.device = Pa_GetDefaultOutputDevice();
outputParams.suggestedLatency = Pa_GetDeviceInfo(outputParams.device)->defaultLowOutputLatency;
PaError err = Pa_OpenStream(&stream, NULL, &outputParams, 48000.0f, 64, paClipOff, _callback, this);
PaError err = Pa_OpenStream(&stream, NULL, &outputParams, 48000.0f, _bufferSize, paClipOff, _callback, this);
printf("%s\n", Pa_GetErrorText(err));
err = Pa_StartStream(stream);
printf("%s\n", Pa_GetErrorText(err));
@ -67,13 +67,8 @@ namespace io {
float vol = powf(_this->_volume, 2);
for (int i = 0; i < frameCount; i++) {
outbuf[(i * 2) + 0] = _this->buffer[i] * vol;
outbuf[(i * 2) + 1] = _this->buffer[i] * vol;
}
return 0;
}

Wyświetl plik

@ -43,6 +43,10 @@ namespace io {
devList = SoapySDR::Device::enumerate();
txtDevList = "";
if (devList.size() == 0) {
txtDevList += '\0';
return;
}
for (int i = 0; i < devList.size(); i++) {
txtDevList += devList[i]["label"];
txtDevList += '\0';

Wyświetl plik

@ -29,7 +29,7 @@ void SignalPath::init(uint64_t sampleRate, int fftRate, int fftSize, dsp::stream
ssbDemod.init(mainVFO.output, 6000, 3000, 22);
audioResamp.init(&demod.output, 200000, 48000, 800);
audio.init(&audioResamp.output, 16);
audio.init(&audioResamp.output, 64);
}
void SignalPath::setSampleRate(float sampleRate) {