diff options
author | Joerg Mueller <nexyon@gmail.com> | 2009-09-20 18:00:00 +0400 |
---|---|---|
committer | Joerg Mueller <nexyon@gmail.com> | 2009-09-20 18:00:00 +0400 |
commit | 1185be4355e6f0d812b7a8909ab3677aeec694ed (patch) | |
tree | 14148472f03c42c93d7ce6a293a2f1f52a399133 /intern | |
parent | 7d86e92df9d92fe7c2fe7dc144b113dcc8436578 (diff) |
Sound:
* Moved AudioData back to Scene
* Updated RNA stuff
* Added mixdown volume
Diffstat (limited to 'intern')
-rw-r--r-- | intern/audaspace/intern/AUD_C-API.cpp | 25 | ||||
-rw-r--r-- | intern/audaspace/intern/AUD_C-API.h | 15 |
2 files changed, 35 insertions, 5 deletions
diff --git a/intern/audaspace/intern/AUD_C-API.cpp b/intern/audaspace/intern/AUD_C-API.cpp index 45faebc7e97..afa1568d6dc 100644 --- a/intern/audaspace/intern/AUD_C-API.cpp +++ b/intern/audaspace/intern/AUD_C-API.cpp @@ -516,21 +516,40 @@ AUD_Device* AUD_openReadDevice(AUD_Specs specs) } } -int AUD_playDevice(AUD_Device* device, AUD_Sound* sound) +AUD_Handle* AUD_playDevice(AUD_Device* device, AUD_Sound* sound) { assert(device); assert(sound); try { - return device->play(sound) != NULL; + return device->play(sound); } catch(AUD_Exception) { - return false; + return NULL; } } +int AUD_setDeviceSoundVolume(AUD_Device* device, AUD_Handle* handle, + float volume) +{ + if(handle) + { + assert(device); + AUD_SourceCaps caps; + caps.handle = handle; + caps.value = volume; + + try + { + return device->setCapability(AUD_CAPS_SOURCE_VOLUME, &caps); + } + catch(AUD_Exception) {} + } + return false; +} + int AUD_readDevice(AUD_Device* device, sample_t* buffer, int length) { assert(device); diff --git a/intern/audaspace/intern/AUD_C-API.h b/intern/audaspace/intern/AUD_C-API.h index 6ec5ec87ad5..b02b465bff2 100644 --- a/intern/audaspace/intern/AUD_C-API.h +++ b/intern/audaspace/intern/AUD_C-API.h @@ -303,9 +303,20 @@ extern AUD_Device* AUD_openReadDevice(AUD_Specs specs); * Plays back a sound file through a read device. * \param device The read device. * \param sound The handle of the sound file. - * \return Whether the sound could be played back. + * \return A handle to the played back sound. + */ +extern AUD_Handle* AUD_playDevice(AUD_Device* device, AUD_Sound* sound); + +/** + * Sets the volume of a played back sound of a read device. + * \param device The read device. + * \param handle The handle to the sound. + * \param volume The new volume, must be between 0.0 and 1.0. + * \return Whether the action succeeded. */ -extern int AUD_playDevice(AUD_Device* device, AUD_Sound* sound); +extern int AUD_setDeviceSoundVolume(AUD_Device* device, + AUD_Handle* handle, + float volume); /** * Reads the next samples into the supplied buffer. |