mirror of
https://github.com/overte-org/overte.git
synced 2025-08-11 00:53:17 +02:00
Check _currentSendPosition instead of overriding
This commit is contained in:
parent
dfe70ed2e3
commit
5a8b9082b2
2 changed files with 7 additions and 4 deletions
|
@ -44,11 +44,14 @@ void AudioInjector::setOptions(AudioInjectorOptions& options) {
|
||||||
|
|
||||||
const uchar MAX_INJECTOR_VOLUME = 0xFF;
|
const uchar MAX_INJECTOR_VOLUME = 0xFF;
|
||||||
|
|
||||||
void AudioInjector::injectAudio(int startingPosition) {
|
void AudioInjector::injectAudio() {
|
||||||
_currentSendPosition = startingPosition;
|
|
||||||
|
|
||||||
QByteArray soundByteArray = _sound->getByteArray();
|
QByteArray soundByteArray = _sound->getByteArray();
|
||||||
|
|
||||||
|
if (_currentSendPosition < 0 ||
|
||||||
|
_currentSendPosition >= soundByteArray.size()) {
|
||||||
|
_currentSendPosition = 0;
|
||||||
|
}
|
||||||
|
|
||||||
// make sure we actually have samples downloaded to inject
|
// make sure we actually have samples downloaded to inject
|
||||||
if (soundByteArray.size()) {
|
if (soundByteArray.size()) {
|
||||||
// give our sample byte array to the local audio interface, if we have it, so it can be handled locally
|
// give our sample byte array to the local audio interface, if we have it, so it can be handled locally
|
||||||
|
|
|
@ -29,7 +29,7 @@ public:
|
||||||
|
|
||||||
int getCurrentSendPosition() const { return _currentSendPosition; }
|
int getCurrentSendPosition() const { return _currentSendPosition; }
|
||||||
public slots:
|
public slots:
|
||||||
void injectAudio(int startingPosition = 0);
|
void injectAudio();
|
||||||
void stop() { _shouldStop = true; }
|
void stop() { _shouldStop = true; }
|
||||||
void setOptions(AudioInjectorOptions& options);
|
void setOptions(AudioInjectorOptions& options);
|
||||||
void setCurrentSendPosition(int currentSendPosition) { _currentSendPosition = currentSendPosition; }
|
void setCurrentSendPosition(int currentSendPosition) { _currentSendPosition = currentSendPosition; }
|
||||||
|
|
Loading…
Reference in a new issue