mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-31 21:15:33 +08:00
[AFV] Handle stereo in- and output devices
This commit is contained in:
committed by
Mat Sutcliffe
parent
a06205efbd
commit
9f497c1b60
@@ -8,7 +8,7 @@ QVector<qint16> convertBytesTo16BitPCM(const QByteArray input)
|
||||
|
||||
for (int n = 0; n < inputSamples; n++)
|
||||
{
|
||||
output[n] = *reinterpret_cast<const qint16*>(input.data() + n * 2);
|
||||
output[n] = *reinterpret_cast<const qint16 *>(input.data() + n * 2);
|
||||
}
|
||||
return output;
|
||||
}
|
||||
@@ -19,3 +19,26 @@ QVector<qint16> convertFloatBytesTo16BitPCM(const QByteArray input)
|
||||
qFatal("Not implemented");
|
||||
return {};
|
||||
}
|
||||
|
||||
QVector<qint16> convertFromMonoToStereo(const QVector<qint16> &mono)
|
||||
{
|
||||
QVector<qint16> stereo;
|
||||
stereo.reserve(mono.size() * 2);
|
||||
for (qint16 sample : mono)
|
||||
{
|
||||
stereo << sample;
|
||||
stereo << sample;
|
||||
}
|
||||
return stereo;
|
||||
}
|
||||
|
||||
QVector<qint16> convertFromStereoToMono(const QVector<qint16> &stereo)
|
||||
{
|
||||
QVector<qint16> mono;
|
||||
mono.reserve(stereo.size() / 2);
|
||||
for (int i = 0; i < stereo.size(); i = i + 2)
|
||||
{
|
||||
mono.append(stereo.at(i));
|
||||
}
|
||||
return mono;
|
||||
}
|
||||
|
||||
@@ -7,5 +7,7 @@
|
||||
|
||||
BLACKSOUND_EXPORT QVector<qint16> convertBytesTo16BitPCM(const QByteArray input);
|
||||
BLACKSOUND_EXPORT QVector<qint16> convertFloatBytesTo16BitPCM(const QByteArray input);
|
||||
BLACKSOUND_EXPORT QVector<qint16> convertFromMonoToStereo(const QVector<qint16> &mono);
|
||||
BLACKSOUND_EXPORT QVector<qint16> convertFromStereoToMono(const QVector<qint16> &stereo);
|
||||
|
||||
#endif // guard
|
||||
|
||||
Reference in New Issue
Block a user