[AFV] Handle stereo in- and output devices

This commit is contained in:
Roland Rossgotterer
2019-09-25 21:37:48 +02:00
committed by Mat Sutcliffe
parent a06205efbd
commit 9f497c1b60
5 changed files with 52 additions and 24 deletions

View File

@@ -10,6 +10,7 @@
#include "output.h"
#include "blackmisc/logmessage.h"
#include "blacksound/audioutilities.h"
#include <QDebug>
#include <QStringBuilder>
@@ -61,16 +62,13 @@ namespace BlackCore
m_maxSampleOutput = 0;
}
// if (maxlen > buffer.size()) { maxlen = buffer.size(); }
// memcpy(data, buffer.constData(), maxlen > buffer.size() ? buffer.size() : maxlen);
qint16 *p = reinterpret_cast<qint16 *>(data);
int index = 0;
for (int n = 0; n < count; n++)
if (channelCount == 2)
{
p[index++] = buffer[n];
if (channelCount == 2) p[index++] = buffer[n];
buffer = convertFromMonoToStereo(buffer);
}
memcpy(data, buffer.constData(), maxlen);
return maxlen;
}