mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 23:09:52 +02:00
loopback local injectors on server echo
This commit is contained in:
parent
01d2d9243a
commit
768354e49f
3 changed files with 11 additions and 5 deletions
|
@ -167,7 +167,8 @@ public slots:
|
||||||
|
|
||||||
int setOutputBufferSize(int numFrames, bool persist = true);
|
int setOutputBufferSize(int numFrames, bool persist = true);
|
||||||
|
|
||||||
virtual bool outputLocalInjector(bool isStereo, AudioInjector* injector) override;
|
bool outputLocalInjector(bool isStereo, AudioInjector* injector) override;
|
||||||
|
bool shouldLoopbackInjectors() override { return _shouldEchoToServer; }
|
||||||
|
|
||||||
bool switchInputToAudioDevice(const QString& inputDeviceName);
|
bool switchInputToAudioDevice(const QString& inputDeviceName);
|
||||||
bool switchOutputToAudioDevice(const QString& outputDeviceName);
|
bool switchOutputToAudioDevice(const QString& outputDeviceName);
|
||||||
|
|
|
@ -33,6 +33,7 @@ public:
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
virtual bool outputLocalInjector(bool isStereo, AudioInjector* injector) = 0;
|
virtual bool outputLocalInjector(bool isStereo, AudioInjector* injector) = 0;
|
||||||
|
virtual bool shouldLoopbackInjectors() { return false; }
|
||||||
|
|
||||||
virtual void setIsStereoInput(bool stereo) = 0;
|
virtual void setIsStereoInput(bool stereo) = 0;
|
||||||
};
|
};
|
||||||
|
|
|
@ -211,6 +211,7 @@ int64_t AudioInjector::injectNextFrame() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// if we haven't setup the packet to send then do so now
|
// if we haven't setup the packet to send then do so now
|
||||||
|
static int loopbackOptionOffset = -1;
|
||||||
static int positionOptionOffset = -1;
|
static int positionOptionOffset = -1;
|
||||||
static int volumeOptionOffset = -1;
|
static int volumeOptionOffset = -1;
|
||||||
static int audioDataOffset = -1;
|
static int audioDataOffset = -1;
|
||||||
|
@ -260,10 +261,9 @@ int64_t AudioInjector::injectNextFrame() {
|
||||||
// pack the stereo/mono type of the stream
|
// pack the stereo/mono type of the stream
|
||||||
audioPacketStream << _options.stereo;
|
audioPacketStream << _options.stereo;
|
||||||
|
|
||||||
// pack the flag for loopback. Now, we don't loopback
|
// pack the flag for loopback, if requested
|
||||||
// and _always_ play locally, so loopbackFlag should be
|
loopbackOptionOffset = _currentPacket->pos();
|
||||||
// false always.
|
uchar loopbackFlag = (_localAudioInterface && _localAudioInterface->shouldLoopbackInjectors());
|
||||||
uchar loopbackFlag = (uchar)false;
|
|
||||||
audioPacketStream << loopbackFlag;
|
audioPacketStream << loopbackFlag;
|
||||||
|
|
||||||
// pack the position for injected audio
|
// pack the position for injected audio
|
||||||
|
@ -293,6 +293,7 @@ int64_t AudioInjector::injectNextFrame() {
|
||||||
return NEXT_FRAME_DELTA_ERROR_OR_FINISHED;
|
return NEXT_FRAME_DELTA_ERROR_OR_FINISHED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_frameTimer->isValid()) {
|
if (!_frameTimer->isValid()) {
|
||||||
// in the case where we have been restarted, the frame timer will be invalid and we need to start it back over here
|
// in the case where we have been restarted, the frame timer will be invalid and we need to start it back over here
|
||||||
_frameTimer->restart();
|
_frameTimer->restart();
|
||||||
|
@ -317,6 +318,9 @@ int64_t AudioInjector::injectNextFrame() {
|
||||||
// pack the sequence number
|
// pack the sequence number
|
||||||
_currentPacket->writePrimitive(_outgoingSequenceNumber);
|
_currentPacket->writePrimitive(_outgoingSequenceNumber);
|
||||||
|
|
||||||
|
_currentPacket->seek(loopbackOptionOffset);
|
||||||
|
_currentPacket->writePrimitive((uchar)(_localAudioInterface && _localAudioInterface->shouldLoopbackInjectors()));
|
||||||
|
|
||||||
_currentPacket->seek(positionOptionOffset);
|
_currentPacket->seek(positionOptionOffset);
|
||||||
_currentPacket->writePrimitive(_options.position);
|
_currentPacket->writePrimitive(_options.position);
|
||||||
_currentPacket->writePrimitive(_options.orientation);
|
_currentPacket->writePrimitive(_options.orientation);
|
||||||
|
|
Loading…
Reference in a new issue