mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 11:48:09 +02:00
fixes for all current headsets work
This commit is contained in:
parent
6b644eb130
commit
f7ed8cef8f
1 changed files with 9 additions and 6 deletions
|
@ -185,14 +185,16 @@ void linearResampling(int16_t* sourceSamples, int16_t* destinationSamples,
|
||||||
// we need to downsample from 48 to 24
|
// we need to downsample from 48 to 24
|
||||||
// for now this only supports a mono output - this would be the case for audio input
|
// for now this only supports a mono output - this would be the case for audio input
|
||||||
|
|
||||||
for (int i = 2; i < numSourceSamples; i += 4) {
|
for (int i = sourceAudioFormat.channelCount(); i < numSourceSamples; i += 2 * sourceAudioFormat.channelCount()) {
|
||||||
if (i + 2 >= numSourceSamples) {
|
if (i + (sourceAudioFormat.channelCount()) >= numSourceSamples) {
|
||||||
destinationSamples[(i - 2) / 4] = (sourceSamples[i - 2] / 2)
|
destinationSamples[(i - sourceAudioFormat.channelCount()) / (int) sourceToDestinationFactor] =
|
||||||
|
(sourceSamples[i - sourceAudioFormat.channelCount()] / 2)
|
||||||
+ (sourceSamples[i] / 2);
|
+ (sourceSamples[i] / 2);
|
||||||
} else {
|
} else {
|
||||||
destinationSamples[(i - 2) / 4] = (sourceSamples[i - 2] / 4)
|
destinationSamples[(i - sourceAudioFormat.channelCount()) / (int) sourceToDestinationFactor] =
|
||||||
|
(sourceSamples[i - sourceAudioFormat.channelCount()] / 4)
|
||||||
+ (sourceSamples[i] / 2)
|
+ (sourceSamples[i] / 2)
|
||||||
+ (sourceSamples[i + 2] / 4);
|
+ (sourceSamples[i + sourceAudioFormat.channelCount()] / 4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -448,7 +450,8 @@ void Audio::addReceivedAudioToBuffer(const QByteArray& audioByteArray) {
|
||||||
|
|
||||||
// add output (@speakers) data just written to the scope
|
// add output (@speakers) data just written to the scope
|
||||||
QMetaObject::invokeMethod(_scope, "addSamples", Qt::QueuedConnection,
|
QMetaObject::invokeMethod(_scope, "addSamples", Qt::QueuedConnection,
|
||||||
Q_ARG(QByteArray, outputBuffer),
|
Q_ARG(QByteArray, QByteArray((char*) ringBufferSamples,
|
||||||
|
NETWORK_BUFFER_LENGTH_BYTES_STEREO)),
|
||||||
Q_ARG(bool, true), Q_ARG(bool, false));
|
Q_ARG(bool, true), Q_ARG(bool, false));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue