kopia lustrzana https://gitlab.com/eliggett/wfview
Added a mutex. Still have strange crashes.
rodzic
3c5cb7d539
commit
2bf131afd5
|
@ -670,6 +670,8 @@ void audioHandler::incomingAudio(audioPacket inPacket)
|
|||
|
||||
// Begin plugin code:
|
||||
|
||||
pluginMutex.lock();
|
||||
|
||||
//
|
||||
// Note, size of qint16 array is data.size() / 2 .
|
||||
//
|
||||
|
@ -680,22 +682,15 @@ void audioHandler::incomingAudio(audioPacket inPacket)
|
|||
QByteArray pluginOutputQBA;
|
||||
qDebug() << "made byte array.";
|
||||
|
||||
pluginOutputQBA.reserve(inPacket.data.size());
|
||||
pluginOutputQBA.resize(inPacket.data.size());
|
||||
// pluginOutputQBA.reserve(inPacket.data.size());
|
||||
// pluginOutputQBA.resize(inPacket.data.size());
|
||||
pluginOutputQBA.fill('0', inPacket.data.size());
|
||||
|
||||
qDebug(logAudio()) << "plugin output QBA size: " << pluginOutputQBA.length();
|
||||
// qDebug(logAudio()) << "plugin output QBA size: " << pluginOutputQBA.length();
|
||||
|
||||
qint16* pluginOutput = (qint16*)pluginOutputQBA.data();
|
||||
volatile qint16* pluginOutput = (qint16*)pluginOutputQBA.data();
|
||||
|
||||
|
||||
// uint16_t BUF_SIZE = inPacket.data.size() / 2;
|
||||
|
||||
// LADSPA_Data pInStereoBuffer[2*BUF_SIZE];
|
||||
// LADSPA_Data pOutStereoBuffer[2*BUF_SIZE];
|
||||
// LADSPA_Data pInBuffer[2][BUF_SIZE];
|
||||
// LADSPA_Data pOutBuffer[2][BUF_SIZE];
|
||||
|
||||
// Copy data from "out" to pInBuffer:
|
||||
// copyDataIn();
|
||||
|
||||
|
@ -713,17 +708,21 @@ void audioHandler::incomingAudio(audioPacket inPacket)
|
|||
runPlugin();
|
||||
|
||||
// copy data back out from pOutBuffer to inPacket.data
|
||||
// pOutBuffer[0] has size BUF_SIZE/2
|
||||
// pOutBuffer[1] has size BUF_SIZE/2
|
||||
|
||||
// Maybe the issue is here?
|
||||
|
||||
// This is wrong:
|
||||
for (int n = 0; n+1 < BUF_SIZE; n += 2) {
|
||||
|
||||
pluginOutput[n] = (pOutBuffer[0][n] + 1) * max;
|
||||
pluginOutput[n+1] = (pOutBuffer[1][n] + 1) * max;
|
||||
pluginOutput[n] = (pOutBuffer[0][n/2] + 1) * max;
|
||||
pluginOutput[n+1] = (pOutBuffer[1][n/2] + 1) * max;
|
||||
}
|
||||
|
||||
// copyDataOut();
|
||||
|
||||
// --- End plugin code.
|
||||
pluginMutex.unlock();
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -182,6 +182,7 @@ private:
|
|||
unsigned int ratioDen;
|
||||
|
||||
// --- Plugin support:
|
||||
QMutex pluginMutex;
|
||||
uint16_t SAMPLE_RATE;
|
||||
uint16_t BUF_SIZE;
|
||||
const LADSPA_Descriptor * psDescriptor;
|
||||
|
|
Ładowanie…
Reference in New Issue