mirror of
https://github.com/overte-org/overte.git
synced 2025-04-08 07:12:40 +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 {
|
||||
id: buttonClickSound
|
||||
volume: 0.1
|
||||
source: "../../../sounds/Gamemaster-Audio-button-click.wav"
|
||||
}
|
||||
|
||||
|
|
|
@ -23,10 +23,19 @@ void SoundEffect::setSource(QUrl 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) {
|
||||
AudioInjectorOptions options;
|
||||
options.position = vec3FromVariant(position);
|
||||
options.localOnly = true;
|
||||
options.volume = _volume;
|
||||
if (_injector) {
|
||||
_injector->setOptions(options);
|
||||
_injector->restart();
|
||||
|
|
|
@ -22,6 +22,7 @@ class AudioInjector;
|
|||
class SoundEffect : public QQuickItem {
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QUrl source READ getSource WRITE setSource)
|
||||
Q_PROPERTY(float volume READ getVolume WRITE setVolume)
|
||||
public:
|
||||
|
||||
virtual ~SoundEffect();
|
||||
|
@ -29,9 +30,13 @@ public:
|
|||
QUrl getSource() const;
|
||||
void setSource(QUrl url);
|
||||
|
||||
float getVolume() const;
|
||||
void setVolume(float volume);
|
||||
|
||||
Q_INVOKABLE void play(QVariant position);
|
||||
protected:
|
||||
QUrl _url;
|
||||
float _volume { 1.0f };
|
||||
SharedSoundPointer _sound;
|
||||
AudioInjector* _injector { nullptr };
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue