mirror of
https://github.com/overte-org/overte.git
synced 2025-04-19 13:43:49 +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);
|
||||
|
||||
// pack 255 for attenuation byte
|
||||
uchar volume = 255;
|
||||
uchar volume = MAX_INJECTOR_VOLUME * _volume;
|
||||
memcpy(currentPacketPosition, &volume, sizeof(volume));
|
||||
currentPacketPosition += sizeof(volume);
|
||||
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
class AbstractAudioInterface;
|
||||
class QNetworkReply;
|
||||
|
||||
const uchar MAX_INJECTOR_VOLUME = 0xFF;
|
||||
|
||||
class AudioInjector : public QObject {
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
@ -28,6 +30,7 @@ public:
|
|||
|
||||
void setPosition(const glm::vec3& position) { _position = position; }
|
||||
void setOrientation(const glm::quat& orientation) { _orientation = orientation; }
|
||||
void setVolume(float volume) { _volume = std::max(fabsf(volume), 1.0f); }
|
||||
public slots:
|
||||
void injectViaThread(AbstractAudioInterface* localAudioInterface = NULL);
|
||||
|
||||
|
@ -38,6 +41,7 @@ private:
|
|||
QUrl _sourceURL;
|
||||
glm::vec3 _position;
|
||||
glm::quat _orientation;
|
||||
float _volume;
|
||||
|
||||
private slots:
|
||||
void startDownload();
|
||||
|
|
Loading…
Reference in a new issue