45 lines · 999 B · C++
RawDownload
 #include "SoundEffect.h" #include <RegisteredMetaTypes.h>#include <AudioInjector.h> SoundEffect::~SoundEffect() {    if (_injector) {         // stop will cause the AudioInjector to delete itself.        _injector->stop();    }} QUrl SoundEffect::getSource() const {    return _url;} void SoundEffect::setSource(QUrl url) {    _url = 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();    } else {        QByteArray samples = _sound->getByteArray();        _injector = AudioInjector::playSound(samples, options);    }} #include "SoundEffect.moc"

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t