mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 03:40:20 +02:00
Merge pull request #9589 from hyperlogic/bug-fix/tablet-ui-button-click-volume
tablet-ui: reduced volume of button click
This commit is contained in:
commit
0dead3b458
3 changed files with 15 additions and 0 deletions
|
@ -20,6 +20,7 @@ Item {
|
||||||
|
|
||||||
SoundEffect {
|
SoundEffect {
|
||||||
id: buttonClickSound
|
id: buttonClickSound
|
||||||
|
volume: 0.1
|
||||||
source: "../../../sounds/Gamemaster-Audio-button-click.wav"
|
source: "../../../sounds/Gamemaster-Audio-button-click.wav"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,10 +23,19 @@ void SoundEffect::setSource(QUrl url) {
|
||||||
_sound = DependencyManager::get<SoundCache>()->getSound(_url);
|
_sound = DependencyManager::get<SoundCache>()->getSound(_url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float SoundEffect::getVolume() const {
|
||||||
|
return _volume;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SoundEffect::setVolume(float volume) {
|
||||||
|
_volume = volume;
|
||||||
|
}
|
||||||
|
|
||||||
void SoundEffect::play(QVariant position) {
|
void SoundEffect::play(QVariant position) {
|
||||||
AudioInjectorOptions options;
|
AudioInjectorOptions options;
|
||||||
options.position = vec3FromVariant(position);
|
options.position = vec3FromVariant(position);
|
||||||
options.localOnly = true;
|
options.localOnly = true;
|
||||||
|
options.volume = _volume;
|
||||||
if (_injector) {
|
if (_injector) {
|
||||||
_injector->setOptions(options);
|
_injector->setOptions(options);
|
||||||
_injector->restart();
|
_injector->restart();
|
||||||
|
|
|
@ -22,6 +22,7 @@ class AudioInjector;
|
||||||
class SoundEffect : public QQuickItem {
|
class SoundEffect : public QQuickItem {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PROPERTY(QUrl source READ getSource WRITE setSource)
|
Q_PROPERTY(QUrl source READ getSource WRITE setSource)
|
||||||
|
Q_PROPERTY(float volume READ getVolume WRITE setVolume)
|
||||||
public:
|
public:
|
||||||
|
|
||||||
virtual ~SoundEffect();
|
virtual ~SoundEffect();
|
||||||
|
@ -29,9 +30,13 @@ public:
|
||||||
QUrl getSource() const;
|
QUrl getSource() const;
|
||||||
void setSource(QUrl url);
|
void setSource(QUrl url);
|
||||||
|
|
||||||
|
float getVolume() const;
|
||||||
|
void setVolume(float volume);
|
||||||
|
|
||||||
Q_INVOKABLE void play(QVariant position);
|
Q_INVOKABLE void play(QVariant position);
|
||||||
protected:
|
protected:
|
||||||
QUrl _url;
|
QUrl _url;
|
||||||
|
float _volume { 1.0f };
|
||||||
SharedSoundPointer _sound;
|
SharedSoundPointer _sound;
|
||||||
AudioInjector* _injector { nullptr };
|
AudioInjector* _injector { nullptr };
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue