mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-06-19 22:49:29 +02:00
add a volume setter to the AudioInjector
This commit is contained in:
parent
3f4b4178ff
commit
534010347b
2 changed files with 5 additions and 1 deletions
|
@ -107,7 +107,7 @@ void AudioInjector::injectAudio(AbstractAudioInterface* localAudioInterface) {
|
||||||
currentPacketPosition += sizeof(radius);
|
currentPacketPosition += sizeof(radius);
|
||||||
|
|
||||||
// pack 255 for attenuation byte
|
// pack 255 for attenuation byte
|
||||||
uchar volume = 255;
|
uchar volume = MAX_INJECTOR_VOLUME * _volume;
|
||||||
memcpy(currentPacketPosition, &volume, sizeof(volume));
|
memcpy(currentPacketPosition, &volume, sizeof(volume));
|
||||||
currentPacketPosition += sizeof(volume);
|
currentPacketPosition += sizeof(volume);
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,8 @@
|
||||||
class AbstractAudioInterface;
|
class AbstractAudioInterface;
|
||||||
class QNetworkReply;
|
class QNetworkReply;
|
||||||
|
|
||||||
|
const uchar MAX_INJECTOR_VOLUME = 0xFF;
|
||||||
|
|
||||||
class AudioInjector : public QObject {
|
class AudioInjector : public QObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
|
@ -28,6 +30,7 @@ public:
|
||||||
|
|
||||||
void setPosition(const glm::vec3& position) { _position = position; }
|
void setPosition(const glm::vec3& position) { _position = position; }
|
||||||
void setOrientation(const glm::quat& orientation) { _orientation = orientation; }
|
void setOrientation(const glm::quat& orientation) { _orientation = orientation; }
|
||||||
|
void setVolume(float volume) { _volume = std::max(fabsf(volume), 1.0f); }
|
||||||
public slots:
|
public slots:
|
||||||
void injectViaThread(AbstractAudioInterface* localAudioInterface = NULL);
|
void injectViaThread(AbstractAudioInterface* localAudioInterface = NULL);
|
||||||
|
|
||||||
|
@ -38,6 +41,7 @@ private:
|
||||||
QUrl _sourceURL;
|
QUrl _sourceURL;
|
||||||
glm::vec3 _position;
|
glm::vec3 _position;
|
||||||
glm::quat _orientation;
|
glm::quat _orientation;
|
||||||
|
float _volume;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void startDownload();
|
void startDownload();
|
||||||
|
|
Loading…
Reference in a new issue