diff options
Diffstat (limited to 'extern/audaspace/include/devices')
-rw-r--r-- | extern/audaspace/include/devices/DefaultSynchronizer.h | 44 | ||||
-rw-r--r-- | extern/audaspace/include/devices/DeviceManager.h | 129 | ||||
-rw-r--r-- | extern/audaspace/include/devices/I3DDevice.h | 142 | ||||
-rw-r--r-- | extern/audaspace/include/devices/I3DHandle.h | 232 | ||||
-rw-r--r-- | extern/audaspace/include/devices/IDevice.h | 123 | ||||
-rw-r--r-- | extern/audaspace/include/devices/IDeviceFactory.h | 72 | ||||
-rw-r--r-- | extern/audaspace/include/devices/IHandle.h | 189 | ||||
-rw-r--r-- | extern/audaspace/include/devices/ISynchronizer.h | 92 | ||||
-rw-r--r-- | extern/audaspace/include/devices/NULLDevice.h | 96 | ||||
-rw-r--r-- | extern/audaspace/include/devices/ReadDevice.h | 82 | ||||
-rw-r--r-- | extern/audaspace/include/devices/SoftwareDevice.h | 368 |
11 files changed, 0 insertions, 1569 deletions
diff --git a/extern/audaspace/include/devices/DefaultSynchronizer.h b/extern/audaspace/include/devices/DefaultSynchronizer.h deleted file mode 100644 index 31f6c65219c..00000000000 --- a/extern/audaspace/include/devices/DefaultSynchronizer.h +++ /dev/null @@ -1,44 +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 - -/** - * @file DefaultSynchronizer.h - * @ingroup devices - * The DefaultSynchronizer class. - */ - -#include "ISynchronizer.h" - -AUD_NAMESPACE_BEGIN - -/** - * This class is a default ISynchronizer implementation that actually does no - * synchronization and is intended for devices that don't support it. - */ -class AUD_API DefaultSynchronizer : public ISynchronizer -{ -public: - virtual void seek(std::shared_ptr<IHandle> handle, float time); - virtual float getPosition(std::shared_ptr<IHandle> handle); - virtual void play(); - virtual void stop(); - virtual void setSyncCallback(syncFunction function, void* data); - virtual int isPlaying(); -}; - -AUD_NAMESPACE_END diff --git a/extern/audaspace/include/devices/DeviceManager.h b/extern/audaspace/include/devices/DeviceManager.h deleted file mode 100644 index 27a546630e8..00000000000 --- a/extern/audaspace/include/devices/DeviceManager.h +++ /dev/null @@ -1,129 +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 - -/** - * @file DeviceManager.h - * @ingroup devices - * The DeviceManager class. - */ - -#include "Audaspace.h" - -#include <memory> -#include <vector> -#include <unordered_map> - -AUD_NAMESPACE_BEGIN - -class IDevice; -class IDeviceFactory; -class I3DDevice; - -/** - * This class manages all device plugins and maintains a device if asked to do so. - * - * This enables applications to access their output device without having to carry - * it through the whole application. - */ -class AUD_API DeviceManager -{ -private: - static std::unordered_map<std::string, std::shared_ptr<IDeviceFactory>> m_factories; - - static std::shared_ptr<IDevice> m_device; - - // delete copy constructor and operator= - DeviceManager(const DeviceManager&) = delete; - DeviceManager& operator=(const DeviceManager&) = delete; - DeviceManager() = delete; - -public: - /** - * Registers a device factory. - * - * This method is mostly used by plugin developers to add their device implementation - * for general use by the library end users. - * @param name A representative name for the device. - * @param factory The factory that creates the device. - */ - static void registerDevice(std::string name, std::shared_ptr<IDeviceFactory> factory); - - /** - * Returns the factory for a specific device. - * @param name The representative name of the device. - * @return The factory if it was found, or nullptr otherwise. - */ - static std::shared_ptr<IDeviceFactory> getDeviceFactory(std::string name); - - /** - * Returns the default device based on the priorities of the registered factories. - * @return The default device or nullptr if no factory has been registered. - */ - static std::shared_ptr<IDeviceFactory> getDefaultDeviceFactory(); - - - /** - * Sets a device that should be handled by the manager. - * - * If a device is currently being handled it will be released. - * @param device The device the manager should take care of. - */ - static void setDevice(std::shared_ptr<IDevice> device); - - /** - * Opens a device which will then be handled by the manager. - * - * If a device is currently being handled it will be released. - * @param name The representative name of the device. - */ - static void openDevice(std::string name); - - /** - * Opens the default device which will then be handled by the manager. - * - * The device to open is selected based on the priority of the registered factories. - * If a device is currently being handled it will be released. - */ - static void openDefaultDevice(); - - /** - * Releases the currently handled device. - */ - static void releaseDevice(); - - /** - * Returns the currently handled device. - * @return The handled device or nullptr if no device has been registered. - */ - static std::shared_ptr<IDevice> getDevice(); - - /** - * Returns the currently handled 3D device. - * @return The handled device or nullptr if no device has been registered - * or the registered device is not an I3DDevice. - */ - static std::shared_ptr<I3DDevice> get3DDevice(); - - /** - * Returns a list of available devices. - * @return A list of strings with the names of available devices. - */ - static std::vector<std::string> getAvailableDeviceNames(); -}; - -AUD_NAMESPACE_END diff --git a/extern/audaspace/include/devices/I3DDevice.h b/extern/audaspace/include/devices/I3DDevice.h deleted file mode 100644 index f49bbcbb07e..00000000000 --- a/extern/audaspace/include/devices/I3DDevice.h +++ /dev/null @@ -1,142 +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 - -/** - * @file I3DDevice.h - * @ingroup devices - * Defines the I3DDevice interface as well as the different distance models. - */ - -#include "util/Math3D.h" - -AUD_NAMESPACE_BEGIN - -/** - * Possible distance models for the 3D device. - * - * The distance models supported are the same as documented in the [OpenAL Specification](http://openal.org/). - */ -enum DistanceModel -{ - DISTANCE_MODEL_INVALID = 0, - DISTANCE_MODEL_INVERSE, - DISTANCE_MODEL_INVERSE_CLAMPED, - DISTANCE_MODEL_LINEAR, - DISTANCE_MODEL_LINEAR_CLAMPED, - DISTANCE_MODEL_EXPONENT, - DISTANCE_MODEL_EXPONENT_CLAMPED -}; - -/** - * @interface I3DDevice - * The I3DDevice interface represents an output device for 3D sound. - * - * The interface has been modelled after the OpenAL 1.1 API, - * see the [OpenAL Specification](http://openal.org/) for lots of details. - */ -class AUD_API I3DDevice -{ -public: - /** - * Retrieves the listener location. - * \return The listener location. - */ - virtual Vector3 getListenerLocation() const=0; - - /** - * Sets the listener location. - * \param location The new location. - * \note The location is not updated with the velocity and - * remains constant until the next call of this method. - */ - virtual void setListenerLocation(const Vector3& location)=0; - - /** - * Retrieves the listener velocity. - * \return The listener velocity. - */ - virtual Vector3 getListenerVelocity() const=0; - - /** - * Sets the listener velocity. - * \param velocity The new velocity. - * \note This velocity does not change the position of the listener - * over time, it is simply used for the calculation of the doppler effect. - */ - virtual void setListenerVelocity(const Vector3& velocity)=0; - - /** - * Retrieves the listener orientation. - * \return The listener orientation as quaternion. - */ - virtual Quaternion getListenerOrientation() const=0; - - /** - * Sets the listener orientation. - * \param orientation The new orientation as quaternion. - * \note The coordinate system used is right handed and the listener - * by default is oriented looking in the negative z direction with the - * positive y axis as up direction. - */ - virtual void setListenerOrientation(const Quaternion& orientation)=0; - - - /** - * Retrieves the speed of sound. - * This value is needed for doppler effect calculation. - * \return The speed of sound. - */ - virtual float getSpeedOfSound() const=0; - - /** - * Sets the speed of sound. - * This value is needed for doppler effect calculation. - * \param speed The new speed of sound. - */ - virtual void setSpeedOfSound(float speed)=0; - - /** - * Retrieves the doppler factor. - * This value is a scaling factor for the velocity vectors of sources and - * listener which is used while calculating the doppler effect. - * \return The doppler factor. - */ - virtual float getDopplerFactor() const=0; - - /** - * Sets the doppler factor. - * This value is a scaling factor for the velocity vectors of sources and - * listener which is used while calculating the doppler effect. - * \param factor The new doppler factor. - */ - virtual void setDopplerFactor(float factor)=0; - - /** - * Retrieves the distance model. - * \return The distance model. - */ - virtual DistanceModel getDistanceModel() const=0; - - /** - * Sets the distance model. - * \param model distance model. - */ - virtual void setDistanceModel(DistanceModel model)=0; -}; - -AUD_NAMESPACE_END diff --git a/extern/audaspace/include/devices/I3DHandle.h b/extern/audaspace/include/devices/I3DHandle.h deleted file mode 100644 index 2ff29f9bd21..00000000000 --- a/extern/audaspace/include/devices/I3DHandle.h +++ /dev/null @@ -1,232 +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 - -/** - * @file I3DHandle.h - * @ingroup devices - * The I3DHandle interface. - */ - -#include "util/Math3D.h" - -AUD_NAMESPACE_BEGIN - -/** - * @interface I3DHandle - * The I3DHandle interface represents a playback handle for 3D sources. - * If the playback IDevice class also implements the I3DDevice interface - * then all playback IHandle instances also implement this interface. - * - * The interface has been modelled after the OpenAL 1.1 API, - * see the [OpenAL Specification](http://openal.org/) for lots of details. - */ -class AUD_API I3DHandle -{ -public: - /** - * Destroys the handle. - */ - virtual ~I3DHandle() {} - - /** - * Retrieves the location of the source. - * \return The location. - */ - virtual Vector3 getLocation()=0; - - /** - * Sets the location of the source. - * \param location The new location. - * \return Whether the action succeeded. - * \note The location is not updated with the velocity and - * remains constant until the next call of this method. - */ - virtual bool setLocation(const Vector3& location)=0; - - /** - * Retrieves the velocity of the source. - * \return The velocity. - */ - virtual Vector3 getVelocity()=0; - - /** - * Sets the velocity of the source. - * \param velocity The new velocity. - * \return Whether the action succeeded. - * \note This velocity does not change the position of the listener - * over time, it is simply used for the calculation of the doppler effect. - */ - virtual bool setVelocity(const Vector3& velocity)=0; - - /** - * Retrieves the orientation of the source. - * \return The orientation as quaternion. - */ - virtual Quaternion getOrientation()=0; - - /** - * Sets the orientation of the source. - * \param orientation The new orientation as quaternion. - * \return Whether the action succeeded. - * \note The coordinate system used is right handed and the source - * by default is oriented looking in the negative z direction with the - * positive y axis as up direction. - * \note This setting currently only affects sounds with non-default cone settings. - */ - virtual bool setOrientation(const Quaternion& orientation)=0; - - - /** - * Checks whether the source location, velocity and orientation are relative - * to the listener. - * \return Whether the source is relative. - */ - virtual bool isRelative()=0; - - /** - * Sets whether the source location, velocity and orientation are relative - * to the listener. - * \param relative Whether the source is relative. - * \return Whether the action succeeded. - * \note The default value is true as this setting is used to play sounds ordinarily without 3D. - */ - virtual bool setRelative(bool relative)=0; - - /** - * Retrieves the maximum volume of a source. - * \return The maximum volume. - */ - virtual float getVolumeMaximum()=0; - - /** - * Sets the maximum volume of a source. - * \param volume The new maximum volume. - * \return Whether the action succeeded. - */ - virtual bool setVolumeMaximum(float volume)=0; - - /** - * Retrieves the minimum volume of a source. - * \return The minimum volume. - */ - virtual float getVolumeMinimum()=0; - - /** - * Sets the minimum volume of a source. - * \param volume The new minimum volume. - * \return Whether the action succeeded. - */ - virtual bool setVolumeMinimum(float volume)=0; - - /** - * Retrieves the maximum distance of a source. - * If a source is further away from the reader than this distance, the - * volume will automatically be set to 0. - * \return The maximum distance. - */ - virtual float getDistanceMaximum()=0; - - /** - * Sets the maximum distance of a source. - * If a source is further away from the reader than this distance, the - * volume will automatically be set to 0. - * \param distance The new maximum distance. - * \return Whether the action succeeded. - */ - virtual bool setDistanceMaximum(float distance)=0; - - /** - * Retrieves the reference distance of a source. - * \return The reference distance. - */ - virtual float getDistanceReference()=0; - - /** - * Sets the reference distance of a source. - * \param distance The new reference distance. - * \return Whether the action succeeded. - */ - virtual bool setDistanceReference(float distance)=0; - - /** - * Retrieves the attenuation of a source. - * \return The attenuation. - */ - virtual float getAttenuation()=0; - - /** - * Sets the attenuation of a source. - * This value is used for distance calculation. - * \param factor The new attenuation. - * \return Whether the action succeeded. - */ - virtual bool setAttenuation(float factor)=0; - - /** - * Retrieves the outer opening angle of the cone of a source. - * \return The outer angle of the cone. - * \note This angle is defined in degrees. - */ - virtual float getConeAngleOuter()=0; - - /** - * Sets the outer opening angle of the cone of a source. - * \param angle The new outer angle of the cone. - * \return Whether the action succeeded. - * \note This angle is defined in degrees. - */ - virtual bool setConeAngleOuter(float angle)=0; - - /** - * Retrieves the inner opening angle of the cone of a source. - * The volume inside this cone is unaltered. - * \return The inner angle of the cone. - * \note This angle is defined in degrees. - */ - virtual float getConeAngleInner()=0; - - /** - * Sets the inner opening angle of the cone of a source. - * The volume inside this cone is unaltered. - * \param angle The new inner angle of the cone. - * \return Whether the action succeeded. - * \note This angle is defined in degrees. - */ - virtual bool setConeAngleInner(float angle)=0; - - /** - * Retrieves the outer volume of the cone of a source. - * The volume between inner and outer angle is interpolated between inner - * volume and this value. - * \return The outer volume of the cone. - * \note The general volume of the handle still applies on top of this. - */ - virtual float getConeVolumeOuter()=0; - - /** - * Sets the outer volume of the cone of a source. - * The volume between inner and outer angle is interpolated between inner - * volume and this value. - * \param volume The new outer volume of the cone. - * \return Whether the action succeeded. - * \note The general volume of the handle still applies on top of this. - */ - virtual bool setConeVolumeOuter(float volume)=0; -}; - -AUD_NAMESPACE_END diff --git a/extern/audaspace/include/devices/IDevice.h b/extern/audaspace/include/devices/IDevice.h deleted file mode 100644 index 92a85d900e2..00000000000 --- a/extern/audaspace/include/devices/IDevice.h +++ /dev/null @@ -1,123 +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 - -/** - * @file IDevice.h - * @ingroup devices - * The IDevice interface. - */ - -#include "respec/Specification.h" -#include "util/ILockable.h" - -#include <memory> - -AUD_NAMESPACE_BEGIN - -class IHandle; -class IReader; -class ISound; -class ISynchronizer; - -/** - * @interface IDevice - * The IDevice interface represents an output device for sound sources. - * Output devices may be several backends such as plattform independand like - * SDL or OpenAL or plattform specific like ALSA, but they may also be - * files, RAM buffers or other types of streams. - * \warning Thread safety must be insured so that no reader is beeing called - * twice at the same time. - */ -class IDevice : public ILockable -{ -public: - /** - * Destroys the device. - */ - virtual ~IDevice() {} - - /** - * Returns the specification of the device. - */ - virtual DeviceSpecs getSpecs() const=0; - - /** - * Plays a sound source. - * \param reader The reader to play. - * \param keep When keep is true the sound source will not be deleted but - * set to paused when its end has been reached. - * \return Returns a handle with which the playback can be controlled. - * This is nullptr if the sound couldn't be played back. - * \exception Exception Thrown if there's an unexpected (from the - * device side) error during creation of the reader. - */ - virtual std::shared_ptr<IHandle> play(std::shared_ptr<IReader> reader, bool keep = false)=0; - - /** - * Plays a sound source. - * \param sound The sound to create the reader for the sound source. - * \param keep When keep is true the sound source will not be deleted but - * set to paused when its end has been reached. - * \return Returns a handle with which the playback can be controlled. - * This is nullptr if the sound couldn't be played back. - * \exception Exception Thrown if there's an unexpected (from the - * device side) error during creation of the reader. - */ - virtual std::shared_ptr<IHandle> play(std::shared_ptr<ISound> sound, bool keep = false)=0; - - /** - * Stops all playing sounds. - */ - virtual void stopAll()=0; - - /** - * Locks the device. - * Used to make sure that between lock and unlock, no buffers are read, so - * that it is possible to start, resume, pause, stop or seek several - * playback handles simultaneously. - * \warning Make sure the locking time is as small as possible to avoid - * playback delays that result in unexpected noise and cracks. - */ - virtual void lock()=0; - - /** - * Unlocks the previously locked device. - */ - virtual void unlock()=0; - - /** - * Retrieves the overall device volume. - * \return The overall device volume. - */ - virtual float getVolume() const=0; - - /** - * Sets the overall device volume. - * \param volume The overall device volume. - */ - virtual void setVolume(float volume)=0; - - /** - * Retrieves the synchronizer for this device, which enables accurate synchronization - * between audio playback and video playback for example. - * @return The synchronizer which will be the DefaultSynchronizer if synchonization is not supported. - */ - virtual ISynchronizer* getSynchronizer()=0; -}; - -AUD_NAMESPACE_END diff --git a/extern/audaspace/include/devices/IDeviceFactory.h b/extern/audaspace/include/devices/IDeviceFactory.h deleted file mode 100644 index 6a0f4537b13..00000000000 --- a/extern/audaspace/include/devices/IDeviceFactory.h +++ /dev/null @@ -1,72 +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 - -/** - * @file IDeviceFactory.h - * @ingroup devices - * The IDeviceFactory interface. - */ - -#include "respec/Specification.h" - -#include <memory> - -AUD_NAMESPACE_BEGIN - -/** - * @interface IDeviceFactory - * The IDeviceFactory interface opens an output device. - */ -class AUD_API IDeviceFactory -{ -public: - /** - * Opens an audio device for playback. - * \exception Exception Thrown if the audio device cannot be opened. - */ - virtual std::shared_ptr<IDevice> openDevice()=0; - - /** - * Returns the priority of the device to be the default device for a system. - * The higher the priority the more likely it is for this device to be used as the default device. - * \return Priority to be the default device. - */ - virtual int getPriority()=0; - - /** - * Sets the wanted device specifications for opening the device. - * \param specs The wanted audio specification. - */ - virtual void setSpecs(DeviceSpecs specs)=0; - - /** - * Sets the size for the internal playback buffers. - * The bigger the buffersize, the less likely clicks happen, - * but the latency increases too. - * \param buffersize The size of the internal buffer. - */ - virtual void setBufferSize(int buffersize)=0; - - /** - * Sets a name for the device. - * \param name The internal name for the device. - */ - virtual void setName(std::string name)=0; -}; - -AUD_NAMESPACE_END diff --git a/extern/audaspace/include/devices/IHandle.h b/extern/audaspace/include/devices/IHandle.h deleted file mode 100644 index 3f42fc33c3a..00000000000 --- a/extern/audaspace/include/devices/IHandle.h +++ /dev/null @@ -1,189 +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 - -/** - * @file IHandle.h - * @ingroup devices - * Defines the IHandle interface as well as possible states of the handle. - */ - -#include "Audaspace.h" - -AUD_NAMESPACE_BEGIN - -/// Status of a playback handle. -enum Status -{ - STATUS_INVALID = 0, /// Invalid handle. Maybe due to stopping. - STATUS_PLAYING, /// Sound is playing. - STATUS_PAUSED, /// Sound is being paused. - STATUS_STOPPED /// Sound is stopped but kept in the device. -}; - -/** - * The stopCallback is called when a handle reaches the end of the stream and - * thus gets stopped. A user defined pointer is supplied to the callback. - */ -typedef void (*stopCallback)(void*); - -/** - * @interface IHandle - * The IHandle interface represents a playback handles of a specific device. - */ -class AUD_API IHandle -{ -public: - /** - * Destroys the handle. - */ - virtual ~IHandle() {} - - /** - * Pauses a played back sound. - * \return - * - true if the sound has been paused. - * - false if the sound isn't playing back or the handle is invalid. - */ - virtual bool pause()=0; - - /** - * Resumes a paused sound. - * \return - * - true if the sound has been resumed. - * - false if the sound isn't paused or the handle is invalid. - */ - virtual bool resume()=0; - - /** - * Stops a played back or paused sound. The handle is definitely invalid - * afterwards. - * \return - * - true if the sound has been stopped. - * - false if the handle is invalid. - */ - virtual bool stop()=0; - - /** - * Gets the behaviour of the device for a played back sound when the sound - * doesn't return any more samples. - * \return - * - true if the source will be paused when it's end is reached - * - false if the handle won't kept or is invalid. - */ - virtual bool getKeep()=0; - - /** - * Sets the behaviour of the device for a played back sound when the sound - * doesn't return any more samples. - * \param keep True when the source should be paused and not deleted. - * \return - * - true if the behaviour has been changed. - * - false if the handle is invalid. - */ - virtual bool setKeep(bool keep)=0; - - /** - * Seeks in a played back sound. - * \param position The new position from where to play back, in seconds. - * \return - * - true if the handle is valid. - * - false if the handle is invalid. - * \warning Whether the seek works or not depends on the sound source. - */ - virtual bool seek(float position)=0; - - /** - * Retrieves the current playback position of a sound. - * \return The playback position in seconds, or 0.0 if the handle is - * invalid. - */ - virtual float getPosition()=0; - - /** - * Returns the status of a played back sound. - * \return - * - STATUS_INVALID if the sound has stopped or the handle is - *. invalid - * - STATUS_PLAYING if the sound is currently played back. - * - STATUS_PAUSED if the sound is currently paused. - * - STATUS_STOPPED if the sound finished playing and is still - * kept in the device. - * \see Status - */ - virtual Status getStatus()=0; - - /** - * Retrieves the volume of a playing sound. - * \return The volume. - */ - virtual float getVolume()=0; - - /** - * Sets the volume of a playing sound. - * \param volume The volume. - * \return - * - true if the handle is valid. - * - false if the handle is invalid. - */ - virtual bool setVolume(float volume)=0; - - /** - * Retrieves the pitch of a playing sound. - * \return The pitch. - */ - virtual float getPitch()=0; - - /** - * Sets the pitch of a playing sound. - * \param pitch The pitch. - * \return - * - true if the handle is valid. - * - false if the handle is invalid. - */ - virtual bool setPitch(float pitch)=0; - - /** - * Retrieves the loop count of a playing sound. - * A negative value indicates infinity. - * \return The remaining loop count. - */ - virtual int getLoopCount()=0; - - /** - * Sets the loop count of a playing sound. - * A negative value indicates infinity. - * \param count The new loop count. - * \return - * - true if the handle is valid. - * - false if the handle is invalid. - */ - virtual bool setLoopCount(int count)=0; - - /** - * Sets the callback function that's called when the end of a playing sound - * is reached. - * \param callback The callback function. - * \param data The data that should be passed to the callback function. - * \return - * - true if the handle is valid. - * - false if the handle is invalid. - */ - virtual bool setStopCallback(stopCallback callback = 0, void* data = 0)=0; -}; - -AUD_NAMESPACE_END diff --git a/extern/audaspace/include/devices/ISynchronizer.h b/extern/audaspace/include/devices/ISynchronizer.h deleted file mode 100644 index 6f14de59565..00000000000 --- a/extern/audaspace/include/devices/ISynchronizer.h +++ /dev/null @@ -1,92 +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 - -/** - * @file ISynchronizer.h - * @ingroup devices - * The ISynchronizer interface. - */ - -#include "Audaspace.h" - -#include <memory> - -AUD_NAMESPACE_BEGIN - -class IHandle; - -/** - * @interface ISynchronizer - * This class enables global synchronization of several audio applications if supported. - * JACK for example supports synchronization through JACK Transport. - */ -class AUD_API ISynchronizer -{ -public: - /** - * Destroys the synchronizer. - */ - virtual ~ISynchronizer() {} - - /** - * The syncFunction is called when a synchronization event happens. - * The function awaits three parameters. The first one is a user defined - * pointer, the second informs about whether playback is on and the third - * is the current playback time in seconds. - */ - typedef void (*syncFunction)(void*, int, float); - - /** - * Sets the playback position of a handle and the synchronizer to a specific time. - * @param handle The handle that should be synchronized/seeked. - * @param time The absolute time to synchronize to. - */ - virtual void seek(std::shared_ptr<IHandle> handle, float time) = 0; - - /** - * Retrieves the position of the synchronizer. - * @param handle The handle which is synchronized. - * @return The position in seconds. - */ - virtual float getPosition(std::shared_ptr<IHandle> handle) = 0; - - /** - * Starts the synchronizer playback. - */ - virtual void play() = 0; - - /** - * Stops the synchronizer playback. - */ - virtual void stop() = 0; - - /** - * Sets the callback function that is called when a synchronization event happens. - * @param function The function to be called. - * @param data User data to be passed to the callback. - */ - virtual void setSyncCallback(syncFunction function, void* data) = 0; - - /** - * Retrieves whether the synchronizer is playing back. - * @return Whether the synchronizer plays back. - */ - virtual int isPlaying() = 0; -}; - -AUD_NAMESPACE_END diff --git a/extern/audaspace/include/devices/NULLDevice.h b/extern/audaspace/include/devices/NULLDevice.h deleted file mode 100644 index 76211a799b9..00000000000 --- a/extern/audaspace/include/devices/NULLDevice.h +++ /dev/null @@ -1,96 +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 - -/** - * @file NULLDevice.h - * @ingroup devices - * The NULLDevice class. - */ - -#include "devices/IDevice.h" -#include "devices/IHandle.h" - -AUD_NAMESPACE_BEGIN - -class IReader; - -/** - * This device plays nothing. - * It is similar to the linux device /dev/null. - */ -class AUD_API NULLDevice : public IDevice -{ -private: - class AUD_LOCAL NULLHandle : public IHandle - { - private: - // delete copy constructor and operator= - NULLHandle(const NULLHandle&) = delete; - NULLHandle& operator=(const NULLHandle&) = delete; - - public: - - NULLHandle(); - - virtual ~NULLHandle() {} - virtual bool pause(); - virtual bool resume(); - virtual bool stop(); - virtual bool getKeep(); - virtual bool setKeep(bool keep); - virtual bool seek(float position); - virtual float getPosition(); - virtual Status getStatus(); - virtual float getVolume(); - virtual bool setVolume(float volume); - virtual float getPitch(); - virtual bool setPitch(float pitch); - virtual int getLoopCount(); - virtual bool setLoopCount(int count); - virtual bool setStopCallback(stopCallback callback = 0, void* data = 0); - }; - - // delete copy constructor and operator= - NULLDevice(const NULLDevice&) = delete; - NULLDevice& operator=(const NULLDevice&) = delete; - -public: - /** - * Creates a new NULLDevice. - */ - NULLDevice(); - - virtual ~NULLDevice(); - - virtual DeviceSpecs getSpecs() const; - virtual std::shared_ptr<IHandle> play(std::shared_ptr<IReader> reader, bool keep = false); - virtual std::shared_ptr<IHandle> play(std::shared_ptr<ISound> sound, bool keep = false); - virtual void stopAll(); - virtual void lock(); - virtual void unlock(); - virtual float getVolume() const; - virtual void setVolume(float volume); - virtual ISynchronizer* getSynchronizer(); - - /** - * Registers this plugin. - */ - static void registerPlugin(); -}; - -AUD_NAMESPACE_END diff --git a/extern/audaspace/include/devices/ReadDevice.h b/extern/audaspace/include/devices/ReadDevice.h deleted file mode 100644 index b56bd8ce5c4..00000000000 --- a/extern/audaspace/include/devices/ReadDevice.h +++ /dev/null @@ -1,82 +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 - -/** - * @file ReadDevice.h - * @ingroup devices - * The ReadDevice class. - */ - -#include "devices/SoftwareDevice.h" - -AUD_NAMESPACE_BEGIN - -/** - * This device enables to let the user read raw data out of it. - */ -class AUD_API ReadDevice : public SoftwareDevice -{ -private: - /** - * Whether the device is currently playing back. - */ - bool m_playing; - - // delete copy constructor and operator= - ReadDevice(const ReadDevice&) = delete; - ReadDevice& operator=(const ReadDevice&) = delete; - -protected: - virtual void AUD_LOCAL playing(bool playing); - -public: - /** - * Creates a new read device. - * \param specs The wanted audio specification. - */ - ReadDevice(DeviceSpecs specs); - - /** - * Creates a new read device. - * \param specs The wanted audio specification. - */ - ReadDevice(Specs specs); - - /** - * Closes the device. - */ - virtual ~ReadDevice(); - - /** - * Reads the next bytes into the supplied buffer. - * \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. - */ - bool read(data_t* buffer, int length); - - /** - * Changes the output specification. - * \param specs The new audio data specification. - */ - void changeSpecs(Specs specs); -}; - -AUD_NAMESPACE_END diff --git a/extern/audaspace/include/devices/SoftwareDevice.h b/extern/audaspace/include/devices/SoftwareDevice.h deleted file mode 100644 index 8f3846394c6..00000000000 --- a/extern/audaspace/include/devices/SoftwareDevice.h +++ /dev/null @@ -1,368 +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 - -/** - * @file SoftwareDevice.h - * @ingroup devices - * The SoftwareDevice class. - */ - -#include "devices/IDevice.h" -#include "devices/IHandle.h" -#include "devices/I3DDevice.h" -#include "devices/I3DHandle.h" -#include "devices/DefaultSynchronizer.h" -#include "util/Buffer.h" - -#include <list> -#include <mutex> - -AUD_NAMESPACE_BEGIN - -class Mixer; -class PitchReader; -class ResampleReader; -class ChannelMapperReader; - -/** - * The software device is a generic device with software mixing. - * It is a base class for all software mixing classes. - * Classes implementing this have to: - * - Implement the playing function. - * - Prepare the m_specs, m_mixer variables. - * - Call the create and destroy functions. - * - Call the mix function to retrieve their audio data. - */ -class AUD_API SoftwareDevice : public IDevice, public I3DDevice -{ -protected: - /// Saves the data for playback. - class AUD_API SoftwareHandle : public IHandle, public I3DHandle - { - private: - // delete copy constructor and operator= - SoftwareHandle(const SoftwareHandle&) = delete; - SoftwareHandle& operator=(const SoftwareHandle&) = delete; - - public: - /// The reader source. - std::shared_ptr<IReader> m_reader; - - /// The pitch reader in between. - std::shared_ptr<PitchReader> m_pitch; - - /// The resample reader in between. - std::shared_ptr<ResampleReader> m_resampler; - - /// The channel mapper reader in between. - std::shared_ptr<ChannelMapperReader> m_mapper; - - /// Whether to keep the source if end of it is reached. - bool m_keep; - - /// The user set pitch of the source. - float m_user_pitch; - - /// The user set volume of the source. - float m_user_volume; - - /// The user set panning for non-3D sources - float m_user_pan; - - /// The calculated final volume of the source. - float m_volume; - - /// The previous calculated final volume of the source. - float m_old_volume; - - /// The loop count of the source. - int m_loopcount; - - /// Location in 3D Space. - Vector3 m_location; - - /// Velocity in 3D Space. - Vector3 m_velocity; - - /// Orientation in 3D Space. - Quaternion m_orientation; - - /// Whether the position to the listener is relative or absolute - bool m_relative; - - /// Maximum volume. - float m_volume_max; - - /// Minimum volume. - float m_volume_min; - - /// Maximum distance. - float m_distance_max; - - /// Reference distance; - float m_distance_reference; - - /// Attenuation - float m_attenuation; - - /// Cone outer angle. - float m_cone_angle_outer; - - /// Cone inner angle. - float m_cone_angle_inner; - - /// Cone outer volume. - float m_cone_volume_outer; - - /// Rendering flags - int m_flags; - - /// The stop callback. - stopCallback m_stop; - - /// Stop callback data. - void* m_stop_data; - - /// Current status of the handle - Status m_status; - - /// Own device. - SoftwareDevice* m_device; - - /** - * This method is for internal use only. - * @param keep Whether the sound should be marked stopped or paused. - * @return Whether the action succeeded. - */ - bool pause(bool keep); - - public: - /** - * Creates a new software handle. - * \param device The device this handle is from. - * \param reader The reader to play. - * \param pitch The pitch reader. - * \param resampler The resampling reader. - * \param mapper The channel mapping reader. - * \param keep Whether to keep the handle when the sound ends. - */ - SoftwareHandle(SoftwareDevice* device, std::shared_ptr<IReader> reader, std::shared_ptr<PitchReader> pitch, std::shared_ptr<ResampleReader> resampler, std::shared_ptr<ChannelMapperReader> mapper, bool keep); - - /** - * Updates the handle's playback parameters. - */ - void update(); - - /** - * Sets the audio output specification of the readers. - * \param specs The output specification. - */ - void setSpecs(Specs specs); - - virtual ~SoftwareHandle() {} - virtual bool pause(); - virtual bool resume(); - virtual bool stop(); - virtual bool getKeep(); - virtual bool setKeep(bool keep); - virtual bool seek(float position); - virtual float getPosition(); - virtual Status getStatus(); - virtual float getVolume(); - virtual bool setVolume(float volume); - virtual float getPitch(); - virtual bool setPitch(float pitch); - virtual int getLoopCount(); - virtual bool setLoopCount(int count); - virtual bool setStopCallback(stopCallback callback = 0, void* data = 0); - - virtual Vector3 getLocation(); - virtual bool setLocation(const Vector3& location); - virtual Vector3 getVelocity(); - virtual bool setVelocity(const Vector3& velocity); - virtual Quaternion getOrientation(); - virtual bool setOrientation(const Quaternion& orientation); - virtual bool isRelative(); - virtual bool setRelative(bool relative); - virtual float getVolumeMaximum(); - virtual bool setVolumeMaximum(float volume); - virtual float getVolumeMinimum(); - virtual bool setVolumeMinimum(float volume); - virtual float getDistanceMaximum(); - virtual bool setDistanceMaximum(float distance); - virtual float getDistanceReference(); - virtual bool setDistanceReference(float distance); - virtual float getAttenuation(); - virtual bool setAttenuation(float factor); - virtual float getConeAngleOuter(); - virtual bool setConeAngleOuter(float angle); - virtual float getConeAngleInner(); - virtual bool setConeAngleInner(float angle); - virtual float getConeVolumeOuter(); - virtual bool setConeVolumeOuter(float volume); - }; - - /** - * The specification of the device. - */ - DeviceSpecs m_specs; - - /** - * The mixer. - */ - std::shared_ptr<Mixer> m_mixer; - - /** - * Whether to do high or low quality resampling. - */ - bool m_quality; - - /** - * Initializes member variables. - */ - void create(); - - /** - * Uninitializes member variables. - */ - void destroy(); - - /** - * Mixes the next samples into the buffer. - * \param buffer The target buffer. - * \param length The length in samples to be filled. - */ - void mix(data_t* buffer, int length); - - /** - * This function tells the device, to start or pause playback. - * \param playing True if device should playback. - */ - virtual void playing(bool playing)=0; - - /** - * Sets the audio output specification of the device. - * \param specs The output specification. - */ - void setSpecs(Specs specs); - - /** - * Empty default constructor. To setup the device call the function create() - * and to uninitialize call destroy(). - */ - SoftwareDevice(); - -private: - /** - * The reading buffer. - */ - Buffer m_buffer; - - /** - * The list of sounds that are currently playing. - */ - std::list<std::shared_ptr<SoftwareHandle> > m_playingSounds; - - /** - * The list of sounds that are currently paused. - */ - std::list<std::shared_ptr<SoftwareHandle> > m_pausedSounds; - - /** - * Whether there is currently playback. - */ - bool m_playback; - - /** - * The mutex for locking. - */ - std::recursive_mutex m_mutex; - - /** - * The overall volume of the device. - */ - float m_volume; - - /// Listener location. - Vector3 m_location; - - /// Listener velocity. - Vector3 m_velocity; - - /// Listener orientation. - Quaternion m_orientation; - - /// Speed of Sound. - float m_speed_of_sound; - - /// Doppler factor. - float m_doppler_factor; - - /// Distance model. - DistanceModel m_distance_model; - - /// Rendering flags - int m_flags; - - /// Synchronizer. - DefaultSynchronizer m_synchronizer; - - // delete copy constructor and operator= - SoftwareDevice(const SoftwareDevice&) = delete; - SoftwareDevice& operator=(const SoftwareDevice&) = delete; - -public: - - /** - * Sets the panning of a specific handle. - * \param handle The handle to set the panning from. - * \param pan The new panning value, should be in the range [-2, 2]. - */ - static void setPanning(IHandle* handle, float pan); - - /** - * Sets the resampling quality. - * \param quality Low (false) or high (true) quality. - */ - void setQuality(bool quality); - - virtual DeviceSpecs getSpecs() const; - virtual std::shared_ptr<IHandle> play(std::shared_ptr<IReader> reader, bool keep = false); - virtual std::shared_ptr<IHandle> play(std::shared_ptr<ISound> sound, bool keep = false); - virtual void stopAll(); - virtual void lock(); - virtual void unlock(); - virtual float getVolume() const; - virtual void setVolume(float volume); - virtual ISynchronizer* getSynchronizer(); - - virtual Vector3 getListenerLocation() const; - virtual void setListenerLocation(const Vector3& location); - virtual Vector3 getListenerVelocity() const; - virtual void setListenerVelocity(const Vector3& velocity); - virtual Quaternion getListenerOrientation() const; - virtual void setListenerOrientation(const Quaternion& orientation); - virtual float getSpeedOfSound() const; - virtual void setSpeedOfSound(float speed); - virtual float getDopplerFactor() const; - virtual void setDopplerFactor(float factor); - virtual DistanceModel getDistanceModel() const; - virtual void setDistanceModel(DistanceModel model); -}; - -AUD_NAMESPACE_END |