diff options
Diffstat (limited to 'extern/audaspace/bindings/C')
23 files changed, 0 insertions, 4673 deletions
diff --git a/extern/audaspace/bindings/C/AUD_Device.cpp b/extern/audaspace/bindings/C/AUD_Device.cpp deleted file mode 100644 index 441f228deac..00000000000 --- a/extern/audaspace/bindings/C/AUD_Device.cpp +++ /dev/null @@ -1,336 +0,0 @@ -/******************************************************************************* - * Copyright 2009-2016 Jörg Müller - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - ******************************************************************************/ - -#include "devices/DeviceManager.h" -#include "devices/I3DDevice.h" -#include "devices/IDeviceFactory.h" -#include "devices/ReadDevice.h" -#include "Exception.h" - -#include <cassert> - -using namespace aud; - -#define AUD_CAPI_IMPLEMENTATION -#include "AUD_Device.h" - -static inline aud::Specs convCToSpec(AUD_Specs specs) -{ - aud::Specs s; - s.channels = static_cast<Channels>(specs.channels); - s.rate = static_cast<SampleRate>(specs.rate); - return s; -} - -static inline aud::DeviceSpecs convCToDSpec(AUD_DeviceSpecs specs) -{ - aud::DeviceSpecs s; - s.specs = convCToSpec(specs.specs); - s.format = static_cast<SampleFormat>(specs.format); - return s; -} - -AUD_API AUD_Device* AUD_Device_open(const char* type, AUD_DeviceSpecs specs, int buffersize, const char* name) -{ - DeviceSpecs dspecs = convCToDSpec(specs); - - if(dspecs.channels == CHANNELS_INVALID) - dspecs.channels = CHANNELS_STEREO; - if(dspecs.format == FORMAT_INVALID) - dspecs.format = FORMAT_FLOAT32; - if(dspecs.rate == RATE_INVALID) - dspecs.rate = RATE_48000; - if(buffersize < 128) - buffersize = AUD_DEFAULT_BUFFER_SIZE; - if(name == nullptr) - name = ""; - - try - { - if(!type) - { - auto device = DeviceManager::getDevice(); - if(!device) - { - DeviceManager::openDefaultDevice(); - device = DeviceManager::getDevice(); - } - return new AUD_Device(device); - } - - if(type == std::string("read")) - { - return new AUD_Device(new ReadDevice(dspecs)); - } - - std::shared_ptr<IDeviceFactory> factory; - if(!*type) - factory = DeviceManager::getDefaultDeviceFactory(); - else - factory = DeviceManager::getDeviceFactory(type); - - if(factory) - { - factory->setName(name); - factory->setSpecs(dspecs); - factory->setBufferSize(buffersize); - return new AUD_Device(factory->openDevice()); - } - } - catch(Exception&) - { - } - return nullptr; -} - -AUD_API void AUD_Device_lock(AUD_Device* device) -{ - auto dev = device ? *device : DeviceManager::getDevice(); - dev->lock(); -} - -AUD_API AUD_Handle* AUD_Device_play(AUD_Device* device, AUD_Sound* sound, int keep) -{ - assert(sound); - auto dev = device ? *device : DeviceManager::getDevice(); - - try - { - AUD_Handle handle = dev->play(*sound, keep); - if(handle.get()) - { - return new AUD_Handle(handle); - } - } - catch(Exception&) - { - } - return nullptr; -} - -AUD_API void AUD_Device_stopAll(AUD_Device* device) -{ - auto dev = device ? *device : DeviceManager::getDevice(); - dev->stopAll(); -} - -AUD_API void AUD_Device_unlock(AUD_Device* device) -{ - auto dev = device ? *device : DeviceManager::getDevice(); - dev->unlock(); -} - -AUD_API AUD_Channels AUD_Device_getChannels(AUD_Device* device) -{ - auto dev = device ? *device : DeviceManager::getDevice(); - return static_cast<AUD_Channels>(dev->getSpecs().channels); -} - -AUD_API AUD_DistanceModel AUD_Device_getDistanceModel(AUD_Device* device) -{ - auto dev = device ? std::dynamic_pointer_cast<I3DDevice>(*device) : DeviceManager::get3DDevice(); - return static_cast<AUD_DistanceModel>(dev->getDistanceModel()); -} - -AUD_API void AUD_Device_setDistanceModel(AUD_Device* device, AUD_DistanceModel value) -{ - auto dev = device ? std::dynamic_pointer_cast<I3DDevice>(*device) : DeviceManager::get3DDevice(); - dev->setDistanceModel(static_cast<DistanceModel>(value)); -} - -AUD_API float AUD_Device_getDopplerFactor(AUD_Device* device) -{ - auto dev = device ? std::dynamic_pointer_cast<I3DDevice>(*device) : DeviceManager::get3DDevice(); - return dev->getDopplerFactor(); -} - -AUD_API void AUD_Device_setDopplerFactor(AUD_Device* device, float value) -{ - auto dev = device ? std::dynamic_pointer_cast<I3DDevice>(*device) : DeviceManager::get3DDevice(); - dev->setDopplerFactor(value); -} - -AUD_API AUD_SampleFormat AUD_Device_getFormat(AUD_Device* device) -{ - auto dev = device ? *device : DeviceManager::getDevice(); - return static_cast<AUD_SampleFormat>(dev->getSpecs().format); -} - -AUD_API void AUD_Device_getListenerLocation(AUD_Device* device, float value[3]) -{ - auto dev = device ? std::dynamic_pointer_cast<I3DDevice>(*device) : DeviceManager::get3DDevice(); - Vector3 v = dev->getListenerLocation(); - value[0] = v.x(); - value[1] = v.y(); - value[2] = v.z(); -} - -AUD_API void AUD_Device_setListenerLocation(AUD_Device* device, const float value[3]) -{ - auto dev = device ? std::dynamic_pointer_cast<I3DDevice>(*device) : DeviceManager::get3DDevice(); - Vector3 v(value[0], value[1], value[2]); - dev->setListenerLocation(v); -} - -AUD_API void AUD_Device_getListenerOrientation(AUD_Device* device, float value[4]) -{ - auto dev = device ? std::dynamic_pointer_cast<I3DDevice>(*device) : DeviceManager::get3DDevice(); - Quaternion v = dev->getListenerOrientation(); - value[0] = v.x(); - value[1] = v.y(); - value[2] = v.z(); - value[3] = v.w(); -} - -AUD_API void AUD_Device_setListenerOrientation(AUD_Device* device, const float value[4]) -{ - auto dev = device ? std::dynamic_pointer_cast<I3DDevice>(*device) : DeviceManager::get3DDevice(); - Quaternion v(value[3], value[0], value[1], value[2]); - dev->setListenerOrientation(v); -} - -AUD_API void AUD_Device_getListenerVelocity(AUD_Device* device, float value[3]) -{ - auto dev = device ? std::dynamic_pointer_cast<I3DDevice>(*device) : DeviceManager::get3DDevice(); - Vector3 v = dev->getListenerVelocity(); - value[0] = v.x(); - value[1] = v.y(); - value[2] = v.z(); -} - -AUD_API void AUD_Device_setListenerVelocity(AUD_Device* device, const float value[3]) -{ - auto dev = device ? std::dynamic_pointer_cast<I3DDevice>(*device) : DeviceManager::get3DDevice(); - Vector3 v(value[0], value[1], value[2]); - dev->setListenerVelocity(v); -} - -AUD_API double AUD_Device_getRate(AUD_Device* device) -{ - auto dev = device ? *device : DeviceManager::getDevice(); - return dev->getSpecs().rate; -} - -AUD_API float AUD_Device_getSpeedOfSound(AUD_Device* device) -{ - auto dev = device ? std::dynamic_pointer_cast<I3DDevice>(*device) : DeviceManager::get3DDevice(); - return dev->getSpeedOfSound(); -} - -AUD_API void AUD_Device_setSpeedOfSound(AUD_Device* device, float value) -{ - auto dev = device ? std::dynamic_pointer_cast<I3DDevice>(*device) : DeviceManager::get3DDevice(); - dev->setSpeedOfSound(value); -} - -AUD_API float AUD_Device_getVolume(AUD_Device* device) -{ - auto dev = device ? *device : DeviceManager::getDevice(); - return dev->getVolume(); -} - -AUD_API void AUD_Device_setVolume(AUD_Device* device, float value) -{ - auto dev = device ? *device : DeviceManager::getDevice(); - dev->setVolume(value); -} - -AUD_API int AUD_Device_read(AUD_Device* device, unsigned char* buffer, int length) -{ - assert(device); - assert(buffer); - - auto readDevice = std::dynamic_pointer_cast<ReadDevice>(*device); - if(!readDevice) - return false; - - try - { - return readDevice->read(buffer, length); - } - catch(Exception&) - { - return false; - } -} - -AUD_API void AUD_Device_free(AUD_Device* device) -{ - assert(device); - - try - { - delete device; - } - catch(Exception&) - { - } -} - -AUD_API AUD_Device* AUD_Device_getCurrent() -{ - auto device = DeviceManager::getDevice(); - - if(!device) - return nullptr; - - return new AUD_Device(device); -} - -AUD_API void AUD_seekSynchronizer(AUD_Handle* handle, float time) -{ - auto synchronizer = DeviceManager::getDevice()->getSynchronizer(); - if(synchronizer) - synchronizer->seek(*reinterpret_cast<std::shared_ptr<IHandle>*>(handle), time); -} - -AUD_API float AUD_getSynchronizerPosition(AUD_Handle* handle) -{ - auto synchronizer = DeviceManager::getDevice()->getSynchronizer(); - if(synchronizer) - return synchronizer->getPosition(*reinterpret_cast<std::shared_ptr<IHandle>*>(handle)); - return (*reinterpret_cast<std::shared_ptr<IHandle>*>(handle))->getPosition(); -} - -AUD_API void AUD_playSynchronizer() -{ - auto synchronizer = DeviceManager::getDevice()->getSynchronizer(); - if(synchronizer) - synchronizer->play(); -} - -AUD_API void AUD_stopSynchronizer() -{ - auto synchronizer = DeviceManager::getDevice()->getSynchronizer(); - if(synchronizer) - synchronizer->stop(); -} - -AUD_API void AUD_setSynchronizerCallback(AUD_syncFunction function, void* data) -{ - auto synchronizer = DeviceManager::getDevice()->getSynchronizer(); - if(synchronizer) - synchronizer->setSyncCallback(function, data); -} - -AUD_API int AUD_isSynchronizerPlaying() -{ - auto synchronizer = DeviceManager::getDevice()->getSynchronizer(); - if(synchronizer) - return synchronizer->isPlaying(); - return false; -} - diff --git a/extern/audaspace/bindings/C/AUD_Device.h b/extern/audaspace/bindings/C/AUD_Device.h deleted file mode 100644 index 0dfa21f0660..00000000000 --- a/extern/audaspace/bindings/C/AUD_Device.h +++ /dev/null @@ -1,258 +0,0 @@ -/******************************************************************************* - * Copyright 2009-2016 Jörg Müller - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - ******************************************************************************/ - -#pragma once - -#include "AUD_Types.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/// Possible distance models for the 3D device. -typedef enum -{ - AUD_DISTANCE_MODEL_INVALID = 0, - AUD_DISTANCE_MODEL_INVERSE, - AUD_DISTANCE_MODEL_INVERSE_CLAMPED, - AUD_DISTANCE_MODEL_LINEAR, - AUD_DISTANCE_MODEL_LINEAR_CLAMPED, - AUD_DISTANCE_MODEL_EXPONENT, - AUD_DISTANCE_MODEL_EXPONENT_CLAMPED -} AUD_DistanceModel; - -typedef void (*AUD_syncFunction)(void*, int, float); - -/** - * Opens a new sound device. - * \param type The name of the device. - * Can be NULL to open the default device with default settings or return the handle to the already opened one. - * Can be "" to open the a default factory device with given settings. - * Can be "read" to open a readable device. - * \param specs Specification of the device parameters. - * \param buffersize Size of the mixing buffer. - * \param name Custom name of the device. - * \return A handle to the opened device or NULL on failure. - */ -extern AUD_API AUD_Device* AUD_Device_open(const char* type, AUD_DeviceSpecs specs, int buffersize, const char* name); - -/** - * Locks the playback device. - */ -extern AUD_API void AUD_Device_lock(AUD_Device* device); - -/** - * Plays back a sound file. - * \param sound The handle of the sound file. - * \param keep When keep is true the sound source will not be deleted but set to - * paused when its end has been reached. - * \return A handle to the played back sound. - */ -extern AUD_API AUD_Handle* AUD_Device_play(AUD_Device* device, AUD_Sound* sound, int keep); - -/** - * Stops all sounds playing. - */ -extern AUD_API void AUD_Device_stopAll(AUD_Device* device); - -/** - * Unlocks the device. - */ -extern AUD_API void AUD_Device_unlock(AUD_Device* device); - -/** - * Retrieves the channels of a device. - * param device The device to get the channels from. - * return The channels of the device. - */ -extern AUD_API AUD_Channels AUD_Device_getChannels(AUD_Device* device); - -/** - * Retrieves the distance model of a device. - * param device The device to get the distance model from. - * return The distance model of the device. - */ -extern AUD_API AUD_DistanceModel AUD_Device_getDistanceModel(AUD_Device* device); - -/** - * Sets the distance model of a device. - * param device The device to set the distance model from. - * param value The new distance model to set. - */ -extern AUD_API void AUD_Device_setDistanceModel(AUD_Device* device, AUD_DistanceModel value); - -/** - * Retrieves the doppler factor of a device. - * param device The device to get the doppler factor from. - * return The doppler factor of the device. - */ -extern AUD_API float AUD_Device_getDopplerFactor(AUD_Device* device); - -/** - * Sets the doppler factor of a device. - * param device The device to set the doppler factor from. - * param value The new doppler factor to set. - */ -extern AUD_API void AUD_Device_setDopplerFactor(AUD_Device* device, float value); - -/** - * Retrieves the format of a device. - * param device The device to get the format from. - * return The format of the device. - */ -extern AUD_API AUD_SampleFormat AUD_Device_getFormat(AUD_Device* device); - -/** - * Retrieves the listener location of a device. - * param device The device to get the listener location from. - * return The listener location of the device. - */ -extern AUD_API void AUD_Device_getListenerLocation(AUD_Device* device, float value[3]); - -/** - * Sets the listener location of a device. - * param device The device to set the listener location from. - * param value The new listener location to set. - */ -extern AUD_API void AUD_Device_setListenerLocation(AUD_Device* device, const float value[3]); - -/** - * Retrieves the listener orientation of a device. - * param device The device to get the listener orientation from. - * return The listener orientation of the device. - */ -extern AUD_API void AUD_Device_getListenerOrientation(AUD_Device* device, float value[4]); - -/** - * Sets the listener orientation of a device. - * param device The device to set the listener orientation from. - * param value The new listener orientation to set. - */ -extern AUD_API void AUD_Device_setListenerOrientation(AUD_Device* device, const float value[4]); - -/** - * Retrieves the listener velocity of a device. - * param device The device to get the listener velocity from. - * return The listener velocity of the device. - */ -extern AUD_API void AUD_Device_getListenerVelocity(AUD_Device* device, float value[3]); - -/** - * Sets the listener velocity of a device. - * param device The device to set the listener velocity from. - * param value The new listener velocity to set. - */ -extern AUD_API void AUD_Device_setListenerVelocity(AUD_Device* device, const float value[3]); - -/** - * Retrieves the rate of a device. - * param device The device to get the rate from. - * return The rate of the device. - */ -extern AUD_API double AUD_Device_getRate(AUD_Device* device); - -/** - * Retrieves the speed of sound of a device. - * param device The device to get the speed of sound from. - * return The speed of sound of the device. - */ -extern AUD_API float AUD_Device_getSpeedOfSound(AUD_Device* device); - -/** - * Sets the speed of sound of a device. - * param device The device to set the speed of sound from. - * param value The new speed of sound to set. - */ -extern AUD_API void AUD_Device_setSpeedOfSound(AUD_Device* device, float value); - -/** - * Retrieves the volume of a device. - * param device The device to get the volume from. - * return The volume of the device. - */ -extern AUD_API float AUD_Device_getVolume(AUD_Device* device); - -/** - * Sets the volume of a device. - * param device The device to set the volume from. - * param value The new volume to set. - */ -extern AUD_API void AUD_Device_setVolume(AUD_Device* device, float value); - -/** - * Reads the next samples into the supplied buffer. - * \param device The readable device. - * \param buffer The target buffer. - * \param length The length in samples to be filled. - * \return True if the reading succeeded, false if there are no sounds - * played back currently, in that case the buffer is filled with - * silence. - */ -extern AUD_API int AUD_Device_read(AUD_Device* device, unsigned char* buffer, int length); - -/** - * Closes a device. Handle becomes invalid afterwards. - * \param device The device to close. - */ -extern AUD_API void AUD_Device_free(AUD_Device* device); - -/** - * Retrieves the current device of the DeviceManager. - * \return A pointer to the current device, which needs to be freed with - * AUD_Device_free. - */ -extern AUD_API AUD_Device* AUD_Device_getCurrent(); - -/** - * Seeks sequenced sound scene playback. - * \param handle Playback handle. - * \param time Time in seconds to seek to. - */ -extern AUD_API void AUD_seekSynchronizer(AUD_Handle* handle, float time); - -/** - * Returns the current sound scene playback time. - * \param handle Playback handle. - * \return The playback time in seconds. - */ -extern AUD_API float AUD_getSynchronizerPosition(AUD_Handle* handle); - -/** - * Starts the playback of jack transport if possible. - */ -extern AUD_API void AUD_playSynchronizer(); - -/** - * Stops the playback of jack transport if possible. - */ -extern AUD_API void AUD_stopSynchronizer(); - -/** - * Sets the sync callback for jack transport. - * \param function The callback function. - * \param data The data parameter for the callback. - */ -extern AUD_API void AUD_setSynchronizerCallback(AUD_syncFunction function, void* data); - -/** - * Returns whether jack transport is currently playing. - * \return Whether jack transport is currently playing. - */ -extern AUD_API int AUD_isSynchronizerPlaying(); - -#ifdef __cplusplus -} -#endif diff --git a/extern/audaspace/bindings/C/AUD_DynamicMusic.cpp b/extern/audaspace/bindings/C/AUD_DynamicMusic.cpp deleted file mode 100644 index bb7a129dde3..00000000000 --- a/extern/audaspace/bindings/C/AUD_DynamicMusic.cpp +++ /dev/null @@ -1,144 +0,0 @@ -/******************************************************************************* -* Copyright 2015-2016 Juan Francisco Crespo Galán -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -******************************************************************************/ - -#include "Exception.h" - -#include <cassert> - -using namespace aud; - -#define AUD_CAPI_IMPLEMENTATION -#include "AUD_DynamicMusic.h" - -AUD_API AUD_DynamicMusic* AUD_DynamicMusic_create(AUD_Device* device) -{ - assert(device); - - try - { - return new AUD_DynamicMusic(new DynamicMusic(*device)); - } - catch(Exception&) - { - return nullptr; - } -} - -AUD_API void AUD_DynamicMusic_free(AUD_DynamicMusic* player) -{ - assert(player); - delete player; -} - -AUD_API int AUD_DynamicMusic_addScene(AUD_DynamicMusic* player, AUD_Sound* scene) -{ - assert(player); - assert(scene); - - return (*player)->addScene(*scene); -} - -AUD_API int AUD_DynamicMusic_setSecene(AUD_DynamicMusic* player, int scene) -{ - assert(player); - - return (*player)->changeScene(scene); -} - -AUD_API int AUD_DynamicMusic_getScene(AUD_DynamicMusic* player) -{ - assert(player); - - return (*player)->getScene(); -} - -AUD_API int AUD_DynamicMusic_addTransition(AUD_DynamicMusic* player, int ini, int end, AUD_Sound* transition) -{ - assert(player); - assert(transition); - - return (*player)->addTransition(ini, end, *transition); -} - -AUD_API void AUD_DynamicMusic_setFadeTime(AUD_DynamicMusic* player, float seconds) -{ - assert(player); - - (*player)->setFadeTime(seconds); -} - -AUD_API float AUD_DynamicMusic_getFadeTime(AUD_DynamicMusic* player) -{ - assert(player); - - return (*player)->getFadeTime(); -} - -AUD_API int AUD_DynamicMusic_resume(AUD_DynamicMusic* player) -{ - assert(player); - - return (*player)->resume(); -} - -AUD_API int AUD_DynamicMusic_pause(AUD_DynamicMusic* player) -{ - assert(player); - - return (*player)->pause(); -} - -AUD_API int AUD_DynamicMusic_seek(AUD_DynamicMusic* player, float position) -{ - assert(player); - - return (*player)->seek(position); -} - -AUD_API float AUD_DynamicMusic_getPosition(AUD_DynamicMusic* player) -{ - assert(player); - - return (*player)->getPosition(); -} - -AUD_API float AUD_DynamicMusic_getVolume(AUD_DynamicMusic* player) -{ - assert(player); - - return (*player)->getVolume(); -} - -AUD_API int AUD_DynamicMusic_setVolume(AUD_DynamicMusic* player, float volume) -{ - assert(player); - - return (*player)->setVolume(volume); -} - -AUD_API AUD_Status AUD_DynamicMusic_getStatus(AUD_DynamicMusic* player) -{ - assert(player); - - return static_cast<AUD_Status>((*player)->getStatus()); -} - -AUD_API int AUD_DynamicMusic_stop(AUD_DynamicMusic* player) -{ - assert(player); - - return (*player)->stop(); -}
\ No newline at end of file diff --git a/extern/audaspace/bindings/C/AUD_DynamicMusic.h b/extern/audaspace/bindings/C/AUD_DynamicMusic.h deleted file mode 100644 index c362479591e..00000000000 --- a/extern/audaspace/bindings/C/AUD_DynamicMusic.h +++ /dev/null @@ -1,145 +0,0 @@ -/******************************************************************************* -* Copyright 2015-2016 Juan Francisco Crespo Galán -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -******************************************************************************/ - -#pragma once - -#include "AUD_Types.h" -#include "AUD_Handle.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Creates a new dynamic music player. -* \param device The device that will be used to play sounds. -* \return The new DynamicMusic object. -*/ -extern AUD_API AUD_DynamicMusic* AUD_DynamicMusic_create(AUD_Device* device); - -/** -* Deletes a dynamic music player. -* \param player The DynamicMusic object to be deleted. -*/ -extern AUD_API void AUD_DynamicMusic_free(AUD_DynamicMusic* player); - -/** -* Adds a sound scene to a dynamic music player. -* \param player The DynamicMusic object. -* \param scene The sound to be added as a scene. -* \return The index of the new scene. -*/ -extern AUD_API int AUD_DynamicMusic_addScene(AUD_DynamicMusic* player, AUD_Sound* scene); - -/** -* Changes the current sound scene of a dynamic music player. -* \param player The DynamicMusic object. -* \param scene The index of the scene to be played. -* \return 0 if the target scene doesn't exist. -*/ -extern AUD_API int AUD_DynamicMusic_setSecene(AUD_DynamicMusic* player, int scene); - -/** -* Retrives the index of the current scene. -* \param player The DynamicMusic object. -* \return The index of the current scene. -*/ -extern AUD_API int AUD_DynamicMusic_getScene(AUD_DynamicMusic* player); - -/** -* Adds a new transition between two scenes. -* \param player The DynamicMusic object. -* \param ini The origin scene for the transition. -* \param end The end scene for the transition. -* \param transition A sound that will be used as transition between two scenes. -* \return 0 if the ini or end scenes don't exist. -*/ -extern AUD_API int AUD_DynamicMusic_addTransition(AUD_DynamicMusic* player, int ini, int end, AUD_Sound* transition); - -/** -* Changes the fade time for the default transitions of a dynamic music player. -* \param player The DynamicMusic object. -* \param seconds The amount of secods that the crossfade transition will take. -*/ -extern AUD_API void AUD_DynamicMusic_setFadeTime(AUD_DynamicMusic* player, float seconds); - -/** -* Retrieves the fade time of a dynamic music player. -* \param player The DynamicMusic object. -* \return The fade time of the player. -*/ -extern AUD_API float AUD_DynamicMusic_getFadeTime(AUD_DynamicMusic* player); - -/** -* Resumes the current scene playback of a dynamic music player if it is paused. -* \param player The DynamicMusic object. -* \return 0 if the playback wasn't resumed. -*/ -extern AUD_API int AUD_DynamicMusic_resume(AUD_DynamicMusic* player); - -/** -* Pauses the current scene of a dynamic music player. -* \param player The DynamicMusic object. -* \return 0 if the playback wasn't paused. -*/ -extern AUD_API int AUD_DynamicMusic_pause(AUD_DynamicMusic* player); - -/** -* Seeks the current playing scene of a dynamic music player. -* \param player The DynamicMusic object. -* \param position The new position from which to play back, in seconds. -* \return 0 if the seeking wasn't possible. -*/ -extern AUD_API int AUD_DynamicMusic_seek(AUD_DynamicMusic* player, float position); - -/** -* Retrieves the position of the current scene of a dynamic music player. -* \param player The DynamicMusic object. -* \return The position of the current playing scene. -*/ -extern AUD_API float AUD_DynamicMusic_getPosition(AUD_DynamicMusic* player); - -/** -* Retrieves the volume of the current scene of a dynamic music player. -* \param player The DynamicMusic object. -* \return The volume of the current playing scene. -*/ -extern AUD_API float AUD_DynamicMusic_getVolume(AUD_DynamicMusic* player); - -/** -* Changes the volume of the current scene in a dynamic music player. -* \param player The DynamicMusic object. -* \param 0 if the volume couldn't be changed. -*/ -extern AUD_API int AUD_DynamicMusic_setVolume(AUD_DynamicMusic* player, float volume); - -/** -* Retrieves the status of the current scene in a dynamic music player. -* \param player The DynamicMusic object. -* \return The Status of the current playing scene. -*/ -extern AUD_API AUD_Status AUD_DynamicMusic_getStatus(AUD_DynamicMusic* player); - -/** -* Stops the current scene of a dynamic music player. -* \param player The DynamicMusic object. -* \return 0 if the playback wasn't stopped. -*/ -extern AUD_API int AUD_DynamicMusic_stop(AUD_DynamicMusic* player); - -#ifdef __cplusplus -} -#endif
\ No newline at end of file diff --git a/extern/audaspace/bindings/C/AUD_HRTF.cpp b/extern/audaspace/bindings/C/AUD_HRTF.cpp deleted file mode 100644 index 002c5d61ddd..00000000000 --- a/extern/audaspace/bindings/C/AUD_HRTF.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/******************************************************************************* -* Copyright 2009-2015 Juan Francisco Crespo Galán -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -******************************************************************************/ - -#include "Exception.h" - -#include <cassert> - -using namespace aud; - -#define AUD_CAPI_IMPLEMENTATION -#include "AUD_HRTF.h" - -extern AUD_API AUD_HRTF* AUD_HRTF_create() -{ - try - { - return new AUD_HRTF(new HRTF()); - } - catch(Exception&) - { - return nullptr; - } -} - -extern AUD_API void AUD_HRTF_free(AUD_HRTF* hrtfs) -{ - assert(hrtfs); - delete hrtfs; -} - -extern AUD_API void AUD_HRTF_addImpulseResponseFromSound(AUD_HRTF* hrtfs, AUD_Sound* sound, float azimuth, float elevation) -{ - assert(hrtfs); - assert(sound); - - (*hrtfs)->addImpulseResponse(std::make_shared<StreamBuffer>(*sound), azimuth, elevation); -}
\ No newline at end of file diff --git a/extern/audaspace/bindings/C/AUD_HRTF.h b/extern/audaspace/bindings/C/AUD_HRTF.h deleted file mode 100644 index 29dda371695..00000000000 --- a/extern/audaspace/bindings/C/AUD_HRTF.h +++ /dev/null @@ -1,48 +0,0 @@ -/******************************************************************************* -* Copyright 2009-2015 Juan Francisco Crespo Galán -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -******************************************************************************/ - -#pragma once - -#include "AUD_Types.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Creates a new HRTF object. -* \return The new HRTF object. -*/ -extern AUD_API AUD_HRTF* AUD_HRTF_create(); - -/** -* Deletes a HRTF object. -* \param hrtfs The HRTF object to be deleted. -*/ -extern AUD_API void AUD_HRTF_free(AUD_HRTF* hrtfs); - -/** -* Adds a new impulse response to an HRTF object. -* \param hrtfs The HRTF object. -* \param sound A Sound object representing an HRTF. -* \param azimuth The azimuth angle of the HRTF. -* \param elevation The elevation angle of the HRTF. -*/ -extern AUD_API void AUD_HRTF_addImpulseResponseFromSound(AUD_HRTF* hrtfs, AUD_Sound* sound, float azimuth, float elevation); - -#ifdef __cplusplus -} -#endif
\ No newline at end of file diff --git a/extern/audaspace/bindings/C/AUD_Handle.cpp b/extern/audaspace/bindings/C/AUD_Handle.cpp deleted file mode 100644 index 265c7bf08d2..00000000000 --- a/extern/audaspace/bindings/C/AUD_Handle.cpp +++ /dev/null @@ -1,384 +0,0 @@ -/******************************************************************************* - * Copyright 2009-2016 Jörg Müller - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - ******************************************************************************/ - -#include "devices/I3DHandle.h" -#include "Exception.h" - -#include <cassert> - -using namespace aud; - -#define AUD_CAPI_IMPLEMENTATION -#include "AUD_Handle.h" - -AUD_API int AUD_Handle_pause(AUD_Handle* handle) -{ - assert(handle); - return (*handle)->pause(); -} - -AUD_API int AUD_Handle_resume(AUD_Handle* handle) -{ - assert(handle); - return (*handle)->resume(); -} - -AUD_API int AUD_Handle_stop(AUD_Handle* handle) -{ - assert(handle); - int result = (*handle)->stop(); - delete handle; - return result; -} - -AUD_API float AUD_Handle_getAttenuation(AUD_Handle* handle) -{ - assert(handle); - std::shared_ptr<I3DHandle> h = std::dynamic_pointer_cast<I3DHandle>(*handle); - - if(h.get()) - return h->getAttenuation(); - return 0.0f; -} - -AUD_API int AUD_Handle_setAttenuation(AUD_Handle* handle, float value) -{ - assert(handle); - std::shared_ptr<I3DHandle> h = std::dynamic_pointer_cast<I3DHandle>(*handle); - - if(h.get()) - return h->setAttenuation(value); - return false; -} - -AUD_API float AUD_Handle_getConeAngleInner(AUD_Handle* handle) -{ - assert(handle); - std::shared_ptr<I3DHandle> h = std::dynamic_pointer_cast<I3DHandle>(*handle); - - if(h.get()) - return h->getConeAngleInner(); - return 0.0f; -} - -AUD_API int AUD_Handle_setConeAngleInner(AUD_Handle* handle, float value) -{ - assert(handle); - std::shared_ptr<I3DHandle> h = std::dynamic_pointer_cast<I3DHandle>(*handle); - - if(h.get()) - return h->setConeAngleInner(value); - return false; -} - -AUD_API float AUD_Handle_getConeAngleOuter(AUD_Handle* handle) -{ - assert(handle); - std::shared_ptr<I3DHandle> h = std::dynamic_pointer_cast<I3DHandle>(*handle); - - if(h.get()) - return h->getConeAngleOuter(); - return 0.0f; -} - -AUD_API int AUD_Handle_setConeAngleOuter(AUD_Handle* handle, float value) -{ - assert(handle); - std::shared_ptr<I3DHandle> h = std::dynamic_pointer_cast<I3DHandle>(*handle); - - if(h.get()) - return h->setConeAngleOuter(value); - return false; -} - -AUD_API float AUD_Handle_getConeVolumeOuter(AUD_Handle* handle) -{ - assert(handle); - std::shared_ptr<I3DHandle> h = std::dynamic_pointer_cast<I3DHandle>(*handle); - - if(h.get()) - return h->getConeVolumeOuter(); - return 0.0f; -} - -AUD_API int AUD_Handle_setConeVolumeOuter(AUD_Handle* handle, float value) -{ - assert(handle); - std::shared_ptr<I3DHandle> h = std::dynamic_pointer_cast<I3DHandle>(*handle); - - if(h.get()) - return h->setConeVolumeOuter(value); - return false; -} - -AUD_API float AUD_Handle_getDistanceMaximum(AUD_Handle* handle) -{ - assert(handle); - std::shared_ptr<I3DHandle> h = std::dynamic_pointer_cast<I3DHandle>(*handle); - - if(h.get()) - return h->getDistanceMaximum(); - return 0.0f; -} - -AUD_API int AUD_Handle_setDistanceMaximum(AUD_Handle* handle, float value) -{ - assert(handle); - std::shared_ptr<I3DHandle> h = std::dynamic_pointer_cast<I3DHandle>(*handle); - - if(h.get()) - return h->setDistanceMaximum(value); - return false; -} - -AUD_API float AUD_Handle_getDistanceReference(AUD_Handle* handle) -{ - assert(handle); - std::shared_ptr<I3DHandle> h = std::dynamic_pointer_cast<I3DHandle>(*handle); - - if(h.get()) - return h->getDistanceReference(); - return 0.0f; -} - -AUD_API int AUD_Handle_setDistanceReference(AUD_Handle* handle, float value) -{ - assert(handle); - std::shared_ptr<I3DHandle> h = std::dynamic_pointer_cast<I3DHandle>(*handle); - - if(h.get()) - return h->setDistanceReference(value); - return false; -} - -AUD_API int AUD_Handle_doesKeep(AUD_Handle* handle) -{ - assert(handle); - return (*handle)->getKeep(); -} - -AUD_API int AUD_Handle_setKeep(AUD_Handle* handle, int value) -{ - assert(handle); - return (*handle)->setKeep(value); -} - -AUD_API int AUD_Handle_getLocation(AUD_Handle* handle, float value[3]) -{ - assert(handle); - std::shared_ptr<I3DHandle> h = std::dynamic_pointer_cast<I3DHandle>(*handle); - - if(h.get()) - { - Vector3 v = h->getLocation(); - value[0] = v.x(); - value[1] = v.y(); - value[2] = v.z(); - return true; - } - return false; -} - -AUD_API int AUD_Handle_setLocation(AUD_Handle* handle, const float value[3]) -{ - assert(handle); - std::shared_ptr<I3DHandle> h = std::dynamic_pointer_cast<I3DHandle>(*handle); - - if(h.get()) - { - Vector3 v = Vector3(value[0], value[1], value[2]); - return h->setLocation(v); - } - return false; -} - -AUD_API int AUD_Handle_getLoopCount(AUD_Handle* handle) -{ - assert(handle); - return (*handle)->getLoopCount(); -} - -AUD_API int AUD_Handle_setLoopCount(AUD_Handle* handle, int value) -{ - assert(handle); - return (*handle)->setLoopCount(value); -} - -AUD_API int AUD_Handle_getOrientation(AUD_Handle* handle, float value[4]) -{ - assert(handle); - std::shared_ptr<I3DHandle> h = std::dynamic_pointer_cast<I3DHandle>(*handle); - - if(h.get()) - { - Quaternion v = h->getOrientation(); - value[0] = v.x(); - value[1] = v.y(); - value[2] = v.z(); - value[3] = v.w(); - return true; - } - return false; -} - -AUD_API int AUD_Handle_setOrientation(AUD_Handle* handle, const float value[4]) -{ - assert(handle); - std::shared_ptr<I3DHandle> h = std::dynamic_pointer_cast<I3DHandle>(*handle); - - if(h.get()) - { - Quaternion v(value[3], value[0], value[1], value[2]); - return h->setOrientation(v); - } - return false; -} - -AUD_API float AUD_Handle_getPitch(AUD_Handle* handle) -{ - assert(handle); - return (*handle)->getPitch(); -} - -AUD_API int AUD_Handle_setPitch(AUD_Handle* handle, float value) -{ - assert(handle); - return (*handle)->setPitch(value); -} - -AUD_API float AUD_Handle_getPosition(AUD_Handle* handle) -{ - assert(handle); - return (*handle)->getPosition(); -} - -AUD_API int AUD_Handle_setPosition(AUD_Handle* handle, float value) -{ - assert(handle); - return (*handle)->seek(value); -} - -AUD_API int AUD_Handle_isRelative(AUD_Handle* handle) -{ - assert(handle); - std::shared_ptr<I3DHandle> h = std::dynamic_pointer_cast<I3DHandle>(*handle); - - if(h.get()) - return h->isRelative(); - return true; -} - -AUD_API int AUD_Handle_setRelative(AUD_Handle* handle, int value) -{ - assert(handle); - std::shared_ptr<I3DHandle> h = std::dynamic_pointer_cast<I3DHandle>(*handle); - - if(h.get()) - return h->setRelative(value); - return false; -} - -AUD_API AUD_Status AUD_Handle_getStatus(AUD_Handle* handle) -{ - assert(handle); - return static_cast<AUD_Status>((*handle)->getStatus()); -} - -AUD_API int AUD_Handle_getVelocity(AUD_Handle* handle, float value[3]) -{ - assert(handle); - std::shared_ptr<I3DHandle> h = std::dynamic_pointer_cast<I3DHandle>(*handle); - - if(h.get()) - { - Vector3 v = h->getVelocity(); - value[0] = v.x(); - value[1] = v.y(); - value[2] = v.z(); - return true; - } - return false; -} - -AUD_API int AUD_Handle_setVelocity(AUD_Handle* handle, const float value[3]) -{ - assert(handle); - std::shared_ptr<I3DHandle> h = std::dynamic_pointer_cast<I3DHandle>(*handle); - - if(h.get()) - { - Vector3 v = Vector3(value[0], value[1], value[2]); - return h->setVelocity(v); - } - return false; -} - -AUD_API float AUD_Handle_getVolume(AUD_Handle* handle) -{ - assert(handle); - return (*handle)->getVolume(); -} - -AUD_API int AUD_Handle_setVolume(AUD_Handle* handle, float value) -{ - assert(handle); - return (*handle)->setVolume(value); -} - -AUD_API float AUD_Handle_getVolumeMaximum(AUD_Handle* handle) -{ - assert(handle); - std::shared_ptr<I3DHandle> h = std::dynamic_pointer_cast<I3DHandle>(*handle); - - if(h.get()) - return h->getVolumeMaximum(); - return 0.0f; -} - -AUD_API int AUD_Handle_setVolumeMaximum(AUD_Handle* handle, float value) -{ - assert(handle); - std::shared_ptr<I3DHandle> h = std::dynamic_pointer_cast<I3DHandle>(*handle); - - if(h.get()) - return h->setVolumeMaximum(value); - return false; -} - -AUD_API float AUD_Handle_getVolumeMinimum(AUD_Handle* handle) -{ - assert(handle); - std::shared_ptr<I3DHandle> h = std::dynamic_pointer_cast<I3DHandle>(*handle); - - if(h.get()) - return h->getVolumeMinimum(); - return 0.0f; -} - -AUD_API int AUD_Handle_setVolumeMinimum(AUD_Handle* handle, float value) -{ - assert(handle); - std::shared_ptr<I3DHandle> h = std::dynamic_pointer_cast<I3DHandle>(*handle); - - if(h.get()) - return h->setVolumeMinimum(value); - return false; -} - -AUD_API void AUD_Handle_free(AUD_Handle* handle) -{ - delete handle; -} diff --git a/extern/audaspace/bindings/C/AUD_Handle.h b/extern/audaspace/bindings/C/AUD_Handle.h deleted file mode 100644 index 27cbd251de5..00000000000 --- a/extern/audaspace/bindings/C/AUD_Handle.h +++ /dev/null @@ -1,308 +0,0 @@ -/******************************************************************************* - * Copyright 2009-2016 Jörg Müller - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - ******************************************************************************/ - -#pragma once - -#include "AUD_Types.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/// Status of a playback handle. -typedef enum -{ - AUD_STATUS_INVALID = 0, /// Invalid handle. Maybe due to stopping. - AUD_STATUS_PLAYING, /// Sound is playing. - AUD_STATUS_PAUSED, /// Sound is being paused. - AUD_STATUS_STOPPED /// Sound is stopped but kept in the device. -} AUD_Status; - -/** - * Pauses a played back sound. - * \param handle The handle to the sound. - * \return Whether the handle has been playing or not. - */ -extern AUD_API int AUD_Handle_pause(AUD_Handle* handle); - -/** - * Resumes a paused sound. - * \param handle The handle to the sound. - * \return Whether the handle has been paused or not. - */ -extern AUD_API int AUD_Handle_resume(AUD_Handle* handle); - -/** - * Stops a playing or paused sound. - * \param handle The handle to the sound. - * \return Whether the handle has been valid or not. - */ -extern AUD_API int AUD_Handle_stop(AUD_Handle* handle); - -/** - * Retrieves the attenuation of a handle. - * param handle The handle to get the attenuation from. - * return The attenuation of the handle. - */ -extern AUD_API float AUD_Handle_getAttenuation(AUD_Handle* handle); - -/** - * Sets the attenuation of a handle. - * param handle The handle to set the attenuation from. - * param value The new attenuation to set. - */ -extern AUD_API int AUD_Handle_setAttenuation(AUD_Handle* handle, float value); - -/** - * Retrieves the cone angle inner of a handle. - * param handle The handle to get the cone angle inner from. - * return The cone angle inner of the handle. - */ -extern AUD_API float AUD_Handle_getConeAngleInner(AUD_Handle* handle); - -/** - * Sets the cone angle inner of a handle. - * param handle The handle to set the cone angle inner from. - * param value The new cone angle inner to set. - */ -extern AUD_API int AUD_Handle_setConeAngleInner(AUD_Handle* handle, float value); - -/** - * Retrieves the cone angle outer of a handle. - * param handle The handle to get the cone angle outer from. - * return The cone angle outer of the handle. - */ -extern AUD_API float AUD_Handle_getConeAngleOuter(AUD_Handle* handle); - -/** - * Sets the cone angle outer of a handle. - * param handle The handle to set the cone angle outer from. - * param value The new cone angle outer to set. - */ -extern AUD_API int AUD_Handle_setConeAngleOuter(AUD_Handle* handle, float value); - -/** - * Retrieves the cone volume outer of a handle. - * param handle The handle to get the cone volume outer from. - * return The cone volume outer of the handle. - */ -extern AUD_API float AUD_Handle_getConeVolumeOuter(AUD_Handle* handle); - -/** - * Sets the cone volume outer of a handle. - * param handle The handle to set the cone volume outer from. - * param value The new cone volume outer to set. - */ -extern AUD_API int AUD_Handle_setConeVolumeOuter(AUD_Handle* handle, float value); - -/** - * Retrieves the distance maximum of a handle. - * param handle The handle to get the distance maximum from. - * return The distance maximum of the handle. - */ -extern AUD_API float AUD_Handle_getDistanceMaximum(AUD_Handle* handle); - -/** - * Sets the distance maximum of a handle. - * param handle The handle to set the distance maximum from. - * param value The new distance maximum to set. - */ -extern AUD_API int AUD_Handle_setDistanceMaximum(AUD_Handle* handle, float value); - -/** - * Retrieves the distance reference of a handle. - * param handle The handle to get the distance reference from. - * return The distance reference of the handle. - */ -extern AUD_API float AUD_Handle_getDistanceReference(AUD_Handle* handle); - -/** - * Sets the distance reference of a handle. - * param handle The handle to set the distance reference from. - * param value The new distance reference to set. - */ -extern AUD_API int AUD_Handle_setDistanceReference(AUD_Handle* handle, float value); - -/** - * Retrieves the keep of a handle. - * param handle The handle to get the keep from. - * return The keep of the handle. - */ -extern AUD_API int AUD_Handle_doesKeep(AUD_Handle* handle); - -/** - * Sets the keep of a handle. - * param handle The handle to set the keep from. - * param value The new keep to set. - */ -extern AUD_API int AUD_Handle_setKeep(AUD_Handle* handle, int value); - -/** - * Retrieves the location of a handle. - * param handle The handle to get the location from. - * return The location of the handle. - */ -extern AUD_API int AUD_Handle_getLocation(AUD_Handle* handle, float value[3]); - -/** - * Sets the location of a handle. - * param handle The handle to set the location from. - * param value The new location to set. - */ -extern AUD_API int AUD_Handle_setLocation(AUD_Handle* handle, const float value[3]); - -/** - * Retrieves the loop count of a handle. - * param handle The handle to get the loop count from. - * return The loop count of the handle. - */ -extern AUD_API int AUD_Handle_getLoopCount(AUD_Handle* handle); - -/** - * Sets the loop count of a handle. - * param handle The handle to set the loop count from. - * param value The new loop count to set. - */ -extern AUD_API int AUD_Handle_setLoopCount(AUD_Handle* handle, int value); - -/** - * Retrieves the orientation of a handle. - * param handle The handle to get the orientation from. - * return The orientation of the handle. - */ -extern AUD_API int AUD_Handle_getOrientation(AUD_Handle* handle, float value[4]); - -/** - * Sets the orientation of a handle. - * param handle The handle to set the orientation from. - * param value The new orientation to set. - */ -extern AUD_API int AUD_Handle_setOrientation(AUD_Handle* handle, const float value[4]); - -/** - * Retrieves the pitch of a handle. - * param handle The handle to get the pitch from. - * return The pitch of the handle. - */ -extern AUD_API float AUD_Handle_getPitch(AUD_Handle* handle); - -/** - * Sets the pitch of a handle. - * param handle The handle to set the pitch from. - * param value The new pitch to set. - */ -extern AUD_API int AUD_Handle_setPitch(AUD_Handle* handle, float value); - -/** - * Retrieves the position of a handle. - * param handle The handle to get the position from. - * return The position of the handle. - */ -extern AUD_API float AUD_Handle_getPosition(AUD_Handle* handle); - -/** - * Sets the position of a handle. - * param handle The handle to set the position from. - * param value The new position to set. - */ -extern AUD_API int AUD_Handle_setPosition(AUD_Handle* handle, float value); - -/** - * Retrieves the relative of a handle. - * param handle The handle to get the relative from. - * return The relative of the handle. - */ -extern AUD_API int AUD_Handle_isRelative(AUD_Handle* handle); - -/** - * Sets the relative of a handle. - * param handle The handle to set the relative from. - * param value The new relative to set. - */ -extern AUD_API int AUD_Handle_setRelative(AUD_Handle* handle, int value); - -/** - * Retrieves the status of a handle. - * param handle The handle to get the status from. - * return The status of the handle. - */ -extern AUD_API AUD_Status AUD_Handle_getStatus(AUD_Handle* handle); - -/** - * Retrieves the velocity of a handle. - * param handle The handle to get the velocity from. - * return The velocity of the handle. - */ -extern AUD_API int AUD_Handle_getVelocity(AUD_Handle* handle, float value[3]); - -/** - * Sets the velocity of a handle. - * param handle The handle to set the velocity from. - * param value The new velocity to set. - */ -extern AUD_API int AUD_Handle_setVelocity(AUD_Handle* handle, const float value[3]); - -/** - * Retrieves the volume of a handle. - * param handle The handle to get the volume from. - * return The volume of the handle. - */ -extern AUD_API float AUD_Handle_getVolume(AUD_Handle* handle); - -/** - * Sets the volume of a handle. - * param handle The handle to set the volume from. - * param value The new volume to set. - */ -extern AUD_API int AUD_Handle_setVolume(AUD_Handle* handle, float value); - -/** - * Retrieves the volume maximum of a handle. - * param handle The handle to get the volume maximum from. - * return The volume maximum of the handle. - */ -extern AUD_API float AUD_Handle_getVolumeMaximum(AUD_Handle* handle); - -/** - * Sets the volume maximum of a handle. - * param handle The handle to set the volume maximum from. - * param value The new volume maximum to set. - */ -extern AUD_API int AUD_Handle_setVolumeMaximum(AUD_Handle* handle, float value); - -/** - * Retrieves the volume minimum of a handle. - * param handle The handle to get the volume minimum from. - * return The volume minimum of the handle. - */ -extern AUD_API float AUD_Handle_getVolumeMinimum(AUD_Handle* handle); - -/** - * Sets the volume minimum of a handle. - * param handle The handle to set the volume minimum from. - * param value The new volume minimum to set. - */ -extern AUD_API int AUD_Handle_setVolumeMinimum(AUD_Handle* handle, float value); - -/** - * Frees a handle. - * \param channel Handle to free. - */ -extern AUD_API void AUD_Handle_free(AUD_Handle* channel); - -#ifdef __cplusplus -} -#endif diff --git a/extern/audaspace/bindings/C/AUD_ImpulseResponse.cpp b/extern/audaspace/bindings/C/AUD_ImpulseResponse.cpp deleted file mode 100644 index f3c28d4d660..00000000000 --- a/extern/audaspace/bindings/C/AUD_ImpulseResponse.cpp +++ /dev/null @@ -1,44 +0,0 @@ -/******************************************************************************* -* Copyright 2009-2015 Juan Francisco Crespo Galán -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -******************************************************************************/ - -#include "Exception.h" - -#include <cassert> - -using namespace aud; - -#define AUD_CAPI_IMPLEMENTATION -#include "AUD_ImpulseResponse.h" - -AUD_API AUD_ImpulseResponse* AUD_ImpulseResponse_create(AUD_Sound* sound) -{ - assert(sound); - - try - { - return new AUD_ImpulseResponse(new ImpulseResponse(std::make_shared<StreamBuffer>(*sound))); - } - catch(Exception&) - { - return nullptr; - } -} - -AUD_API void AUD_ImpulseResponse_free(AUD_ImpulseResponse* filter) -{ - assert(filter); - delete filter; -}
\ No newline at end of file diff --git a/extern/audaspace/bindings/C/AUD_ImpulseResponse.h b/extern/audaspace/bindings/C/AUD_ImpulseResponse.h deleted file mode 100644 index dad2e87e899..00000000000 --- a/extern/audaspace/bindings/C/AUD_ImpulseResponse.h +++ /dev/null @@ -1,40 +0,0 @@ -/******************************************************************************* -* Copyright 2009-2015 Juan Francisco Crespo Galán -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -******************************************************************************/ - -#pragma once - -#include "AUD_Types.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Creates a new ImpulseResponse object. -* \param sound A Sound object representing a impulse response. -* \return The new ImpulseResponse object. -*/ -extern AUD_API AUD_ImpulseResponse* AUD_ImpulseResponse_create(AUD_Sound* sound); - -/** -* Deletes a ImpulseResponse object. -* \param threadPool The ImpulseResponse object to be deleted. -*/ -extern AUD_API void AUD_ImpulseResponse_free(AUD_ImpulseResponse* filter); - -#ifdef __cplusplus -} -#endif
\ No newline at end of file diff --git a/extern/audaspace/bindings/C/AUD_PlaybackManager.cpp b/extern/audaspace/bindings/C/AUD_PlaybackManager.cpp deleted file mode 100644 index 69ecb0987e1..00000000000 --- a/extern/audaspace/bindings/C/AUD_PlaybackManager.cpp +++ /dev/null @@ -1,94 +0,0 @@ -/******************************************************************************* -* Copyright 2015-2016 Juan Francisco Crespo Galán -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -******************************************************************************/ - -#include "Exception.h" - -#include <cassert> - -using namespace aud; - -#define AUD_CAPI_IMPLEMENTATION -#include "AUD_PlaybackManager.h" - -AUD_API AUD_PlaybackManager* AUD_PlaybackManager_create(AUD_Device* device) -{ - assert(device); - - try - { - return new AUD_PlaybackManager(new PlaybackManager(*device)); - } - catch(Exception&) - { - return nullptr; - } -} - -AUD_API void AUD_PlaybackManager_free(AUD_PlaybackManager* manager) -{ - assert(manager); - delete manager; -} - -AUD_API void AUD_PlaybackManager_play(AUD_PlaybackManager* manager, AUD_Sound* sound, unsigned int catKey) -{ - assert(manager); - assert(sound); - - (*manager)->play(*sound, catKey); -} - -AUD_API int AUD_PlaybackManager_resume(AUD_PlaybackManager* manager, unsigned int catKey) -{ - assert(manager); - return (*manager)->resume(catKey); -} - -AUD_API int AUD_PlaybackManager_pause(AUD_PlaybackManager* manager, unsigned int catKey) -{ - assert(manager); - return (*manager)->pause(catKey); -} - -AUD_API unsigned int AUD_PlaybackManager_addCategory(AUD_PlaybackManager* manager, float volume) -{ - assert(manager); - return (*manager)->addCategory(volume); -} - -AUD_API float AUD_PlaybackManager_getVolume(AUD_PlaybackManager* manager, unsigned int catKey) -{ - assert(manager); - return (*manager)->getVolume(catKey); -} - -AUD_API int AUD_PlaybackManager_setVolume(AUD_PlaybackManager* manager, float volume, unsigned int catKey) -{ - assert(manager); - return (*manager)->setVolume(volume, catKey); -} - -AUD_API int AUD_PlaybackManager_stop(AUD_PlaybackManager* manager, unsigned int catKey) -{ - assert(manager); - return (*manager)->stop(catKey); -} - -AUD_API void AUD_PlaybackManager_clean(AUD_PlaybackManager* manager) -{ - assert(manager); - (*manager)->clean(); -} diff --git a/extern/audaspace/bindings/C/AUD_PlaybackManager.h b/extern/audaspace/bindings/C/AUD_PlaybackManager.h deleted file mode 100644 index 0fa8171599d..00000000000 --- a/extern/audaspace/bindings/C/AUD_PlaybackManager.h +++ /dev/null @@ -1,103 +0,0 @@ -/******************************************************************************* -* Copyright 2015-2016 Juan Francisco Crespo Galán -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -******************************************************************************/ - -#pragma once - -#include "AUD_Types.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Creates a new PlaybackManager object. -* \param device The device that will be used to play sounds. -* \return The new PlaybackManager object. -*/ -extern AUD_API AUD_PlaybackManager* AUD_PlaybackManager_create(AUD_Device* device); - -/** -* Deletes a PlaybackManager object. -* \param manager The PlaybackManager object to be deleted. -*/ -extern AUD_API void AUD_PlaybackManager_free(AUD_PlaybackManager* manager); - -/** -* Plays a sound through the playback manager, adding it into a category. -* \param manager The PlaybackManager object. -* \param sound The sound to be played. -* \param catKey The key of the category into which the sound will be added. If it doesn't exist a new one will be creatd. -*/ -extern AUD_API void AUD_PlaybackManager_play(AUD_PlaybackManager* manager, AUD_Sound* sound, unsigned int catKey); - -/** -* Resumes the playback of all the paused sounds assigned to a category of a playback manager. -* \param manager The PlaybackManager object. -* \param catKey The key of the category. -* \return 0 if the category doesn't exist. -*/ -extern AUD_API int AUD_PlaybackManager_resume(AUD_PlaybackManager* manager, unsigned int catKey); - -/** -* Pauses all the sounds assigned to a category of a playback manager. -* \param manager The PlaybackManager object. -* \param catKey The key of the category. -* \return 0 if the category doesn't exist. -*/ -extern AUD_API int AUD_PlaybackManager_pause(AUD_PlaybackManager* manager, unsigned int catKey); - -/** -* Adds a new category with a custom volume. -* \param manager The PlaybackManager object. -* \param volume The volume value. -* \return The key of the new category. -*/ -extern AUD_API unsigned int AUD_PlaybackManager_addCategory(AUD_PlaybackManager* manager, float volume); - -/** -* Retrieves the volume of a category of a playback manager. -* \param manager The PlaybackManager object. -* \param catKey The key of the category. -* \return The volume of the category. -*/ -extern AUD_API float AUD_PlaybackManager_getVolume(AUD_PlaybackManager* manager, unsigned int catKey); - -/** -* Changes the voulume of a category of a playback manager. -* \param manager The PlaybackManager object. -* \param volume The new volume of the category. -* \param catKey The key of the category. -* \return 0 if the category doesn't exist. -*/ -extern AUD_API int AUD_PlaybackManager_setVolume(AUD_PlaybackManager* manager, float volume, unsigned int catKey); - -/** -* Stops all the sounds assigned to a category of a playback manager. -* \param manager The PlaybackManager object. -* \param catKey The key of the category. -* \return 0 if the category doesn't exist. -*/ -extern AUD_API int AUD_PlaybackManager_stop(AUD_PlaybackManager* manager, unsigned int catKey); - -/** -* Cleans all the invalid handles in a playback manager -* \param manager The PlaybackManager object. -*/ -extern AUD_API void AUD_PlaybackManager_clean(AUD_PlaybackManager* manager); - -#ifdef __cplusplus -} -#endif diff --git a/extern/audaspace/bindings/C/AUD_Sequence.cpp b/extern/audaspace/bindings/C/AUD_Sequence.cpp deleted file mode 100644 index d278cb148a1..00000000000 --- a/extern/audaspace/bindings/C/AUD_Sequence.cpp +++ /dev/null @@ -1,315 +0,0 @@ -/******************************************************************************* - * Copyright 2009-2016 Jörg Müller - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - ******************************************************************************/ - -#include "devices/I3DDevice.h" -#include "devices/DeviceManager.h" -#include "sequence/Sequence.h" -#include "Exception.h" - -#include <cassert> - -using namespace aud; - -#define AUD_CAPI_IMPLEMENTATION -#include "AUD_Sequence.h" - -AUD_API AUD_Sound* AUD_Sequence_create(float fps, int muted) -{ - // specs are changed at a later point! - Specs specs; - specs.channels = CHANNELS_STEREO; - specs.rate = RATE_48000; - AUD_Sound* sequence = new AUD_Sound(std::shared_ptr<Sequence>(new Sequence(specs, fps, muted))); - return sequence; -} - -AUD_API void AUD_Sequence_free(AUD_Sound* sequence) -{ - delete sequence; -} - -AUD_API AUD_SequenceEntry* AUD_Sequence_add(AUD_Sound* sequence, AUD_Sound* sound, float begin, float end, float skip) -{ - if(!sound) - return new AUD_SequenceEntry(((Sequence *)sequence->get())->add(AUD_Sound(), begin, end, skip)); - return new AUD_SequenceEntry(((Sequence *)sequence->get())->add(*sound, begin, end, skip)); -} - -AUD_API void AUD_Sequence_remove(AUD_Sound* sequence, AUD_SequenceEntry* entry) -{ - dynamic_cast<Sequence *>(sequence->get())->remove(*entry); - delete entry; -} - -AUD_API void AUD_Sequence_setAnimationData(AUD_Sound* sequence, AUD_AnimateablePropertyType type, int frame, float* data, char animated) -{ - AnimateableProperty* prop = dynamic_cast<Sequence *>(sequence->get())->getAnimProperty(static_cast<AnimateablePropertyType>(type)); - if(animated) - { - if(frame >= 0) - { - prop->write(data, frame, 1); - } - } - else - { - prop->write(data); - } -} - -AUD_API AUD_DistanceModel AUD_Sequence_getDistanceModel(AUD_Sound* sequence) -{ - assert(sequence); - return static_cast<AUD_DistanceModel>(dynamic_cast<Sequence *>(sequence->get())->getDistanceModel()); -} - -AUD_API void AUD_Sequence_setDistanceModel(AUD_Sound* sequence, AUD_DistanceModel value) -{ - assert(sequence); - dynamic_cast<Sequence *>(sequence->get())->setDistanceModel(static_cast<DistanceModel>(value)); -} - -AUD_API float AUD_Sequence_getDopplerFactor(AUD_Sound* sequence) -{ - assert(sequence); - return dynamic_cast<Sequence *>(sequence->get())->getDopplerFactor(); -} - -AUD_API void AUD_Sequence_setDopplerFactor(AUD_Sound* sequence, float value) -{ - assert(sequence); - dynamic_cast<Sequence *>(sequence->get())->setDopplerFactor(value); -} - -AUD_API float AUD_Sequence_getFPS(AUD_Sound* sequence) -{ - assert(sequence); - return dynamic_cast<Sequence *>(sequence->get())->getFPS(); -} - -AUD_API void AUD_Sequence_setFPS(AUD_Sound* sequence, float value) -{ - assert(sequence); - dynamic_cast<Sequence *>(sequence->get())->setFPS(value); -} - -AUD_API int AUD_Sequence_isMuted(AUD_Sound* sequence) -{ - assert(sequence); - return dynamic_cast<Sequence *>(sequence->get())->isMuted(); -} - -AUD_API void AUD_Sequence_setMuted(AUD_Sound* sequence, int value) -{ - assert(sequence); - dynamic_cast<Sequence *>(sequence->get())->mute(value); -} - -static inline AUD_Specs convSpecToC(aud::Specs specs) -{ - AUD_Specs s; - s.channels = static_cast<AUD_Channels>(specs.channels); - s.rate = static_cast<AUD_SampleRate>(specs.rate); - return s; -} - -static inline aud::Specs convCToSpec(AUD_Specs specs) -{ - aud::Specs s; - s.channels = static_cast<Channels>(specs.channels); - s.rate = static_cast<SampleRate>(specs.rate); - return s; -} - -AUD_API AUD_Specs AUD_Sequence_getSpecs(AUD_Sound* sequence) -{ - assert(sequence); - return convSpecToC(dynamic_cast<Sequence *>(sequence->get())->getSpecs()); -} - -AUD_API void AUD_Sequence_setSpecs(AUD_Sound* sequence, AUD_Specs value) -{ - assert(sequence); - dynamic_cast<Sequence *>(sequence->get())->setSpecs(convCToSpec(value)); -} - -AUD_API float AUD_Sequence_getSpeedOfSound(AUD_Sound* sequence) -{ - assert(sequence); - return dynamic_cast<Sequence *>(sequence->get())->getSpeedOfSound(); -} - -AUD_API void AUD_Sequence_setSpeedOfSound(AUD_Sound* sequence, float value) -{ - assert(sequence); - dynamic_cast<Sequence *>(sequence->get())->setSpeedOfSound(value); -} - - - -AUD_API void AUD_SequenceEntry_move(AUD_SequenceEntry* entry, float begin, float end, float skip) -{ - (*entry)->move(begin, end, skip); -} - -AUD_API void AUD_SequenceEntry_setAnimationData(AUD_SequenceEntry* entry, AUD_AnimateablePropertyType type, int frame, float* data, char animated) -{ - AnimateableProperty* prop = (*entry)->getAnimProperty(static_cast<AnimateablePropertyType>(type)); - if(animated) - { - if(frame >= 0) - prop->write(data, frame, 1); - } - else - { - prop->write(data); - } -} - -AUD_API float AUD_SequenceEntry_getAttenuation(AUD_SequenceEntry* sequence_entry) -{ - assert(sequence_entry); - return (*sequence_entry)->getAttenuation(); -} - -AUD_API void AUD_SequenceEntry_setAttenuation(AUD_SequenceEntry* sequence_entry, float value) -{ - assert(sequence_entry); - (*sequence_entry)->setAttenuation(value); -} - -AUD_API float AUD_SequenceEntry_getConeAngleInner(AUD_SequenceEntry* sequence_entry) -{ - assert(sequence_entry); - return (*sequence_entry)->getConeAngleInner(); -} - -AUD_API void AUD_SequenceEntry_setConeAngleInner(AUD_SequenceEntry* sequence_entry, float value) -{ - assert(sequence_entry); - (*sequence_entry)->setConeAngleInner(value); -} - -AUD_API float AUD_SequenceEntry_getConeAngleOuter(AUD_SequenceEntry* sequence_entry) -{ - assert(sequence_entry); - return (*sequence_entry)->getConeAngleOuter(); -} - -AUD_API void AUD_SequenceEntry_setConeAngleOuter(AUD_SequenceEntry* sequence_entry, float value) -{ - assert(sequence_entry); - (*sequence_entry)->setConeAngleOuter(value); -} - -AUD_API float AUD_SequenceEntry_getConeVolumeOuter(AUD_SequenceEntry* sequence_entry) -{ - assert(sequence_entry); - return (*sequence_entry)->getConeVolumeOuter(); -} - -AUD_API void AUD_SequenceEntry_setConeVolumeOuter(AUD_SequenceEntry* sequence_entry, float value) -{ - assert(sequence_entry); - (*sequence_entry)->setConeVolumeOuter(value); -} - -AUD_API float AUD_SequenceEntry_getDistanceMaximum(AUD_SequenceEntry* sequence_entry) -{ - assert(sequence_entry); - return (*sequence_entry)->getDistanceMaximum(); -} - -AUD_API void AUD_SequenceEntry_setDistanceMaximum(AUD_SequenceEntry* sequence_entry, float value) -{ - assert(sequence_entry); - (*sequence_entry)->setDistanceMaximum(value); -} - -AUD_API float AUD_SequenceEntry_getDistanceReference(AUD_SequenceEntry* sequence_entry) -{ - assert(sequence_entry); - return (*sequence_entry)->getDistanceReference(); -} - -AUD_API void AUD_SequenceEntry_setDistanceReference(AUD_SequenceEntry* sequence_entry, float value) -{ - assert(sequence_entry); - (*sequence_entry)->setDistanceReference(value); -} - -AUD_API int AUD_SequenceEntry_isMuted(AUD_SequenceEntry* sequence_entry) -{ - assert(sequence_entry); - return (*sequence_entry)->isMuted(); -} - -AUD_API void AUD_SequenceEntry_setMuted(AUD_SequenceEntry* sequence_entry, int value) -{ - assert(sequence_entry); - (*sequence_entry)->mute(value); -} - -AUD_API int AUD_SequenceEntry_isRelative(AUD_SequenceEntry* sequence_entry) -{ - assert(sequence_entry); - return (*sequence_entry)->isRelative(); -} - -AUD_API void AUD_SequenceEntry_setRelative(AUD_SequenceEntry* sequence_entry, int value) -{ - assert(sequence_entry); - (*sequence_entry)->setRelative(value); -} - -AUD_API AUD_Sound* AUD_SequenceEntry_getSound(AUD_SequenceEntry* sequence_entry) -{ - assert(sequence_entry); - return new std::shared_ptr<ISound>((*sequence_entry)->getSound()); -} - -AUD_API void AUD_SequenceEntry_setSound(AUD_SequenceEntry* sequence_entry, AUD_Sound* value) -{ - assert(sequence_entry); - if(value) - (*sequence_entry)->setSound(*value); - else - (*sequence_entry)->setSound(AUD_Sound()); -} - -AUD_API float AUD_SequenceEntry_getVolumeMaximum(AUD_SequenceEntry* sequence_entry) -{ - assert(sequence_entry); - return (*sequence_entry)->getVolumeMaximum(); -} - -AUD_API void AUD_SequenceEntry_setVolumeMaximum(AUD_SequenceEntry* sequence_entry, float value) -{ - assert(sequence_entry); - (*sequence_entry)->setVolumeMaximum(value); -} - -AUD_API float AUD_SequenceEntry_getVolumeMinimum(AUD_SequenceEntry* sequence_entry) -{ - assert(sequence_entry); - return (*sequence_entry)->getVolumeMinimum(); -} - -AUD_API void AUD_SequenceEntry_setVolumeMinimum(AUD_SequenceEntry* sequence_entry, float value) -{ - assert(sequence_entry); - (*sequence_entry)->setVolumeMinimum(value); -} diff --git a/extern/audaspace/bindings/C/AUD_Sequence.h b/extern/audaspace/bindings/C/AUD_Sequence.h deleted file mode 100644 index 668960c7d50..00000000000 --- a/extern/audaspace/bindings/C/AUD_Sequence.h +++ /dev/null @@ -1,338 +0,0 @@ -/******************************************************************************* - * Copyright 2009-2016 Jörg Müller - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - ******************************************************************************/ - -#pragma once - -#include "AUD_Device.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/// Possible animatable properties for Sequence Factories and Entries. -typedef enum -{ - AUD_AP_VOLUME, - AUD_AP_PANNING, - AUD_AP_PITCH, - AUD_AP_LOCATION, - AUD_AP_ORIENTATION -} AUD_AnimateablePropertyType; - -/** - * Creates a new sequenced sound scene. - * \param fps The FPS of the scene. - * \param muted Whether the scene is muted. - * \return The new sound scene. - */ -extern AUD_API AUD_Sound* AUD_Sequence_create(float fps, int muted); - -/** - * Deletes a sound scene. - * \param sequence The sound scene. - */ -extern AUD_API void AUD_Sequence_free(AUD_Sound* sequence); - -/** - * Adds a new entry to the scene. - * \param sequence The sound scene. - * \param sound The sound this entry should play. - * \param begin The start time. - * \param end The end time or a negative value if determined by the sound. - * \param skip How much seconds should be skipped at the beginning. - * \return The entry added. - */ -extern AUD_API AUD_SequenceEntry* AUD_Sequence_add(AUD_Sound* sequence, AUD_Sound* sound, float begin, float end, float skip); - -/** - * Removes an entry from the scene. - * \param sequence The sound scene. - * \param entry The entry to remove. - */ -extern AUD_API void AUD_Sequence_remove(AUD_Sound* sequence, AUD_SequenceEntry* entry); - -/** - * Writes animation data to a sequence. - * \param sequence The sound scene. - * \param type The type of animation data. - * \param frame The frame this data is for. - * \param data The data to write. - * \param animated Whether the attribute is animated. - */ -extern AUD_API void AUD_Sequence_setAnimationData(AUD_Sound* sequence, AUD_AnimateablePropertyType type, int frame, float* data, char animated); - -/** - * Retrieves the distance model of a sequence. - * param sequence The sequence to get the distance model from. - * return The distance model of the sequence. - */ -extern AUD_API AUD_DistanceModel AUD_Sequence_getDistanceModel(AUD_Sound* sequence); - -/** - * Sets the distance model of a sequence. - * param sequence The sequence to set the distance model from. - * param value The new distance model to set. - */ -extern AUD_API void AUD_Sequence_setDistanceModel(AUD_Sound* sequence, AUD_DistanceModel value); - -/** - * Retrieves the doppler factor of a sequence. - * param sequence The sequence to get the doppler factor from. - * return The doppler factor of the sequence. - */ -extern AUD_API float AUD_Sequence_getDopplerFactor(AUD_Sound* sequence); - -/** - * Sets the doppler factor of a sequence. - * param sequence The sequence to set the doppler factor from. - * param value The new doppler factor to set. - */ -extern AUD_API void AUD_Sequence_setDopplerFactor(AUD_Sound* sequence, float value); - -/** - * Retrieves the fps of a sequence. - * param sequence The sequence to get the fps from. - * return The fps of the sequence. - */ -extern AUD_API float AUD_Sequence_getFPS(AUD_Sound* sequence); - -/** - * Sets the fps of a sequence. - * param sequence The sequence to set the fps from. - * param value The new fps to set. - */ -extern AUD_API void AUD_Sequence_setFPS(AUD_Sound* sequence, float value); - -/** - * Retrieves the muted of a sequence. - * param sequence The sequence to get the muted from. - * return The muted of the sequence. - */ -extern AUD_API int AUD_Sequence_isMuted(AUD_Sound* sequence); - -/** - * Sets the muted of a sequence. - * param sequence The sequence to set the muted from. - * param value The new muted to set. - */ -extern AUD_API void AUD_Sequence_setMuted(AUD_Sound* sequence, int value); - -/** - * Retrieves the specs of a sequence. - * param sequence The sequence to get the specs from. - * return The specs of the sequence. - */ -extern AUD_API AUD_Specs AUD_Sequence_getSpecs(AUD_Sound* sequence); - -/** - * Sets the specs of a sequence. - * param sequence The sequence to set the specs from. - * param value The new specs to set. - */ -extern AUD_API void AUD_Sequence_setSpecs(AUD_Sound* sequence, AUD_Specs value); - -/** - * Retrieves the speed of sound of a sequence. - * param sequence The sequence to get the speed of sound from. - * return The speed of sound of the sequence. - */ -extern AUD_API float AUD_Sequence_getSpeedOfSound(AUD_Sound* sequence); - -/** - * Sets the speed of sound of a sequence. - * param sequence The sequence to set the speed of sound from. - * param value The new speed of sound to set. - */ -extern AUD_API void AUD_Sequence_setSpeedOfSound(AUD_Sound* sequence, float value); - - - -/** - * Moves the entry. - * \param entry The sequenced entry. - * \param begin The new start time. - * \param end The new end time or a negative value if unknown. - * \param skip How many seconds to skip at the beginning. - */ -extern AUD_API void AUD_SequenceEntry_move(AUD_SequenceEntry* entry, float begin, float end, float skip); - -/** - * Writes animation data to a sequenced entry. - * \param entry The sequenced entry. - * \param type The type of animation data. - * \param frame The frame this data is for. - * \param data The data to write. - * \param animated Whether the attribute is animated. - */ -extern AUD_API void AUD_SequenceEntry_setAnimationData(AUD_SequenceEntry* entry, AUD_AnimateablePropertyType type, int frame, float* data, char animated); - -/** - * Retrieves the attenuation of a sequence_entry. - * param sequence_entry The sequence_entry to get the attenuation from. - * return The attenuation of the sequence_entry. - */ -extern AUD_API float AUD_SequenceEntry_getAttenuation(AUD_SequenceEntry* sequence_entry); - -/** - * Sets the attenuation of a sequence_entry. - * param sequence_entry The sequence_entry to set the attenuation from. - * param value The new attenuation to set. - */ -extern AUD_API void AUD_SequenceEntry_setAttenuation(AUD_SequenceEntry* sequence_entry, float value); - -/** - * Retrieves the cone angle inner of a sequence_entry. - * param sequence_entry The sequence_entry to get the cone angle inner from. - * return The cone angle inner of the sequence_entry. - */ -extern AUD_API float AUD_SequenceEntry_getConeAngleInner(AUD_SequenceEntry* sequence_entry); - -/** - * Sets the cone angle inner of a sequence_entry. - * param sequence_entry The sequence_entry to set the cone angle inner from. - * param value The new cone angle inner to set. - */ -extern AUD_API void AUD_SequenceEntry_setConeAngleInner(AUD_SequenceEntry* sequence_entry, float value); - -/** - * Retrieves the cone angle outer of a sequence_entry. - * param sequence_entry The sequence_entry to get the cone angle outer from. - * return The cone angle outer of the sequence_entry. - */ -extern AUD_API float AUD_SequenceEntry_getConeAngleOuter(AUD_SequenceEntry* sequence_entry); - -/** - * Sets the cone angle outer of a sequence_entry. - * param sequence_entry The sequence_entry to set the cone angle outer from. - * param value The new cone angle outer to set. - */ -extern AUD_API void AUD_SequenceEntry_setConeAngleOuter(AUD_SequenceEntry* sequence_entry, float value); - -/** - * Retrieves the cone volume outer of a sequence_entry. - * param sequence_entry The sequence_entry to get the cone volume outer from. - * return The cone volume outer of the sequence_entry. - */ -extern AUD_API float AUD_SequenceEntry_getConeVolumeOuter(AUD_SequenceEntry* sequence_entry); - -/** - * Sets the cone volume outer of a sequence_entry. - * param sequence_entry The sequence_entry to set the cone volume outer from. - * param value The new cone volume outer to set. - */ -extern AUD_API void AUD_SequenceEntry_setConeVolumeOuter(AUD_SequenceEntry* sequence_entry, float value); - -/** - * Retrieves the distance maximum of a sequence_entry. - * param sequence_entry The sequence_entry to get the distance maximum from. - * return The distance maximum of the sequence_entry. - */ -extern AUD_API float AUD_SequenceEntry_getDistanceMaximum(AUD_SequenceEntry* sequence_entry); - -/** - * Sets the distance maximum of a sequence_entry. - * param sequence_entry The sequence_entry to set the distance maximum from. - * param value The new distance maximum to set. - */ -extern AUD_API void AUD_SequenceEntry_setDistanceMaximum(AUD_SequenceEntry* sequence_entry, float value); - -/** - * Retrieves the distance reference of a sequence_entry. - * param sequence_entry The sequence_entry to get the distance reference from. - * return The distance reference of the sequence_entry. - */ -extern AUD_API float AUD_SequenceEntry_getDistanceReference(AUD_SequenceEntry* sequence_entry); - -/** - * Sets the distance reference of a sequence_entry. - * param sequence_entry The sequence_entry to set the distance reference from. - * param value The new distance reference to set. - */ -extern AUD_API void AUD_SequenceEntry_setDistanceReference(AUD_SequenceEntry* sequence_entry, float value); - -/** - * Retrieves the muted of a sequence_entry. - * param sequence_entry The sequence_entry to get the muted from. - * return The muted of the sequence_entry. - */ -extern AUD_API int AUD_SequenceEntry_isMuted(AUD_SequenceEntry* sequence_entry); - -/** - * Sets the muted of a sequence_entry. - * param sequence_entry The sequence_entry to set the muted from. - * param value The new muted to set. - */ -extern AUD_API void AUD_SequenceEntry_setMuted(AUD_SequenceEntry* sequence_entry, int value); - -/** - * Retrieves the relative of a sequence_entry. - * param sequence_entry The sequence_entry to get the relative from. - * return The relative of the sequence_entry. - */ -extern AUD_API int AUD_SequenceEntry_isRelative(AUD_SequenceEntry* sequence_entry); - -/** - * Sets the relative of a sequence_entry. - * param sequence_entry The sequence_entry to set the relative from. - * param value The new relative to set. - */ -extern AUD_API void AUD_SequenceEntry_setRelative(AUD_SequenceEntry* sequence_entry, int value); - -/** - * Retrieves the sound of a sequence_entry. - * param sequence_entry The sequence_entry to get the sound from. - * return The sound of the sequence_entry. - */ -extern AUD_API AUD_Sound* AUD_SequenceEntry_getSound(AUD_SequenceEntry* sequence_entry); - -/** - * Sets the sound of a sequence_entry. - * param sequence_entry The sequence_entry to set the sound from. - * param value The new sound to set. - */ -extern AUD_API void AUD_SequenceEntry_setSound(AUD_SequenceEntry* sequence_entry, AUD_Sound* value); - -/** - * Retrieves the volume maximum of a sequence_entry. - * param sequence_entry The sequence_entry to get the volume maximum from. - * return The volume maximum of the sequence_entry. - */ -extern AUD_API float AUD_SequenceEntry_getVolumeMaximum(AUD_SequenceEntry* sequence_entry); - -/** - * Sets the volume maximum of a sequence_entry. - * param sequence_entry The sequence_entry to set the volume maximum from. - * param value The new volume maximum to set. - */ -extern AUD_API void AUD_SequenceEntry_setVolumeMaximum(AUD_SequenceEntry* sequence_entry, float value); - -/** - * Retrieves the volume minimum of a sequence_entry. - * param sequence_entry The sequence_entry to get the volume minimum from. - * return The volume minimum of the sequence_entry. - */ -extern AUD_API float AUD_SequenceEntry_getVolumeMinimum(AUD_SequenceEntry* sequence_entry); - -/** - * Sets the volume minimum of a sequence_entry. - * param sequence_entry The sequence_entry to set the volume minimum from. - * param value The new volume minimum to set. - */ -extern AUD_API void AUD_SequenceEntry_setVolumeMinimum(AUD_SequenceEntry* sequence_entry, float value); - -#ifdef __cplusplus -} -#endif diff --git a/extern/audaspace/bindings/C/AUD_Sound.cpp b/extern/audaspace/bindings/C/AUD_Sound.cpp deleted file mode 100644 index 30860acde62..00000000000 --- a/extern/audaspace/bindings/C/AUD_Sound.cpp +++ /dev/null @@ -1,709 +0,0 @@ -/******************************************************************************* - * Copyright 2009-2016 Jörg Müller - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - ******************************************************************************/ - -#include "generator/Sawtooth.h" -#include "generator/Sine.h" -#include "generator/Silence.h" -#include "generator/Square.h" -#include "generator/Triangle.h" -#include "file/File.h" -#include "file/FileWriter.h" -#include "util/StreamBuffer.h" -#include "fx/Accumulator.h" -#include "fx/ADSR.h" -#include "fx/Delay.h" -#include "fx/Envelope.h" -#include "fx/Fader.h" -#include "fx/Highpass.h" -#include "fx/IIRFilter.h" -#include "fx/Limiter.h" -#include "fx/Loop.h" -#include "fx/Lowpass.h" -#include "fx/Pitch.h" -#include "fx/Reverse.h" -#include "fx/Sum.h" -#include "fx/Threshold.h" -#include "fx/Volume.h" -#include "fx/SoundList.h" -#include "fx/MutableSound.h" -#include "sequence/Double.h" -#include "sequence/Superpose.h" -#include "sequence/PingPong.h" -#include "respec/LinearResample.h" -#include "respec/JOSResample.h" -#include "respec/JOSResampleReader.h" -#include "respec/ChannelMapper.h" -#include "respec/ChannelMapperReader.h" -#include "util/Buffer.h" -#include "Exception.h" - -#ifdef WITH_CONVOLUTION -#include "fx/BinauralSound.h" -#include "fx/ConvolverSound.h" -#endif - -#include <cassert> -#include <cstring> - -using namespace aud; - -#define AUD_CAPI_IMPLEMENTATION -#include "AUD_Sound.h" - -static inline AUD_Specs convSpecToC(aud::Specs specs) -{ - AUD_Specs s; - s.channels = static_cast<AUD_Channels>(specs.channels); - s.rate = static_cast<AUD_SampleRate>(specs.rate); - return s; -} - -static inline aud::Specs convCToSpec(AUD_Specs specs) -{ - aud::Specs s; - s.channels = static_cast<Channels>(specs.channels); - s.rate = static_cast<SampleRate>(specs.rate); - return s; -} - -AUD_API AUD_Specs AUD_Sound_getSpecs(AUD_Sound* sound) -{ - assert(sound); - - return convSpecToC((*sound)->createReader()->getSpecs()); -} - -AUD_API int AUD_Sound_getLength(AUD_Sound* sound) -{ - assert(sound); - - return (*sound)->createReader()->getLength(); -} - -AUD_API sample_t* AUD_Sound_data(AUD_Sound* sound, int* length, AUD_Specs* specs) -{ - assert(sound); - assert(length); - assert(specs); - - auto stream_buffer = std::dynamic_pointer_cast<StreamBuffer>(*sound); - if(!stream_buffer) - stream_buffer = std::make_shared<StreamBuffer>(*sound); - *specs = convSpecToC(stream_buffer->getSpecs()); - auto buffer = stream_buffer->getBuffer(); - - *length = buffer->getSize() / AUD_SAMPLE_SIZE((*specs)); - - sample_t* data = new sample_t[buffer->getSize()]; - - std::memcpy(data, buffer->getBuffer(), buffer->getSize()); - - return data; -} - -AUD_API void AUD_Sound_freeData(sample_t* data) -{ - delete[] data; -} - -AUD_API const char* AUD_Sound_write(AUD_Sound* sound, const char* filename, AUD_SampleRate rate, AUD_Channels channels, AUD_SampleFormat format, AUD_Container container, AUD_Codec codec, int bitrate, int buffersize) -{ - assert(sound); - assert(filename); - - try - { - std::shared_ptr<IReader> reader = (*sound)->createReader(); - - DeviceSpecs specs; - specs.specs = reader->getSpecs(); - - if((rate != RATE_INVALID) && (specs.rate != rate)) - { - specs.rate = rate; - reader = std::make_shared<JOSResampleReader>(reader, rate); - } - - if((channels != AUD_CHANNELS_INVALID) && (specs.channels != static_cast<Channels>(channels))) - { - specs.channels = static_cast<Channels>(channels); - reader = std::make_shared<ChannelMapperReader>(reader, specs.channels); - } - - if(format == AUD_FORMAT_INVALID) - format = AUD_FORMAT_S16; - specs.format = static_cast<SampleFormat>(format); - - const char* invalid_container_error = "Container could not be determined from filename."; - - if(container == AUD_CONTAINER_INVALID) - { - std::string path = filename; - - if(path.length() < 4) - return invalid_container_error; - - std::string extension = path.substr(path.length() - 4); - - if(extension == ".ac3") - container = AUD_CONTAINER_AC3; - else if(extension == "flac") - container = AUD_CONTAINER_FLAC; - else if(extension == ".mkv") - container = AUD_CONTAINER_MATROSKA; - else if(extension == ".mp2") - container = AUD_CONTAINER_MP2; - else if(extension == ".mp3") - container = AUD_CONTAINER_MP3; - else if(extension == ".ogg") - container = AUD_CONTAINER_OGG; - else if(extension == ".wav") - container = AUD_CONTAINER_WAV; - else - return invalid_container_error; - } - - if(codec == AUD_CODEC_INVALID) - { - switch(container) - { - case AUD_CONTAINER_AC3: - codec = AUD_CODEC_AC3; - break; - case AUD_CONTAINER_FLAC: - codec = AUD_CODEC_FLAC; - break; - case AUD_CONTAINER_MATROSKA: - codec = AUD_CODEC_OPUS; - break; - case AUD_CONTAINER_MP2: - codec = AUD_CODEC_MP2; - break; - case AUD_CONTAINER_MP3: - codec = AUD_CODEC_MP3; - break; - case AUD_CONTAINER_OGG: - codec = AUD_CODEC_VORBIS; - break; - case AUD_CONTAINER_WAV: - codec = AUD_CODEC_PCM; - break; - default: - return "Unknown container, cannot select default codec."; - } - } - - if(buffersize <= 0) - buffersize = AUD_DEFAULT_BUFFER_SIZE; - - std::shared_ptr<IWriter> writer = FileWriter::createWriter(filename, specs, static_cast<Container>(container), static_cast<Codec>(codec), bitrate); - FileWriter::writeReader(reader, writer, 0, buffersize); - } - catch(Exception& e) - { - return "An exception occured while writing."; - } - - return nullptr; -} - -AUD_API AUD_Sound* AUD_Sound_buffer(sample_t* data, int length, AUD_Specs specs) -{ - assert(data); - - if(length <= 0 || specs.rate <= 0 || specs.channels <= 0) - { - return nullptr; - } - - int size = length * AUD_SAMPLE_SIZE(specs); - - std::shared_ptr<Buffer> buffer = std::make_shared<Buffer>(size); - - std::memcpy(buffer->getBuffer(), data, size); - - try - { - return new AUD_Sound(new StreamBuffer(buffer, convCToSpec(specs))); - } - catch(Exception&) - { - return nullptr; - } -} - -AUD_API AUD_Sound* AUD_Sound_bufferFile(unsigned char* buffer, int size) -{ - assert(buffer); - return new AUD_Sound(new File(buffer, size)); -} - -AUD_API AUD_Sound* AUD_Sound_cache(AUD_Sound* sound) -{ - assert(sound); - - try - { - return new AUD_Sound(new StreamBuffer(*sound)); - } - catch(Exception&) - { - return nullptr; - } -} - -AUD_API AUD_Sound* AUD_Sound_file(const char* filename) -{ - assert(filename); - return new AUD_Sound(new File(filename)); -} - -AUD_API AUD_Sound* AUD_Sound_sawtooth(float frequency, AUD_SampleRate rate) -{ - return new AUD_Sound(new Sawtooth(frequency, rate)); -} - -AUD_API AUD_Sound*AUD_Sound_silence() -{ - return new AUD_Sound(new Silence()); -} - -AUD_API AUD_Sound* AUD_Sound_sine(float frequency, AUD_SampleRate rate) -{ - return new AUD_Sound(new Sine(frequency, rate)); -} - -AUD_API AUD_Sound* AUD_Sound_square(float frequency, AUD_SampleRate rate) -{ - return new AUD_Sound(new Square(frequency, rate)); -} - -AUD_API AUD_Sound* AUD_Sound_triangle(float frequency, AUD_SampleRate rate) -{ - return new AUD_Sound(new Triangle(frequency, rate)); -} - -AUD_API AUD_Sound* AUD_Sound_accumulate(AUD_Sound* sound, int additive) -{ - assert(sound); - - try - { - return new AUD_Sound(new Accumulator(*sound, additive)); - } - catch(Exception&) - { - return nullptr; - } -} - -AUD_API AUD_Sound* AUD_Sound_ADSR(AUD_Sound* sound, float attack, float decay, float sustain, float release) -{ - assert(sound); - - try - { - return new AUD_Sound(new ADSR(*sound, attack, decay, sustain, release)); - } - catch(Exception&) - { - return nullptr; - } -} - -AUD_API AUD_Sound* AUD_Sound_delay(AUD_Sound* sound, float delay) -{ - assert(sound); - - try - { - return new AUD_Sound(new Delay(*sound, delay)); - } - catch(Exception&) - { - return nullptr; - } -} - -AUD_API AUD_Sound* AUD_Sound_envelope(AUD_Sound* sound, float attack, float release, float threshold, float arthreshold) -{ - assert(sound); - - try - { - return new AUD_Sound(new Envelope(*sound, attack, release, threshold, arthreshold)); - } - catch(Exception&) - { - return nullptr; - } -} - -AUD_API AUD_Sound* AUD_Sound_fadein(AUD_Sound* sound, float start, float length) -{ - assert(sound); - - try - { - return new AUD_Sound(new Fader(*sound, FADE_IN, start, length)); - } - catch(Exception&) - { - return nullptr; - } -} - -AUD_API AUD_Sound* AUD_Sound_fadeout(AUD_Sound* sound, float start, float length) -{ - assert(sound); - - try - { - return new AUD_Sound(new Fader(*sound, FADE_OUT, start, length)); - } - catch(Exception&) - { - return nullptr; - } -} - -AUD_API AUD_Sound* AUD_Sound_filter(AUD_Sound* sound, float* b, int b_length, float* a, int a_length) -{ - assert(sound); - - try - { - std::vector<float> a_coeff, b_coeff; - - if(b) - for(int i = 0; i < b_length; i++) - b_coeff.push_back(b[i]); - - if(a) - { - for(int i = 0; i < a_length; i++) - a_coeff.push_back(a[i]); - - if(*a == 0.0f) - a_coeff[0] = 1.0f; - } - - return new AUD_Sound(new IIRFilter(*sound, b_coeff, a_coeff)); - } - catch(Exception&) - { - return nullptr; - } -} - -AUD_API AUD_Sound* AUD_Sound_highpass(AUD_Sound* sound, float frequency, float Q) -{ - assert(sound); - - try - { - return new AUD_Sound(new Highpass(*sound, frequency, Q)); - } - catch(Exception&) - { - return nullptr; - } -} - -AUD_API AUD_Sound* AUD_Sound_limit(AUD_Sound* sound, float start, float end) -{ - assert(sound); - - try - { - return new AUD_Sound(new Limiter(*sound, start, end)); - } - catch(Exception&) - { - return nullptr; - } -} - -AUD_API AUD_Sound* AUD_Sound_loop(AUD_Sound* sound, int count) -{ - assert(sound); - - try - { - return new AUD_Sound(new Loop(*sound, count)); - } - catch(Exception&) - { - return nullptr; - } -} - -AUD_API AUD_Sound* AUD_Sound_lowpass(AUD_Sound* sound, float frequency, float Q) -{ - assert(sound); - - try - { - return new AUD_Sound(new Lowpass(*sound, frequency, Q)); - } - catch(Exception&) - { - return nullptr; - } -} - -AUD_API AUD_Sound* AUD_Sound_pitch(AUD_Sound* sound, float factor) -{ - assert(sound); - - try - { - return new AUD_Sound(new Pitch(*sound, factor)); - } - catch(Exception&) - { - return nullptr; - } -} - -AUD_API AUD_Sound* AUD_Sound_rechannel(AUD_Sound* sound, AUD_Channels channels) -{ - assert(sound); - - try - { - DeviceSpecs specs; - specs.channels = static_cast<Channels>(channels); - specs.rate = RATE_INVALID; - specs.format = FORMAT_INVALID; - return new AUD_Sound(new ChannelMapper(*sound, specs)); - } - catch(Exception&) - { - return nullptr; - } -} - -AUD_API AUD_Sound* AUD_Sound_resample(AUD_Sound* sound, AUD_SampleRate rate, bool high_quality) -{ - assert(sound); - - try - { - DeviceSpecs specs; - specs.channels = CHANNELS_INVALID; - specs.rate = rate; - specs.format = FORMAT_INVALID; - if(high_quality) - return new AUD_Sound(new JOSResample(*sound, specs)); - else - return new AUD_Sound(new LinearResample(*sound, specs)); - } - catch(Exception&) - { - return nullptr; - } -} - -AUD_API AUD_Sound* AUD_Sound_reverse(AUD_Sound* sound) -{ - assert(sound); - - try - { - return new AUD_Sound(new Reverse(*sound)); - } - catch(Exception&) - { - return nullptr; - } -} - -AUD_API AUD_Sound* AUD_Sound_sum(AUD_Sound* sound) -{ - assert(sound); - - try - { - return new AUD_Sound(new Sum(*sound)); - } - catch(Exception&) - { - return nullptr; - } -} - -AUD_API AUD_Sound* AUD_Sound_threshold(AUD_Sound* sound, float threshold) -{ - assert(sound); - - try - { - return new AUD_Sound(new Threshold(*sound, threshold)); - } - catch(Exception&) - { - return nullptr; - } -} - -AUD_API AUD_Sound* AUD_Sound_volume(AUD_Sound* sound, float volume) -{ - assert(sound); - - try - { - return new AUD_Sound(new Volume(*sound, volume)); - } - catch(Exception&) - { - return nullptr; - } -} - -AUD_API AUD_Sound* AUD_Sound_join(AUD_Sound* first, AUD_Sound* second) -{ - assert(first); - assert(second); - - try - { - return new AUD_Sound(new Double(*first, *second)); - } - catch(Exception&) - { - return nullptr; - } -} - -AUD_API AUD_Sound* AUD_Sound_mix(AUD_Sound* first, AUD_Sound* second) -{ - assert(first); - assert(second); - - try - { - return new AUD_Sound(new Superpose(*first, *second)); - } - catch(Exception&) - { - return nullptr; - } -} - -AUD_API AUD_Sound* AUD_Sound_pingpong(AUD_Sound* sound) -{ - assert(sound); - - try - { - return new AUD_Sound(new PingPong(*sound)); - } - catch(Exception&) - { - return nullptr; - } -} - -AUD_API void AUD_Sound_free(AUD_Sound* sound) -{ - assert(sound); - delete sound; -} - -AUD_API AUD_Sound* AUD_Sound_copy(AUD_Sound* sound) -{ - return new std::shared_ptr<ISound>(*sound); -} - -AUD_API AUD_Sound* AUD_Sound_list(int random) -{ - try - { - return new AUD_Sound(new SoundList(random)); - } - catch(Exception&) - { - return nullptr; - } -} - -AUD_API int AUD_SoundList_addSound(AUD_Sound* list, AUD_Sound* sound) -{ - assert(sound); - assert(list); - - std::shared_ptr<SoundList> s = std::dynamic_pointer_cast<SoundList>(*list); - if(s.get()) - { - s->addSound(*sound); - return 1; - } - else - return 0; - -} - -AUD_API AUD_Sound* AUD_Sound_mutable(AUD_Sound* sound) -{ - assert(sound); - - try - { - return new AUD_Sound(new MutableSound(*sound)); - } - catch(Exception&) - { - return nullptr; - } -} - -#ifdef WITH_CONVOLUTION - -AUD_API AUD_Sound* AUD_Sound_Convolver(AUD_Sound* sound, AUD_ImpulseResponse* filter, AUD_ThreadPool* threadPool) -{ - assert(sound); - assert(filter); - assert(threadPool); - - try - { - return new AUD_Sound(new ConvolverSound(*sound, *filter, *threadPool)); - } - catch(Exception&) - { - return nullptr; - } -} - -AUD_API AUD_Sound* AUD_Sound_Binaural(AUD_Sound* sound, AUD_HRTF* hrtfs, AUD_Source* source, AUD_ThreadPool* threadPool) -{ - assert(sound); - assert(hrtfs); - assert(source); - assert(threadPool); - - try - { - return new AUD_Sound(new BinauralSound(*sound, *hrtfs, *source, *threadPool)); - } - catch(Exception&) - { - return nullptr; - } -} - -#endif diff --git a/extern/audaspace/bindings/C/AUD_Sound.h b/extern/audaspace/bindings/C/AUD_Sound.h deleted file mode 100644 index b18e3c3a8eb..00000000000 --- a/extern/audaspace/bindings/C/AUD_Sound.h +++ /dev/null @@ -1,370 +0,0 @@ -/******************************************************************************* - * Copyright 2009-2016 Jörg Müller - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - ******************************************************************************/ - -#pragma once - -#include "AUD_Types.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Retrieves the sample specification of the sound. - * \param sound The sound to retrieve from. - * \return The sample specification of the sound. - * \note This function creates a reader from the sound and deletes it again. - */ -extern AUD_API AUD_Specs AUD_Sound_getSpecs(AUD_Sound* sound); - -/** - * Retrieves the approximate length of the sound. - * \param sound The sound to retrieve from. - * \return The length of the sound in samples. - * \note This function creates a reader from the sound and deletes it again. - */ -extern AUD_API int AUD_getLength(AUD_Sound* sound); - -/** - * Reads a sound's samples into memory. - * \param sound The sound to read. - * \param length Pointer to store the length of memory read. - * \param specs Pointer to store the data's sample specification. - * \return A pointer to the sample data. - * \warning The data has to be freed with AUD_Sound_freeData. - */ -extern AUD_API sample_t* AUD_Sound_data(AUD_Sound* sound, int* length, AUD_Specs* specs); - -/** - * Frees a buffer previously allocated with AUD_Sound_data. - * \param data The buffer to be freed. - */ -extern AUD_API void AUD_Sound_freeData(sample_t* data); - -/** - * Writes the sound to a file. - * \param sound The sound to write. - * \param filename The path to write to.. - * \param rate The sample rate to write with. - * \param channels The number of channels to write with. - * \param format The sample format to write with. - * \param container The container format for the file. - * \param codec The codec to use in the file. - * \param bitrate The bitrate to write with. - * \param buffersize The size of the writing buffer. - * \return A nullptr or an error message in case of error. - * \note Most parameters can be set to zero for default values. - */ -extern AUD_API const char* AUD_Sound_write(AUD_Sound* sound, const char* filename, AUD_SampleRate rate, AUD_Channels channels, AUD_SampleFormat format, AUD_Container container, AUD_Codec codec, int bitrate, int buffersize); - -/** - * Creates a sound from a data buffer. - * \param data The data as interleaved samples. - * \param length The data's length in samples. - * \param specs The data's sample specification. - * \return A handle of the sound. - * \note The data gets copied to an internal memory buffer. - * The pointer does not need to stay valid for the lifetime of the object. - */ -extern AUD_API AUD_Sound* AUD_Sound_buffer(sample_t* data, int length, AUD_Specs specs); - -/** - * Loads a sound file from a memory buffer. - * \param buffer The buffer which contains the sound file. - * \param size The size of the buffer. - * \return A handle of the sound file. - */ -extern AUD_API AUD_Sound* AUD_Sound_bufferFile(unsigned char* buffer, int size); - -/** - * Caches a sound into a memory buffer. - * \param sound The sound to cache. - * \return A handle of the cached sound. - */ -extern AUD_API AUD_Sound* AUD_Sound_cache(AUD_Sound* sound); - -/** - * Loads a sound file. - * \param filename The filename of the sound file. - * \return A handle of the sound file. - */ -extern AUD_API AUD_Sound* AUD_Sound_file(const char* filename); - -/** - * Creates a sawtooth sound. - * \param frequency The frequency of the generated sawtooth sound. - * \param rate The sample rate of the sawtooth sound. - * \return A handle of the sound. - */ -extern AUD_API AUD_Sound* AUD_Sound_sawtooth(float frequency, AUD_SampleRate rate); - -/** - * Creates a quiet sound. - * \return A handle of the sound. - */ -extern AUD_API AUD_Sound* AUD_Sound_silence(); - -/** - * Creates a sine sound. - * \param frequency The frequency of the generated sine sound. - * \param rate The sample rate of the sine sound. - * \return A handle of the sound. - */ -extern AUD_API AUD_Sound* AUD_Sound_sine(float frequency, AUD_SampleRate rate); - -/** - * Creates a square sound. - * \param frequency The frequency of the generated square sound. - * \param rate The sample rate of the square sound. - * \return A handle of the sound. - */ -extern AUD_API AUD_Sound* AUD_Sound_square(float frequency, AUD_SampleRate rate); - -/** - * Creates a triangle sound. - * \param frequency The frequency of the generated triangle sound. - * \param rate The sample rate of the triangle sound. - * \return A handle of the sound. - */ -extern AUD_API AUD_Sound* AUD_Sound_triangle(float frequency, AUD_SampleRate rate); - -/** - * Accumulates a sound by summing over positive input differences thus generating a monotonic sigal. - * If additivity is set to true negative input differences get added too, but positive ones with a factor of two. - * Note that with additivity the signal is not monotonic anymore. - * \param sound The sound to accumulate. - * \param additive Whether the accumulation should be additive or not. - * \return A handle of the accumulated sound. - */ -extern AUD_API AUD_Sound* AUD_Sound_accumulate(AUD_Sound* sound, int additive); - -/** - * Attack-Decay-Sustain-Release envelopes the volume of a sound. - * Note: there is currently no way to trigger the release with this API. - * \param sound The sound to filter. - * \param attack The attack time in seconds. - * \param decay The decay time in seconds. - * \param sustain The sustain level. - * \param release The release time in seconds. - * \return A handle of the filtered sound. - */ -extern AUD_API AUD_Sound* AUD_Sound_ADSR(AUD_Sound* sound, float attack, float decay, float sustain, float release); - -/** - * Delays a sound. - * \param sound The sound to dealy. - * \param delay The delay in seconds. - * \return A handle of the delayed sound. - */ -extern AUD_API AUD_Sound* AUD_Sound_delay(AUD_Sound* sound, float delay); - -/** - * Envelopes a sound. - * \param sound The sound to envelope. - * \param attack The attack factor. - * \param release The release factor. - * \param threshold The general threshold value. - * \param arthreshold The attack/release threshold value. - * \return A handle of the enveloped sound. - */ -extern AUD_API AUD_Sound* AUD_Sound_envelope(AUD_Sound* sound, float attack, float release, float threshold, float arthreshold); - -/** - * Fade in a sound. - * \param sound The sound to be fade in. - * \param start The time when the fading should start in seconds. - * \param length The duration of the fade in seconds. - * \return A handle of the faded sound. - */ -extern AUD_API AUD_Sound* AUD_Sound_fadein(AUD_Sound* sound, float start, float length); - -/** - * Fade out a sound. - * \param sound The sound to be fade out. - * \param start The time when the fading should start in seconds. - * \param length The duration of the fade in seconds. - * \return A handle of the faded sound. - */ -extern AUD_API AUD_Sound* AUD_Sound_fadeout(AUD_Sound* sound, float start, float length); - -/** - * Filter a sound. - * \param sound The sound to be filtered. - * \param b The nominator filter coefficients, may be NULL. - * \param b_length The length of the b array. - * \param a The denominator filter coefficients, may be NULL. - * \param a_length The length of the a array. - * \return A handle of the filtered sound. - */ -extern AUD_API AUD_Sound* AUD_Sound_filter(AUD_Sound* sound, float* b, int b_length, float* a, int a_length); - -/** - * Highpass filters a sound. - * \param sound The sound to filter. - * \param frequency The filter cut-off frequency. - * \param Q The filter quality. If usunsure which value to use, pass 1.0f. - * \return A handle of the filtered sound. - */ -extern AUD_API AUD_Sound* AUD_Sound_highpass(AUD_Sound* sound, float frequency, float Q); - -/** - * Limits a sound. - * \param sound The sound to limit. - * \param start The start time in seconds. - * \param end The stop time in seconds. - * \return A handle of the limited sound. - */ -extern AUD_API AUD_Sound* AUD_Sound_limit(AUD_Sound* sound, float start, float end); - -/** - * Loops a sound. - * \param sound The sound to loop. - * \param count How often the sound should be looped. Negative values mean endlessly. - * \return A handle of the looped sound. - */ -extern AUD_API AUD_Sound* AUD_Sound_loop(AUD_Sound* sound, int count); - -/** - * Lowpass filters a sound. - * \param sound The sound to filter. - * \param frequency The filter cut-off frequency. - * \param Q The filter quality. If usunsure which value to use, pass 1.0f. - * \return A handle of the filtered sound. - */ -extern AUD_API AUD_Sound* AUD_Sound_lowpass(AUD_Sound* sound, float frequency, float Q); - -/** - * Changes the pitch of a sound. - * \param sound The sound to change. - * \param factor The factor to change the pitch with. - * \return A handle of the pitched sound. - */ -extern AUD_API AUD_Sound* AUD_Sound_pitch(AUD_Sound* sound, float factor); - -/** - * Rechannels the sound. - * \param sound The sound to rechannel. - * \param channels The new channel configuration. - * \return The rechanneled sound. - */ -extern AUD_API AUD_Sound* AUD_Sound_rechannel(AUD_Sound* sound, AUD_Channels channels); - -/** - * Resamples the sound. - * \param sound The sound to resample. - * \param rate The new sample rate. - * \param high_quality When true use a higher quality but slower resampler. - * \return The resampled sound. - */ -extern AUD_API AUD_Sound* AUD_Sound_resample(AUD_Sound* sound, AUD_SampleRate rate, bool high_quality); - -/** - * Reverses a sound. Make sure the sound source can be reversed. - * \param sound The sound to reverse. - * \return A handle of the reversed sound. - */ -extern AUD_API AUD_Sound* AUD_Sound_reverse(AUD_Sound* sound); - -/** - * Sums the samples of a sound. - * \param sound The sound to sum. - * \return A handle of the summed sound. - */ -extern AUD_API AUD_Sound* AUD_Sound_sum(AUD_Sound* sound); - -/** - * Turns a sound into a square wave by thresholding. - * \param sound The sound to threshold. - * \param threshold Threshold value over which an amplitude counts non-zero. - * \return A handle of the thresholded sound. - */ -extern AUD_API AUD_Sound* AUD_Sound_threshold(AUD_Sound* sound, float threshold); - -/** - * Changes the volume of a sound. - * \param sound The sound to change. - * \param volume The new volume of the sound. Should be in the range 0 to 1. Use higher values with caution. - * \return A handle of the amplified sound. - */ -extern AUD_API AUD_Sound* AUD_Sound_volume(AUD_Sound* sound, float volume); - -/** - * Joins two sound, which means playing them one after the other. - * \param first The first sound. - * \param second The second sound. - * \return A handle of the joined sound. - */ -extern AUD_API AUD_Sound* AUD_Sound_join(AUD_Sound* first, AUD_Sound* second); - -/** - * Mixes two sound, which means superposing the sound samples. - * \param first The first sound. - * \param second The second sound. - * \return A handle of the mixed sound. - */ -extern AUD_API AUD_Sound* AUD_Sound_mix(AUD_Sound* first, AUD_Sound* second); - -/** - * Ping pongs a sound. - * \param sound The sound to ping pong. - * \return A handle of the ping pong sound. - */ -extern AUD_API AUD_Sound* AUD_Sound_pingpong(AUD_Sound* sound); - -/** - * Unloads a sound of any type. - * \param sound The handle of the sound. - */ -extern AUD_API void AUD_Sound_free(AUD_Sound* sound); - -/** - * Copies a sound. - * \param sound Sound to copy. - * \return Copied sound. - */ -extern AUD_API AUD_Sound* AUD_Sound_copy(AUD_Sound* sound); - -/** - * Creates an empty sound list that can contain several sounds. - * \param random A flag that indicates how the list will be played: Randomly or sequentially. - * if 0 the playback will be sequential, if not 0 the playback will be random. - * \return A handle of the sound list. - */ -extern AUD_API AUD_Sound* AUD_Sound_list(int random); - -/** -* Adds a new sound to a sound list. - * \param list The sound list in which the sound will be added. - * \param sound The sound that will be added to the list. - * \return 0 if the sound couldn't be added (the list parameter isn't a sound list). -*/ -extern AUD_API int AUD_SoundList_addSound(AUD_Sound* list, AUD_Sound* sound); - -/** - * Creates a sound that will be restarted when sought backwards. If the original sound is a sound list, the playing sound can change. - * \param sound The handle of the sound. - * \return A handle of the mutable sound. -*/ -extern AUD_API AUD_Sound* AUD_Sound_mutable(AUD_Sound* sound); - -#ifdef WITH_CONVOLUTION - extern AUD_API AUD_Sound* AUD_Sound_Convolver(AUD_Sound* sound, AUD_ImpulseResponse* filter, AUD_ThreadPool* threadPool); - extern AUD_API AUD_Sound* AUD_Sound_Binaural(AUD_Sound* sound, AUD_HRTF* hrtfs, AUD_Source* source, AUD_ThreadPool* threadPool); -#endif - -#ifdef __cplusplus -} -#endif diff --git a/extern/audaspace/bindings/C/AUD_Source.cpp b/extern/audaspace/bindings/C/AUD_Source.cpp deleted file mode 100644 index c4bf6fea6a1..00000000000 --- a/extern/audaspace/bindings/C/AUD_Source.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/******************************************************************************* -* Copyright 2009-2015 Juan Francisco Crespo Galán -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -******************************************************************************/ - -#include "Exception.h" - -#include <cassert> - -using namespace aud; - -#define AUD_CAPI_IMPLEMENTATION -#include "AUD_Source.h" - -extern AUD_API AUD_Source* AUD_Source_create(float azimuth, float elevation, float distance) -{ - try - { - return new AUD_Source(new Source(azimuth, elevation, distance)); - } - catch(Exception&) - { - return nullptr; - } -} - -extern AUD_API void AUD_Source_free(AUD_Source* source) -{ - assert(source); - delete source; -} - -extern AUD_API float AUD_Source_getAzimuth(AUD_Source* source) -{ - assert(source); - - return (*source)->getAzimuth(); -} - -extern AUD_API float AUD_Source_getElevation(AUD_Source* source) -{ - assert(source); - - return (*source)->getElevation(); -} - -extern AUD_API float AUD_Source_getDistance(AUD_Source* source) -{ - assert(source); - - return (*source)->getDistance(); -} - -extern AUD_API void AUD_Source_setAzimuth(AUD_Source* source, float azimuth) -{ - assert(source); - - (*source)->setAzimuth(azimuth); -} - -extern AUD_API void AUD_Source_setElevation(AUD_Source* source, float elevation) -{ - assert(source); - - (*source)->setElevation(elevation); -} - -extern AUD_API void AUD_Source_setDistance(AUD_Source* source, float distance) -{ - assert(source); - - (*source)->setDistance(distance); -}
\ No newline at end of file diff --git a/extern/audaspace/bindings/C/AUD_Source.h b/extern/audaspace/bindings/C/AUD_Source.h deleted file mode 100644 index 6ff045ec848..00000000000 --- a/extern/audaspace/bindings/C/AUD_Source.h +++ /dev/null @@ -1,84 +0,0 @@ -/******************************************************************************* -* Copyright 2009-2015 Juan Francisco Crespo Galán -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -******************************************************************************/ - -#pragma once - -#include "AUD_Types.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Creates a new Source object. -* \param azimuth The azimuth angle. -* \param elevation The elevation angle. -* \param elevation The distance value. [0,1] -* \return The new Source object. -*/ -extern AUD_API AUD_Source* AUD_Source_create(float azimuth, float elevation, float distance); - -/** -* Deletes a Source object. -* \param source The Source object to be deleted. -*/ -extern AUD_API void AUD_Source_free(AUD_Source* source); - -/** -* Retrieves the azimuth angle of a Source object. -* \param source The Source object. -* \return The azimuth angle. -*/ -extern AUD_API float AUD_Source_getAzimuth(AUD_Source* source); - -/** -* Retrieves the elevation angle oa a Source object. -* \param source The Source object. -* \return The elevation angle. -*/ -extern AUD_API float AUD_Source_getElevation(AUD_Source* source); - -/** -* Retrieves the distance of a Source object. [0,1] -* \param source The Source object. -* \return The distance. -*/ -extern AUD_API float AUD_Source_getDistance(AUD_Source* distance); - -/** -* Changes the azimuth angle of a Source object. -* \param source The Source object. -* \param azimuth The azimuth angle. -*/ -extern AUD_API void AUD_Source_setAzimuth(AUD_Source* source, float azimuth); - -/** -* Changes the elevation angle of a Source object. -* \param source The Source object. -* \param elevation The elevation angle. -*/ -extern AUD_API void AUD_Source_setElevation(AUD_Source* source, float elevation); - -/** -* Changes the distance of a Source object. [0,1] -* \param source The Source object. -* \param distance The distance. -*/ -extern AUD_API void AUD_Source_setDistance(AUD_Source* source, float distance); - -#ifdef __cplusplus -} -#endif diff --git a/extern/audaspace/bindings/C/AUD_Special.cpp b/extern/audaspace/bindings/C/AUD_Special.cpp deleted file mode 100644 index f8f46651231..00000000000 --- a/extern/audaspace/bindings/C/AUD_Special.cpp +++ /dev/null @@ -1,420 +0,0 @@ -/******************************************************************************* - * Copyright 2009-2016 Jörg Müller - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - ******************************************************************************/ - -#include "Exception.h" -#include "IReader.h" -#include "file/File.h" -#include "respec/ChannelMapper.h" -#include "fx/Lowpass.h" -#include "fx/Highpass.h" -#include "fx/Envelope.h" -#include "respec/LinearResample.h" -#include "fx/Threshold.h" -#include "fx/Accumulator.h" -#include "fx/Sum.h" -#include "generator/Silence.h" -#include "fx/Limiter.h" -#include "devices/DeviceManager.h" -#include "sequence/Sequence.h" -#include "file/FileWriter.h" -#include "devices/ReadDevice.h" -#include "plugin/PluginManager.h" -#include "devices/DeviceManager.h" -#include "devices/IDeviceFactory.h" -#include "devices/NULLDevice.h" - -#include <cassert> -#include <cstring> -#include <cmath> -#include <sstream> - -using namespace aud; - -#define AUD_CAPI_IMPLEMENTATION -#include "AUD_Special.h" - -static inline AUD_Specs convSpecToC(aud::Specs specs) -{ - AUD_Specs s; - s.channels = static_cast<AUD_Channels>(specs.channels); - s.rate = static_cast<AUD_SampleRate>(specs.rate); - return s; -} - -static inline aud::Specs convCToSpec(AUD_Specs specs) -{ - aud::Specs s; - s.channels = static_cast<Channels>(specs.channels); - s.rate = static_cast<SampleRate>(specs.rate); - return s; -} - -static inline AUD_DeviceSpecs convDSpecToC(aud::DeviceSpecs specs) -{ - AUD_DeviceSpecs s; - s.specs = convSpecToC(specs.specs); - s.format = static_cast<AUD_SampleFormat>(specs.format); - return s; -} - -static inline aud::DeviceSpecs convCToDSpec(AUD_DeviceSpecs specs) -{ - aud::DeviceSpecs s; - s.specs = convCToSpec(specs.specs); - s.format = static_cast<SampleFormat>(specs.format); - return s; -} - -AUD_API AUD_SoundInfo AUD_getInfo(AUD_Sound* sound) -{ - assert(sound); - - AUD_SoundInfo info; - info.specs.channels = AUD_CHANNELS_INVALID; - info.specs.rate = AUD_RATE_INVALID; - info.length = 0.0f; - - try - { - std::shared_ptr<IReader> reader = (*sound)->createReader(); - - if(reader.get()) - { - info.specs = convSpecToC(reader->getSpecs()); - info.length = reader->getLength() / (float) info.specs.rate; - } - } - catch(Exception&) - { - } - - return info; -} - -AUD_API float* AUD_readSoundBuffer(const char* filename, float low, float high, - float attack, float release, float threshold, - int accumulate, int additive, int square, - float sthreshold, double samplerate, int* length) -{ - Buffer buffer; - DeviceSpecs specs; - specs.channels = CHANNELS_MONO; - specs.rate = (SampleRate)samplerate; - std::shared_ptr<ISound> sound; - - std::shared_ptr<ISound> file = std::shared_ptr<ISound>(new File(filename)); - - int position = 0; - - try - { - std::shared_ptr<IReader> reader = file->createReader(); - - SampleRate rate = reader->getSpecs().rate; - - sound = std::shared_ptr<ISound>(new ChannelMapper(file, specs)); - - if(high < rate) - sound = std::shared_ptr<ISound>(new Lowpass(sound, high)); - if(low > 0) - sound = std::shared_ptr<ISound>(new Highpass(sound, low)); - - sound = std::shared_ptr<ISound>(new Envelope(sound, attack, release, threshold, 0.1f)); - sound = std::shared_ptr<ISound>(new LinearResample(sound, specs)); - - if(square) - sound = std::shared_ptr<ISound>(new Threshold(sound, sthreshold)); - - if(accumulate) - sound = std::shared_ptr<ISound>(new Accumulator(sound, additive)); - else if(additive) - sound = std::shared_ptr<ISound>(new Sum(sound)); - - reader = sound->createReader(); - - if(!reader.get()) - return nullptr; - - int len; - bool eos; - do - { - len = samplerate; - buffer.resize((position + len) * sizeof(float), true); - reader->read(len, eos, buffer.getBuffer() + position); - position += len; - } while(!eos); - } - catch(Exception&) - { - return nullptr; - } - - float * result = (float *)malloc(position * sizeof(float)); - std::memcpy(result, buffer.getBuffer(), position * sizeof(float)); - *length = position; - return result; -} - -static void pauseSound(AUD_Handle* handle) -{ - assert(handle); - (*handle)->pause(); -} - -AUD_API AUD_Handle* AUD_pauseAfter(AUD_Handle* handle, float seconds) -{ - std::shared_ptr<ISound> silence = std::shared_ptr<ISound>(new Silence); - std::shared_ptr<ISound> limiter = std::shared_ptr<ISound>(new Limiter(silence, 0, seconds)); - - auto device = DeviceManager::getDevice(); - - std::lock_guard<ILockable> lock(*device); - - try - { - AUD_Handle handle2 = device->play(limiter); - if(handle2.get()) - { - handle2->setStopCallback((stopCallback)pauseSound, handle); - return new AUD_Handle(handle2); - } - } - catch(Exception&) - { - } - - return nullptr; -} - -AUD_API int AUD_readSound(AUD_Sound* sound, float* buffer, int length, int samples_per_second, short* interrupt) -{ - DeviceSpecs specs; - float* buf; - Buffer aBuffer; - - specs.rate = RATE_INVALID; - specs.channels = CHANNELS_MONO; - specs.format = FORMAT_INVALID; - - std::shared_ptr<IReader> reader = ChannelMapper(*sound, specs).createReader(); - - specs.specs = reader->getSpecs(); - int len; - float samplejump = specs.rate / samples_per_second; - float min, max, power, overallmax; - bool eos; - - overallmax = 0; - - for(int i = 0; i < length; i++) - { - len = floor(samplejump * (i+1)) - floor(samplejump * i); - - if(*interrupt) - return 0; - - aBuffer.assureSize(len * AUD_SAMPLE_SIZE(specs)); - buf = aBuffer.getBuffer(); - - reader->read(len, eos, buf); - - max = min = *buf; - power = *buf * *buf; - for(int j = 1; j < len; j++) - { - if(buf[j] < min) - min = buf[j]; - if(buf[j] > max) - max = buf[j]; - power += buf[j] * buf[j]; - } - - buffer[i * 3] = min; - buffer[i * 3 + 1] = max; - buffer[i * 3 + 2] = sqrt(power) / len; - - if(overallmax < max) - overallmax = max; - if(overallmax < -min) - overallmax = -min; - - if(eos) - { - length = i; - break; - } - } - - if(overallmax > 1.0f) - { - for(int i = 0; i < length * 3; i++) - { - buffer[i] /= overallmax; - } - } - - return length; -} - -AUD_API const char* AUD_mixdown(AUD_Sound* sound, unsigned int start, unsigned int length, unsigned int buffersize, const char* filename, AUD_DeviceSpecs specs, AUD_Container format, AUD_Codec codec, unsigned int bitrate) -{ - try - { - Sequence* f = dynamic_cast<Sequence *>(sound->get()); - - f->setSpecs(convCToSpec(specs.specs)); - std::shared_ptr<IReader> reader = f->createQualityReader(); - reader->seek(start); - std::shared_ptr<IWriter> writer = FileWriter::createWriter(filename, convCToDSpec(specs), static_cast<Container>(format), static_cast<Codec>(codec), bitrate); - FileWriter::writeReader(reader, writer, length, buffersize); - - return nullptr; - } - catch(Exception& e) - { - return e.getMessage().c_str(); - } -} - -AUD_API const char* AUD_mixdown_per_channel(AUD_Sound* sound, unsigned int start, unsigned int length, unsigned int buffersize, const char* filename, AUD_DeviceSpecs specs, AUD_Container format, AUD_Codec codec, unsigned int bitrate) -{ - try - { - Sequence* f = dynamic_cast<Sequence *>(sound->get()); - - f->setSpecs(convCToSpec(specs.specs)); - - std::vector<std::shared_ptr<IWriter> > writers; - - int channels = specs.channels; - specs.channels = AUD_CHANNELS_MONO; - - for(int i = 0; i < channels; i++) - { - std::stringstream stream; - std::string fn = filename; - size_t index = fn.find_last_of('.'); - size_t index_slash = fn.find_last_of('/'); - size_t index_backslash = fn.find_last_of('\\'); - - if((index == std::string::npos) || - ((index < index_slash) && (index_slash != std::string::npos)) || - ((index < index_backslash) && (index_backslash != std::string::npos))) - { - stream << filename << "_" << (i + 1); - } - else - { - stream << fn.substr(0, index) << "_" << (i + 1) << fn.substr(index); - } - writers.push_back(FileWriter::createWriter(stream.str(), convCToDSpec(specs), static_cast<Container>(format), static_cast<Codec>(codec), bitrate)); - } - - std::shared_ptr<IReader> reader = f->createQualityReader(); - reader->seek(start); - FileWriter::writeReader(reader, writers, length, buffersize); - - return nullptr; - } - catch(Exception& e) - { - return e.getMessage().c_str(); - } -} - -AUD_API AUD_Device* AUD_openMixdownDevice(AUD_DeviceSpecs specs, AUD_Sound* sequencer, float volume, float start) -{ - try - { - ReadDevice* device = new ReadDevice(convCToDSpec(specs)); - device->setQuality(true); - device->setVolume(volume); - - Sequence* f = dynamic_cast<Sequence*>(sequencer->get()); - - f->setSpecs(convCToSpec(specs.specs)); - - AUD_Handle handle = device->play(f->createQualityReader()); - if(handle.get()) - { - handle->seek(start); - } - - return new AUD_Device(device); - } - catch(Exception&) - { - return nullptr; - } -} - -AUD_API void AUD_initOnce() -{ - PluginManager::loadPlugins(); - NULLDevice::registerPlugin(); -} - -AUD_API void AUD_exitOnce() -{ -} - -AUD_API AUD_Device* AUD_init(const char* device, AUD_DeviceSpecs specs, int buffersize, const char* name) -{ - try - { - std::shared_ptr<IDeviceFactory> factory = DeviceManager::getDeviceFactory(device); - - if(factory) - { - factory->setName(name); - factory->setBufferSize(buffersize); - factory->setSpecs(convCToDSpec(specs)); - auto device = factory->openDevice(); - DeviceManager::setDevice(device); - - return new AUD_Device(device); - } - } - catch(Exception&) - { - } - return nullptr; -} - -AUD_API void AUD_exit(AUD_Device* device) -{ - delete device; - DeviceManager::releaseDevice(); -} - - -AUD_API char** AUD_getDeviceNames() -{ - std::vector<std::string> v_names = DeviceManager::getAvailableDeviceNames(); - char** names = (char**) malloc(sizeof(char*) * (v_names.size() + 1)); - - for(int i = 0; i < v_names.size(); i++) - { - std::string name = v_names[i]; - names[i] = (char*) malloc(sizeof(char) * (name.length() + 1)); - strcpy(names[i], name.c_str()); - } - - names[v_names.size()] = nullptr; - - return names; -} diff --git a/extern/audaspace/bindings/C/AUD_Special.h b/extern/audaspace/bindings/C/AUD_Special.h deleted file mode 100644 index ab79ae915a2..00000000000 --- a/extern/audaspace/bindings/C/AUD_Special.h +++ /dev/null @@ -1,138 +0,0 @@ -/******************************************************************************* - * Copyright 2009-2016 Jörg Müller - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - ******************************************************************************/ - -#pragma once - -#include "AUD_Types.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Returns information about a sound. - * \param sound The sound to get the info about. - * \return The AUD_SoundInfo structure with filled in data. - */ -extern AUD_API AUD_SoundInfo AUD_getInfo(AUD_Sound* sound); - -/** - * Reads a sound file into a newly created float buffer. - * The sound is therefore bandpassed, rectified and resampled. - */ -extern AUD_API float* AUD_readSoundBuffer(const char* filename, float low, float high, - float attack, float release, float threshold, - int accumulate, int additive, int square, - float sthreshold, double samplerate, - int* length); - -/** - * Pauses a playing sound after a specific amount of time. - * \param handle The handle to the sound. - * \param seconds The time in seconds. - * \return The silence handle. - */ -extern AUD_API AUD_Handle* AUD_pauseAfter(AUD_Handle* handle, float seconds); - -/** - * Reads a sound into a buffer for drawing at a specific sampling rate. - * \param sound The sound to read. - * \param buffer The buffer to write to. Must have a size of 3*4*length. - * \param length How many samples to read from the sound. - * \param samples_per_second How many samples to read per second of the sound. - * \return How many samples really have been read. Always <= length. - */ -extern AUD_API int AUD_readSound(AUD_Sound* sound, float* buffer, int length, int samples_per_second, short* interrupt); - -/** - * Mixes a sound down into a file. - * \param sound The sound scene to mix down. - * \param start The start frame. - * \param length The count of frames to write. - * \param buffersize How many samples should be written at once. - * \param filename The file to write to. - * \param specs The file's audio specification. - * \param format The file's container format. - * \param codec The codec used for encoding the audio data. - * \param bitrate The bitrate for encoding. - * \return An error message or NULL in case of success. - */ -extern AUD_API const char* AUD_mixdown(AUD_Sound* sound, unsigned int start, unsigned int length, - unsigned int buffersize, const char* filename, - AUD_DeviceSpecs specs, AUD_Container format, - AUD_Codec codec, unsigned int bitrate); - -/** - * Mixes a sound down into multiple files. - * \param sound The sound scene to mix down. - * \param start The start frame. - * \param length The count of frames to write. - * \param buffersize How many samples should be written at once. - * \param filename The file to write to, the channel number and an underscore are added at the beginning. - * \param specs The file's audio specification. - * \param format The file's container format. - * \param codec The codec used for encoding the audio data. - * \param bitrate The bitrate for encoding. - * \return An error message or NULL in case of success. - */ -extern AUD_API const char* AUD_mixdown_per_channel(AUD_Sound* sound, unsigned int start, unsigned int length, - unsigned int buffersize, const char* filename, - AUD_DeviceSpecs specs, AUD_Container format, - AUD_Codec codec, unsigned int bitrate); - -/** - * Opens a read device and prepares it for mixdown of the sound scene. - * \param specs Output audio specifications. - * \param sequencer The sound scene to mix down. - * \param volume The overall mixdown volume. - * \param start The start time of the mixdown in the sound scene. - * \return The read device for the mixdown. - */ -extern AUD_API AUD_Device* AUD_openMixdownDevice(AUD_DeviceSpecs specs, AUD_Sound* sequencer, float volume, float start); - -/** - * Initializes audio routines (FFMPEG/JACK if it is enabled). - */ -extern AUD_API void AUD_initOnce(); - -/** - * Unitinitializes an audio routines. - */ -extern AUD_API void AUD_exitOnce(); - -/** - * Initializes an audio device. - * \param device The device type that should be used. - * \param specs The audio specification to be used. - * \param buffersize The buffersize for the device. - * \return Whether the device has been initialized. - */ -extern AUD_API AUD_Device* AUD_init(const char* device, AUD_DeviceSpecs specs, int buffersize, const char* name); - -/** - * Unitinitializes an audio device. - * \param device The device to free. - */ -extern AUD_API void AUD_exit(AUD_Device* device); - -/** - * Retrieves available devices. Note that all memory returned has to be freed! - */ -extern AUD_API char** AUD_getDeviceNames(); - -#ifdef __cplusplus -} -#endif diff --git a/extern/audaspace/bindings/C/AUD_ThreadPool.cpp b/extern/audaspace/bindings/C/AUD_ThreadPool.cpp deleted file mode 100644 index f22a904838b..00000000000 --- a/extern/audaspace/bindings/C/AUD_ThreadPool.cpp +++ /dev/null @@ -1,42 +0,0 @@ -/******************************************************************************* -* Copyright 2009-2015 Juan Francisco Crespo Galán -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -******************************************************************************/ - -#include "Exception.h" - -#include <cassert> - -using namespace aud; - -#define AUD_CAPI_IMPLEMENTATION -#include "AUD_ThreadPool.h" - -AUD_API AUD_ThreadPool* AUD_ThreadPool_create(int nThreads) -{ - try - { - return new AUD_ThreadPool(new ThreadPool(nThreads)); - } - catch(Exception&) - { - return nullptr; - } -} - -AUD_API void AUD_ThreadPool_free(AUD_ThreadPool* pool) -{ - assert(pool); - delete pool; -}
\ No newline at end of file diff --git a/extern/audaspace/bindings/C/AUD_ThreadPool.h b/extern/audaspace/bindings/C/AUD_ThreadPool.h deleted file mode 100644 index c1b2204a80a..00000000000 --- a/extern/audaspace/bindings/C/AUD_ThreadPool.h +++ /dev/null @@ -1,40 +0,0 @@ -/******************************************************************************* -* Copyright 2009-2015 Juan Francisco Crespo Galán -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -******************************************************************************/ - -#pragma once - -#include "AUD_Types.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Creates a new ThreadPool object. -* \param nThreads The number of threads of the pool. -* \return The new ThreadPool object. -*/ -extern AUD_API AUD_ThreadPool* AUD_ThreadPool_create(int nThreads); - -/** -* Deletes a ThreadPool object. -* \param threadPool The ThreadPool object to be deleted. -*/ -extern AUD_API void AUD_ThreadPool_free(AUD_ThreadPool* threadPool); - -#ifdef __cplusplus -} -#endif
\ No newline at end of file diff --git a/extern/audaspace/bindings/C/AUD_Types.h b/extern/audaspace/bindings/C/AUD_Types.h deleted file mode 100644 index 75e4ffae18c..00000000000 --- a/extern/audaspace/bindings/C/AUD_Types.h +++ /dev/null @@ -1,179 +0,0 @@ -/******************************************************************************* - * Copyright 2009-2016 Jörg Müller - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - ******************************************************************************/ - -#pragma once - -#include "Audaspace.h" - -#ifdef __cplusplus -using namespace aud; -#endif - -#ifdef AUD_CAPI_IMPLEMENTATION -#include "ISound.h" -#include "devices/IHandle.h" -#include "devices/IDevice.h" -#include "sequence/SequenceEntry.h" -#include "fx/PlaybackManager.h" -#include "fx/DynamicMusic.h" -#include "fx/Source.h" -#include "util/ThreadPool.h" -#ifdef WITH_CONVOLUTION -#include "fx/ImpulseResponse.h" -#include "fx/HRTF.h" -#endif - -typedef std::shared_ptr<aud::ISound> AUD_Sound; -typedef std::shared_ptr<aud::IHandle> AUD_Handle; -typedef std::shared_ptr<aud::IDevice> AUD_Device; -typedef std::shared_ptr<aud::SequenceEntry> AUD_SequenceEntry; -typedef std::shared_ptr<aud::PlaybackManager> AUD_PlaybackManager; -typedef std::shared_ptr<aud::DynamicMusic> AUD_DynamicMusic; -typedef std::shared_ptr<aud::ThreadPool> AUD_ThreadPool; -typedef std::shared_ptr<aud::Source> AUD_Source; -#ifdef WITH_CONVOLUTION -typedef std::shared_ptr<aud::ImpulseResponse> AUD_ImpulseResponse; -typedef std::shared_ptr<aud::HRTF> AUD_HRTF; -#endif -#else -typedef void AUD_Sound; -typedef void AUD_Handle; -typedef void AUD_Device; -typedef void AUD_SequenceEntry; -typedef void AUD_PlaybackManager; -typedef void AUD_DynamicMusic; -typedef void AUD_ThreadPool; -typedef void AUD_Source; -#ifdef WITH_CONVOLUTION -typedef void AUD_ImpulseResponse; -typedef void AUD_HRTF; -#endif -#endif - -/// Container formats for writers. -typedef enum -{ - AUD_CONTAINER_INVALID = 0, - AUD_CONTAINER_AC3, - AUD_CONTAINER_FLAC, - AUD_CONTAINER_MATROSKA, - AUD_CONTAINER_MP2, - AUD_CONTAINER_MP3, - AUD_CONTAINER_OGG, - AUD_CONTAINER_WAV -} AUD_Container; - -/// Audio codecs for writers. -typedef enum -{ - AUD_CODEC_INVALID = 0, - AUD_CODEC_AAC, - AUD_CODEC_AC3, - AUD_CODEC_FLAC, - AUD_CODEC_MP2, - AUD_CODEC_MP3, - AUD_CODEC_PCM, - AUD_CODEC_VORBIS, - AUD_CODEC_OPUS -} AUD_Codec; - -/** - * The format of a sample. - * The last 4 bit save the byte count of the format. - */ -typedef enum -{ - AUD_FORMAT_INVALID = 0x00, /// Invalid sample format. - AUD_FORMAT_U8 = 0x01, /// 1 byte unsigned byte. - AUD_FORMAT_S16 = 0x12, /// 2 byte signed integer. - AUD_FORMAT_S24 = 0x13, /// 3 byte signed integer. - AUD_FORMAT_S32 = 0x14, /// 4 byte signed integer. - AUD_FORMAT_FLOAT32 = 0x24, /// 4 byte float. - AUD_FORMAT_FLOAT64 = 0x28 /// 8 byte float. -} AUD_SampleFormat; - -/// The channel count. -typedef enum -{ - AUD_CHANNELS_INVALID = 0, /// Invalid channel count. - AUD_CHANNELS_MONO = 1, /// Mono. - AUD_CHANNELS_STEREO = 2, /// Stereo. - AUD_CHANNELS_STEREO_LFE = 3, /// Stereo with LFE channel. - AUD_CHANNELS_SURROUND4 = 4, /// 4 channel surround sound. - AUD_CHANNELS_SURROUND5 = 5, /// 5 channel surround sound. - AUD_CHANNELS_SURROUND51 = 6, /// 5.1 surround sound. - AUD_CHANNELS_SURROUND61 = 7, /// 6.1 surround sound. - AUD_CHANNELS_SURROUND71 = 8 /// 7.1 surround sound. -} AUD_Channels; - -/** - * The sample rate tells how many samples are played back within one second. - * Some exotic formats may use other sample rates than provided here. - */ -typedef enum -{ - AUD_RATE_INVALID = 0, /// Invalid sample rate. - AUD_RATE_8000 = 8000, /// 8000 Hz. - AUD_RATE_16000 = 16000, /// 16000 Hz. - AUD_RATE_11025 = 11025, /// 11025 Hz. - AUD_RATE_22050 = 22050, /// 22050 Hz. - AUD_RATE_32000 = 32000, /// 32000 Hz. - AUD_RATE_44100 = 44100, /// 44100 Hz. - AUD_RATE_48000 = 48000, /// 48000 Hz. - AUD_RATE_88200 = 88200, /// 88200 Hz. - AUD_RATE_96000 = 96000, /// 96000 Hz. - AUD_RATE_192000 = 192000 /// 192000 Hz. -} AUD_DefaultSampleRate; - -/// Sample rate type. -typedef double AUD_SampleRate; - -/// Specification of a sound source. -typedef struct -{ - /// Sample rate in Hz. - AUD_SampleRate rate; - - /// Channel count. - AUD_Channels channels; -} AUD_Specs; - -/// Specification of a sound device. -typedef struct -{ - /// Sample format. - AUD_SampleFormat format; - - union - { - struct - { - /// Sample rate in Hz. - AUD_SampleRate rate; - - /// Channel count. - AUD_Channels channels; - }; - AUD_Specs specs; - }; -} AUD_DeviceSpecs; - -/// Sound information structure. -typedef struct -{ - AUD_Specs specs; - float length; -} AUD_SoundInfo; |