kopia lustrzana https://gitlab.com/eliggett/wfview
And just like that we have a mix now!
rodzic
49c423a7fb
commit
4fdcc4bf26
|
@ -260,9 +260,10 @@ void paHandler::incomingAudio(audioPacket packet)
|
|||
if(setup.isinput)
|
||||
{
|
||||
// Try sending directly to the hardware:
|
||||
// (not currently working)
|
||||
//convertedOutput(packet);
|
||||
|
||||
// Convert:
|
||||
// Convert: (if needed)
|
||||
//emit sendToMonitorConverter(packet);
|
||||
|
||||
// if the formats are actually the same, no need to convert:
|
||||
|
@ -307,6 +308,20 @@ int paHandler::writeData(const void* inputBuffer, void* outputBuffer,
|
|||
return paContinue;
|
||||
}
|
||||
|
||||
void paHandler::mixAudio(QByteArray *dest, unsigned char *monitorSource)
|
||||
{
|
||||
int size = dest->size();
|
||||
float* mon = reinterpret_cast<float*>(monitorSource);
|
||||
float* dst = reinterpret_cast<float*>(dest->data());
|
||||
//32 bits per float sample means the size is divide by four.
|
||||
int floatSize = size / 4;
|
||||
|
||||
for(int s=0; s < floatSize; s++)
|
||||
{
|
||||
dst[s] = dst[s] + mon[s];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void paHandler::convertedOutput(audioPacket packet) {
|
||||
|
||||
|
@ -338,6 +353,10 @@ void paHandler::convertedOutput(audioPacket packet) {
|
|||
// qDebug(logAudio()) << "ERROR, size mismatch. packet is " << packet.data.size() << "bytes, monitor audio is " << sharedAudioInfo->monitorAudioBuffer[readPos].data.size() << "bytes.";
|
||||
// }
|
||||
|
||||
mixAudio(&packet.data, sharedAudioInfo->monitorAudioBufferChar[readPos]);
|
||||
|
||||
// Copy:
|
||||
/*
|
||||
for(int p=0; p < packet.data.size(); p++)
|
||||
{
|
||||
// monitor only test: (this sounds bad currently)
|
||||
|
@ -348,6 +367,7 @@ void paHandler::convertedOutput(audioPacket packet) {
|
|||
// Mix:
|
||||
//packet.data[p] = packet.data[p] + (unsigned char)(sharedAudioInfo->monitorVolume*sharedAudioInfo->monitorAudioBuffer[sharedAudioInfo->bufferReadPosition].data.at(p));
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -75,6 +75,8 @@ private:
|
|||
return ((paHandler*)userData)->writeData(inputBuffer, outputBuffer, nFrames, streamTime, status);
|
||||
}
|
||||
|
||||
void mixAudio(QByteArray *dest, unsigned char *monitorSource);
|
||||
|
||||
bool isInitialized = false;
|
||||
PaStream* audio = Q_NULLPTR;
|
||||
PaStreamParameters aParams;
|
||||
|
|
Ładowanie…
Reference in New Issue