diff options
author | Germano <germano.costa@ig.com.br> | 2018-02-01 03:35:46 +0300 |
---|---|---|
committer | Germano <germano.costa@ig.com.br> | 2018-02-01 03:35:46 +0300 |
commit | 0a4e170c28cecd70e7cfb776f0c22a435ecd10e9 (patch) | |
tree | 598f691f9305d91084f76e8e15ee0cecdb5b7d8b /extern/audaspace/include | |
parent | 42ca1fe89cc93929426ab681a5520e5938158a4d (diff) |
Revert "tmp"
This reverts commit ea31f0ac3b877eb0df4c47d0c908d11d1bff33e4.
Diffstat (limited to 'extern/audaspace/include')
115 files changed, 0 insertions, 11497 deletions
diff --git a/extern/audaspace/include/Exception.h b/extern/audaspace/include/Exception.h deleted file mode 100644 index b102bfade63..00000000000 --- a/extern/audaspace/include/Exception.h +++ /dev/null @@ -1,185 +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 - -/** - * \def AUD_NOEXCEPT - * Compatibility macro for noexcept. - */ -#ifdef _MSC_VER -#define AUD_NOEXCEPT -#else -#define AUD_NOEXCEPT noexcept -#endif - -/** - * @file Exception.h - * @ingroup general - * Defines the Exception class as well as the AUD_THROW macro for easy throwing. - */ - -#include "Audaspace.h" - -#include <exception> -#include <string> - -/// Throws a Exception with the provided error code. -#define AUD_THROW(exception, message) { throw exception(message, __FILE__, __LINE__); } - -AUD_NAMESPACE_BEGIN - -/** - * The Exception class is the general exception base class. - */ -class AUD_API Exception : public std::exception -{ -protected: - /// A message describing the problem. - const std::string m_message; - - /// The source code file in which the exception was thrown. - const std::string m_file; - - /// The source code line from which the exception was thrown. - const int m_line; - - /** - * Copy constructor. - * @param exception The exception to be copied. - */ - Exception(const Exception& exception); - - /** - * Creates a new Exception object. - * @param message A message describing the problem. - * @param file The source code file in which the exception was thrown. - * @param line The source code line from which the exception was thrown. - */ - Exception(std::string message, std::string file, int line); -public: - /** - * Destroys the object. - */ - virtual ~Exception() AUD_NOEXCEPT; - - /** - * Returns the error message. - * @return A C string error message. - */ - virtual const char* what() const AUD_NOEXCEPT; - - /** - * Returns the error message plus file and line number for debugging purposes. - * @return The error message including debug information. - */ - virtual std::string getDebugMessage() const; - - /** - * Returns the error message. - * @return The error message as string. - */ - const std::string& getMessage() const; - - /** - * Returns the file in which the exception was thrown. - * @return The name of the file in which the exception was thrown. - */ - const std::string& getFile() const; - - /** - * Returns the line where the exception was originally thrown. - * @return The line of the source file where the exception was generated. - */ - int getLine() const; -}; - -/** - * The FileException class is used for error cases in which files cannot - * be read or written due to unknown containers or codecs. - */ -class AUD_API FileException : public Exception -{ -public: - /** - * Creates a new FileException object. - * @param message A message describing the problem. - * @param file The source code file in which the exception was thrown. - * @param line The source code line from which the exception was thrown. - */ - FileException(std::string message, std::string file, int line); - - /** - * Copy constructor. - * @param exception The exception to be copied. - */ - FileException(const FileException& exception); - - ~FileException() AUD_NOEXCEPT; -}; - -/** - * The DeviceException class is used for error cases in connection with - * devices, which usually happens when specific features or requests - * cannot be fulfilled by a device, for example when the device is opened. - */ -class AUD_API DeviceException : public Exception -{ -public: - /** - * Creates a new DeviceException object. - * @param message A message describing the problem. - * @param file The source code file in which the exception was thrown. - * @param line The source code line from which the exception was thrown. - */ - DeviceException(std::string message, std::string file, int line); - - /** - * Copy constructor. - * @param exception The exception to be copied. - */ - DeviceException(const DeviceException& exception); - - ~DeviceException() AUD_NOEXCEPT; -}; - -/** - * The StateException class is used for error cases of sounds or readers - * with illegal states or requirements for states of dependent classes. - * It is used for example when an effect reader needs a specific - * specification from its input. - */ -class AUD_API StateException : public Exception -{ -public: - /** - * Creates a new StateException object. - * @param message A message describing the problem. - * @param file The source code file in which the exception was thrown. - * @param line The source code line from which the exception was thrown. - */ - StateException(std::string message, std::string file, int line); - - /** - * Copy constructor. - * @param exception The exception to be copied. - */ - StateException(const StateException& exception); - - ~StateException() AUD_NOEXCEPT; -}; - -AUD_NAMESPACE_END diff --git a/extern/audaspace/include/IReader.h b/extern/audaspace/include/IReader.h deleted file mode 100644 index c29900ca579..00000000000 --- a/extern/audaspace/include/IReader.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 IReader.h - * @ingroup general - * The IReader interface. - */ - -#include "respec/Specification.h" - -AUD_NAMESPACE_BEGIN - -/** - * @interface IReader - * This class represents a sound source as stream or as buffer which can be read - * for example by another reader, a device or whatever. - */ -class AUD_API IReader -{ -public: - /** - * Destroys the reader. - */ - virtual ~IReader() {} - - /** - * Tells whether the source provides seeking functionality or not. - * \warning This doesn't mean that the seeking always has to succeed. - * \return Always returns true for readers of buffering types. - */ - virtual bool isSeekable() const=0; - - /** - * Seeks to a specific position in the source. - * \param position The position to seek for measured in samples. To get - * from a given time to the samples you simply have to multiply the - * time value in seconds with the sample rate of the reader. - * \warning This may work or not, depending on the actual reader. - */ - virtual void seek(int position)=0; - - /** - * Returns an approximated length of the source in samples. - * \return The length as sample count. May be negative if unknown. - */ - virtual int getLength() const=0; - - /** - * Returns the position of the source as a sample count value. - * \return The current position in the source. A negative value indicates - * that the position is unknown. - * \warning The value returned doesn't always have to be correct for readers, - * especially after seeking. - */ - virtual int getPosition() const=0; - - /** - * Returns the specification of the reader. - * \return The Specs structure. - */ - virtual Specs getSpecs() const=0; - - /** - * Request to read the next length samples out of the source. - * The buffer supplied has the needed size. - * \param[in,out] length The count of samples that should be read. Shall - * contain the real count of samples after reading, in case - * there were only fewer samples available. - * A smaller value also indicates the end of the reader. - * \param[out] eos End of stream, whether the end is reached or not. - * \param[in] buffer The pointer to the buffer to read into. - */ - virtual void read(int& length, bool& eos, sample_t* buffer)=0; -}; - -AUD_NAMESPACE_END diff --git a/extern/audaspace/include/ISound.h b/extern/audaspace/include/ISound.h deleted file mode 100644 index c28337e1b4e..00000000000 --- a/extern/audaspace/include/ISound.h +++ /dev/null @@ -1,57 +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 ISound.h - * @ingroup general - * The ISound interface. - */ - -#include "Audaspace.h" - -#include <memory> - -AUD_NAMESPACE_BEGIN - -class IReader; - -/** - * @interface ISound - * This class represents a type of sound source and saves the necessary values - * for it. It is able to create a reader that is actually usable for playback - * of the respective sound source through the factory method createReader. - */ -class AUD_API ISound -{ -public: - /** - * Destroys the sound. - */ - virtual ~ISound() {} - - /** - * Creates a reader for playback of the sound source. - * \return A pointer to an IReader object or nullptr if there has been an - * error. - * \exception Exception An exception may be thrown if there has been - * a more unexpected error during reader creation. - */ - virtual std::shared_ptr<IReader> createReader()=0; -}; - -AUD_NAMESPACE_END 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 diff --git a/extern/audaspace/include/file/File.h b/extern/audaspace/include/file/File.h deleted file mode 100644 index 24745a757e8..00000000000 --- a/extern/audaspace/include/file/File.h +++ /dev/null @@ -1,74 +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 File.h - * @ingroup file - * The File class. - */ - -#include "ISound.h" - -#include <string> -#include <memory> - -AUD_NAMESPACE_BEGIN - -class Buffer; - -/** - * The File sound tries to read a sound file via all available file inputs - * that have been registered in the FileManager class. - */ -class AUD_API File : public ISound -{ -private: - /** - * The filename of the sound source file. - */ - std::string m_filename; - - /** - * The buffer to read from. - */ - std::shared_ptr<Buffer> m_buffer; - - // delete copy constructor and operator= - File(const File&) = delete; - File& operator=(const File&) = delete; - -public: - /** - * Creates a new sound. - * The file is read from the file system using the given path. - * \param filename The sound file path. - */ - File(std::string filename); - - /** - * Creates a new sound. - * The file is read from memory using the supplied buffer. - * \param buffer The buffer to read from. - * \param size The size of the buffer. - */ - File(const data_t* buffer, int size); - - virtual std::shared_ptr<IReader> createReader(); -}; - -AUD_NAMESPACE_END diff --git a/extern/audaspace/include/file/FileManager.h b/extern/audaspace/include/file/FileManager.h deleted file mode 100644 index 03943ea8ae0..00000000000 --- a/extern/audaspace/include/file/FileManager.h +++ /dev/null @@ -1,95 +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 FileManager.h - * @ingroup file - * The FileManager class. - */ - -#include "respec/Specification.h" -#include "IWriter.h" - -#include <list> -#include <memory> - -AUD_NAMESPACE_BEGIN - -class IFileInput; -class IFileOutput; -class IReader; -class Buffer; - -/** - * The FileManager manages all file input and output plugins. - */ -class AUD_API FileManager -{ -private: - static std::list<std::shared_ptr<IFileInput>>& inputs(); - static std::list<std::shared_ptr<IFileOutput>>& outputs(); - - // delete copy constructor and operator= - FileManager(const FileManager&) = delete; - FileManager& operator=(const FileManager&) = delete; - FileManager() = delete; - -public: - /** - * Registers a file input used to create an IReader to read from a file. - * @param input The IFileInput to register. - */ - static void registerInput(std::shared_ptr<IFileInput> input); - - /** - * Registers a file output used to create an IWriter to write to a file. - * @param output The IFileOutput to register. - */ - static void registerOutput(std::shared_ptr<IFileOutput> output); - - /** - * Creates a file reader for the given filename if a registed IFileInput is able to read it. - * @param filename The path to the file. - * @return The reader created. - * @exception Exception If no file input can read the file an exception is thrown. - */ - static std::shared_ptr<IReader> createReader(std::string filename); - - /** - * Creates a file reader for the given buffer if a registed IFileInput is able to read it. - * @param buffer The buffer to read the file from. - * @return The reader created. - * @exception Exception If no file input can read the file an exception is thrown. - */ - static std::shared_ptr<IReader> createReader(std::shared_ptr<Buffer> buffer); - - /** - * Creates a file writer that writes a sound to the given file path. - * Existing files will be overwritten. - * @param filename The file path to write to. - * @param specs The output specification. - * @param format The container format for the file. - * @param codec The codec used inside the container. - * @param bitrate The bitrate to write with. - * @return A writer that creates the file. - * @exception Exception If no file output can write the file with the given specification an exception is thrown. - */ - static std::shared_ptr<IWriter> createWriter(std::string filename, DeviceSpecs specs, Container format, Codec codec, unsigned int bitrate); -}; - -AUD_NAMESPACE_END diff --git a/extern/audaspace/include/file/FileWriter.h b/extern/audaspace/include/file/FileWriter.h deleted file mode 100644 index dac842f2a8f..00000000000 --- a/extern/audaspace/include/file/FileWriter.h +++ /dev/null @@ -1,78 +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 FileWriter.h - * @ingroup file - * The FileWriter class. - */ - -#include "respec/Specification.h" -#include "file/IWriter.h" - -#include <string> -#include <vector> -#include <memory> - -AUD_NAMESPACE_BEGIN - -class IReader; - -/** - * The FileWriter class is able to create IWriter classes as well as write readers to them. - */ -class AUD_API FileWriter -{ -private: - // hide default constructor, copy constructor and operator= - FileWriter() = delete; - FileWriter(const FileWriter&) = delete; - FileWriter& operator=(const FileWriter&) = delete; - -public: - /** - * Creates a new IWriter. - * \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 The writer to write data to. - */ - static std::shared_ptr<IWriter> createWriter(std::string filename, DeviceSpecs specs, Container format, Codec codec, unsigned int bitrate); - - /** - * Writes a reader to a writer. - * \param reader The reader to read from. - * \param writer The writer to write to. - * \param length How many samples should be transferred. - * \param buffersize How many samples should be transferred at once. - */ - static void writeReader(std::shared_ptr<IReader> reader, std::shared_ptr<IWriter> writer, unsigned int length, unsigned int buffersize); - - /** - * Writes a reader to several writers. - * \param reader The reader to read from. - * \param writers The writers to write to. - * \param length How many samples should be transferred. - * \param buffersize How many samples should be transferred at once. - */ - static void writeReader(std::shared_ptr<IReader> reader, std::vector<std::shared_ptr<IWriter> >& writers, unsigned int length, unsigned int buffersize); -}; - -AUD_NAMESPACE_END diff --git a/extern/audaspace/include/file/IFileInput.h b/extern/audaspace/include/file/IFileInput.h deleted file mode 100644 index bb016a88602..00000000000 --- a/extern/audaspace/include/file/IFileInput.h +++ /dev/null @@ -1,60 +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 IFileInput.h - * @ingroup file - * The IFileInput interface. - */ - -#include "Audaspace.h" - -#include <memory> -#include <string> - -AUD_NAMESPACE_BEGIN - -class IReader; -class Buffer; - -/** - * @interface IFileInput - * The IFileInput interface represents a file input plugin that can create file - * input readers from filenames or buffers. - */ -class AUD_API IFileInput -{ -public: - /** - * Creates a reader for a file to be read. - * \param filename Path to the file to be read. - * \return The reader that reads the file. - * \exception Exception Thrown if the file specified cannot be read. - */ - virtual std::shared_ptr<IReader> createReader(std::string filename)=0; - - /** - * Creates a reader for a file to be read from memory. - * \param buffer The in-memory file buffer. - * \return The reader that reads the file. - * \exception Exception Thrown if the file specified cannot be read. - */ - virtual std::shared_ptr<IReader> createReader(std::shared_ptr<Buffer> buffer)=0; -}; - -AUD_NAMESPACE_END diff --git a/extern/audaspace/include/file/IFileOutput.h b/extern/audaspace/include/file/IFileOutput.h deleted file mode 100644 index 5a6efacfe94..00000000000 --- a/extern/audaspace/include/file/IFileOutput.h +++ /dev/null @@ -1,52 +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 IFileOutput.h - * @ingroup file - * The IFileOutput interface. - */ - -#include "file/IWriter.h" -#include "respec/Specification.h" - -#include <memory> -#include <string> - -AUD_NAMESPACE_BEGIN - -/** - * @interface IFileOutput - * The IFileOutput interface represents a file output plugin that can write files. - */ -class AUD_API IFileOutput -{ -public: - /** - * Creates a new file writer. - * \param filename The path to the file to be written. - * \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. - * \exception Exception Thrown if the file specified cannot be written. - */ - virtual std::shared_ptr<IWriter> createWriter(std::string filename, DeviceSpecs specs, Container format, Codec codec, unsigned int bitrate)=0; -}; - -AUD_NAMESPACE_END diff --git a/extern/audaspace/include/file/IWriter.h b/extern/audaspace/include/file/IWriter.h deleted file mode 100644 index 96decdda391..00000000000 --- a/extern/audaspace/include/file/IWriter.h +++ /dev/null @@ -1,89 +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 IWriter.h - * @ingroup file - * Defines the IWriter interface as well as Container and Codec types. - */ - -#include "respec/Specification.h" - -AUD_NAMESPACE_BEGIN - -/// Container formats for writers. -enum Container -{ - CONTAINER_INVALID = 0, - CONTAINER_AC3, - CONTAINER_FLAC, - CONTAINER_MATROSKA, - CONTAINER_MP2, - CONTAINER_MP3, - CONTAINER_OGG, - CONTAINER_WAV -}; - -/// Audio codecs for writers. -enum Codec -{ - CODEC_INVALID = 0, - CODEC_AAC, - CODEC_AC3, - CODEC_FLAC, - CODEC_MP2, - CODEC_MP3, - CODEC_PCM, - CODEC_VORBIS, - CODEC_OPUS -}; - -/** - * @interface IWriter - * This class represents a sound sink where audio data can be written to. - */ -class AUD_API IWriter -{ -public: - /** - * Destroys the writer. - */ - virtual ~IWriter() {} - - /** - * Returns how many samples have been written so far. - * \return The writing position as sample count. May be negative if unknown. - */ - virtual int getPosition() const=0; - - /** - * Returns the specification of the audio data being written into the sink. - * \return The DeviceSpecs structure. - * \note Regardless of the format the input still has to be float! - */ - virtual DeviceSpecs getSpecs() const=0; - - /** - * Request to write the next length samples out into the sink. - * \param length The count of samples to write. - * \param buffer The pointer to the buffer containing the data. - */ - virtual void write(unsigned int length, sample_t* buffer)=0; -}; - -AUD_NAMESPACE_END diff --git a/extern/audaspace/include/fx/ADSR.h b/extern/audaspace/include/fx/ADSR.h deleted file mode 100644 index c453f2477e1..00000000000 --- a/extern/audaspace/include/fx/ADSR.h +++ /dev/null @@ -1,121 +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 ADSR.h - * @ingroup fx - * The ADSR class. - */ - -#include "fx/Effect.h" - -AUD_NAMESPACE_BEGIN - -/** - * The ADSR effect implements the Attack-Delay-Sustain-Release behaviour of a sound. - */ -class AUD_API ADSR : public Effect -{ -private: - /** - * Attack time. - */ - float m_attack; - - /** - * Decay time. - */ - float m_decay; - - /** - * Sustain level. - */ - float m_sustain; - - /** - * Release time. - */ - float m_release; - - // delete copy constructor and operator= - ADSR(const ADSR&) = delete; - ADSR& operator=(const ADSR&) = delete; - -public: - /** - * Creates a new ADSR object. - * @param sound The sound to apply this effect to. - * @param attack The attack time in seconds. - * @param decay The decay time in seconds. - * @param sustain The sustain level as linear volume. - * @param release The release time in seconds. - */ - ADSR(std::shared_ptr<ISound> sound, float attack, float decay, float sustain, float release); - - /** - * Returns the attack time. - * @return The attack time in seconds. - */ - float getAttack() const; - - /** - * Sets the attack time. - * @param attack The attack time in seconds. - */ - void setAttack(float attack); - - /** - * Returns the decay time. - * @return The decay time in seconds. - */ - float getDecay() const; - - /** - * Sets the decay time. - * @param decay The decay time in seconds. - */ - void setDecay(float decay); - - /** - * Returns the sustain level. - * @return The sustain level in linear volume. - */ - float getSustain() const; - - /** - * Sets the sustain level. - * @param sustain The sustain level in linear volume. - */ - void setSustain(float sustain); - - /** - * Returns the release time. - * @return The release time in seconds. - */ - float getRelease() const; - - /** - * Sets the release time. - * @param release The release time in seconds. - */ - void setRelease(float release); - - virtual std::shared_ptr<IReader> createReader(); -}; - -AUD_NAMESPACE_END diff --git a/extern/audaspace/include/fx/ADSRReader.h b/extern/audaspace/include/fx/ADSRReader.h deleted file mode 100644 index a9ec076a1c5..00000000000 --- a/extern/audaspace/include/fx/ADSRReader.h +++ /dev/null @@ -1,101 +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 ADSRReader.h - * @ingroup fx - * The ADSRReader class. - */ - -#include "fx/EffectReader.h" - -AUD_NAMESPACE_BEGIN - -/** - * This class is an ADSR filters. - */ -class AUD_API ADSRReader : public EffectReader -{ -private: - enum ADSRState - { - ADSR_STATE_INVALID = 0, /// Invalid ADSR state or finished. - ADSR_STATE_ATTACK = 1, /// Initial attack state. - ADSR_STATE_DECAY = 2, /// Decay state. - ADSR_STATE_SUSTAIN = 3, /// Sustain state. - ADSR_STATE_RELEASE = 4 /// Release state. - }; - - /** - * Attack time. - */ - float m_attack; - - /** - * Decay time. - */ - float m_decay; - - /** - * Sustain level. - */ - float m_sustain; - - /** - * Release time. - */ - float m_release; - - /** - * Current state. - */ - ADSRState m_state; - - /** - * Current level. - */ - float m_level; - - // delete copy constructor and operator= - ADSRReader(const ADSRReader&) = delete; - ADSRReader& operator=(const ADSRReader&) = delete; - - void AUD_LOCAL nextState(ADSRState state); - -public: - /** - * Creates a new ADSR reader. - * \param reader The reader to read from. - * \param attack The attack time in seconds. - * \param decay The decay time in seconds. - * \param sustain The sustain level, should be in range [0 - 1]. - * \param release The release time in seconds. - */ - ADSRReader(std::shared_ptr<IReader> reader, float attack, float decay, float sustain, float release); - - virtual ~ADSRReader(); - - virtual void read(int& length, bool& eos, sample_t* buffer); - - /** - * Triggers the release. - */ - void release(); -}; - -AUD_NAMESPACE_END diff --git a/extern/audaspace/include/fx/Accumulator.h b/extern/audaspace/include/fx/Accumulator.h deleted file mode 100644 index d0c635d663c..00000000000 --- a/extern/audaspace/include/fx/Accumulator.h +++ /dev/null @@ -1,79 +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 Accumulator.h - * @ingroup fx - * The Accumulator class. - */ - -#include "fx/Effect.h" - -AUD_NAMESPACE_BEGIN - -class CallbackIIRFilterReader; - -/** - * This sound creates an accumulator reader. - * - * The accumulator adds the difference at the input to the last output in case - * it's positive. In additive mode it additionaly adds the difference always. - * So in case the difference is positive, it's added twice. - */ -class AUD_API Accumulator : public Effect -{ -private: - /** - * Whether the accumulator is additive. - */ - const bool m_additive; - - // delete copy constructor and operator= - Accumulator(const Accumulator&) = delete; - Accumulator& operator=(const Accumulator&) = delete; - -public: - /** - * Creates a new accumulator sound. - * \param sound The input sound. - * \param additive Whether the accumulator is additive. - */ - Accumulator(std::shared_ptr<ISound> sound, bool additive = false); - - virtual std::shared_ptr<IReader> createReader(); - - /** - * The accumulatorFilterAdditive function implements the doFilterIIR callback - * for the additive accumulator filter. - * @param reader The CallbackIIRFilterReader that executes the callback. - * @param useless A user defined pointer that is not needed for this filter. - * @return The filtered sample. - */ - static sample_t AUD_LOCAL accumulatorFilterAdditive(CallbackIIRFilterReader* reader, void* useless); - - /** - * The accumulatorFilter function implements the doFilterIIR callback - * for the non-additive accumulator filter. - * @param reader The CallbackIIRFilterReader that executes the callback. - * @param useless A user defined pointer that is not needed for this filter. - * @return The filtered sample. - */ - static sample_t AUD_LOCAL accumulatorFilter(CallbackIIRFilterReader* reader, void* useless); -}; - -AUD_NAMESPACE_END diff --git a/extern/audaspace/include/fx/BaseIIRFilterReader.h b/extern/audaspace/include/fx/BaseIIRFilterReader.h deleted file mode 100644 index 193b98578de..00000000000 --- a/extern/audaspace/include/fx/BaseIIRFilterReader.h +++ /dev/null @@ -1,133 +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 BaseIIRFilterReader.h - * @ingroup fx - * The BaseIIRFilterReader class. - */ - -#include "fx/EffectReader.h" - -AUD_NAMESPACE_BEGIN - -/** - * This class is a base class for infinite impulse response filters. - */ -class AUD_API BaseIIRFilterReader : public EffectReader -{ -private: - /** - * Specs. - */ - Specs m_specs; - - /** - * Length of input samples needed. - */ - int m_xlen; - - /** - * Length of output samples needed. - */ - int m_ylen; - - /** - * The last in samples array. - */ - sample_t* m_x; - - /** - * The last out samples array. - */ - sample_t* m_y; - - /** - * Position of the current input sample in the input array. - */ - int m_xpos; - - /** - * Position of the current output sample in the output array. - */ - int m_ypos; - - /** - * Current channel. - */ - int m_channel; - - // delete copy constructor and operator= - BaseIIRFilterReader(const BaseIIRFilterReader&) = delete; - BaseIIRFilterReader& operator=(const BaseIIRFilterReader&) = delete; - -protected: - /** - * Creates a new base IIR filter reader. - * \param reader The reader to read from. - * \param in The count of past input samples needed. - * \param out The count of past output samples needed. - */ - BaseIIRFilterReader(std::shared_ptr<IReader> reader, int in, int out); - - /** - * Sets the length for the required input and output samples of the IIR filter. - * @param in The amount of past input samples needed, including the current one. - * @param out The amount of past output samples needed. - */ - void setLengths(int in, int out); - -public: - /** - * Retrieves the last input samples. - * \param pos The position, valid are 0 (current) or negative values. - * \return The sample value. - */ - inline sample_t x(int pos) - { - return m_x[(m_xpos + pos + m_xlen) % m_xlen * m_specs.channels + m_channel]; - } - - /** - * Retrieves the last output samples. - * \param pos The position, valid are negative values. - * \return The sample value. - */ - inline sample_t y(int pos) - { - return m_y[(m_ypos + pos + m_ylen) % m_ylen * m_specs.channels + m_channel]; - } - - virtual ~BaseIIRFilterReader(); - - virtual void read(int& length, bool& eos, sample_t* buffer); - - /** - * Runs the filtering function. - * \return The current output sample value. - */ - virtual sample_t filter()=0; - - /** - * Notifies the filter about a sample rate change. - * \param rate The new sample rate. - */ - virtual void sampleRateChanged(SampleRate rate); -}; - -AUD_NAMESPACE_END diff --git a/extern/audaspace/include/fx/BinauralReader.h b/extern/audaspace/include/fx/BinauralReader.h deleted file mode 100644 index f5667a093f6..00000000000 --- a/extern/audaspace/include/fx/BinauralReader.h +++ /dev/null @@ -1,223 +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 - -/** -* @file BinauralReader.h -* @ingroup fx -* The BinauralReader class. -*/ - -#include "IReader.h" -#include "ISound.h" -#include "Convolver.h" -#include "HRTF.h" -#include "Source.h" -#include "util/FFTPlan.h" -#include "util/ThreadPool.h" - -#include <memory> -#include <vector> -#include <future> - -AUD_NAMESPACE_BEGIN - -/** -* This class represents a reader for a sound that can sound different depending on its realtive position with the listener. -*/ -class AUD_API BinauralReader : public IReader -{ -private: - /** - * The current position. - */ - int m_position; - - /** - * The reader of the input sound. - */ - std::shared_ptr<IReader> m_reader; - - /** - * The HRTF set. - */ - std::shared_ptr<HRTF> m_hrtfs; - - /** - * A Source object that will be used to change the source position of the sound. - */ - std::shared_ptr<Source> m_source; - - /** - * The intended azimuth. - */ - float m_Azimuth; - - /** - * The intended elevation. - */ - float m_Elevation; - - /** - * The real azimuth being used. - */ - float m_RealAzimuth; - - /** - * The real elevation being used. - */ - float m_RealElevation; - - /** - * The FFT size, given by the FFTPlan. - */ - int m_N; - - /** - * The length of the impulse response fragments, m_N/2 will be used. - */ - int m_M; - - /** - * The max length of the input slices, m_N/2 will be used. - */ - int m_L; - - /** - * The array of convolvers that will be used, one per channel. - */ - std::vector<std::unique_ptr<Convolver>> m_convolvers; - - /** - * True if a transition is happening. - */ - bool m_transition; - - /** - * The position of the current transition (decreasing) - */ - int m_transPos; - - /** - * The output buffer in which the convolved data will be written and from which the reader will read. - */ - sample_t* m_outBuffer; - - /** - * The input buffer that will hold the data to be convolved. - */ - sample_t* m_inBuffer; - - /** - * Current position in which the m_outBuffer is being read. - */ - int m_outBufferPos; - - /** - * Length of rhe m_outBuffer. - */ - int m_outBufLen; - - /** - * Effective length of rhe m_outBuffer. - */ - int m_eOutBufLen; - - /** - * Flag indicating whether the end of the sound has been reached or not. - */ - bool m_eosReader; - - /** - * Flag indicating whether the end of the extra data generated in the convolution has been reached or not. - */ - bool m_eosTail; - - /** - * A vector of buffers (one per channel) on which the audio signal will be separated per channel so it can be convolved. - */ - std::vector<sample_t*> m_vecOut; - - /** - * A shared ptr to a thread pool. - */ - std::shared_ptr<ThreadPool> m_threadPool; - - /** - * Length of the input data to be used by the channel threads. - */ - int m_lastLengthIn; - - /** - * A vector of futures to sync tasks. - */ - std::vector<std::future<int>> m_futures; - - // delete copy constructor and operator= - BinauralReader(const BinauralReader&) = delete; - BinauralReader& operator=(const BinauralReader&) = delete; - -public: - /** - * Creates a new convolver reader. - * \param reader A reader of the input sound to be assigned to this reader. It must have one channel. - * \param hrtfs A shared pointer to an HRTF object that will be used to get a particular impulse response depending on the source. - * \param source A shared pointer to a Source object that will be used to change the source position of the sound. - * \param threadPool A shared pointer to a ThreadPool object with 1 or more threads. - * \param plan A shared pointer to and FFT plan that will be used for convolution. - * \exception Exception thrown if the specs of the HRTFs and the sound don't match or if the provided HRTF object is empty. - */ - BinauralReader(std::shared_ptr<IReader> reader, std::shared_ptr<HRTF> hrtfs, std::shared_ptr<Source> source, std::shared_ptr<ThreadPool> threadPool, std::shared_ptr<FFTPlan> plan); - virtual ~BinauralReader(); - - virtual bool isSeekable() const; - virtual void seek(int position); - virtual int getLength() const; - virtual int getPosition() const; - virtual Specs getSpecs() const; - virtual void read(int& length, bool& eos, sample_t* buffer); - -private: - /** - * Joins several buffers (one per channel) into the m_outBuffer. - * \param start The starting position from which the m_outBuffer will be written. - * \param len The amout of samples that will be joined. - * \param nConvolvers The number of convolvers that have been used. Only use 2 or 4 as possible values. - If the value is 4 the result will be interpolated. - */ - void joinByChannel(int start, int len, int nConvolvers); - - /** - * Loads the m_outBuffer with data. - * \param nConvolvers The number of convolver objects that will be used. Only 2 or 4 should be used. - */ - void loadBuffer(int nConvolvers); - - /** - * The function that the threads will run. It will process a subset of channels. - * \param id An id number that will determine which subset of channels will be processed. - * \param input A flag that will indicate if thare is input data. - * -If true there is new input data. - * -If false there isn't new input data. - * \return The number of samples obtained. - */ - int threadFunction(int id, bool input); - - bool checkSource(); -}; - -AUD_NAMESPACE_END
\ No newline at end of file diff --git a/extern/audaspace/include/fx/BinauralSound.h b/extern/audaspace/include/fx/BinauralSound.h deleted file mode 100644 index 733e111dc2b..00000000000 --- a/extern/audaspace/include/fx/BinauralSound.h +++ /dev/null @@ -1,119 +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 - -/** -* @file BinauralSound.h -* @ingroup fx -* The BinauralSound class. -*/ - -#include "ISound.h" -#include "HRTF.h" -#include "Source.h" -#include "util/ThreadPool.h" -#include "util/FFTPlan.h" - -#include <memory> -#include <vector> - -AUD_NAMESPACE_BEGIN - -/** -* This class represents a sound that can sound different depending on its realtive position with the listener. -*/ -class AUD_API BinauralSound : public ISound -{ -private: - /** - * A pointer to the imput sound. - */ - std::shared_ptr<ISound> m_sound; - - /** - * A pointer to an HRTF object with a collection of impulse responses. - */ - std::shared_ptr<HRTF> m_hrtfs; - - /** - * A pointer to a Source object which represents the source of the sound. - */ - std::shared_ptr<Source> m_source; - - /** - * A shared ptr to a thread pool. - */ - std::shared_ptr<ThreadPool> m_threadPool; - - /** - * A shared ponter to an FFT plan. - */ - std::shared_ptr<FFTPlan> m_plan; - - // delete copy constructor and operator= - BinauralSound(const BinauralSound&) = delete; - BinauralSound& operator=(const BinauralSound&) = delete; - -public: - /** - * Creates a new ConvolverSound. - * \param sound The sound that will be convolved. It must have only one channel. - * \param hrtfs The HRTF set that will be used. - * \param source A shared pointer to a Source object that contains the source of the sound. - * \param threadPool A shared pointer to a ThreadPool object with 1 or more threads. - * \param plan A shared pointer to a FFTPlan object that will be used for convolution. - * \warning The same FFTPlan object must be used to construct both this and the HRTF object provided. - */ - BinauralSound(std::shared_ptr<ISound> sound, std::shared_ptr<HRTF> hrtfs, std::shared_ptr<Source> source, std::shared_ptr<ThreadPool> threadPool, std::shared_ptr<FFTPlan> plan); - - /** - * Creates a new BinauralSound. A default FFT plan will be created. - * \param sound The sound that will be convolved. Must have only one channel. - * \param hrtfs The HRTF set that will be used. - * \param source A shared pointer to a Source object that contains the source of the sound. - * \param threadPool A shared pointer to a ThreadPool object with 1 or more threads. - * \warning To use this constructor no FFTPlan object must have been provided to the hrtfs. - */ - BinauralSound(std::shared_ptr<ISound> sound, std::shared_ptr<HRTF> hrtfs, std::shared_ptr<Source> source, std::shared_ptr<ThreadPool> threadPool); - - virtual std::shared_ptr<IReader> createReader(); - - /** - * Retrieves the HRTF set being used. - * \return A shared pointer to the current HRTF object being used. - */ - std::shared_ptr<HRTF> getHRTFs(); - - /** - * Changes the set of HRTFs used for convolution, it'll only affect newly created readers. - * \param hrtfs A shared pointer to the new HRTF object. - */ - void setHRTFs(std::shared_ptr<HRTF> hrtfs); - - /** - * Retrieves the Source object being used. - * \return A shared pointer to the current Source object being used. - */ - std::shared_ptr<Source> getSource(); - - /** - * Changes the Source object used to change the source position of the sound. - * \param source A shared pointer to the new Source object. - */ - void setSource(std::shared_ptr<Source> source); -}; -AUD_NAMESPACE_END
\ No newline at end of file diff --git a/extern/audaspace/include/fx/Butterworth.h b/extern/audaspace/include/fx/Butterworth.h deleted file mode 100644 index db2ad743863..00000000000 --- a/extern/audaspace/include/fx/Butterworth.h +++ /dev/null @@ -1,48 +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 Butterworth.h - * @ingroup fx - * The Butterworth class. - */ - -#include "fx/DynamicIIRFilter.h" - -AUD_NAMESPACE_BEGIN - -/** - * This sound creates a butterworth lowpass filter reader. - */ -class AUD_API Butterworth : public DynamicIIRFilter -{ -private: - // delete copy constructor and operator= - Butterworth(const Butterworth&) = delete; - Butterworth& operator=(const Butterworth&) = delete; - -public: - /** - * Creates a new butterworth sound. - * \param sound The input sound. - * \param frequency The cutoff frequency. - */ - Butterworth(std::shared_ptr<ISound> sound, float frequency); -}; - -AUD_NAMESPACE_END diff --git a/extern/audaspace/include/fx/ButterworthCalculator.h b/extern/audaspace/include/fx/ButterworthCalculator.h deleted file mode 100644 index f4d4894c8b8..00000000000 --- a/extern/audaspace/include/fx/ButterworthCalculator.h +++ /dev/null @@ -1,55 +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 ButterworthCalculator.h - * @ingroup fx - * The ButterworthCalculator class. - */ - -#include "fx/IDynamicIIRFilterCalculator.h" - -AUD_NAMESPACE_BEGIN - -/** - * The ButterworthCalculator class calculates fourth order Butterworth low pass - * filter coefficients for a dynamic DynamicIIRFilter. - */ -class AUD_LOCAL ButterworthCalculator : public IDynamicIIRFilterCalculator -{ -private: - /** - * The attack value in seconds. - */ - const float m_frequency; - - // delete copy constructor and operator= - ButterworthCalculator(const ButterworthCalculator&) = delete; - ButterworthCalculator& operator=(const ButterworthCalculator&) = delete; - -public: - /** - * Creates a ButterworthCalculator object. - * @param frequency The cutoff frequency. - */ - ButterworthCalculator(float frequency); - - virtual void recalculateCoefficients(SampleRate rate, std::vector<float> &b, std::vector<float> &a); -}; - -AUD_NAMESPACE_END diff --git a/extern/audaspace/include/fx/CallbackIIRFilterReader.h b/extern/audaspace/include/fx/CallbackIIRFilterReader.h deleted file mode 100644 index f1dfab70d7f..00000000000 --- a/extern/audaspace/include/fx/CallbackIIRFilterReader.h +++ /dev/null @@ -1,88 +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 CallbackIIRFilterReader.h - * @ingroup fx - * The CallbackIIRFilterReader class. - */ - -#include "fx/BaseIIRFilterReader.h" - -AUD_NAMESPACE_BEGIN - -class CallbackIIRFilterReader; - -/** - * The doFilterIIR callback is executed when a new sample of a callback filter - * should be calculated. For sample access the CallbackIIRFilterReader is - * provided. Furthermore a user defined pointer is also handed to the callback. - */ -typedef sample_t (*doFilterIIR)(CallbackIIRFilterReader*, void*); - -/** - * The endFilterIIR callback is called when the callback filter is not needed - * anymore. The goal of this function should be to clean up the data behind the - * user supplied pointer which is handed to the callback. - */ -typedef void (*endFilterIIR)(void*); - -/** - * This class provides an interface for infinite impulse response filters via a - * callback filter function. - */ -class AUD_API CallbackIIRFilterReader : public BaseIIRFilterReader -{ -private: - /** - * Filter function. - */ - const doFilterIIR m_filter; - - /** - * End filter function. - */ - const endFilterIIR m_endFilter; - - /** - * Data pointer. - */ - void* m_data; - - // delete copy constructor and operator= - CallbackIIRFilterReader(const CallbackIIRFilterReader&) = delete; - CallbackIIRFilterReader& operator=(const CallbackIIRFilterReader&) = delete; - -public: - /** - * Creates a new callback IIR filter reader. - * \param reader The reader to read from. - * \param in The count of past input samples needed. - * \param out The count of past output samples needed. - * \param doFilter The filter callback. - * \param endFilter The finishing callback. - * \param data Data pointer for the callbacks. - */ - CallbackIIRFilterReader(std::shared_ptr<IReader> reader, int in, int out, doFilterIIR doFilter, endFilterIIR endFilter = 0, void* data = nullptr); - - virtual ~CallbackIIRFilterReader(); - - virtual sample_t filter(); -}; - -AUD_NAMESPACE_END diff --git a/extern/audaspace/include/fx/Convolver.h b/extern/audaspace/include/fx/Convolver.h deleted file mode 100644 index 5ce134839f6..00000000000 --- a/extern/audaspace/include/fx/Convolver.h +++ /dev/null @@ -1,177 +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 - -/** -* @file Convolver.h -* @ingroup fx -* The Convolver class. -*/ - -#include "FFTConvolver.h" -#include "util/ThreadPool.h" -#include "util/FFTPlan.h" - -#include <memory> -#include <vector> -#include <mutex> -#include <future> -#include <atomic> -#include <deque> - -AUD_NAMESPACE_BEGIN -/** -* This class allows to convolve a sound with a very large impulse response. -*/ -class AUD_API Convolver -{ -private: - /** - * The FFT size, must be at least M+L-1. - */ - int m_N; - - /** - * The length of the impulse response parts. - */ - int m_M; - - /** - * The max length of the input slices. - */ - int m_L; - - /** - * The impulse response divided in parts. - */ - std::shared_ptr<std::vector<std::shared_ptr<std::vector<std::complex<sample_t>>>>> m_irBuffers; - - /** - * Accumulation buffers for the threads. - */ - std::vector<fftwf_complex*> m_threadAccBuffers; - - /** - * A vector of FFTConvolvers used to calculate the partial convolutions. - */ - std::vector<std::unique_ptr<FFTConvolver>> m_fftConvolvers; - - /** - * The actual number of threads being used. - */ - int m_numThreads; - - /** - * A pool of threads that will be used for convolution. - */ - std::shared_ptr<ThreadPool> m_threadPool; - - /** - * A vector of futures used for thread sync - */ - std::vector<std::future<bool>> m_futures; - - /** - * A mutex for the sum of thread accumulators. - */ - std::mutex m_sumMutex; - - /** - * A flag to control thread execution when a reset is scheduled. - */ - std::atomic_bool m_resetFlag; - - /** - * Global accumulation buffer. - */ - fftwf_complex* m_accBuffer; - - /** - * Delay line. - */ - std::deque<fftwf_complex*> m_delayLine; - - /** - * The complete length of the impulse response. - */ - int m_irLength; - - /** - * Counter for the tail; - */ - int m_tailCounter; - - /** - * Flag end of sound; - */ - bool m_eos; - - // delete copy constructor and operator= - Convolver(const Convolver&) = delete; - Convolver& operator=(const Convolver&) = delete; - -public: - - /** - * Creates a new FFTConvolver. - * \param ir A shared pointer to a vector with the data of the various impulse response parts in the frequency domain (see ImpulseResponse class for an easy way to obtain it). - * \param irLength The length of the full impulse response. - * \param threadPool A shared pointer to a ThreadPool object with 1 or more threads. - * \param plan A shared pointer to a FFT plan that will be used for convolution. - */ - Convolver(std::shared_ptr<std::vector<std::shared_ptr<std::vector<std::complex<sample_t>>>>> ir, int irLength, std::shared_ptr<ThreadPool> threadPool, std::shared_ptr<FFTPlan> plan); - - virtual ~Convolver(); - - /** - * Convolves the data that is provided with the inpulse response. - * Given a plan of size N, the amount of samples convolved by one call to this method will be N/2. - * \param[in] inBuffer A buffer with the input data to be convolved, nullptr if the source sound has ended (the convolved sound is larger than the source sound). - * \param[in] outBuffer A buffer in which the convolved data will be written. Its size must be at least N/2. - * \param[in,out] length The number of samples you wish to obtain. If an inBuffer is provided this argument must match its length. - * When this method returns, the value of length represents the number of samples written into the outBuffer. - * \param[out] eos True if the end of the sound is reached, false otherwise. - */ - void getNext(sample_t* inBuffer, sample_t* outBuffer, int& length, bool& eos); - - /** - * Resets all the internally stored data so the convolution of a new sound can be started. - */ - void reset(); - - /** - * Retrieves the current impulse response being used. - * \return The current impulse response. - */ - std::shared_ptr<std::vector<std::shared_ptr<std::vector<std::complex<sample_t>>>>> getImpulseResponse(); - - /** - * Changes the impulse response and resets the convolver. - * \param ir A shared pointer to a vector with the data of the various impulse response parts in the frequency domain (see ImpulseResponse class for an easy way to obtain it). - */ - void setImpulseResponse(std::shared_ptr<std::vector<std::shared_ptr<std::vector<std::complex<sample_t>>>>> ir); - -private: - - /** - * This function will be enqueued into the thread pool, and will process the input signal with a subset of the impulse response parts. - * \param id The id of the thread, starting with 0. - */ - bool threadFunction(int id); -}; - -AUD_NAMESPACE_END diff --git a/extern/audaspace/include/fx/ConvolverReader.h b/extern/audaspace/include/fx/ConvolverReader.h deleted file mode 100644 index 2ce917daec5..00000000000 --- a/extern/audaspace/include/fx/ConvolverReader.h +++ /dev/null @@ -1,198 +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 - -/** -* @file ConvolverReader.h -* @ingroup fx -* The ConvolverReader class. -*/ - -#include "IReader.h" -#include "ISound.h" -#include "Convolver.h" -#include "ImpulseResponse.h" -#include "util/FFTPlan.h" -#include "util/ThreadPool.h" - -#include <memory> -#include <vector> -#include <future> - -AUD_NAMESPACE_BEGIN - -/** -* This class represents a reader for a sound that can be modified depending on a given impulse response. -*/ -class AUD_API ConvolverReader : public IReader -{ -private: - /** - * The current position. - */ - int m_position; - - /** - * The reader of the input sound. - */ - std::shared_ptr<IReader> m_reader; - - /** - * The impulse response in the frequency domain. - */ - std::shared_ptr<ImpulseResponse> m_ir; - - /** - * The FFT size, given by the FFTPlan. - */ - int m_N; - - /** - * The length of the impulse response fragments, m_N/2 will be used. - */ - int m_M; - - /** - * The max length of the input slices, m_N/2 will be used. - */ - int m_L; - - /** - * The array of convolvers that will be used, one per channel. - */ - std::vector<std::unique_ptr<Convolver>> m_convolvers; - - /** - * The output buffer in which the convolved data will be written and from which the reader will read. - */ - sample_t* m_outBuffer; - - /** - * A vector of buffers (one per channel) on which the audio signal will be separated per channel so it can be convolved. - */ - std::vector<sample_t*> m_vecInOut; - - /** - * Current position in which the m_outBuffer is being read. - */ - int m_outBufferPos; - - /** - * Effective length of the m_outBuffer. - */ - int m_eOutBufLen; - - /** - * Real length of the m_outBuffer. - */ - int m_outBufLen; - - /** - * Flag indicating whether the end of the sound has been reached or not. - */ - bool m_eosReader; - - /** - * Flag indicating whether the end of the extra data generated in the convolution has been reached or not. - */ - bool m_eosTail; - - /** - * The number of channels of the sound to be convolved. - */ - int m_inChannels; - - /** - * The number of channels of the impulse response. - */ - int m_irChannels; - - /** - * The number of threads used for channels. - */ - int m_nChannelThreads; - - /** - * Length of the input data to be used by the channel threads. - */ - int m_lastLengthIn; - - /** - * A shared ptr to a thread pool. - */ - std::shared_ptr<ThreadPool> m_threadPool; - - /** - * A vector of futures to sync tasks. - */ - std::vector<std::future<int>> m_futures; - - // delete copy constructor and operator= - ConvolverReader(const ConvolverReader&) = delete; - ConvolverReader& operator=(const ConvolverReader&) = delete; - -public: - /** - * Creates a new convolver reader. - * \param reader A reader of the input sound to be assigned to this reader. - * \param ir A shared pointer to an impulseResponse object that will be used to convolve the sound. - * \param threadPool A shared pointer to a ThreadPool object with 1 or more threads. - * \param plan A shared pointer to and FFT plan that will be used for convolution. - * \exception Exception thrown if impulse response doesn't match the specs (number fo channels and rate) of the input reader. - */ - ConvolverReader(std::shared_ptr<IReader> reader, std::shared_ptr<ImpulseResponse> ir, std::shared_ptr<ThreadPool> threadPool, std::shared_ptr<FFTPlan> plan); - virtual ~ConvolverReader(); - - virtual bool isSeekable() const; - virtual void seek(int position); - virtual int getLength() const; - virtual int getPosition() const; - virtual Specs getSpecs() const; - virtual void read(int& length, bool& eos, sample_t* buffer); - -private: - /** - * Divides a sound buffer in several buffers, one per channel. - * \param buffer The buffer that will be divided. - * \param len The length of the buffer. - */ - void divideByChannel(const sample_t* buffer, int len); - - /** - * Joins several buffers (one per channel) into the m_outBuffer. - * \param start The starting position from which the m_outBuffer will be written. - * \param len The amout of samples that will be joined. - */ - void joinByChannel(int start, int len); - - /** - * Loads the m_outBuffer with data. - */ - void loadBuffer(); - - /** - * The function that the threads will run. It will process a subset of channels. - * \param id An id number that will determine which subset of channels will be processed. - * \param input A flag that will indicate if thare is input data. - * -If true there is new input data. - * -If false there isn't new input data. - * \return The number of samples obtained. - */ - int threadFunction(int id, bool input); -}; - -AUD_NAMESPACE_END
\ No newline at end of file diff --git a/extern/audaspace/include/fx/ConvolverSound.h b/extern/audaspace/include/fx/ConvolverSound.h deleted file mode 100644 index 957e3b8af1c..00000000000 --- a/extern/audaspace/include/fx/ConvolverSound.h +++ /dev/null @@ -1,100 +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 - -/** -* @file ConvolverSound.h -* @ingroup fx -* The ConvolverSound class. -*/ - -#include "ISound.h" -#include "ImpulseResponse.h" -#include "util/ThreadPool.h" -#include "util/FFTPlan.h" - -#include <memory> -#include <vector> - -AUD_NAMESPACE_BEGIN - -/** -* This class represents a sound that can be modified depending on a given impulse response. -*/ -class AUD_API ConvolverSound : public ISound -{ -private: - /** - * A pointer to the imput sound. - */ - std::shared_ptr<ISound> m_sound; - - /** - * A pointer to the impulse response. - */ - std::shared_ptr<ImpulseResponse> m_impulseResponse; - - /** - * A shared ptr to a thread pool. - */ - std::shared_ptr<ThreadPool> m_threadPool; - - /** - * A shared ponter to an FFT plan. - */ - std::shared_ptr<FFTPlan> m_plan; - - // delete copy constructor and operator= - ConvolverSound(const ConvolverSound&) = delete; - ConvolverSound& operator=(const ConvolverSound&) = delete; - -public: - /** - * Creates a new ConvolverSound. - * \param sound The sound that will be convolved. - * \param impulseResponse The impulse response sound. - * \param threadPool A shared pointer to a ThreadPool object with 1 or more threads. - * \param plan A shared pointer to a FFTPlan object that will be used for convolution. - * \warning The same FFTPlan object must be used to construct both this and the ImpulseResponse object provided. - */ - ConvolverSound(std::shared_ptr<ISound> sound, std::shared_ptr<ImpulseResponse> impulseResponse, std::shared_ptr<ThreadPool> threadPool, std::shared_ptr<FFTPlan> plan); - - /** - * Creates a new ConvolverSound. A default FFT plan will be created. - * \param sound The sound that will be convolved. - * \param impulseResponse The impulse response sound. - * \param threadPool A shared pointer to a ThreadPool object with 1 or more threads. - * \warning To use this constructor no FFTPlan object must have been provided to the inpulseResponse. - */ - ConvolverSound(std::shared_ptr<ISound> sound, std::shared_ptr<ImpulseResponse> impulseResponse, std::shared_ptr<ThreadPool> threadPool); - - virtual std::shared_ptr<IReader> createReader(); - - /** - * Retrieves the impulse response sound being used. - * \return A shared pointer to the current impulse response being used. - */ - std::shared_ptr<ImpulseResponse> getImpulseResponse(); - - /** - * Changes the inpulse response used for convolution, it'll only affect newly created readers. - * \param impulseResponse A shared pointer to the new impulse response sound. - */ - void setImpulseResponse(std::shared_ptr<ImpulseResponse> impulseResponse); -}; - -AUD_NAMESPACE_END
\ No newline at end of file diff --git a/extern/audaspace/include/fx/Delay.h b/extern/audaspace/include/fx/Delay.h deleted file mode 100644 index d6ab93ca351..00000000000 --- a/extern/audaspace/include/fx/Delay.h +++ /dev/null @@ -1,60 +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 Delay.h - * @ingroup fx - * The Delay class. - */ - -#include "fx/Effect.h" - -AUD_NAMESPACE_BEGIN - -/** - * This sound plays another sound delayed. - */ -class AUD_API Delay : public Effect -{ -private: - /** - * The delay in samples. - */ - const float m_delay; - - // delete copy constructor and operator= - Delay(const Delay&) = delete; - Delay& operator=(const Delay&) = delete; - -public: - /** - * Creates a new delay sound. - * \param sound The input sound. - * \param delay The desired delay in seconds. - */ - Delay(std::shared_ptr<ISound> sound, float delay = 0); - - /** - * Returns the delay in seconds. - */ - float getDelay() const; - - virtual std::shared_ptr<IReader> createReader(); -}; - -AUD_NAMESPACE_END diff --git a/extern/audaspace/include/fx/DelayReader.h b/extern/audaspace/include/fx/DelayReader.h deleted file mode 100644 index fe37e56d83e..00000000000 --- a/extern/audaspace/include/fx/DelayReader.h +++ /dev/null @@ -1,63 +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 DelayReader.h - * @ingroup fx - * The DelayReader class. - */ - -#include "fx/EffectReader.h" - -AUD_NAMESPACE_BEGIN - -/** - * This class reads another reader and delays it. - */ -class AUD_API DelayReader : public EffectReader -{ -private: - /** - * The delay level. - */ - const int m_delay; - - /** - * The remaining delay for playback. - */ - int m_remdelay; - - // delete copy constructor and operator= - DelayReader(const DelayReader&) = delete; - DelayReader& operator=(const DelayReader&) = delete; - -public: - /** - * Creates a new delay reader. - * \param reader The reader to read from. - * \param delay The delay in seconds. - */ - DelayReader(std::shared_ptr<IReader> reader, float delay); - - virtual void seek(int position); - virtual int getLength() const; - virtual int getPosition() const; - virtual void read(int& length, bool& eos, sample_t* buffer); -}; - -AUD_NAMESPACE_END diff --git a/extern/audaspace/include/fx/DynamicIIRFilter.h b/extern/audaspace/include/fx/DynamicIIRFilter.h deleted file mode 100644 index 5528e7c7b9b..00000000000 --- a/extern/audaspace/include/fx/DynamicIIRFilter.h +++ /dev/null @@ -1,54 +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 DynamicIIRFilter.h - * @ingroup fx - * The DynamicIIRFilter class. - */ - -#include "fx/Effect.h" - -AUD_NAMESPACE_BEGIN - -class IDynamicIIRFilterCalculator; - -/** - * This sound creates a IIR filter reader. - * - * This means that on sample rate change the filter recalculates its - * coefficients. - */ -class AUD_API DynamicIIRFilter : public Effect -{ -protected: - /// The IDynamicIIRFilterCalculator that calculates the dynamic filter coefficients. - std::shared_ptr<IDynamicIIRFilterCalculator> m_calculator; - -public: - /** - * Creates a new Dynmic IIR filter sound. - * \param sound The input sound. - * \param calculator The calculator which recalculates the dynamic filter coefficients. - */ - DynamicIIRFilter(std::shared_ptr<ISound> sound, std::shared_ptr<IDynamicIIRFilterCalculator> calculator); - - virtual std::shared_ptr<IReader> createReader(); -}; - -AUD_NAMESPACE_END diff --git a/extern/audaspace/include/fx/DynamicIIRFilterReader.h b/extern/audaspace/include/fx/DynamicIIRFilterReader.h deleted file mode 100644 index 9e2267243ce..00000000000 --- a/extern/audaspace/include/fx/DynamicIIRFilterReader.h +++ /dev/null @@ -1,60 +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 DynamicIIRFilterReader.h - * @ingroup fx - * The DynamicIIRFilterReader class. - */ - -#include "fx/IIRFilterReader.h" - -AUD_NAMESPACE_BEGIN - -class IDynamicIIRFilterCalculator; - -/** - * This class is for dynamic infinite impulse response filters with simple - * coefficients that change depending on the sample rate. - */ -class AUD_API DynamicIIRFilterReader : public IIRFilterReader -{ -private: - /** - * The sound for dynamically recalculating filter coefficients. - */ - std::shared_ptr<IDynamicIIRFilterCalculator> m_calculator; - -public: - /** - * Creates a new DynamicIIRFilterReader. - * @param reader The reader the filter is applied on. - * @param calculator The IDynamicIIRFilterCalculator that recalculates the filter coefficients. - */ - DynamicIIRFilterReader(std::shared_ptr<IReader> reader, - std::shared_ptr<IDynamicIIRFilterCalculator> calculator); - - /** - * The function sampleRateChanged is called whenever the sample rate of the - * underlying reader changes and thus updates the filter coefficients. - * @param rate The new sample rate. - */ - virtual void sampleRateChanged(SampleRate rate); -}; - -AUD_NAMESPACE_END diff --git a/extern/audaspace/include/fx/DynamicMusic.h b/extern/audaspace/include/fx/DynamicMusic.h deleted file mode 100644 index 5d59f77401a..00000000000 --- a/extern/audaspace/include/fx/DynamicMusic.h +++ /dev/null @@ -1,235 +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 - -/** -* @file DynamicMusic.h -* @ingroup fx -* The DynamicMusic class. -*/ - -#include "devices/IHandle.h" -#include "devices/IDevice.h" -#include "ISound.h" - -#include <memory> -#include <vector> -#include <thread> -#include <atomic> -#include <condition_variable> -#include <mutex> - -AUD_NAMESPACE_BEGIN - -/** -* This class allows to play music depending on a current "scene", scene changes are managed by the class. -* The default scene is silent and has id 0. -*/ -class AUD_API DynamicMusic -{ -private: - /** - * Matrix of pointers which will store the sounds of the scenes and the transitions between them. - */ - std::vector<std::vector<std::shared_ptr<ISound>>> m_scenes; - - /** - * Id of the current scene. - */ - std::atomic_int m_id; - - /** - * Length of the crossfade transition in seconds, used when no custom transition has been set. - */ - float m_fadeTime; - - /** - * Handle to the playback of the current scene. - */ - std::shared_ptr<IHandle> m_currentHandle; - - /** - * Handle used during transitions. - */ - std::shared_ptr<IHandle> m_transitionHandle; - - /** - * Device used for playback. - */ - std::shared_ptr<IDevice> m_device; - - /** - * Flag that is true when a transition is happening. - */ - std::atomic_bool m_transitioning; - - /** - * Flag that is true when the music is paused. - */ - std::atomic_bool m_stopThread; - - /** - * Id of the sound that will play with the next transition. - */ - std::atomic_int m_soundTarget; - - /** - * Volume of the scenes. - */ - float m_volume; - - /** - * A thread that manages the crossfade transition. - */ - std::thread m_fadeThread; - - // delete copy constructor and operator= - DynamicMusic(const DynamicMusic&) = delete; - DynamicMusic& operator=(const DynamicMusic&) = delete; - -public: - /** - * Creates a new dynamic music manager with the default silent scene (id: 0). - * \param device The device that will be used to play sounds. - */ - DynamicMusic(std::shared_ptr<IDevice> device); - - virtual ~DynamicMusic(); - - /** - * Adds a new scene to the manager. - * \param sound The sound that will play when the scene is selected with the changeScene(). - * \return The identifier of the new scene. - */ - int addScene(std::shared_ptr<ISound> sound); - - /** - * Changes to another scene. - * \param id The id of the scene which should start playing the changeScene method. - * \return - * - true if the change has been scheduled succesfully. - * - false if there already is a transition in course or the scene selected doesnt exist. - */ - bool changeScene(int id); - - /** - * Retrieves the scene currently selected. - * \return The identifier of the current scene. - */ - int getScene(); - - /** - * Adds a new transition between scenes - * \param init The id of the initial scene that will allow the transition to play. - * \param end The id if the target scene for the transition. - * \param sound The sound that will play when the scene changes from init to end. - * \return false if the init or end scenes don't exist. - */ - bool addTransition(int init, int end, std::shared_ptr<ISound> sound); - - /** - * Sets the length of the crossfade transition (default 1 second). - * \param seconds The time in seconds. - */ - void setFadeTime(float seconds); - - /** - * Gets the length of the crossfade transition (default 1 second). - * \return The length of the cressfade transition in seconds. - */ - float getFadeTime(); - - /** - * Resumes a paused sound. - * \return - * - true if the sound has been resumed. - * - false if the sound isn't paused or the handle is invalid. - */ - bool resume(); - - /** - * Pauses the current played back sound. - * \return - * - true if the sound has been paused. - * - false if the sound isn't playing back or the handle is invalid. - */ - bool pause(); - - /** - * Seeks in the current 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. - */ - bool seek(float position); - - /** - * Retrieves the current playback position of a sound. - * \return The playback position in seconds, or 0.0 if the handle is - * invalid. - */ - float getPosition(); - - /** - * Retrieves the volume of the scenes. - * \return The volume. - */ - float getVolume(); - - /** - * Sets the volume for the scenes. - * \param volume The volume. - * \return - * - true if the handle is valid. - * - false if the handle is invalid. - */ - bool setVolume(float volume); - - /** - * Returns the status of the current 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 - */ - Status getStatus(); - - /** - * Stops any played back or paused sound and sets the dynamic music player to default silent state (scene 0) - * \return - * - true if the sound has been stopped. - * - false if the handle is invalid. - */ - bool stop(); - - private: - //Callbacks used to schedule transitions after a sound ends. - static void transitionCallback(void* player); - static void sceneCallback(void* player); - //These functions can fade sounds in and out if used with a thread. - void crossfadeThread(); - void fadeInThread(); - void fadeOutThread(); -}; - -AUD_NAMESPACE_END diff --git a/extern/audaspace/include/fx/Effect.h b/extern/audaspace/include/fx/Effect.h deleted file mode 100644 index 471e37b5ecf..00000000000 --- a/extern/audaspace/include/fx/Effect.h +++ /dev/null @@ -1,76 +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 Effect.h - * @ingroup fx - * The Effect class. - */ - -#include "ISound.h" - -AUD_NAMESPACE_BEGIN - -/** - * This sound is a base class for all effect factories that take one other - * sound as input. - */ -class AUD_API Effect : public ISound -{ -private: - // delete copy constructor and operator= - Effect(const Effect&) = delete; - Effect& operator=(const Effect&) = delete; - -protected: - /** - * If there is no reader it is created out of this sound. - */ - std::shared_ptr<ISound> m_sound; - - /** - * Returns the reader created out of the sound. - * This method can be used for the createReader function of the implementing - * classes. - * \return The reader created out of the sound. - */ - inline std::shared_ptr<IReader> getReader() const - { - return m_sound->createReader(); - } - -public: - /** - * Creates a new sound. - * \param sound The input sound. - */ - Effect(std::shared_ptr<ISound> sound); - - /** - * Destroys the sound. - */ - virtual ~Effect(); - - /** - * Returns the saved sound. - * \return The sound or nullptr if there has no sound been saved. - */ - std::shared_ptr<ISound> getSound() const; -}; - -AUD_NAMESPACE_END diff --git a/extern/audaspace/include/fx/EffectReader.h b/extern/audaspace/include/fx/EffectReader.h deleted file mode 100644 index 85eff6a8ab9..00000000000 --- a/extern/audaspace/include/fx/EffectReader.h +++ /dev/null @@ -1,68 +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 EffectReader.h - * @ingroup fx - * The EffectReader class. - */ - -#include "IReader.h" - -#include <memory> - -AUD_NAMESPACE_BEGIN - -/** - * This reader is a base class for all effect readers that take one other reader - * as input. - */ -class AUD_API EffectReader : public IReader -{ -private: - // delete copy constructor and operator= - EffectReader(const EffectReader&) = delete; - EffectReader& operator=(const EffectReader&) = delete; - -protected: - /** - * The reader to read from. - */ - std::shared_ptr<IReader> m_reader; - -public: - /** - * Creates a new effect reader. - * \param reader The reader to read from. - */ - EffectReader(std::shared_ptr<IReader> reader); - - /** - * Destroys the reader. - */ - virtual ~EffectReader(); - - virtual bool isSeekable() const; - virtual void seek(int position); - virtual int getLength() const; - virtual int getPosition() const; - virtual Specs getSpecs() const; - virtual void read(int& length, bool& eos, sample_t* buffer); -}; - -AUD_NAMESPACE_END diff --git a/extern/audaspace/include/fx/Envelope.h b/extern/audaspace/include/fx/Envelope.h deleted file mode 100644 index 3d44e897b3a..00000000000 --- a/extern/audaspace/include/fx/Envelope.h +++ /dev/null @@ -1,93 +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 Envelope.h - * @ingroup fx - * The Envelope class. - */ - -#include "fx/Effect.h" - -AUD_NAMESPACE_BEGIN - -class CallbackIIRFilterReader; -struct EnvelopeParameters; - -/** - * This sound creates an envelope follower reader. - */ -class AUD_API Envelope : public Effect -{ -private: - /** - * The attack value in seconds. - */ - const float m_attack; - - /** - * The release value in seconds. - */ - const float m_release; - - /** - * The threshold value. - */ - const float m_threshold; - - /** - * The attack/release threshold value. - */ - const float m_arthreshold; - - // delete copy constructor and operator= - Envelope(const Envelope&) = delete; - Envelope& operator=(const Envelope&) = delete; - -public: - /** - * Creates a new envelope sound. - * \param sound The input sound. - * \param attack The attack value in seconds. - * \param release The release value in seconds. - * \param threshold The threshold value. - * \param arthreshold The attack/release threshold value. - */ - Envelope(std::shared_ptr<ISound> sound, float attack, float release, - float threshold, float arthreshold); - - virtual std::shared_ptr<IReader> createReader(); - - /** - * The envelopeFilter function implements the doFilterIIR callback - * for the callback IIR filter. - * @param reader The CallbackIIRFilterReader that executes the callback. - * @param param The envelope parameters. - * @return The filtered sample. - */ - static sample_t AUD_LOCAL envelopeFilter(CallbackIIRFilterReader* reader, EnvelopeParameters* param); - - /** - * The endEnvelopeFilter function implements the endFilterIIR callback - * for the callback IIR filter. - * @param param The envelope parameters. - */ - static void AUD_LOCAL endEnvelopeFilter(EnvelopeParameters* param); -}; - -AUD_NAMESPACE_END diff --git a/extern/audaspace/include/fx/FFTConvolver.h b/extern/audaspace/include/fx/FFTConvolver.h deleted file mode 100644 index 62ce1cbf5ad..00000000000 --- a/extern/audaspace/include/fx/FFTConvolver.h +++ /dev/null @@ -1,196 +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 - -/** -* @file FFTConvolver.h -* @ingroup fx -* The FFTConvolver class. -*/ - -#include "IReader.h" -#include "ISound.h" -#include "util/FFTPlan.h" - -#include <memory> -#include <vector> - -AUD_NAMESPACE_BEGIN -/** -* This class allows to easily convolve a sound using the Fourier transform. -*/ -class AUD_API FFTConvolver -{ -private: - /** - * A shared pointer to an FFT plan. - */ - std::shared_ptr<FFTPlan> m_plan; - - /** - * The FFT size, must be at least M+L-1. - */ - int m_N; - - /** - * The length of the impulse response. - */ - int m_M; - - /** - * The max length of the input slices. - */ - int m_L; - - /** - * The real length of the internal buffer in fftwf_complex elements. - */ - int m_realBufLen; - - /** - * The internal buffer for the FFTS. - */ - std::complex<sample_t>* m_inBuffer; - - /** - * A shift buffer for the FDL method - */ - sample_t* m_shiftBuffer; - - /** - * A buffer to store the extra data obtained after each partial convolution. - */ - float* m_tail; - - /** - * The provided impulse response. - */ - std::shared_ptr<std::vector<std::complex<sample_t>>> m_irBuffer; - - /** - * If the tail is being read, this marks the current position. - */ - int m_tailPos; - - // delete copy constructor and operator= - FFTConvolver(const FFTConvolver&) = delete; - FFTConvolver& operator=(const FFTConvolver&) = delete; - -public: - /** - * Creates a new FFTConvolver. - * \param ir A shared pointer to a vector with the impulse response data in the frequency domain (see ImpulseResponse class for an easy way to obtain it). - * \param plan A shared pointer to and FFT plan. - */ - FFTConvolver(std::shared_ptr<std::vector<std::complex<sample_t>>> ir, std::shared_ptr<FFTPlan> plan); - virtual ~FFTConvolver(); - - /** - * Convolves the data that is provided with the inpulse response. - * \param[in] inBuffer A buffer with the input data to be convolved. - * \param[in] outBuffer A pointer to the buffer in which the convolution result will be written. - * \param[in,out] length The number of samples to be convolved (the length of both the inBuffer and the outBuffer). - * The convolution output should be larger than the input, but since this class uses the overlap - * add method, the extra length will be saved internally. - * It must be equal or lower than N/2 (N=size of the FFTPlan) or the call will fail, setting this variable to 0 since no data would be - * written in the outBuffer. - */ - void getNext(const sample_t* inBuffer, sample_t* outBuffer, int& length); - - /** - * Convolves the data that is provided with the inpulse response. - * \param[in] inBuffer A buffer with the input data to be convolved. - * \param[in] outBuffer A pointer to the buffer in which the convolution result will be written. - * \param[in,out] length The number of samples to be convolved (the length of both the inBuffer and the outBuffer). - * The convolution output should be larger than the input, but since this class uses the overlap - * add method, the extra length will be saved internally. - * It must be equal or lower than N/2 (N=size of the FFTPlan) or the call will fail, setting this variable to 0 since no data would be - * written in the outBuffer. - * \param[in] transformedData A pointer to a buffer in which the Fourier transform of the input will be written. - */ - void getNext(const sample_t* inBuffer, sample_t* outBuffer, int& length, fftwf_complex* transformedData); - - /** - * Convolves the data that is provided with the inpulse response. - * \param[in] inBuffer A buffer with the input data to be convolved. Its length must be N/2 + 1 - * \param[in] outBuffer A pointer to the buffer in which the convolution result will be written. - * \param[in,out] length The number of samples to be convolved and the length of the outBuffer. - * The convolution output should be larger than the input, but since this class uses the overlap - * add method, the extra length will be saved internally. - * It must be equal or lower than N/2 (N=size of the FFTPlan) or the call will fail and set the value of length to 0 since no data would be - * written in the outBuffer. - */ - void getNext(const fftwf_complex* inBuffer, sample_t* outBuffer, int& length); - - /** - * Gets the internally stored extra data which is result of the convolution. - * \param[in,out] length The count of samples that should be read. Shall - * contain the real count of samples after reading, in case - * there were only fewer samples available. - * A smaller value also indicates the end of the data. - * \param[out] eos End of stream, whether the end is reached or not. - * \param[in] buffer The pointer to the buffer to read into. - */ - void getTail(int& length, bool& eos, sample_t* buffer); - - /** - * Resets the internally stored data so a new convolution can be started. - */ - void clear(); - - /** - * Calculates the Inverse Fast Fourier Transform of the input array. - * \param[in] inBuffer A buffer with the input data to be transformed. Its length must be N/2 + 1 - * \param[in] outBuffer A pointer to the buffer in which the transform result will be written. - * \param[in,out] length The number of samples to be transformed and the length of the outBuffer. - * It must be equal or lower than N, but tipically N/2 should be used (N=size of the FFTPlan) or the call will fail and the value - * of length will be setted to 0, since no data would be written in the outBuffer. - */ - void IFFT_FDL(const fftwf_complex* inBuffer, sample_t* outBuffer, int& length); - - /** - * Multiplicates a frequency domain input by the impulse response and accumulates the result to a buffer. - * \param[in] inBuffer A buffer of complex numbers, samples in the frequency domain, that will be multiplied by the impulse response. Its length must be N/2 + 1 - * \param[in] accBuffer A pointer to the buffer into which the result of the multiplication will be summed. Its length must be N/2 + 1 - */ - void getNextFDL(const std::complex<sample_t>* inBuffer, std::complex<sample_t>* accBuffer); - - /** - * Transforms an input array of real data to the frequency domain and multiplies it by the impulse response. The result is accumulated to a buffer. - * \param[in] inBuffer A buffer of real numbers, samples in the time domain, that will be multiplied by the impulse response. - * \param[in] accBuffer A pointer to the buffer into which the result of the multiplication will be summed. Its length must be N/2 + 1. - * \param[in,out] length The number of samples to be transformed and the length of the inBuffer. - * It must be equal or lower than N/2 (N=size of the FFTPlan) or the call will fail and the value - * of length will be setted to 0, since no data would be written in the outBuffer. - * \param[in] transformedData A pointer to a buffer in which the Fourier transform of the input will be written. - */ - void getNextFDL(const sample_t* inBuffer, std::complex<sample_t>* accBuffer, int& length, fftwf_complex* transformedData); - - /** - * Changes the impulse response and resets the FFTConvolver. - * \param ir A shared pointer to a vector with the data of the impulse response in the frequency domain. - */ - void setImpulseResponse(std::shared_ptr<std::vector<std::complex<sample_t>>> ir); - - /** - * Retrieves the current impulse response being used. - * \return The current impulse response. - */ - std::shared_ptr<std::vector<std::complex<sample_t>>> getImpulseResponse(); -}; - -AUD_NAMESPACE_END diff --git a/extern/audaspace/include/fx/Fader.h b/extern/audaspace/include/fx/Fader.h deleted file mode 100644 index 63280aec292..00000000000 --- a/extern/audaspace/include/fx/Fader.h +++ /dev/null @@ -1,87 +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 Fader.h - * @ingroup fx - * The Fader class. - */ - -#include "fx/Effect.h" -#include "fx/FaderReader.h" - -AUD_NAMESPACE_BEGIN - -/** - * This sound fades another sound. - * If the fading type is FADE_IN, everything before the fading start will be - * silenced, for FADE_OUT that's true for everything after fading ends. - */ -class AUD_API Fader : public Effect -{ -private: - /** - * The fading type. - */ - const FadeType m_type; - - /** - * The fading start. - */ - const float m_start; - - /** - * The fading length. - */ - const float m_length; - - // delete copy constructor and operator= - Fader(const Fader&) = delete; - Fader& operator=(const Fader&) = delete; - -public: - /** - * Creates a new fader sound. - * \param sound The input sound. - * \param type The fading type. - * \param start The time where fading should start in seconds. - * \param length How long fading should last in seconds. - */ - Fader(std::shared_ptr<ISound> sound, - FadeType type = FADE_IN, - float start = 0.0f, float length = 1.0f); - - /** - * Returns the fading type. - */ - FadeType getType() const; - - /** - * Returns the fading start. - */ - float getStart() const; - - /** - * Returns the fading length. - */ - float getLength() const; - - virtual std::shared_ptr<IReader> createReader(); -}; - -AUD_NAMESPACE_END diff --git a/extern/audaspace/include/fx/FaderReader.h b/extern/audaspace/include/fx/FaderReader.h deleted file mode 100644 index 99ea3d28938..00000000000 --- a/extern/audaspace/include/fx/FaderReader.h +++ /dev/null @@ -1,77 +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 FaderReader.h - * @ingroup fx - * Defines the FaderReader class as well as the two fading types. - */ - -#include "fx/EffectReader.h" - -AUD_NAMESPACE_BEGIN - -/// Fading types. -enum FadeType -{ - FADE_IN, - FADE_OUT -}; - -/** - * This class fades another reader. - * If the fading type is FADE_IN, everything before the fading start will be - * silenced, for FADE_OUT that's true for everything after fading ends. - */ -class AUD_API FaderReader : public EffectReader -{ -private: - /** - * The fading type. - */ - const FadeType m_type; - - /** - * The fading start. - */ - const float m_start; - - /** - * The fading length. - */ - const float m_length; - - // delete copy constructor and operator= - FaderReader(const FaderReader&) = delete; - FaderReader& operator=(const FaderReader&) = delete; - -public: - /** - * Creates a new fader reader. - * \param reader The reader that this effect is applied on. - * \param type The fading type. - * \param start The time where fading should start in seconds. - * \param length How long fading should last in seconds. - */ - FaderReader(std::shared_ptr<IReader> reader, FadeType type, - float start,float length); - - virtual void read(int& length, bool& eos, sample_t* buffer); -}; - -AUD_NAMESPACE_END diff --git a/extern/audaspace/include/fx/HRTF.h b/extern/audaspace/include/fx/HRTF.h deleted file mode 100644 index 750d5f18991..00000000000 --- a/extern/audaspace/include/fx/HRTF.h +++ /dev/null @@ -1,108 +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 - -/** -* @file HRTF.h -* @ingroup fx -* The HRTF class. -*/ - -#include "util/StreamBuffer.h" -#include "util/FFTPlan.h" -#include "ImpulseResponse.h" - -#include <memory> -#include <vector> -#include <unordered_map> -#include <utility> - -AUD_NAMESPACE_BEGIN - -/** -* This class represents a complete set of HRTFs. -*/ -class AUD_API HRTF -{ -private: - /** - * An unordered map of unordered maps containing the ImpulseResponse objects of the HRTFs. - */ - std::unordered_map<float, std::unordered_map<float, std::shared_ptr<ImpulseResponse>>> m_hrtfs; - - /** - * The FFTPlan used to create the ImpulseResponses. - */ - std::shared_ptr<FFTPlan> m_plan; - - /** - * The specifications of the HRTFs. - */ - Specs m_specs; - - /** - * True if the HRTF object is empty. - */ - bool m_empty; - - // delete copy constructor and operator= - HRTF(const HRTF&) = delete; - HRTF& operator=(const HRTF&) = delete; - -public: - /** - * Creates a new empty HRTF object that will instance it own FFTPlan with default size. - */ - HRTF(); - - /** - * Creates a new empty HRTF object. - * \param plan A shared pointer to a FFT plan used to transform the impulse responses added. - */ - HRTF(std::shared_ptr<FFTPlan> plan); - - /** - * Adds a new HRTF to the class. - * \param impulseResponse A shared pointer to an StreamBuffer with the HRTF. - * \param azimuth The azimuth angle of the HRTF. Interval [0,360). - * \param elevation The elevation angle of the HRTF. - * \return True if the impulse response was added successfully, false otherwise (the specs weren't correct). - */ - bool addImpulseResponse(std::shared_ptr<StreamBuffer> impulseResponse, float azimuth, float elevation); - - /** - * Retrieves a pair of HRTFs for a certain azimuth and elevation. If no exact match is found, the closest ones will be chosen (the elevation has priority over the azimuth). - * \param[in,out] azimuth The desired azimuth angle. If no exact match is found, the value of azimuth will represent the actual azimuth elevation of the chosen HRTF. Interval [0,360) - * \param[in,out] elevation The desired elevation angle. If no exact match is found, the value of elevation will represent the actual elevation angle of the chosen HRTF. - * \return A pair of shared pointers to ImpulseResponse objects containing the HRTFs for the left (first element) and right (second element) ears. - */ - std::pair<std::shared_ptr<ImpulseResponse>, std::shared_ptr<ImpulseResponse>> getImpulseResponse(float &azimuth, float &elevation); - - /** - * Retrieves the specs shared by all the HRTFs. - * \return The shared specs of all the HRTFs. - */ - Specs getSpecs(); - - /** - * Retrieves the state of the HRTF object. - * \return True if it is empty, false otherwise. - */ - bool isEmpty(); -}; - -AUD_NAMESPACE_END diff --git a/extern/audaspace/include/fx/HRTFLoader.h b/extern/audaspace/include/fx/HRTFLoader.h deleted file mode 100644 index 893184ae909..00000000000 --- a/extern/audaspace/include/fx/HRTFLoader.h +++ /dev/null @@ -1,99 +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 - -/** -* @file HRTFLoader.h -* @ingroup fx -* The HRTFLoader class. -*/ - -#include "Audaspace.h" -#include "fx/HRTF.h" -#include "util/FFTPlan.h" - -#include <string> -#include <memory> - -AUD_NAMESPACE_BEGIN - -/** -* This loader provides a method to load all the HRTFs in one directory, provided they follow the following naming scheme: -* Example: L-10e210a.wav -* The first character refers to the ear from which the HRTF was recorded: 'L' for a left ear and 'R' for a right ear. -* Next is the elevation angle followed by the 'e' character. [-90, 90] -* Then is the azimuth angle followed by the 'a' character. [0, 360) -* For a sound source situated at the left of the listener the azimuth angle regarding the left ear is 90 while the angle regarding the right ear is 270. -* KEMAR HRTFs use this naming scheme. -*/ -class AUD_API HRTFLoader -{ -private: - // delete normal constructor, copy constructor and operator= - HRTFLoader(const HRTFLoader&) = delete; - HRTFLoader& operator=(const HRTFLoader&) = delete; - HRTFLoader() = delete; - -public: - /** - * Loads all the left ear HRTFs in the directory.Onle one ear HRTFs for all azimuths [0,360) are needed for binaural sound. - * \param plan The plan that will be used to create the HRTF object. - * \param fileExtension The extension of the HRTF files. - * \param path The path to the folder containing the HRTFs. - * \return A shared pointer to a loaded HRTF object. - */ - static std::shared_ptr<HRTF> loadLeftHRTFs(std::shared_ptr<FFTPlan> plan, const std::string& fileExtension, const std::string& path = ""); - - /** - * Loads all the right ear HRTFs in the directory. Onle one ear HRTFs for all azimuths [0,360) are needed for binaural sound. - * \param plan The plan that will be used to create the HRTF object. - * \param fileExtension The extension of the HRTF files. - * \param path The path to the folder containing the HRTFs. - * \return A shared pointer to a loaded HRTF object. - */ - static std::shared_ptr<HRTF> loadRightHRTFs(std::shared_ptr<FFTPlan> plan, const std::string& fileExtension, const std::string& path = ""); - - /** - * Loads all the left ear HRTFs in the directory.Onle one ear HRTFs for all azimuths [0,360) are needed for binaural sound. - * \param fileExtension The extension of the HRTF files. - * \param path The path to the folder containing the HRTFs. - * \return A shared pointer to a loaded HRTF object. - */ - static std::shared_ptr<HRTF> loadLeftHRTFs(const std::string& fileExtension, const std::string& path = ""); - - /** - * Loads all the right ear HRTFs in the directory. Onle one ear HRTFs for all azimuths [0,360) are needed for binaural sound. - * \param fileExtension The extension of the HRTF files. - * \param path The path to the folder containing the HRTFs. - * \return A shared pointer to a loaded HRTF object. - */ - static std::shared_ptr<HRTF> loadRightHRTFs(const std::string& fileExtension, const std::string& path = ""); - - -private: - - /** - * Loads all the HRTFs in the directory and subdirectories. - * \param hrtfs An HRTF object in which to load the HRTFs. - * \param ear 'L' to load left ear HRTFs, 'R' to load right ear HRTFs. - * \param fileExtension The extension of the HRTF files. - * \param path The path to the folder containing the HRTFs. - */ - static void loadHRTFs(std::shared_ptr<HRTF>hrtfs, char ear, const std::string& fileExtension, const std::string& path = ""); -}; - -AUD_NAMESPACE_END diff --git a/extern/audaspace/include/fx/Highpass.h b/extern/audaspace/include/fx/Highpass.h deleted file mode 100644 index 6bfb6d7885d..00000000000 --- a/extern/audaspace/include/fx/Highpass.h +++ /dev/null @@ -1,49 +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 Highpass.h - * @ingroup fx - * The Highpass class. - */ - -#include "fx/DynamicIIRFilter.h" - -AUD_NAMESPACE_BEGIN - -/** - * This sound creates a highpass filter reader. - */ -class AUD_API Highpass : public DynamicIIRFilter -{ -private: - // delete copy constructor and operator= - Highpass(const Highpass&) = delete; - Highpass& operator=(const Highpass&) = delete; - -public: - /** - * Creates a new highpass sound. - * \param sound The input sound. - * \param frequency The cutoff frequency. - * \param Q The Q factor. - */ - Highpass(std::shared_ptr<ISound> sound, float frequency, float Q = 1.0f); -}; - -AUD_NAMESPACE_END diff --git a/extern/audaspace/include/fx/HighpassCalculator.h b/extern/audaspace/include/fx/HighpassCalculator.h deleted file mode 100644 index 9306a3d20e5..00000000000 --- a/extern/audaspace/include/fx/HighpassCalculator.h +++ /dev/null @@ -1,61 +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 HighpassCalculator.h - * @ingroup fx - * The HighpassCalculator class. - */ - -#include "fx/IDynamicIIRFilterCalculator.h" - -AUD_NAMESPACE_BEGIN - -/** - * The HighpassCalculator class calculates high pass filter coefficients for a - * dynamic DynamicIIRFilter. - */ -class AUD_LOCAL HighpassCalculator : public IDynamicIIRFilterCalculator -{ -private: - /** - * The cutoff frequency. - */ - const float m_frequency; - - /** - * The Q factor. - */ - const float m_Q; - - // delete copy constructor and operator= - HighpassCalculator(const HighpassCalculator&) = delete; - HighpassCalculator& operator=(const HighpassCalculator&) = delete; - -public: - /** - * Creates a HighpassCalculator object. - * @param frequency The cutoff frequency. - * @param Q The Q factor of the filter. If unsure, use 1.0 as default. - */ - HighpassCalculator(float frequency, float Q); - - virtual void recalculateCoefficients(SampleRate rate, std::vector<float> &b, std::vector<float> &a); -}; - -AUD_NAMESPACE_END diff --git a/extern/audaspace/include/fx/IDynamicIIRFilterCalculator.h b/extern/audaspace/include/fx/IDynamicIIRFilterCalculator.h deleted file mode 100644 index 6c890b313b4..00000000000 --- a/extern/audaspace/include/fx/IDynamicIIRFilterCalculator.h +++ /dev/null @@ -1,50 +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 IDynamicIIRFilterCalculator.h - * @ingroup fx - * The IDynamicIIRFilterCalculator interface. - */ - -#include "respec/Specification.h" - -#include <vector> - -AUD_NAMESPACE_BEGIN - -/** - * @interface IDynamicIIRFilterCalculator - * This interface calculates dynamic filter coefficients which depend on the - * sampling rate for DynamicIIRFilterReaders. - */ -class AUD_API IDynamicIIRFilterCalculator -{ -public: - virtual ~IDynamicIIRFilterCalculator() {} - - /** - * Recalculates the filter coefficients. - * \param rate The sample rate of the audio data. - * \param[out] b The input filter coefficients. - * \param[out] a The output filter coefficients. - */ - virtual void recalculateCoefficients(SampleRate rate, std::vector<float>& b, std::vector<float>& a)=0; -}; - -AUD_NAMESPACE_END diff --git a/extern/audaspace/include/fx/IIRFilter.h b/extern/audaspace/include/fx/IIRFilter.h deleted file mode 100644 index 74099a30dc5..00000000000 --- a/extern/audaspace/include/fx/IIRFilter.h +++ /dev/null @@ -1,63 +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 IIRFilter.h - * @ingroup fx - * The IIRFilter class. - */ - -#include "fx/Effect.h" - -#include <vector> - -AUD_NAMESPACE_BEGIN - -/** - * This sound creates a IIR filter reader. - */ -class AUD_API IIRFilter : public Effect -{ -private: - /** - * Output filter coefficients. - */ - std::vector<float> m_a; - - /** - * Input filter coefficients. - */ - std::vector<float> m_b; - - // delete copy constructor and operator= - IIRFilter(const IIRFilter&) = delete; - IIRFilter& operator=(const IIRFilter&) = delete; - -public: - /** - * Creates a new IIR filter sound. - * \param sound The input sound. - * \param b The input filter coefficients. - * \param a The output filter coefficients. - */ - IIRFilter(std::shared_ptr<ISound> sound, const std::vector<float>& b, const std::vector<float>& a); - - virtual std::shared_ptr<IReader> createReader(); -}; - -AUD_NAMESPACE_END diff --git a/extern/audaspace/include/fx/IIRFilterReader.h b/extern/audaspace/include/fx/IIRFilterReader.h deleted file mode 100644 index 34518ce69c6..00000000000 --- a/extern/audaspace/include/fx/IIRFilterReader.h +++ /dev/null @@ -1,70 +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 IIRFilterReader.h - * @ingroup fx - * The IIRFilterReader class. - */ - -#include "fx/BaseIIRFilterReader.h" - -#include <vector> - -AUD_NAMESPACE_BEGIN - -/** - * This class is for infinite impulse response filters with simple coefficients. - */ -class AUD_API IIRFilterReader : public BaseIIRFilterReader -{ -private: - /** - * Output filter coefficients. - */ - std::vector<float> m_a; - - /** - * Input filter coefficients. - */ - std::vector<float> m_b; - - // delete copy constructor and operator= - IIRFilterReader(const IIRFilterReader&) = delete; - IIRFilterReader& operator=(const IIRFilterReader&) = delete; - -public: - /** - * Creates a new IIR filter reader. - * \param reader The reader to read from. - * \param b The input filter coefficients. - * \param a The output filter coefficients. - */ - IIRFilterReader(std::shared_ptr<IReader> reader, const std::vector<float>& b, const std::vector<float>& a); - - virtual sample_t filter(); - - /** - * Sets new filter coefficients. - * @param b The input filter coefficients. - * @param a The output filter coefficients. - */ - void setCoefficients(const std::vector<float>& b, const std::vector<float>& a); -}; - -AUD_NAMESPACE_END diff --git a/extern/audaspace/include/fx/ImpulseResponse.h b/extern/audaspace/include/fx/ImpulseResponse.h deleted file mode 100644 index 3cdb807ff99..00000000000 --- a/extern/audaspace/include/fx/ImpulseResponse.h +++ /dev/null @@ -1,108 +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 - -/** -* @file ImpulseResponse.h -* @ingroup fx -* The ImpulseResponse class. -*/ - -#include "util/StreamBuffer.h" -#include "util/FFTPlan.h" -#include "IReader.h" - -#include <memory> -#include <vector> - -AUD_NAMESPACE_BEGIN - -/** -* This class represents an impulse response that can be used in convolution. -* When this class is instanced, the impulse response is divided in channels and those channels are divided in parts of N/2 samples (N being the size of the FFT plan used). -* The main objetive of this class is to allow the reutilization of an impulse response in various sounds without having to process it more than one time. -* \warning The size of the FFTPlan used to process the impulse response must be the same as the one used in the convolver classes. -*/ -class AUD_API ImpulseResponse -{ -private: - /** - * A tri-dimensional array (channels, parts, values) The impulse response is divided in channels and those channels are divided - * in parts of N/2 samples. Those parts are transformed to the frequency domain transform which generates uni-dimensional - * arrays of fftwtf_complex data (complex numbers). - */ - std::vector<std::shared_ptr<std::vector<std::shared_ptr<std::vector<std::complex<sample_t>>>>>> m_processedIR; - - /** - * The specification of the samples. - */ - Specs m_specs; - - /** - * The length of the impulse response. - */ - int m_length; - - // delete copy constructor and operator= - ImpulseResponse(const ImpulseResponse&) = delete; - ImpulseResponse& operator=(const ImpulseResponse&) = delete; - -public: - /** - * Creates a new ImpulseResponse object. - * The impulse response will be split and transformed to the frequency domain. - * \param impulseResponse The impulse response sound. - * \param plan A shared pointer to a FFT plan used to transform the impulse response. - */ - ImpulseResponse(std::shared_ptr<StreamBuffer> impulseResponse, std::shared_ptr<FFTPlan> plan); - - /** - * Creates a new ImpulseResponse object. This overload instances its own FFTPlan with default size. - * The impulse response will be split and transformed to the frequency domain. - * \param impulseResponse The impulse response sound. - */ - ImpulseResponse(std::shared_ptr<StreamBuffer> impulseResponse); - - /** - * Returns the specification of the impulse response. - * \return The specification of the impulse response. - */ - Specs getSpecs(); - - /** - * Retrieves the length of the impulse response. - * \return The length of the impulse response. - */ - int getLength(); - - /** - * Retrieves one channel of the impulse response. - * \param n The desired channel number (from 0 to channels-1). - * \return The desired channel of the impulse response. - */ - std::shared_ptr<std::vector<std::shared_ptr<std::vector<std::complex<sample_t>>>>> getChannel(int n); - -private: - /** - * Processes the impulse response sound for its use in the convovler classes. - * \param A shared pointer to a reader of the desired sound. - * \param plan A shared pointer to a FFT plan used to transform the impulse response. - */ - void processImpulseResponse(std::shared_ptr<IReader> reader, std::shared_ptr<FFTPlan> plan); -}; - -AUD_NAMESPACE_END diff --git a/extern/audaspace/include/fx/Limiter.h b/extern/audaspace/include/fx/Limiter.h deleted file mode 100644 index 0b5451b4eed..00000000000 --- a/extern/audaspace/include/fx/Limiter.h +++ /dev/null @@ -1,73 +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 Limiter.h - * @ingroup fx - * The Limiter class. - */ - -#include "fx/Effect.h" - -AUD_NAMESPACE_BEGIN - -/** - * This sound limits another sound in start and end time. - */ -class AUD_API Limiter : public Effect -{ -private: - /** - * The start time. - */ - const float m_start; - - /** - * The end time. - */ - const float m_end; - - // delete copy constructor and operator= - Limiter(const Limiter&) = delete; - Limiter& operator=(const Limiter&) = delete; - -public: - /** - * Creates a new limiter sound. - * \param sound The input sound. - * \param start The desired start time. - * \param end The desired end time, a negative value signals that it should - * play to the end. - */ - Limiter(std::shared_ptr<ISound> sound, - float start = 0, float end = -1); - - /** - * Returns the start time. - */ - float getStart() const; - - /** - * Returns the end time. - */ - float getEnd() const; - - virtual std::shared_ptr<IReader> createReader(); -}; - -AUD_NAMESPACE_END diff --git a/extern/audaspace/include/fx/LimiterReader.h b/extern/audaspace/include/fx/LimiterReader.h deleted file mode 100644 index 49a07b5c29e..00000000000 --- a/extern/audaspace/include/fx/LimiterReader.h +++ /dev/null @@ -1,65 +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 LimiterReader.h - * @ingroup fx - * The LimiterReader class. - */ - -#include "fx/EffectReader.h" - -AUD_NAMESPACE_BEGIN - -/** - * This reader limits another reader in start and end times. - */ -class AUD_API LimiterReader : public EffectReader -{ -private: - /** - * The start sample: inclusive. - */ - const float m_start; - - /** - * The end sample: exlusive. - */ - const float m_end; - - // delete copy constructor and operator= - LimiterReader(const LimiterReader&) = delete; - LimiterReader& operator=(const LimiterReader&) = delete; - -public: - /** - * Creates a new limiter reader. - * \param reader The reader to read from. - * \param start The desired start time (inclusive). - * \param end The desired end time (sample exklusive), a negative value - * signals that it should play to the end. - */ - LimiterReader(std::shared_ptr<IReader> reader, float start = 0, float end = -1); - - virtual void seek(int position); - virtual int getLength() const; - virtual int getPosition() const; - virtual void read(int& length, bool& eos, sample_t* buffer); -}; - -AUD_NAMESPACE_END diff --git a/extern/audaspace/include/fx/Loop.h b/extern/audaspace/include/fx/Loop.h deleted file mode 100644 index c8ba7609f23..00000000000 --- a/extern/audaspace/include/fx/Loop.h +++ /dev/null @@ -1,62 +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 Loop.h - * @ingroup fx - * The Loop class. - */ - -#include "fx/Effect.h" - -AUD_NAMESPACE_BEGIN - -/** - * This sound loops another sound. - * \note The reader has to be seekable. - */ -class AUD_API Loop : public Effect -{ -private: - /** - * The loop count. - */ - const int m_loop; - - // delete copy constructor and operator= - Loop(const Loop&) = delete; - Loop& operator=(const Loop&) = delete; - -public: - /** - * Creates a new loop sound. - * \param sound The input sound. - * \param loop The desired loop count, negative values result in endless - * looping. - */ - Loop(std::shared_ptr<ISound> sound, int loop = -1); - - /** - * Returns the loop count. - */ - int getLoop() const; - - virtual std::shared_ptr<IReader> createReader(); -}; - -AUD_NAMESPACE_END diff --git a/extern/audaspace/include/fx/LoopReader.h b/extern/audaspace/include/fx/LoopReader.h deleted file mode 100644 index 72bb92c8b8f..00000000000 --- a/extern/audaspace/include/fx/LoopReader.h +++ /dev/null @@ -1,65 +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 LoopReader.h - * @ingroup fx - * The LoopReader class. - */ - -#include "fx/EffectReader.h" - -AUD_NAMESPACE_BEGIN - -/** - * This class reads another reader and loops it. - * \note The other reader must be seekable. - */ -class AUD_API LoopReader : public EffectReader -{ -private: - /** - * The loop count. - */ - const int m_count; - - /** - * The left loop count. - */ - int m_left; - - // delete copy constructor and operator= - LoopReader(const LoopReader&) = delete; - LoopReader& operator=(const LoopReader&) = delete; - -public: - /** - * Creates a new loop reader. - * \param reader The reader to read from. - * \param loop The desired loop count, negative values result in endless - * looping. - */ - LoopReader(std::shared_ptr<IReader> reader, int loop); - - virtual void seek(int position); - virtual int getLength() const; - virtual int getPosition() const; - virtual void read(int& length, bool& eos, sample_t* buffer); -}; - -AUD_NAMESPACE_END diff --git a/extern/audaspace/include/fx/Lowpass.h b/extern/audaspace/include/fx/Lowpass.h deleted file mode 100644 index c14e5e8e0e2..00000000000 --- a/extern/audaspace/include/fx/Lowpass.h +++ /dev/null @@ -1,49 +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 Lowpass.h - * @ingroup fx - * The Lowpass class. - */ - -#include "fx/DynamicIIRFilter.h" - -AUD_NAMESPACE_BEGIN - -/** - * This sound creates a lowpass filter reader. - */ -class AUD_API Lowpass : public DynamicIIRFilter -{ -private: - // delete copy constructor and operator= - Lowpass(const Lowpass&) = delete; - Lowpass& operator=(const Lowpass&) = delete; - -public: - /** - * Creates a new lowpass sound. - * \param sound The input sound. - * \param frequency The cutoff frequency. - * \param Q The Q factor. - */ - Lowpass(std::shared_ptr<ISound> sound, float frequency, float Q = 1.0f); -}; - -AUD_NAMESPACE_END diff --git a/extern/audaspace/include/fx/LowpassCalculator.h b/extern/audaspace/include/fx/LowpassCalculator.h deleted file mode 100644 index 477adfb5b5b..00000000000 --- a/extern/audaspace/include/fx/LowpassCalculator.h +++ /dev/null @@ -1,61 +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 LowpassCalculator.h - * @ingroup fx - * The LowpassCalculator class. - */ - -#include "fx/IDynamicIIRFilterCalculator.h" - -AUD_NAMESPACE_BEGIN - -/** - * The LowpassCalculator class calculates low pass filter coefficients for a - * dynamic DynamicIIRFilter. - */ -class AUD_LOCAL LowpassCalculator : public IDynamicIIRFilterCalculator -{ -private: - /** - * The cutoff frequency. - */ - const float m_frequency; - - /** - * The Q factor. - */ - const float m_Q; - - // delete copy constructor and operator= - LowpassCalculator(const LowpassCalculator&) = delete; - LowpassCalculator& operator=(const LowpassCalculator&) = delete; - -public: - /** - * Creates a LowpassCalculator object. - * @param frequency The cutoff frequency. - * @param Q The Q factor of the filter. If unsure, use 1.0 as default. - */ - LowpassCalculator(float frequency, float Q); - - virtual void recalculateCoefficients(SampleRate rate, std::vector<float> &b, std::vector<float> &a); -}; - -AUD_NAMESPACE_END diff --git a/extern/audaspace/include/fx/MutableReader.h b/extern/audaspace/include/fx/MutableReader.h deleted file mode 100644 index 217dd2aa5d4..00000000000 --- a/extern/audaspace/include/fx/MutableReader.h +++ /dev/null @@ -1,71 +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 - -/** -* @file MutableReader.h -* @ingroup fx -* The MutableReader class. -*/ - -#include "IReader.h" -#include "ISound.h" - -#include <memory> - -AUD_NAMESPACE_BEGIN - -/** -* This class represents a reader for a sound that can change with each playback. The change will occur when trying to seek backwards -* If the sound doesn't support that, it will be restarted. -* \warning Notice that if a SoundList object is assigned to several MutableReaders, sequential playback won't work correctly. -* To prevent this the SoundList must be copied. -*/ -class AUD_API MutableReader : public IReader -{ -private: - /** - * The current reader. - */ - std::shared_ptr<IReader> m_reader; - - /** - * A sound from which to get the reader. - */ - std::shared_ptr<ISound> m_sound; - - - // delete copy constructor and operator= - MutableReader(const MutableReader&) = delete; - MutableReader& operator=(const MutableReader&) = delete; - -public: - /** - * Creates a new mutable reader. - * \param sound A of sound you want to assign to this reader. - */ - MutableReader(std::shared_ptr<ISound> sound); - - virtual bool isSeekable() const; - virtual void seek(int position); - virtual int getLength() const; - virtual int getPosition() const; - virtual Specs getSpecs() const; - virtual void read(int& length, bool& eos, sample_t* buffer); -}; - -AUD_NAMESPACE_END diff --git a/extern/audaspace/include/fx/MutableSound.h b/extern/audaspace/include/fx/MutableSound.h deleted file mode 100644 index 9b5aa95cf18..00000000000 --- a/extern/audaspace/include/fx/MutableSound.h +++ /dev/null @@ -1,58 +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 - -/** -* @file MutableSound.h -* @ingroup fx -* The MutableSound class. -*/ - -#include "ISound.h" - -#include <memory> - -AUD_NAMESPACE_BEGIN - -/** -* Ths class allows to create MutableReaders for any sound. -*/ -class AUD_API MutableSound : public ISound -{ -private: - /** - * A pointer to a sound. - */ - std::shared_ptr<ISound> m_sound; - - // delete copy constructor and operator= - MutableSound(const MutableSound&) = delete; - MutableSound& operator=(const MutableSound&) = delete; - -public: - /** - * Creates a new MutableSound. - * \param sound The sound in which the MutabeReaders created with the createReader() method will be based. - * If shared pointer to a SoundList object is used in several mutable sounds the sequential - * playback will not work properly. A copy of the SoundList object must be made in this case. - */ - MutableSound(std::shared_ptr<ISound> sound); - - virtual std::shared_ptr<IReader> createReader(); -}; - -AUD_NAMESPACE_END
\ No newline at end of file diff --git a/extern/audaspace/include/fx/Pitch.h b/extern/audaspace/include/fx/Pitch.h deleted file mode 100644 index 570366be549..00000000000 --- a/extern/audaspace/include/fx/Pitch.h +++ /dev/null @@ -1,55 +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 Pitch.h - * @ingroup fx - * The Pitch class. - */ - -#include "fx/Effect.h" - -AUD_NAMESPACE_BEGIN - -/** - * This sound changes the pitch of another sound. - */ -class AUD_API Pitch : public Effect -{ -private: - /** - * The pitch. - */ - const float m_pitch; - - // delete copy constructor and operator= - Pitch(const Pitch&) = delete; - Pitch& operator=(const Pitch&) = delete; - -public: - /** - * Creates a new pitch sound. - * \param sound The input sound. - * \param pitch The desired pitch. - */ - Pitch(std::shared_ptr<ISound> sound, float pitch); - - virtual std::shared_ptr<IReader> createReader(); -}; - -AUD_NAMESPACE_END diff --git a/extern/audaspace/include/fx/PitchReader.h b/extern/audaspace/include/fx/PitchReader.h deleted file mode 100644 index c82f71b61bf..00000000000 --- a/extern/audaspace/include/fx/PitchReader.h +++ /dev/null @@ -1,67 +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 PitchReader.h - * @ingroup fx - * The PitchReader class. - */ - -#include "fx/EffectReader.h" - -AUD_NAMESPACE_BEGIN - -/** - * This class reads another reader and changes it's pitch. - */ -class AUD_API PitchReader : public EffectReader -{ -private: - /** - * The pitch level. - */ - float m_pitch; - - // delete copy constructor and operator= - PitchReader(const PitchReader&) = delete; - PitchReader& operator=(const PitchReader&) = delete; - -public: - /** - * Creates a new pitch reader. - * \param reader The reader to read from. - * \param pitch The pitch value. - */ - PitchReader(std::shared_ptr<IReader> reader, float pitch); - - virtual Specs getSpecs() const; - - /** - * Retrieves the pitch. - * \return The current pitch value. - */ - float getPitch() const; - - /** - * Sets the pitch. - * \param pitch The new pitch value. - */ - void setPitch(float pitch); -}; - -AUD_NAMESPACE_END diff --git a/extern/audaspace/include/fx/PlaybackCategory.h b/extern/audaspace/include/fx/PlaybackCategory.h deleted file mode 100644 index 7721623359f..00000000000 --- a/extern/audaspace/include/fx/PlaybackCategory.h +++ /dev/null @@ -1,127 +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 - -/** -* @file PlaybackCategory.h -* @ingroup fx -* The PlaybackCategory class. -*/ - -#include "devices/IHandle.h" -#include "devices/IDevice.h" -#include "VolumeStorage.h" - -#include <unordered_map> -#include <memory> - -AUD_NAMESPACE_BEGIN - -/** -* This class represents a category of related sounds which are currently playing and allows to control them easily. -*/ -class AUD_API PlaybackCategory -{ -private: - /** - * Next handle ID to be assigned. - */ - unsigned int m_currentID; - - /** - * Vector of handles that belong to the category. - */ - std::unordered_map<unsigned int, std::shared_ptr<IHandle>> m_handles; - - /** - * Device that will play the sounds. - */ - std::shared_ptr<IDevice> m_device; - - /** - * Status of the category. - */ - Status m_status; - - /** - * Volume of all the sounds of the category. - */ - std::shared_ptr<VolumeStorage> m_volumeStorage; - - // delete copy constructor and operator= - PlaybackCategory(const PlaybackCategory&) = delete; - PlaybackCategory& operator=(const PlaybackCategory&) = delete; - -public: - /** - * Creates a new PlaybackCategory. - * \param device A shared pointer to the device which will be used for playback. - */ - PlaybackCategory(std::shared_ptr<IDevice> device); - ~PlaybackCategory(); - - /** - * Plays a new sound in the category. - * \param sound The sound to be played. - * \return A handle for the playback. If the playback failed, nullptr will be returned. - */ - std::shared_ptr<IHandle> play(std::shared_ptr<ISound> sound); - - /** - * Resumes all the paused sounds of the category. - */ - void resume(); - - /** - * Pauses all current played back sounds of the category. - */ - void pause(); - - /** - * Retrieves the volume of the category. - * \return The volume. - */ - float getVolume(); - - /** - * Sets the volume for the category. - * \param volume The volume. - */ - void setVolume(float volume); - - /** - * Stops all the playing back or paused sounds. - */ - void stop(); - - /** - * Retrieves the shared volume of the category. - * \return A shared pointer to the VolumeStorage object that represents the shared volume of the category. - */ - std::shared_ptr<VolumeStorage> getSharedVolume(); - - /** - * Cleans the category erasing all the invalid handles. - * Only needed if individual sounds are stopped with their handles. - */ - void cleanHandles(); - -private: - static void cleanHandleCallback(void* data); -}; - -AUD_NAMESPACE_END diff --git a/extern/audaspace/include/fx/PlaybackManager.h b/extern/audaspace/include/fx/PlaybackManager.h deleted file mode 100644 index f660568b8db..00000000000 --- a/extern/audaspace/include/fx/PlaybackManager.h +++ /dev/null @@ -1,156 +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 - -/** -* @file PlaybackManager.h -* @ingroup fx -* The PlaybackManager class. -*/ - -#include "PlaybackCategory.h" -#include "devices/IDevice.h" -#include "ISound.h" - -#include <unordered_map> -#include <memory> - -AUD_NAMESPACE_BEGIN - -/** -* This class allows to control groups of playing sounds easily. -* The sounds are part of categories. -*/ -class AUD_API PlaybackManager -{ -private: - /** - * Unordered map of categories, each category has different name. - */ - std::unordered_map<unsigned int, std::shared_ptr<PlaybackCategory>> m_categories; - - /** - * Device used for playback. - */ - std::shared_ptr<IDevice> m_device; - - /** - * The current key used for new categories. - */ - unsigned int m_currentKey; - - // delete copy constructor and operator= - PlaybackManager(const PlaybackManager&) = delete; - PlaybackManager& operator=(const PlaybackManager&) = delete; - -public: - /** - * Creates a new PlaybackManager. - * \param device A shared pointer to the device which will be used for playback. - */ - PlaybackManager(std::shared_ptr<IDevice> device); - - /** - * Adds an existent category to the manager and returns a key to access it. - * \param category The category to be added. - * \return The category key. - */ - unsigned int addCategory(std::shared_ptr<PlaybackCategory> category); - - /** - * Adds an existent category to the manager and returns a key to access it. - * \param volume The volume of the new category. - * \return The category key. - */ - unsigned int addCategory(float volume); - - /** - * Plays a sound and adds it to a new or existent category. - * \param sound The sound to be played and added to a category. - * \param catKey Key of the category. - * \return The handle of the playback; nullptr if the sound couldn't be played. - */ - std::shared_ptr<IHandle> play(std::shared_ptr<ISound> sound, unsigned int catKey); - - /** - * Resumes all the paused sounds of a category. - * \param catKey Key of the category. - * \return - * - true if succesful. - * - false if the category doesn't exist. - */ - bool resume(unsigned int catKey); - - /** - * Pauses all current playing sounds of a category. - * \param catKey Key of the category. - * \return - * - true if succesful. - * - false if the category doesn't exist. - */ - bool pause(unsigned int catKey); - - /** - * Retrieves the volume of a category. - * \param catKey Key of the category. - * \return The volume value of the category. If the category doesn't exist it returns a negative number. - */ - float getVolume(unsigned int catKey); - - /** - * Sets the volume for a category. - * \param volume The volume. - * \param catKey Key of the category. - * \return - * - true if succesful. - * - false if the category doesn't exist. - */ - bool setVolume(float volume, unsigned int catKey); - - /** - * Stops and erases a category of sounds. - * \param catKey Key of the category. - * \return - * - true if succesful. - * - false if the category doesn't exist. - */ - bool stop(unsigned int catKey); - - /** - * Removes all the invalid handles of all the categories. - * Only needed if individual sounds are stopped with their handles. - */ - void clean(); - - /** - * Removes all the invalid handles of a category. - * Only needed if individual sounds are stopped with their handles. - * \param catKey Key of the category. - * \return - * - true if succesful. - * - false if the category doesn't exist. - */ - bool clean(unsigned int catKey); - - /** - * Retrieves the device of the PlaybackManager. - * \return A shared pointer to the device used by the playback manager. - */ - std::shared_ptr<IDevice> getDevice(); -}; - -AUD_NAMESPACE_END diff --git a/extern/audaspace/include/fx/Reverse.h b/extern/audaspace/include/fx/Reverse.h deleted file mode 100644 index 32227da977a..00000000000 --- a/extern/audaspace/include/fx/Reverse.h +++ /dev/null @@ -1,50 +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 Reverse.h - * @ingroup fx - * The Reverse class. - */ - -#include "fx/Effect.h" - -AUD_NAMESPACE_BEGIN - -/** - * This sound reads another sound reverted. - * \note Readers from the underlying sound must be seekable. - */ -class AUD_API Reverse : public Effect -{ -private: - // delete copy constructor and operator= - Reverse(const Reverse&) = delete; - Reverse& operator=(const Reverse&) = delete; - -public: - /** - * Creates a new reverse sound. - * \param sound The input sound. - */ - Reverse(std::shared_ptr<ISound> sound); - - virtual std::shared_ptr<IReader> createReader(); -}; - -AUD_NAMESPACE_END diff --git a/extern/audaspace/include/fx/ReverseReader.h b/extern/audaspace/include/fx/ReverseReader.h deleted file mode 100644 index a02608e1378..00000000000 --- a/extern/audaspace/include/fx/ReverseReader.h +++ /dev/null @@ -1,65 +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 ReverseReader.h - * @ingroup fx - * The ReverseReader class. - */ - -#include "fx/EffectReader.h" - -AUD_NAMESPACE_BEGIN - -/** - * This class reads another reader from back to front. - * \note The underlying reader must be seekable. - */ -class AUD_API ReverseReader : public EffectReader -{ -private: - /** - * The sample count. - */ - const int m_length; - - /** - * The current position. - */ - int m_position; - - // delete copy constructor and operator= - ReverseReader(const ReverseReader&) = delete; - ReverseReader& operator=(const ReverseReader&) = delete; - -public: - /** - * Creates a new reverse reader. - * \param reader The reader to read from. - * \exception Exception Thrown if the reader specified has an - * undeterminable/infinite length or is not seekable. - */ - ReverseReader(std::shared_ptr<IReader> reader); - - virtual void seek(int position); - virtual int getLength() const; - virtual int getPosition() const; - virtual void read(int& length, bool& eos, sample_t* buffer); -}; - -AUD_NAMESPACE_END diff --git a/extern/audaspace/include/fx/SoundList.h b/extern/audaspace/include/fx/SoundList.h deleted file mode 100644 index ce3cb386969..00000000000 --- a/extern/audaspace/include/fx/SoundList.h +++ /dev/null @@ -1,110 +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 - -/** -* @file SoundList.h -* @ingroup fx -* The SoundList class. -*/ - -#include "ISound.h" - -#include <vector> -#include <memory> -#include <mutex> - -AUD_NAMESPACE_BEGIN - -/** -* This class allows to have a list of sound that will play sequentially or randomly with each playback. -*/ -class AUD_API SoundList : public ISound -{ -private: - /** - * The list of sounds that will play. - */ - std::vector<std::shared_ptr<ISound>> m_list; - - /** - * Flag for random playback - */ - bool m_random = false; - - /** - * Current sound index. -1 if no reader has been created. - */ - int m_index = -1; - - /** - * Mutex to prevent multithreading crashes. - */ - std::recursive_mutex m_mutex; - - // delete copy constructor and operator= - SoundList(const SoundList&) = delete; - SoundList& operator=(const SoundList&) = delete; - -public: - /** - * Creates a new, empty sound list. - * Sounds must be added to the list using the addSound() method. - * \param random False if the sounds int he list must be played sequentially. True if random. - */ - SoundList(bool random = false); - - /** - * Creates a new sound list and initializes it. - * \param list A vector with sounds to initialize the list. - * \param random False if the sounds int he list must be played sequentially. True if random. - */ - SoundList(std::vector<std::shared_ptr<ISound>>& list, bool random = false); - - virtual std::shared_ptr<IReader> createReader(); - - /** - * Adds a sound to the list. - * The added sounds can be played sequentially or randomly dependig - * on the m_random flag - * \param sound A shared_ptr to the sound. - */ - void addSound(std::shared_ptr<ISound> sound); - - /** - * Sets the playback mode of the sound list. - * There are two posible modes, random and sequential. - * \param random True to activate the random mode, false to activate sequential mode. - */ - void setRandomMode(bool random); - - /** - * Returns the playback mode of the sound list. - * The two posible modes are random and sequential. - * \return True if the random mode is activated, false otherwise. - */ - bool getRandomMode(); - - /** - * Returns the amount of sounds in the list. - * \return The amount of sounds in the list. - */ - int getSize(); - -}; - -AUD_NAMESPACE_END diff --git a/extern/audaspace/include/fx/Source.h b/extern/audaspace/include/fx/Source.h deleted file mode 100644 index 84448aa669d..00000000000 --- a/extern/audaspace/include/fx/Source.h +++ /dev/null @@ -1,109 +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 - -/** -* @file Source.h -* @ingroup fx -* The Source class. -*/ - -#include "Audaspace.h" - -#include <atomic> - -AUD_NAMESPACE_BEGIN - -/** -* This class stores the azimuth and elevation angles of a sound and allows to change them dynamically. -* The azimuth angle goes clockwise. For a sound source situated at the right of the listener the azimuth angle is 90. -*/ -class AUD_API Source -{ -private: - /** - * Azimuth value. - */ - std::atomic<float> m_azimuth; - - /** - * Elevation value. - */ - std::atomic<float> m_elevation; - - /** - * Distance value. Between 0 and 1. - */ - std::atomic<float> m_distance; - - // delete copy constructor and operator= - Source(const Source&) = delete; - Source& operator=(const Source&) = delete; - -public: - /** - * Creates a Source instance with an initial value. - * \param azimuth The value of the azimuth. - * \param elevation The value of the elevation. - * \param distance The distance from the listener. Max distance is 1, min distance is 0. - */ - Source(float azimuth, float elevation, float distance = 0.0); - - /** - * Retrieves the current azimuth value. - * \return The current azimuth. - */ - float getAzimuth(); - - /** - * Retrieves the current elevation value. - * \return The current elevation. - */ - float getElevation(); - - /** - * Retrieves the current distance value. - * \return The current distance. - */ - float getDistance(); - - /** - * Retrieves the current volume value based on the distance. - * \return The current volume based on the Distance. - */ - float getVolume(); - - /** - * Changes the azimuth value. - * \param azimuth The new value for the azimuth. - */ - void setAzimuth(float azimuth); - - /** - * Changes the elevation value. - * \param elevation The new value for the elevation. - */ - void setElevation(float elevation); - - /** - * Changes the distance value. - * \param distance The new value for the distance. Max distance is 1, min distance is 0. - */ - void setDistance(float distance); -}; - -AUD_NAMESPACE_END
\ No newline at end of file diff --git a/extern/audaspace/include/fx/Sum.h b/extern/audaspace/include/fx/Sum.h deleted file mode 100644 index b590aa7fcd1..00000000000 --- a/extern/audaspace/include/fx/Sum.h +++ /dev/null @@ -1,49 +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 Sum.h - * @ingroup fx - * The Sum class. - */ - -#include "fx/Effect.h" - -AUD_NAMESPACE_BEGIN - -/** - * This sound creates a sum reader. - */ -class AUD_API Sum : public Effect -{ -private: - // delete copy constructor and operator= - Sum(const Sum&) = delete; - Sum& operator=(const Sum&) = delete; - -public: - /** - * Creates a new sum sound. - * \param sound The input sound. - */ - Sum(std::shared_ptr<ISound> sound); - - virtual std::shared_ptr<IReader> createReader(); -}; - -AUD_NAMESPACE_END diff --git a/extern/audaspace/include/fx/Threshold.h b/extern/audaspace/include/fx/Threshold.h deleted file mode 100644 index 10baef1714d..00000000000 --- a/extern/audaspace/include/fx/Threshold.h +++ /dev/null @@ -1,78 +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 Threshold.h - * @ingroup fx - * The Threshold class. - */ - -#include "fx/Effect.h" - -AUD_NAMESPACE_BEGIN - -class CallbackIIRFilterReader; - -/** - * This sound Transforms any signal to a square signal by thresholding. - */ -class AUD_API Threshold : public Effect -{ -private: - /** - * The threshold. - */ - const float m_threshold; - - // delete copy constructor and operator= - Threshold(const Threshold&) = delete; - Threshold& operator=(const Threshold&) = delete; - -public: - /** - * Creates a new threshold sound. - * \param sound The input sound. - * \param threshold The threshold. - */ - Threshold(std::shared_ptr<ISound> sound, float threshold = 0.0f); - - /** - * Returns the threshold. - */ - float getThreshold() const; - - virtual std::shared_ptr<IReader> createReader(); - - /** - * The thresholdFilter function implements the doFilterIIR callback - * for the callback IIR filter. - * @param reader The CallbackIIRFilterReader that executes the callback. - * @param threshold The threshold value. - * @return The filtered sample. - */ - static sample_t AUD_LOCAL thresholdFilter(CallbackIIRFilterReader* reader, float* threshold); - - /** - * The endThresholdFilter function implements the endFilterIIR callback - * for the callback IIR filter. - * @param threshold The threshold value. - */ - static void AUD_LOCAL endThresholdFilter(float* threshold); -}; - -AUD_NAMESPACE_END diff --git a/extern/audaspace/include/fx/Volume.h b/extern/audaspace/include/fx/Volume.h deleted file mode 100644 index 0e56e8efd9b..00000000000 --- a/extern/audaspace/include/fx/Volume.h +++ /dev/null @@ -1,63 +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 Volume.h - * @ingroup fx - * The Volume class. - */ - -#include "fx/Effect.h" - -AUD_NAMESPACE_BEGIN - -/** - * This sound changes the volume of another sound. - * The set volume should be a value between 0.0 and 1.0, higher values at your - * own risk! - */ -class AUD_API Volume : public Effect -{ -private: - /** - * The volume. - */ - const float m_volume; - - // delete copy constructor and operator= - Volume(const Volume&) = delete; - Volume& operator=(const Volume&) = delete; - -public: - /** - * Creates a new volume sound. - * \param sound The input sound. - * \param volume The desired volume. - */ - Volume(std::shared_ptr<ISound> sound, float volume); - - /** - * Returns the volume. - * \return The current volume. - */ - float getVolume() const; - - virtual std::shared_ptr<IReader> createReader(); -}; - -AUD_NAMESPACE_END diff --git a/extern/audaspace/include/fx/VolumeReader.h b/extern/audaspace/include/fx/VolumeReader.h deleted file mode 100644 index 13b6845e931..00000000000 --- a/extern/audaspace/include/fx/VolumeReader.h +++ /dev/null @@ -1,70 +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 - -/** -* @file VolumeReader.h -* @ingroup fx -* The VolumeReader class. -*/ - -#include "IReader.h" -#include "ISound.h" -#include "VolumeStorage.h" - -#include <memory> - -AUD_NAMESPACE_BEGIN - -/** -* This class represents a reader for a sound that has its own shared volume -*/ -class AUD_API VolumeReader : public IReader -{ -private: - /** - * The current reader. - */ - std::shared_ptr<IReader> m_reader; - - /** - * A sound from which to get the reader. - */ - std::shared_ptr<VolumeStorage> m_volumeStorage; - - - // delete copy constructor and operator= - VolumeReader(const VolumeReader&) = delete; - VolumeReader& operator=(const VolumeReader&) = delete; - -public: - /** - * Creates a new volume reader. - * \param reader A reader of the sound to be assigned to this reader. - * \param volumeStorage A shared pointer to a VolumeStorage object. - */ - VolumeReader(std::shared_ptr<IReader> reader, std::shared_ptr<VolumeStorage> volumeStorage); - - virtual bool isSeekable() const; - virtual void seek(int position); - virtual int getLength() const; - virtual int getPosition() const; - virtual Specs getSpecs() const; - virtual void read(int& length, bool& eos, sample_t* buffer); -}; - -AUD_NAMESPACE_END
\ No newline at end of file diff --git a/extern/audaspace/include/fx/VolumeSound.h b/extern/audaspace/include/fx/VolumeSound.h deleted file mode 100644 index 0aeffd53e87..00000000000 --- a/extern/audaspace/include/fx/VolumeSound.h +++ /dev/null @@ -1,74 +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 - -/** -* @file VolumeSound.h -* @ingroup fx -* The VolumeSound class. -*/ - -#include "ISound.h" -#include "VolumeStorage.h" -#include <memory> - -AUD_NAMESPACE_BEGIN - -/** -* This class allows to create a sound with its own volume. -*/ -class AUD_API VolumeSound : public ISound -{ -private: - /** - * A pointer to a sound. - */ - std::shared_ptr<ISound> m_sound; - - /** - * A pointer to the shared volume being used. - */ - std::shared_ptr<VolumeStorage> m_volumeStorage; - - // delete copy constructor and operator= - VolumeSound(const VolumeSound&) = delete; - VolumeSound& operator=(const VolumeSound&) = delete; - -public: - /** - * Creates a new VolumeSound. - * \param sound The sound in which shall have its own volume. - * \param volumeStorage A shared pointer to a VolumeStorage object. It allows to change the volume of various sound in one go. - */ - VolumeSound(std::shared_ptr<ISound> sound, std::shared_ptr<VolumeStorage> volumeStorage); - - virtual std::shared_ptr<IReader> createReader(); - - /** - * Retrieves the shared volume of this sound. - * \return A shared pointer to the VolumeStorage object that this sound is using. - */ - std::shared_ptr<VolumeStorage> getSharedVolume(); - - /** - * Changes the shared volume of this sound, it'll only affect newly created readers. - * \param volumeStorage A shared pointer to the new VolumeStorage object. - */ - void setSharedVolume(std::shared_ptr<VolumeStorage> volumeStorage); -}; - -AUD_NAMESPACE_END
\ No newline at end of file diff --git a/extern/audaspace/include/fx/VolumeStorage.h b/extern/audaspace/include/fx/VolumeStorage.h deleted file mode 100644 index 5088a5e2ba9..00000000000 --- a/extern/audaspace/include/fx/VolumeStorage.h +++ /dev/null @@ -1,71 +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 - -/** -* @file VolumeStorage.h -* @ingroup fx -* The VolumeStorage class. -*/ - -#include "Audaspace.h" - -#include <atomic> - -AUD_NAMESPACE_BEGIN - -/** -* This class stores a volume value and allows to change if for a number of sounds in one go. -*/ -class AUD_API VolumeStorage -{ -private: - /** - * Volume value. - */ - std::atomic<float> m_volume; - - // delete copy constructor and operator= - VolumeStorage(const VolumeStorage&) = delete; - VolumeStorage& operator=(const VolumeStorage&) = delete; - -public: - /** - * Creates a new VolumeStorage instance with volume 1 - */ - VolumeStorage(); - - /** - * Creates a VolumeStorage instance with an initial value. - * \param volume The value of the volume. - */ - VolumeStorage(float volume); - - /** - * Retrieves the current volume value. - * \return The current volume. - */ - float getVolume(); - - /** - * Changes the volume value. - * \param volume The new value for the volume. - */ - void setVolume(float volume); -}; - -AUD_NAMESPACE_END diff --git a/extern/audaspace/include/generator/Sawtooth.h b/extern/audaspace/include/generator/Sawtooth.h deleted file mode 100644 index 68f56ae83fd..00000000000 --- a/extern/audaspace/include/generator/Sawtooth.h +++ /dev/null @@ -1,66 +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 Sawtooth.h - * @ingroup generator - * The Sawtooth class. - */ - -#include "ISound.h" -#include "respec/Specification.h" - -AUD_NAMESPACE_BEGIN - -/** - * This sound creates a reader that plays a sawtooth tone. - */ -class AUD_API Sawtooth : public ISound -{ -private: - /** - * The frequence of the sawtooth wave. - */ - const float m_frequency; - - /** - * The target sample rate for output. - */ - const SampleRate m_sampleRate; - - // delete copy constructor and operator= - Sawtooth(const Sawtooth&) = delete; - Sawtooth& operator=(const Sawtooth&) = delete; - -public: - /** - * Creates a new sawtooth sound. - * \param frequency The desired frequency. - * \param sampleRate The target sample rate for playback. - */ - Sawtooth(float frequency, SampleRate sampleRate = RATE_48000); - - /** - * Returns the frequency of the sawtooth wave. - */ - float getFrequency() const; - - virtual std::shared_ptr<IReader> createReader(); -}; - -AUD_NAMESPACE_END diff --git a/extern/audaspace/include/generator/SawtoothReader.h b/extern/audaspace/include/generator/SawtoothReader.h deleted file mode 100644 index b4045eb8820..00000000000 --- a/extern/audaspace/include/generator/SawtoothReader.h +++ /dev/null @@ -1,86 +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 SawtoothReader.h - * @ingroup generator - * The SawtoothReader class. - */ - -#include "IReader.h" - -AUD_NAMESPACE_BEGIN - -/** - * This class is used for sawtooth tone playback. - * The output format is in the 16 bit format and stereo, the sample rate can be - * specified. - * As the two channels both play the same the output could also be mono, but - * in most cases this will result in having to resample for output, so stereo - * sound is created directly. - */ -class AUD_API SawtoothReader : public IReader -{ -private: - /** - * The frequency of the sine wave. - */ - float m_frequency; - - /** - * The current position in samples. - */ - int m_position; - - /** - * The value of the current sample. - */ - float m_sample; - - /** - * The sample rate for the output. - */ - const SampleRate m_sampleRate; - - // delete copy constructor and operator= - SawtoothReader(const SawtoothReader&) = delete; - SawtoothReader& operator=(const SawtoothReader&) = delete; - -public: - /** - * Creates a new reader. - * \param frequency The frequency of the sine wave. - * \param sampleRate The output sample rate. - */ - SawtoothReader(float frequency, SampleRate sampleRate); - - /** - * Sets the frequency of the wave. - * @param frequency The new frequency in Hertz. - */ - void setFrequency(float frequency); - - virtual bool isSeekable() const; - virtual void seek(int position); - virtual int getLength() const; - virtual int getPosition() const; - virtual Specs getSpecs() const; - virtual void read(int & length, bool &eos, sample_t* buffer); -}; - -AUD_NAMESPACE_END diff --git a/extern/audaspace/include/generator/Silence.h b/extern/audaspace/include/generator/Silence.h deleted file mode 100644 index a35b83d37fc..00000000000 --- a/extern/audaspace/include/generator/Silence.h +++ /dev/null @@ -1,48 +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 Silence.h - * @ingroup generator - * The Silence class. - */ - -#include "ISound.h" - -AUD_NAMESPACE_BEGIN - -/** - * This sound creates a reader that plays silence. - */ -class AUD_API Silence : public ISound -{ -private: - // delete copy constructor and operator= - Silence(const Silence&) = delete; - Silence& operator=(const Silence&) = delete; - -public: - /** - * Creates a new silence sound. - */ - Silence(); - - virtual std::shared_ptr<IReader> createReader(); -}; - -AUD_NAMESPACE_END diff --git a/extern/audaspace/include/generator/SilenceReader.h b/extern/audaspace/include/generator/SilenceReader.h deleted file mode 100644 index ecc0ce86da9..00000000000 --- a/extern/audaspace/include/generator/SilenceReader.h +++ /dev/null @@ -1,59 +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 SilenceReader.h - * @ingroup generator - * The SilenceReader class. - */ - -#include "IReader.h" - -AUD_NAMESPACE_BEGIN - -/** - * This class is used for silence playback. - * The signal generated is 44.1kHz mono. - */ -class AUD_API SilenceReader : public IReader -{ -private: - /** - * The current position in samples. - */ - int m_position; - - // delete copy constructor and operator= - SilenceReader(const SilenceReader&) = delete; - SilenceReader& operator=(const SilenceReader&) = delete; - -public: - /** - * Creates a new reader. - */ - SilenceReader(); - - virtual bool isSeekable() const; - virtual void seek(int position); - virtual int getLength() const; - virtual int getPosition() const; - virtual Specs getSpecs() const; - virtual void read(int& length, bool& eos, sample_t* buffer); -}; - -AUD_NAMESPACE_END diff --git a/extern/audaspace/include/generator/Sine.h b/extern/audaspace/include/generator/Sine.h deleted file mode 100644 index ee78fc7d06b..00000000000 --- a/extern/audaspace/include/generator/Sine.h +++ /dev/null @@ -1,67 +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 Sine.h - * @ingroup generator - * The Sine class. - */ - -#include "ISound.h" -#include "respec/Specification.h" - -AUD_NAMESPACE_BEGIN - -/** - * This sound creates a reader that plays a sine tone. - */ -class AUD_API Sine : public ISound -{ -private: - /** - * The frequence of the sine wave. - */ - const float m_frequency; - - /** - * The target sample rate for output. - */ - const SampleRate m_sampleRate; - - // delete copy constructor and operator= - Sine(const Sine&) = delete; - Sine& operator=(const Sine&) = delete; - -public: - /** - * Creates a new sine sound. - * \param frequency The desired frequency. - * \param sampleRate The target sample rate for playback. - */ - Sine(float frequency, - SampleRate sampleRate = RATE_48000); - - /** - * Returns the frequency of the sine wave. - */ - float getFrequency() const; - - virtual std::shared_ptr<IReader> createReader(); -}; - -AUD_NAMESPACE_END diff --git a/extern/audaspace/include/generator/SineReader.h b/extern/audaspace/include/generator/SineReader.h deleted file mode 100644 index 49cd571bc65..00000000000 --- a/extern/audaspace/include/generator/SineReader.h +++ /dev/null @@ -1,77 +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 SineReader.h - * @ingroup generator - * The SineReader class. - */ - -#include "IReader.h" - -AUD_NAMESPACE_BEGIN - -/** - * This class is used for sine tone playback. - * The sample rate can be specified, the signal is mono. - */ -class AUD_API SineReader : public IReader -{ -private: - /** - * The frequency of the sine wave. - */ - float m_frequency; - - /** - * The current position in samples. - */ - int m_position; - - /** - * The sample rate for the output. - */ - const SampleRate m_sampleRate; - - // delete copy constructor and operator= - SineReader(const SineReader&) = delete; - SineReader& operator=(const SineReader&) = delete; - -public: - /** - * Creates a new reader. - * \param frequency The frequency of the sine wave. - * \param sampleRate The output sample rate. - */ - SineReader(float frequency, SampleRate sampleRate); - - /** - * Sets the frequency of the wave. - * @param frequency The new frequency in Hertz. - */ - void setFrequency(float frequency); - - virtual bool isSeekable() const; - virtual void seek(int position); - virtual int getLength() const; - virtual int getPosition() const; - virtual Specs getSpecs() const; - virtual void read(int& length, bool& eos, sample_t* buffer); -}; - -AUD_NAMESPACE_END diff --git a/extern/audaspace/include/generator/Square.h b/extern/audaspace/include/generator/Square.h deleted file mode 100644 index 0ba27677a81..00000000000 --- a/extern/audaspace/include/generator/Square.h +++ /dev/null @@ -1,67 +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 Square.h - * @ingroup generator - * The Square class. - */ - -#include "ISound.h" -#include "respec/Specification.h" - -AUD_NAMESPACE_BEGIN - -/** - * This sound creates a reader that plays a square tone. - */ -class AUD_API Square : public ISound -{ -private: - /** - * The frequence of the square wave. - */ - const float m_frequency; - - /** - * The target sample rate for output. - */ - const SampleRate m_sampleRate; - - // delete copy constructor and operator= - Square(const Square&) = delete; - Square& operator=(const Square&) = delete; - -public: - /** - * Creates a new square sound. - * \param frequency The desired frequency. - * \param sampleRate The target sample rate for playback. - */ - Square(float frequency, - SampleRate sampleRate = RATE_48000); - - /** - * Returns the frequency of the square wave. - */ - float getFrequency() const; - - virtual std::shared_ptr<IReader> createReader(); -}; - -AUD_NAMESPACE_END diff --git a/extern/audaspace/include/generator/SquareReader.h b/extern/audaspace/include/generator/SquareReader.h deleted file mode 100644 index 53fc574c767..00000000000 --- a/extern/audaspace/include/generator/SquareReader.h +++ /dev/null @@ -1,86 +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 SquareReader.h - * @ingroup generator - * The SquareReader class. - */ - -#include "IReader.h" - -AUD_NAMESPACE_BEGIN - -/** - * This class is used for square tone playback. - * The output format is in the 16 bit format and stereo, the sample rate can be - * specified. - * As the two channels both play the same the output could also be mono, but - * in most cases this will result in having to resample for output, so stereo - * sound is created directly. - */ -class AUD_API SquareReader : public IReader -{ -private: - /** - * The frequency of the sine wave. - */ - float m_frequency; - - /** - * The current position in samples. - */ - int m_position; - - /** - * The value of the current sample. - */ - float m_sample; - - /** - * The sample rate for the output. - */ - const SampleRate m_sampleRate; - - // delete copy constructor and operator= - SquareReader(const SquareReader&) = delete; - SquareReader& operator=(const SquareReader&) = delete; - -public: - /** - * Creates a new reader. - * \param frequency The frequency of the sine wave. - * \param sampleRate The output sample rate. - */ - SquareReader(float frequency, SampleRate sampleRate); - - /** - * Sets the frequency of the wave. - * @param frequency The new frequency in Hertz. - */ - void setFrequency(float frequency); - - virtual bool isSeekable() const; - virtual void seek(int position); - virtual int getLength() const; - virtual int getPosition() const; - virtual Specs getSpecs() const; - virtual void read(int & length, bool &eos, sample_t* buffer); -}; - -AUD_NAMESPACE_END diff --git a/extern/audaspace/include/generator/Triangle.h b/extern/audaspace/include/generator/Triangle.h deleted file mode 100644 index 4f607fc23b5..00000000000 --- a/extern/audaspace/include/generator/Triangle.h +++ /dev/null @@ -1,67 +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 Triangle.h - * @ingroup generator - * The Triangle class. - */ - -#include "ISound.h" -#include "respec/Specification.h" - -AUD_NAMESPACE_BEGIN - -/** - * This sound creates a reader that plays a triangle tone. - */ -class AUD_API Triangle : public ISound -{ -private: - /** - * The frequence of the triangle wave. - */ - const float m_frequency; - - /** - * The target sample rate for output. - */ - const SampleRate m_sampleRate; - - // delete copy constructor and operator= - Triangle(const Triangle&) = delete; - Triangle& operator=(const Triangle&) = delete; - -public: - /** - * Creates a new triangle sound. - * \param frequency The desired frequency. - * \param sampleRate The target sample rate for playback. - */ - Triangle(float frequency, - SampleRate sampleRate = RATE_48000); - - /** - * Returns the frequency of the triangle wave. - */ - float getFrequency() const; - - virtual std::shared_ptr<IReader> createReader(); -}; - -AUD_NAMESPACE_END diff --git a/extern/audaspace/include/generator/TriangleReader.h b/extern/audaspace/include/generator/TriangleReader.h deleted file mode 100644 index 15079404b75..00000000000 --- a/extern/audaspace/include/generator/TriangleReader.h +++ /dev/null @@ -1,86 +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 TriangleReader.h - * @ingroup generator - * The TriangleReader class. - */ - -#include "IReader.h" - -AUD_NAMESPACE_BEGIN - -/** - * This class is used for sawtooth tone playback. - * The output format is in the 16 bit format and stereo, the sample rate can be - * specified. - * As the two channels both play the same the output could also be mono, but - * in most cases this will result in having to resample for output, so stereo - * sound is created directly. - */ -class AUD_API TriangleReader : public IReader -{ -private: - /** - * The frequency of the sine wave. - */ - float m_frequency; - - /** - * The current position in samples. - */ - int m_position; - - /** - * The value of the current sample. - */ - float m_sample; - - /** - * The sample rate for the output. - */ - const SampleRate m_sampleRate; - - // delete copy constructor and operator= - TriangleReader(const TriangleReader&) = delete; - TriangleReader& operator=(const TriangleReader&) = delete; - -public: - /** - * Creates a new reader. - * \param frequency The frequency of the sine wave. - * \param sampleRate The output sample rate. - */ - TriangleReader(float frequency, SampleRate sampleRate); - - /** - * Sets the frequency of the wave. - * @param frequency The new frequency in Hertz. - */ - void setFrequency(float frequency); - - virtual bool isSeekable() const; - virtual void seek(int position); - virtual int getLength() const; - virtual int getPosition() const; - virtual Specs getSpecs() const; - virtual void read(int & length, bool &eos, sample_t* buffer); -}; - -AUD_NAMESPACE_END diff --git a/extern/audaspace/include/plugin/PluginManager.h b/extern/audaspace/include/plugin/PluginManager.h deleted file mode 100644 index af2f469c4ea..00000000000 --- a/extern/audaspace/include/plugin/PluginManager.h +++ /dev/null @@ -1,81 +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 PluginManager.h - * @ingroup plugin - * The PluginManager class. - */ - -#include "Audaspace.h" - -#include <unordered_map> -#include <string> - -AUD_NAMESPACE_BEGIN - -/** - * This manager provides utilities for plugin loading. - */ -class AUD_API PluginManager -{ -private: - static std::unordered_map<std::string, void*> m_plugins; - - // delete copy constructor and operator= - PluginManager(const PluginManager&) = delete; - PluginManager& operator=(const PluginManager&) = delete; - PluginManager() = delete; - -public: - /** - * Opens a shared library. - * @param path The path to the file. - * @return A handle to the library or nullptr if opening failed. - */ - static void* openLibrary(const std::string& path); - - /** - * Looks up a symbol from an opened library. - * @param handle The handle to the opened library. - * @param name The name of the symbol to look up. - * @return The symbol or nullptr if the symbol was not found. - */ - static void* lookupLibrary(void* handle, const std::string& name); - - /** - * Closes an opened shared library. - * @param handle The handle to the library to be closed. - */ - static void closeLibrary(void* handle); - - /** - * Loads a plugin from a file. - * @param path The path to the file. - * @return Whether the file could successfully be loaded. - */ - static bool loadPlugin(const std::string& path); - - /** - * Loads all plugins found in a folder. - * @param path The path to the folder containing the plugins. - */ - static void loadPlugins(const std::string& path = ""); -}; - -AUD_NAMESPACE_END diff --git a/extern/audaspace/include/respec/ChannelMapper.h b/extern/audaspace/include/respec/ChannelMapper.h deleted file mode 100644 index 5481a42c433..00000000000 --- a/extern/audaspace/include/respec/ChannelMapper.h +++ /dev/null @@ -1,51 +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 ChannelMapper.h - * @ingroup respec - * The ChannelMapper class. - */ - -#include "respec/SpecsChanger.h" - -AUD_NAMESPACE_BEGIN - -/** - * This sound creates a reader that maps a sound source's channels to a - * specific output channel count. - */ -class AUD_API ChannelMapper : public SpecsChanger -{ -private: - // delete copy constructor and operator= - ChannelMapper(const ChannelMapper&) = delete; - ChannelMapper& operator=(const ChannelMapper&) = delete; - -public: - /** - * Creates a new sound. - * \param sound The input sound. - * \param specs The target specifications. - */ - ChannelMapper(std::shared_ptr<ISound> sound, DeviceSpecs specs); - - virtual std::shared_ptr<IReader> createReader(); -}; - -AUD_NAMESPACE_END diff --git a/extern/audaspace/include/respec/ChannelMapperReader.h b/extern/audaspace/include/respec/ChannelMapperReader.h deleted file mode 100644 index 00739ee995f..00000000000 --- a/extern/audaspace/include/respec/ChannelMapperReader.h +++ /dev/null @@ -1,151 +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 ChannelMapperReader.h - * @ingroup respec - * The ChannelMapperReader class. - */ - -#include "fx/EffectReader.h" -#include "util/Buffer.h" - -AUD_NAMESPACE_BEGIN - -/** - * This class maps a sound source's channels to a specific output channel count. - * \note The input sample format must be float. - */ -class AUD_API ChannelMapperReader : public EffectReader -{ -private: - /** - * The sound reading buffer. - */ - Buffer m_buffer; - - /** - * The output specification. - */ - Channels m_target_channels; - - /** - * The channel count of the reader. - */ - Channels m_source_channels; - - /** - * The mapping specification. - */ - float* m_mapping; - - /** - * The size of the mapping. - */ - int m_map_size; - - /** - * The mono source angle. - */ - float m_mono_angle; - - static const Channel MONO_MAP[]; - static const Channel STEREO_MAP[]; - static const Channel STEREO_LFE_MAP[]; - static const Channel SURROUND4_MAP[]; - static const Channel SURROUND5_MAP[]; - static const Channel SURROUND51_MAP[]; - static const Channel SURROUND61_MAP[]; - static const Channel SURROUND71_MAP[]; - static const Channel* CHANNEL_MAPS[]; - - static const float MONO_ANGLES[]; - static const float STEREO_ANGLES[]; - static const float STEREO_LFE_ANGLES[]; - static const float SURROUND4_ANGLES[]; - static const float SURROUND5_ANGLES[]; - static const float SURROUND51_ANGLES[]; - static const float SURROUND61_ANGLES[]; - static const float SURROUND71_ANGLES[]; - static const float* CHANNEL_ANGLES[]; - - // delete copy constructor and operator= - ChannelMapperReader(const ChannelMapperReader&) = delete; - ChannelMapperReader& operator=(const ChannelMapperReader&) = delete; - - /** - * Calculates the mapping matrix. - */ - void AUD_LOCAL calculateMapping(); - - /** - * Calculates the distance between two angles. - */ - float AUD_LOCAL angleDistance(float alpha, float beta); - -public: - /** - * Creates a channel mapper reader. - * \param reader The reader to map. - * \param channels The target channel count this reader should map to. - */ - ChannelMapperReader(std::shared_ptr<IReader> reader, Channels channels); - - /** - * Destroys the reader. - */ - ~ChannelMapperReader(); - - /** - * Returns the channel configuration of the source reader. - * @return The channel configuration of the reader. - */ - Channels getSourceChannels() const; - - /** - * Returns the target channel configuration. - * Equals getSpecs().channels. - * @return The target channel configuration. - */ - Channels getChannels() const; - - /** - * Sets the requested channel output count. - * \param channels The channel output count. - */ - void setChannels(Channels channels); - - /** - * Returns the mapping of the source channel to the target channel. - * @param source The number of the source channel. Should be in the range [0, source channels). - * @param target The number of the target channel. Should be in the range [0, target channels). - * @return The mapping value which should be between 0.0 and 1.0. If source or target are out of range, NaN is returned. - */ - float getMapping(int source, int target); - - /** - * Sets the angle for mono sources. - * \param angle The angle for mono sources. - */ - void setMonoAngle(float angle); - - virtual Specs getSpecs() const; - virtual void read(int& length, bool& eos, sample_t* buffer); -}; - -AUD_NAMESPACE_END diff --git a/extern/audaspace/include/respec/Converter.h b/extern/audaspace/include/respec/Converter.h deleted file mode 100644 index 35664b28025..00000000000 --- a/extern/audaspace/include/respec/Converter.h +++ /dev/null @@ -1,51 +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 Converter.h - * @ingroup respec - * The Converter class. - */ - -#include "respec/SpecsChanger.h" - -AUD_NAMESPACE_BEGIN - -/** - * This sound creates a converter reader that is able to convert from one - * audio format to another. - */ -class AUD_API Converter : public SpecsChanger -{ -private: - // delete copy constructor and operator= - Converter(const Converter&) = delete; - Converter& operator=(const Converter&) = delete; - -public: - /** - * Creates a new sound. - * \param sound The input sound. - * \param specs The target specifications. - */ - Converter(std::shared_ptr<ISound> sound, DeviceSpecs specs); - - virtual std::shared_ptr<IReader> createReader(); -}; - -AUD_NAMESPACE_END diff --git a/extern/audaspace/include/respec/ConverterFunctions.h b/extern/audaspace/include/respec/ConverterFunctions.h deleted file mode 100644 index 3cc4a713cc9..00000000000 --- a/extern/audaspace/include/respec/ConverterFunctions.h +++ /dev/null @@ -1,377 +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 ConverterFunctions.h - * @ingroup respec - * Defines several conversion functions between different sample formats. - */ - -#include "Audaspace.h" - -#include <cstring> - -AUD_NAMESPACE_BEGIN - -/** - * The function template for functions converting from one sample format - * to another, having the same parameter order as std::memcpy. - */ -typedef void (*convert_f)(data_t* target, data_t* source, int length); - -/** - * The copy conversion function simply calls std::memcpy. - * @param target The target buffer. - * @param source The source buffer. - * @param length The amount of samples to be converted. - */ -template <class T> -void convert_copy(data_t* target, data_t* source, int length) -{ - std::memcpy(target, source, length*sizeof(T)); -} - -/** - * @brief Converts from FORMAT_U8 to FORMAT_S16. - * @param target The target buffer. - * @param source The source buffer. - * @param length The amount of samples to be converted. - */ -void AUD_API convert_u8_s16(data_t* target, data_t* source, int length); - -/** - * @brief Converts from FORMAT_U8 to FORMAT_S24 big endian. - * @param target The target buffer. - * @param source The source buffer. - * @param length The amount of samples to be converted. - */ -void AUD_API convert_u8_s24_be(data_t* target, data_t* source, int length); - -/** - * @brief Converts from FORMAT_U8 to FORMAT_S24 little endian. - * @param target The target buffer. - * @param source The source buffer. - * @param length The amount of samples to be converted. - */ -void AUD_API convert_u8_s24_le(data_t* target, data_t* source, int length); - -/** - * @brief Converts from FORMAT_U8 to FORMAT_S32. - * @param target The target buffer. - * @param source The source buffer. - * @param length The amount of samples to be converted. - */ -void AUD_API convert_u8_s32(data_t* target, data_t* source, int length); - -/** - * @brief Converts from FORMAT_U8 to FORMAT_FLOAT32. - * @param target The target buffer. - * @param source The source buffer. - * @param length The amount of samples to be converted. - */ -void AUD_API convert_u8_float(data_t* target, data_t* source, int length); - -/** - * @brief Converts from FORMAT_U8 to FORMAT_FLOAT64. - * @param target The target buffer. - * @param source The source buffer. - * @param length The amount of samples to be converted. - */ -void AUD_API convert_u8_double(data_t* target, data_t* source, int length); - -/** - * @brief Converts from FORMAT_S16 to FORMAT_U8. - * @param target The target buffer. - * @param source The source buffer. - * @param length The amount of samples to be converted. - */ -void AUD_API convert_s16_u8(data_t* target, data_t* source, int length); - -/** - * @brief Converts from FORMAT_S16 to FORMAT_S24 big endian. - * @param target The target buffer. - * @param source The source buffer. - * @param length The amount of samples to be converted. - */ -void AUD_API convert_s16_s24_be(data_t* target, data_t* source, int length); - -/** - * @brief Converts from FORMAT_S16 to FORMAT_S24 little endian. - * @param target The target buffer. - * @param source The source buffer. - * @param length The amount of samples to be converted. - */ -void AUD_API convert_s16_s24_le(data_t* target, data_t* source, int length); - -/** - * @brief Converts from FORMAT_S16 to FORMAT_S32. - * @param target The target buffer. - * @param source The source buffer. - * @param length The amount of samples to be converted. - */ -void AUD_API convert_s16_s32(data_t* target, data_t* source, int length); - -/** - * @brief Converts from FORMAT_S16 to FORMAT_FLOAT32. - * @param target The target buffer. - * @param source The source buffer. - * @param length The amount of samples to be converted. - */ -void AUD_API convert_s16_float(data_t* target, data_t* source, int length); - -/** - * @brief Converts from FORMAT_S16 to FORMAT_FLOAT64. - * @param target The target buffer. - * @param source The source buffer. - * @param length The amount of samples to be converted. - */ -void AUD_API convert_s16_double(data_t* target, data_t* source, int length); - -/** - * @brief Converts from FORMAT_S24 big endian to FORMAT_U8. - * @param target The target buffer. - * @param source The source buffer. - * @param length The amount of samples to be converted. - */ -void AUD_API convert_s24_u8_be(data_t* target, data_t* source, int length); - -/** - * @brief Converts from FORMAT_S24 little endian to FORMAT_U8. - * @param target The target buffer. - * @param source The source buffer. - * @param length The amount of samples to be converted. - */ -void AUD_API convert_s24_u8_le(data_t* target, data_t* source, int length); - -/** - * @brief Converts from FORMAT_S24 big endian to FORMAT_S16. - * @param target The target buffer. - * @param source The source buffer. - * @param length The amount of samples to be converted. - */ -void AUD_API convert_s24_s16_be(data_t* target, data_t* source, int length); - -/** - * @brief Converts from FORMAT_S24 little endian to FORMAT_S16. - * @param target The target buffer. - * @param source The source buffer. - * @param length The amount of samples to be converted. - */ -void AUD_API convert_s24_s16_le(data_t* target, data_t* source, int length); - -/** - * @brief Converts from FORMAT_S24 to FORMAT_S24 simply using std::memcpy. - * @param target The target buffer. - * @param source The source buffer. - * @param length The amount of samples to be converted. - */ -void AUD_API convert_s24_s24(data_t* target, data_t* source, int length); - -/** - * @brief Converts from FORMAT_S24 big endian to FORMAT_S32. - * @param target The target buffer. - * @param source The source buffer. - * @param length The amount of samples to be converted. - */ -void AUD_API convert_s24_s32_be(data_t* target, data_t* source, int length); - -/** - * @brief Converts from FORMAT_S24 little endian to FORMAT_S32. - * @param target The target buffer. - * @param source The source buffer. - * @param length The amount of samples to be converted. - */ -void AUD_API convert_s24_s32_le(data_t* target, data_t* source, int length); - -/** - * @brief Converts from FORMAT_S24 big endian to FORMAT_FLOAT32. - * @param target The target buffer. - * @param source The source buffer. - * @param length The amount of samples to be converted. - */ -void AUD_API convert_s24_float_be(data_t* target, data_t* source, int length); - -/** - * @brief Converts from FORMAT_S24 little endian to FORMAT_FLOAT32. - * @param target The target buffer. - * @param source The source buffer. - * @param length The amount of samples to be converted. - */ -void AUD_API convert_s24_float_le(data_t* target, data_t* source, int length); - -/** - * @brief Converts from FORMAT_S24 big endian to FORMAT_FLOAT64. - * @param target The target buffer. - * @param source The source buffer. - * @param length The amount of samples to be converted. - */ -void AUD_API convert_s24_double_be(data_t* target, data_t* source, int length); - -/** - * @brief Converts from FORMAT_S24 little endian to FORMAT_FLOAT64. - * @param target The target buffer. - * @param source The source buffer. - * @param length The amount of samples to be converted. - */ -void AUD_API convert_s24_double_le(data_t* target, data_t* source, int length); - -/** - * @brief Converts from FORMAT_S32 to FORMAT_U8. - * @param target The target buffer. - * @param source The source buffer. - * @param length The amount of samples to be converted. - */ -void AUD_API convert_s32_u8(data_t* target, data_t* source, int length); - -/** - * @brief Converts from FORMAT_S32 to FORMAT_S16. - * @param target The target buffer. - * @param source The source buffer. - * @param length The amount of samples to be converted. - */ -void AUD_API convert_s32_s16(data_t* target, data_t* source, int length); - -/** - * @brief Converts from FORMAT_S32 to FORMAT_S24 big endian. - * @param target The target buffer. - * @param source The source buffer. - * @param length The amount of samples to be converted. - */ -void AUD_API convert_s32_s24_be(data_t* target, data_t* source, int length); - -/** - * @brief Converts from FORMAT_S32 to FORMAT_S24 little endian. - * @param target The target buffer. - * @param source The source buffer. - * @param length The amount of samples to be converted. - */ -void AUD_API convert_s32_s24_le(data_t* target, data_t* source, int length); - -/** - * @brief Converts from FORMAT_S32 to FORMAT_FLOAT32. - * @param target The target buffer. - * @param source The source buffer. - * @param length The amount of samples to be converted. - */ -void AUD_API convert_s32_float(data_t* target, data_t* source, int length); - -/** - * @brief Converts from FORMAT_S32 to FORMAT_FLOAT64. - * @param target The target buffer. - * @param source The source buffer. - * @param length The amount of samples to be converted. - */ -void AUD_API convert_s32_double(data_t* target, data_t* source, int length); - -/** - * @brief Converts from FORMAT_FLOAT32 to FORMAT_U8. - * @param target The target buffer. - * @param source The source buffer. - * @param length The amount of samples to be converted. - */ -void AUD_API convert_float_u8(data_t* target, data_t* source, int length); - -/** - * @brief Converts from FORMAT_FLOAT32 to FORMAT_S16. - * @param target The target buffer. - * @param source The source buffer. - * @param length The amount of samples to be converted. - */ -void AUD_API convert_float_s16(data_t* target, data_t* source, int length); - -/** - * @brief Converts from FORMAT_FLOAT32 to FORMAT_S24 big endian. - * @param target The target buffer. - * @param source The source buffer. - * @param length The amount of samples to be converted. - */ -void AUD_API convert_float_s24_be(data_t* target, data_t* source, int length); - -/** - * @brief Converts from FORMAT_FLOAT32 to FORMAT_S24 little endian. - * @param target The target buffer. - * @param source The source buffer. - * @param length The amount of samples to be converted. - */ -void AUD_API convert_float_s24_le(data_t* target, data_t* source, int length); - -/** - * @brief Converts from FORMAT_FLOAT32 to FORMAT_S32. - * @param target The target buffer. - * @param source The source buffer. - * @param length The amount of samples to be converted. - */ -void AUD_API convert_float_s32(data_t* target, data_t* source, int length); - -/** - * @brief Converts from FORMAT_FLOAT32 to FORMAT_FLOAT64. - * @param target The target buffer. - * @param source The source buffer. - * @param length The amount of samples to be converted. - */ -void AUD_API convert_float_double(data_t* target, data_t* source, int length); - -/** - * @brief Converts from FORMAT_FLOAT64 to FORMAT_U8. - * @param target The target buffer. - * @param source The source buffer. - * @param length The amount of samples to be converted. - */ -void AUD_API convert_double_u8(data_t* target, data_t* source, int length); - -/** - * @brief Converts from FORMAT_FLOAT64 to FORMAT_S16. - * @param target The target buffer. - * @param source The source buffer. - * @param length The amount of samples to be converted. - */ -void AUD_API convert_double_s16(data_t* target, data_t* source, int length); - -/** - * @brief Converts from FORMAT_FLOAT64 to FORMAT_S24 big endian. - * @param target The target buffer. - * @param source The source buffer. - * @param length The amount of samples to be converted. - */ -void AUD_API convert_double_s24_be(data_t* target, data_t* source, int length); - -/** - * @brief Converts from FORMAT_FLOAT64 to FORMAT_S24 little endian. - * @param target The target buffer. - * @param source The source buffer. - * @param length The amount of samples to be converted. - */ -void AUD_API convert_double_s24_le(data_t* target, data_t* source, int length); - -/** - * @brief Converts from FORMAT_FLOAT64 to FORMAT_S32. - * @param target The target buffer. - * @param source The source buffer. - * @param length The amount of samples to be converted. - */ -void AUD_API convert_double_s32(data_t* target, data_t* source, int length); - -/** - * @brief Converts from FORMAT_FLOAT64 to FORMAT_FLOAT32. - * @param target The target buffer. - * @param source The source buffer. - * @param length The amount of samples to be converted. - */ -void AUD_API convert_double_float(data_t* target, data_t* source, int length); - -AUD_NAMESPACE_END diff --git a/extern/audaspace/include/respec/ConverterReader.h b/extern/audaspace/include/respec/ConverterReader.h deleted file mode 100644 index c5ff6ded9ad..00000000000 --- a/extern/audaspace/include/respec/ConverterReader.h +++ /dev/null @@ -1,67 +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 ConverterReader.h - * @ingroup respec - * The ConverterReader class. - */ - -#include "fx/EffectReader.h" -#include "respec/ConverterFunctions.h" -#include "util/Buffer.h" - -AUD_NAMESPACE_BEGIN - -/** - * This class converts a sound source from one to another format. - */ -class AUD_API ConverterReader : public EffectReader -{ -private: - /** - * The sound output buffer. - */ - Buffer m_buffer; - - /** - * The target specification. - */ - SampleFormat m_format; - - /** - * Converter function. - */ - convert_f m_convert; - - // delete copy constructor and operator= - ConverterReader(const ConverterReader&) = delete; - ConverterReader& operator=(const ConverterReader&) = delete; - -public: - /** - * Creates a converter reader. - * \param reader The reader to convert. - * \param specs The target specification. - */ - ConverterReader(std::shared_ptr<IReader> reader, DeviceSpecs specs); - - virtual void read(int& length, bool& eos, sample_t* buffer); -}; - -AUD_NAMESPACE_END diff --git a/extern/audaspace/include/respec/JOSResample.h b/extern/audaspace/include/respec/JOSResample.h deleted file mode 100644 index b1f4d757c3c..00000000000 --- a/extern/audaspace/include/respec/JOSResample.h +++ /dev/null @@ -1,50 +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 JOSResample.h - * @ingroup respec - * The JOSResample class. - */ - -#include "respec/SpecsChanger.h" - -AUD_NAMESPACE_BEGIN - -/** - * This sound creates a resampling reader that does Julius O. Smith's resampling algorithm. - */ -class AUD_API JOSResample : public SpecsChanger -{ -private: - // delete copy constructor and operator= - JOSResample(const JOSResample&) = delete; - JOSResample& operator=(const JOSResample&) = delete; - -public: - /** - * Creates a new sound. - * \param sound The input sound. - * \param specs The target specifications. - */ - JOSResample(std::shared_ptr<ISound> sound, DeviceSpecs specs); - - virtual std::shared_ptr<IReader> createReader(); -}; - -AUD_NAMESPACE_END diff --git a/extern/audaspace/include/respec/JOSResampleReader.h b/extern/audaspace/include/respec/JOSResampleReader.h deleted file mode 100644 index e9dd3b4220b..00000000000 --- a/extern/audaspace/include/respec/JOSResampleReader.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 JOSResampleReader.h - * @ingroup respec - * The JOSResampleReader class. - */ - -#include "respec/ResampleReader.h" -#include "util/Buffer.h" - -AUD_NAMESPACE_BEGIN - -/** - * This resampling reader uses Julius O. Smith's resampling algorithm. - */ -class AUD_API JOSResampleReader : public ResampleReader -{ -private: - typedef void (JOSResampleReader::*resample_f)(double target_factor, int length, sample_t* buffer); - - /** - * The half filter length. - */ - static const int m_len; - - /** - * The sample step size for the filter. - */ - static const int m_L; - - /** - * The filter coefficients. - */ - static const float m_coeff[]; - - /** - * The reader channels. - */ - Channels m_channels; - - /** - * The sample position in the cache. - */ - unsigned int m_n; - - /** - * The subsample position in the cache. - */ - double m_P; - - /** - * The input data buffer. - */ - Buffer m_buffer; - - /** - * Double buffer for the sums. - */ - Buffer m_sums; - - /** - * How many samples in the cache are valid. - */ - int m_cache_valid; - - /** - * Resample function. - */ - resample_f m_resample; - - /** - * Last resampling factor. - */ - double m_last_factor; - - // delete copy constructor and operator= - JOSResampleReader(const JOSResampleReader&) = delete; - JOSResampleReader& operator=(const JOSResampleReader&) = delete; - - /** - * Resets the resampler to its initial state. - */ - void AUD_LOCAL reset(); - - /** - * Updates the buffer to be as small as possible for the coming reading. - * \param size The size of samples to be read. - * \param factor The next resampling factor. - * \param samplesize The size of a sample. - */ - void AUD_LOCAL updateBuffer(int size, double factor, int samplesize); - - void AUD_LOCAL resample(double target_factor, int length, sample_t* buffer); - void AUD_LOCAL resample_mono(double target_factor, int length, sample_t* buffer); - void AUD_LOCAL resample_stereo(double target_factor, int length, sample_t* buffer); - -public: - /** - * Creates a resampling reader. - * \param reader The reader to mix. - * \param rate The target sampling rate. - */ - JOSResampleReader(std::shared_ptr<IReader> reader, SampleRate rate); - - virtual void seek(int position); - virtual int getLength() const; - virtual int getPosition() const; - virtual Specs getSpecs() const; - virtual void read(int& length, bool& eos, sample_t* buffer); -}; - -AUD_NAMESPACE_END diff --git a/extern/audaspace/include/respec/LinearResample.h b/extern/audaspace/include/respec/LinearResample.h deleted file mode 100644 index 207cf2a6548..00000000000 --- a/extern/audaspace/include/respec/LinearResample.h +++ /dev/null @@ -1,50 +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 LinearResample.h - * @ingroup respec - * The LinearResample class. - */ - -#include "respec/SpecsChanger.h" - -AUD_NAMESPACE_BEGIN - -/** - * This sound creates a resampling reader that does simple linear resampling. - */ -class AUD_API LinearResample : public SpecsChanger -{ -private: - // delete copy constructor and operator= - LinearResample(const LinearResample&) = delete; - LinearResample& operator=(const LinearResample&) = delete; - -public: - /** - * Creates a new sound. - * \param sound The input sound. - * \param specs The target specifications. - */ - LinearResample(std::shared_ptr<ISound> sound, DeviceSpecs specs); - - virtual std::shared_ptr<IReader> createReader(); -}; - -AUD_NAMESPACE_END diff --git a/extern/audaspace/include/respec/LinearResampleReader.h b/extern/audaspace/include/respec/LinearResampleReader.h deleted file mode 100644 index aaf95672e55..00000000000 --- a/extern/audaspace/include/respec/LinearResampleReader.h +++ /dev/null @@ -1,80 +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 LinearResampleReader.h - * @ingroup respec - * The LinearResampleReader class. - */ - -#include "respec/ResampleReader.h" -#include "util/Buffer.h" - -AUD_NAMESPACE_BEGIN - -/** - * This resampling reader does simple first-order hold resampling. - */ -class AUD_API LinearResampleReader : public ResampleReader -{ -private: - /** - * The reader channels. - */ - Channels m_channels; - - /** - * The position in the cache. - */ - float m_cache_pos; - - /** - * The sound output buffer. - */ - Buffer m_buffer; - - /** - * The input caching buffer. - */ - Buffer m_cache; - - /** - * Whether the cache contains valid data. - */ - bool m_cache_ok; - - // delete copy constructor and operator= - LinearResampleReader(const LinearResampleReader&) = delete; - LinearResampleReader& operator=(const LinearResampleReader&) = delete; - -public: - /** - * Creates a resampling reader. - * \param reader The reader to mix. - * \param rate The target sampling rate. - */ - LinearResampleReader(std::shared_ptr<IReader> reader, SampleRate rate); - - virtual void seek(int position); - virtual int getLength() const; - virtual int getPosition() const; - virtual Specs getSpecs() const; - virtual void read(int& length, bool& eos, sample_t* buffer); -}; - -AUD_NAMESPACE_END diff --git a/extern/audaspace/include/respec/Mixer.h b/extern/audaspace/include/respec/Mixer.h deleted file mode 100644 index 600467826cd..00000000000 --- a/extern/audaspace/include/respec/Mixer.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 Mixer.h - * @ingroup respec - * The Mixer class. - */ - -#include "respec/Specification.h" -#include "respec/ConverterFunctions.h" -#include "util/Buffer.h" - -#include <memory> - -AUD_NAMESPACE_BEGIN - -class IReader; - -/** - * This abstract class is able to mix audiosignals with same channel count - * and sample rate and convert it to a specific output format. - */ -class AUD_API Mixer -{ -private: - // delete copy constructor and operator= - Mixer(const Mixer&) = delete; - Mixer& operator=(const Mixer&) = delete; - -protected: - /** - * The output specification. - */ - DeviceSpecs m_specs; - - /** - * The length of the mixing buffer. - */ - int m_length; - - /** - * The mixing buffer. - */ - Buffer m_buffer; - - /** - * Converter function. - */ - convert_f m_convert; - -public: - /** - * Creates the mixer. - */ - Mixer(DeviceSpecs specs); - - /** - * Destroys the mixer. - */ - virtual ~Mixer() {} - - /** - * Returns the target specification for superposing. - * \return The target specification. - */ - DeviceSpecs getSpecs() const; - - /** - * Sets the target specification for superposing. - * \param specs The target specification. - */ - void setSpecs(Specs specs); - - /** - * Mixes a buffer. - * \param buffer The buffer to superpose. - * \param start The start sample of the buffer. - * \param length The length of the buffer in samples. - * \param volume The mixing volume. Must be a value between 0.0 and 1.0. - */ - void mix(sample_t* buffer, int start, int length, float volume); - - /** - * Mixes a buffer with linear volume interpolation. - * \param buffer The buffer to superpose. - * \param start The start sample of the buffer. - * \param length The length of the buffer in samples. - * \param volume_to The target mixing volume. Must be a value between 0.0 and 1.0. - * \param volume_from The start mixing volume. Must be a value between 0.0 and 1.0. - */ - void mix(sample_t* buffer, int start, int length, float volume_to, float volume_from); - - /** - * Writes the mixing buffer into an output buffer. - * \param buffer The target buffer for superposing. - * \param volume The mixing volume. Must be a value between 0.0 and 1.0. - */ - void read(data_t* buffer, float volume); - - /** - * Clears the mixing buffer. - * \param length The length of the buffer in samples. - */ - void clear(int length); -}; - -AUD_NAMESPACE_END diff --git a/extern/audaspace/include/respec/ResampleReader.h b/extern/audaspace/include/respec/ResampleReader.h deleted file mode 100644 index b38a8d5eb18..00000000000 --- a/extern/audaspace/include/respec/ResampleReader.h +++ /dev/null @@ -1,61 +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 ResampleReader.h - * @ingroup respec - * The ResampleReader class. - */ - -#include "fx/EffectReader.h" - -AUD_NAMESPACE_BEGIN - -/** - * This is the base class for all resampling readers. - */ -class AUD_API ResampleReader : public EffectReader -{ -protected: - /** - * The target sampling rate. - */ - SampleRate m_rate; - - /** - * Creates a resampling reader. - * \param reader The reader to mix. - * \param rate The target sampling rate. - */ - ResampleReader(std::shared_ptr<IReader> reader, SampleRate rate); - -public: - /** - * Sets the sample rate. - * \param rate The target sampling rate. - */ - virtual void setRate(SampleRate rate); - - /** - * Retrieves the sample rate. - * \return The target sampling rate. - */ - virtual SampleRate getRate(); -}; - -AUD_NAMESPACE_END diff --git a/extern/audaspace/include/respec/Specification.h b/extern/audaspace/include/respec/Specification.h deleted file mode 100644 index efcbb4cabce..00000000000 --- a/extern/audaspace/include/respec/Specification.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 - -/** - * @file Specification.h - * @ingroup respec - * Defines all important macros and basic data structures for stream format descriptions. - */ - -#include "Audaspace.h" - -/// The size of a format in bytes. -#define AUD_FORMAT_SIZE(format) (format & 0x0F) -/// The size of a sample in the specified device format in bytes. -#define AUD_DEVICE_SAMPLE_SIZE(specs) (specs.channels * (specs.format & 0x0F)) -/// The size of a sample in the specified format in bytes. -#define AUD_SAMPLE_SIZE(specs) (specs.channels * sizeof(sample_t)) - -/// Compares two audio data specifications. -#define AUD_COMPARE_SPECS(s1, s2) ((s1.rate == s2.rate) && (s1.channels == s2.channels)) - -/// Returns the bit for a channel mask. -#define AUD_CHANNEL_BIT(channel) (0x01 << channel) - -AUD_NAMESPACE_BEGIN - -/** - * The format of a sample. - * The last 4 bit save the byte count of the format. - */ -enum SampleFormat -{ - FORMAT_INVALID = 0x00, /// Invalid sample format. - FORMAT_U8 = 0x01, /// 1 byte unsigned byte. - FORMAT_S16 = 0x12, /// 2 byte signed integer. - FORMAT_S24 = 0x13, /// 3 byte signed integer. - FORMAT_S32 = 0x14, /// 4 byte signed integer. - FORMAT_FLOAT32 = 0x24, /// 4 byte float. - FORMAT_FLOAT64 = 0x28 /// 8 byte float. -}; - -/// The channel count. -enum Channels -{ - CHANNELS_INVALID = 0, /// Invalid channel count. - CHANNELS_MONO = 1, /// Mono. - CHANNELS_STEREO = 2, /// Stereo. - CHANNELS_STEREO_LFE = 3, /// Stereo with LFE channel. - CHANNELS_SURROUND4 = 4, /// 4 channel surround sound. - CHANNELS_SURROUND5 = 5, /// 5 channel surround sound. - CHANNELS_SURROUND51 = 6, /// 5.1 surround sound. - CHANNELS_SURROUND61 = 7, /// 6.1 surround sound. - CHANNELS_SURROUND71 = 8 /// 7.1 surround sound. -}; - -/// The channel names. -enum Channel -{ - CHANNEL_FRONT_LEFT = 0, - CHANNEL_FRONT_RIGHT, - CHANNEL_FRONT_CENTER, - CHANNEL_LFE, - CHANNEL_REAR_LEFT, - CHANNEL_REAR_RIGHT, - CHANNEL_REAR_CENTER, - CHANNEL_SIDE_LEFT, - CHANNEL_SIDE_RIGHT, - CHANNEL_MAX -}; - -/** - * The sample rate tells how many samples are played back within one second. - * Some exotic formats may use other sample rates than provided here. - */ -enum DefaultSampleRate -{ - RATE_INVALID = 0, /// Invalid sample rate. - RATE_8000 = 8000, /// 8000 Hz. - RATE_16000 = 16000, /// 16000 Hz. - RATE_11025 = 11025, /// 11025 Hz. - RATE_22050 = 22050, /// 22050 Hz. - RATE_32000 = 32000, /// 32000 Hz. - RATE_44100 = 44100, /// 44100 Hz. - RATE_48000 = 48000, /// 48000 Hz. - RATE_88200 = 88200, /// 88200 Hz. - RATE_96000 = 96000, /// 96000 Hz. - RATE_192000 = 192000 /// 192000 Hz. -}; - -/// Sample rate type. -typedef double SampleRate; - -/// Specification of a sound source. -struct Specs -{ - /// Sample rate in Hz. - SampleRate rate; - - /// Channel count. - Channels channels; -}; - -/// Specification of a sound device. -struct DeviceSpecs -{ - /// Sample format. - SampleFormat format; - - union - { - struct - { - /// Sample rate in Hz. - SampleRate rate; - - /// Channel count. - Channels channels; - }; - Specs specs; - }; -}; - -AUD_NAMESPACE_END diff --git a/extern/audaspace/include/respec/SpecsChanger.h b/extern/audaspace/include/respec/SpecsChanger.h deleted file mode 100644 index 2eb9f369497..00000000000 --- a/extern/audaspace/include/respec/SpecsChanger.h +++ /dev/null @@ -1,74 +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 SpecsChanger.h - * @ingroup respec - * The SpecsChanger class. - */ - -#include "ISound.h" -#include "respec/Specification.h" - -AUD_NAMESPACE_BEGIN - -/** - * This sound is a base class for all mixer factories. - */ -class AUD_API SpecsChanger : public ISound -{ -protected: - /** - * The target specification for resampling. - */ - const DeviceSpecs m_specs; - - /** - * If there is no reader it is created out of this sound. - */ - std::shared_ptr<ISound> m_sound; - - /** - * Returns the reader created out of the sound. - * This method can be used for the createReader function of the implementing - * classes. - * \return The reader to mix. - */ - std::shared_ptr<IReader> getReader() const; - -public: - /** - * Creates a new sound. - * \param sound The sound to create the readers to mix out of. - * \param specs The target specification. - */ - SpecsChanger(std::shared_ptr<ISound> sound, DeviceSpecs specs); - - /** - * Returns the target specification for resampling. - */ - DeviceSpecs getSpecs() const; - - /** - * Returns the saved sound. - * \return The sound. - */ - std::shared_ptr<ISound> getSound() const; -}; - -AUD_NAMESPACE_END diff --git a/extern/audaspace/include/sequence/AnimateableProperty.h b/extern/audaspace/include/sequence/AnimateableProperty.h deleted file mode 100644 index 2c3fcf23f8b..00000000000 --- a/extern/audaspace/include/sequence/AnimateableProperty.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 AnimateableProperty.h - * @ingroup sequence - * Defines the AnimateableProperty class as well as existing property types. - */ - -#include "util/Buffer.h" -#include "util/ILockable.h" - -#include <mutex> -#include <list> - -AUD_NAMESPACE_BEGIN - -/// Possible animatable properties for Sequencer Factories and Entries. -enum AnimateablePropertyType -{ - AP_VOLUME, - AP_PANNING, - AP_PITCH, - AP_LOCATION, - AP_ORIENTATION -}; - -/** - * This class saves animation data for float properties. - */ -class AUD_API AnimateableProperty : private Buffer -{ -private: - struct Unknown { - int start; - int end; - - Unknown(int start, int end) : - start(start), end(end) {} - }; - - /// The count of floats for a single property. - const int m_count; - - /// Whether the property is animated or not. - bool m_isAnimated; - - /// The mutex for locking. - std::recursive_mutex m_mutex; - - /// The list of unknown buffer areas. - std::list<Unknown> m_unknown; - - // delete copy constructor and operator= - AnimateableProperty(const AnimateableProperty&) = delete; - AnimateableProperty& operator=(const AnimateableProperty&) = delete; - - void AUD_LOCAL updateUnknownCache(int start, int end); - -public: - /** - * Creates a new animateable property. - * \param count The count of floats for a single property. - */ - AnimateableProperty(int count = 1); - - /** - * Creates a new animateable property. - * \param count The count of floats for a single property. - * \param value The value that the property should get initialized with. - * All count floats will be initialized to the same value. - */ - AnimateableProperty(int count, float value); - - /** - * Destroys the animateable property. - */ - ~AnimateableProperty(); - - /** - * Returns the count of floats for a single property. - * \return The count of floats stored per frame. - */ - int getCount() const; - - /** - * Writes the properties value and marks it non-animated. - * \param data The new value. - */ - void write(const float* data); - - /** - * Writes the properties value and marks it animated. - * \param data The new value. - * \param position The position in the animation in frames. - * \param count The count of frames to write. - */ - void write(const float* data, int position, int count); - - /** - * Reads the properties value. - * \param position The position in the animation in frames. - * \param[out] out Where to write the value to. - */ - void read(float position, float* out); - - /** - * Returns whether the property is animated. - * \return Whether the property is animated. - */ - bool isAnimated() const; -}; - -AUD_NAMESPACE_END diff --git a/extern/audaspace/include/sequence/Double.h b/extern/audaspace/include/sequence/Double.h deleted file mode 100644 index dc40ae29e0d..00000000000 --- a/extern/audaspace/include/sequence/Double.h +++ /dev/null @@ -1,60 +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 Double.h - * @ingroup sequence - * The Double class. - */ - -#include "ISound.h" - -AUD_NAMESPACE_BEGIN - -/** - * This sound plays two other factories behind each other. - */ -class AUD_API Double : public ISound -{ -private: - /** - * First played sound. - */ - std::shared_ptr<ISound> m_sound1; - - /** - * Second played sound. - */ - std::shared_ptr<ISound> m_sound2; - - // delete copy constructor and operator= - Double(const Double&) = delete; - Double& operator=(const Double&) = delete; - -public: - /** - * Creates a new double sound. - * \param sound1 The first input sound. - * \param sound2 The second input sound. - */ - Double(std::shared_ptr<ISound> sound1, std::shared_ptr<ISound> sound2); - - virtual std::shared_ptr<IReader> createReader(); -}; - -AUD_NAMESPACE_END diff --git a/extern/audaspace/include/sequence/DoubleReader.h b/extern/audaspace/include/sequence/DoubleReader.h deleted file mode 100644 index 012dcc8e832..00000000000 --- a/extern/audaspace/include/sequence/DoubleReader.h +++ /dev/null @@ -1,77 +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 DoubleReader.h - * @ingroup sequence - * The DoubleReader class. - */ - -#include "IReader.h" - -#include <memory> - -AUD_NAMESPACE_BEGIN - -/** - * This reader plays two readers sequently. - */ -class AUD_API DoubleReader : public IReader -{ -private: - /** - * The first reader. - */ - std::shared_ptr<IReader> m_reader1; - - /** - * The second reader. - */ - std::shared_ptr<IReader> m_reader2; - - /** - * Whether we've reached the end of the first reader. - */ - bool m_finished1; - - // delete copy constructor and operator= - DoubleReader(const DoubleReader&) = delete; - DoubleReader& operator=(const DoubleReader&) = delete; - -public: - /** - * Creates a new double reader. - * \param reader1 The first reader to read from. - * \param reader2 The second reader to read from. - */ - DoubleReader(std::shared_ptr<IReader> reader1, std::shared_ptr<IReader> reader2); - - /** - * Destroys the reader. - */ - virtual ~DoubleReader(); - - virtual bool isSeekable() const; - virtual void seek(int position); - virtual int getLength() const; - virtual int getPosition() const; - virtual Specs getSpecs() const; - virtual void read(int& length, bool& eos, sample_t* buffer); -}; - -AUD_NAMESPACE_END diff --git a/extern/audaspace/include/sequence/PingPong.h b/extern/audaspace/include/sequence/PingPong.h deleted file mode 100644 index 8b1bf792095..00000000000 --- a/extern/audaspace/include/sequence/PingPong.h +++ /dev/null @@ -1,50 +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 PingPong.h - * @ingroup sequence - * The PingPong class. - */ - -#include "fx/Effect.h" - -AUD_NAMESPACE_BEGIN - -/** - * This sound plays another sound first normal, then reversed. - * \note Readers from the underlying sound must be reversable with seeking. - */ -class AUD_API PingPong : public Effect -{ -private: - // delete copy constructor and operator= - PingPong(const PingPong&) = delete; - PingPong& operator=(const PingPong&) = delete; - -public: - /** - * Creates a new ping pong sound. - * \param sound The input sound. - */ - PingPong(std::shared_ptr<ISound> sound); - - virtual std::shared_ptr<IReader> createReader(); -}; - -AUD_NAMESPACE_END diff --git a/extern/audaspace/include/sequence/Sequence.h b/extern/audaspace/include/sequence/Sequence.h deleted file mode 100644 index 7005171e2c8..00000000000 --- a/extern/audaspace/include/sequence/Sequence.h +++ /dev/null @@ -1,171 +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 Sequence.h - * @ingroup sequence - * The Sequence class. - */ - -#include "ISound.h" -#include "respec/Specification.h" -#include "devices/I3DDevice.h" -#include "sequence/AnimateableProperty.h" - -#include <list> - -AUD_NAMESPACE_BEGIN - -class SequenceEntry; -class SequenceData; - -/** - * This sound represents sequenced entries to play a sound scene. - */ -class AUD_API Sequence : public ISound -{ - friend class SequenceReader; -private: - /// The sequence. - std::shared_ptr<SequenceData> m_sequence; - - // delete copy constructor and operator= - Sequence(const Sequence&) = delete; - Sequence& operator=(const Sequence&) = delete; - -public: - /** - * Creates a new sound scene. - * \param specs The output audio data specification. - * \param fps The FPS of the scene. - * \param muted Whether the whole scene is muted. - */ - Sequence(Specs specs, float fps, bool muted); - - /** - * Retrieves the audio output specification. - * \return The specification. - */ - Specs getSpecs(); - - /** - * Sets the audio output specification. - * \param specs The new specification. - */ - void setSpecs(Specs specs); - - /** - * Retrieves the scene's FPS. - * \return The scene's FPS. - */ - float getFPS() const; - - /** - * Sets the scene's FPS. - * \param fps The new FPS. - */ - void setFPS(float fps); - - /** - * Sets the muting state of the scene. - * \param muted Whether the scene is muted. - */ - void mute(bool muted); - - /** - * Retrieves the muting state of the scene. - * \return Whether the scene is muted. - */ - bool isMuted() const; - - /** - * Retrieves the speed of sound. - * This value is needed for doppler effect calculation. - * \return The speed of sound. - */ - float getSpeedOfSound() const; - - /** - * Sets the speed of sound. - * This value is needed for doppler effect calculation. - * \param speed The new speed of sound. - */ - void setSpeedOfSound(float speed); - - /** - * 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. - */ - float getDopplerFactor() const; - - /** - * 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. - */ - void setDopplerFactor(float factor); - - /** - * Retrieves the distance model. - * \return The distance model. - */ - DistanceModel getDistanceModel() const; - - /** - * Sets the distance model. - * \param model distance model. - */ - void setDistanceModel(DistanceModel model); - - /** - * Retrieves one of the animated properties of the sound. - * \param type Which animated property to retrieve. - * \return A pointer to the animated property, valid as long as the - * sound is. - */ - AnimateableProperty* getAnimProperty(AnimateablePropertyType type); - - /** - * Adds a new entry to the 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. - */ - std::shared_ptr<SequenceEntry> add(std::shared_ptr<ISound> sound, float begin, float end, float skip); - - /** - * Removes an entry from the scene. - * \param entry The entry to remove. - */ - void remove(std::shared_ptr<SequenceEntry> entry); - - /** - * Creates a new reader with high quality resampling. - * \return The new reader. - */ - std::shared_ptr<IReader> createQualityReader(); - - virtual std::shared_ptr<IReader> createReader(); -}; - -AUD_NAMESPACE_END diff --git a/extern/audaspace/include/sequence/SequenceData.h b/extern/audaspace/include/sequence/SequenceData.h deleted file mode 100644 index b3df0548a4d..00000000000 --- a/extern/audaspace/include/sequence/SequenceData.h +++ /dev/null @@ -1,215 +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 SequenceData.h - * @ingroup sequence - * The SequenceData class. - */ - -#include "respec/Specification.h" -#include "sequence/AnimateableProperty.h" -#include "devices/I3DDevice.h" -#include "util/ILockable.h" - -#include <list> -#include <memory> -#include <mutex> - -AUD_NAMESPACE_BEGIN - -class SequenceEntry; -class ISound; - -/** - * This class represents sequenced entries to play a sound scene. - */ -class AUD_API SequenceData : public ILockable -{ - friend class SequenceReader; -private: - /// The target specification. - Specs m_specs; - - /// The status of the sequence. Changes every time a non-animated parameter changes. - int m_status; - - /// The entry status. Changes every time an entry is removed or added. - int m_entry_status; - - /// The next unused ID for the entries. - int m_id; - - /// The sequenced entries. - std::list<std::shared_ptr<SequenceEntry> > m_entries; - - /// Whether the whole scene is muted. - bool m_muted; - - /// The FPS of the scene. - float m_fps; - - /// Speed of Sound. - float m_speed_of_sound; - - /// Doppler factor. - float m_doppler_factor; - - /// Distance model. - DistanceModel m_distance_model; - - /// The animated volume. - AnimateableProperty m_volume; - - /// The animated listener location. - AnimateableProperty m_location; - - /// The animated listener orientation. - AnimateableProperty m_orientation; - - /// The mutex for locking. - std::recursive_mutex m_mutex; - - // delete copy constructor and operator= - SequenceData(const SequenceData&) = delete; - SequenceData& operator=(const SequenceData&) = delete; - -public: - /** - * Creates a new sound scene. - * \param specs The output audio data specification. - * \param fps The FPS of the scene. - * \param muted Whether the whole scene is muted. - */ - SequenceData(Specs specs, float fps, bool muted); - virtual ~SequenceData(); - - /** - * Locks the sequence. - */ - virtual void lock(); - - /** - * Unlocks the previously locked sequence. - */ - virtual void unlock(); - - /** - * Retrieves the audio output specification. - * \return The specification. - */ - Specs getSpecs(); - - /** - * Sets the audio output specification. - * \param specs The new specification. - */ - void setSpecs(Specs specs); - - /** - * Retrieves the scene's FPS. - * \return The scene's FPS. - */ - float getFPS() const; - - /** - * Sets the scene's FPS. - * \param fps The new FPS. - */ - void setFPS(float fps); - - /** - * Sets the muting state of the scene. - * \param muted Whether the scene is muted. - */ - void mute(bool muted); - - /** - * Retrieves the muting state of the scene. - * \return Whether the scene is muted. - */ - bool isMuted() const; - - /** - * Retrieves the speed of sound. - * This value is needed for doppler effect calculation. - * \return The speed of sound. - */ - float getSpeedOfSound() const; - - /** - * Sets the speed of sound. - * This value is needed for doppler effect calculation. - * \param speed The new speed of sound. - */ - void setSpeedOfSound(float speed); - - /** - * 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. - */ - float getDopplerFactor() const; - - /** - * 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. - */ - void setDopplerFactor(float factor); - - /** - * Retrieves the distance model. - * \return The distance model. - */ - DistanceModel getDistanceModel() const; - - /** - * Sets the distance model. - * \param model distance model. - */ - void setDistanceModel(DistanceModel model); - - /** - * Retrieves one of the animated properties of the sequence. - * \param type Which animated property to retrieve. - * \return A pointer to the animated property, valid as long as the - * sequence is. - */ - AnimateableProperty* getAnimProperty(AnimateablePropertyType type); - - /** - * Adds a new entry to the 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. - */ - std::shared_ptr<SequenceEntry> add(std::shared_ptr<ISound> sound, float begin, float end, float skip); - - /** - * Removes an entry from the scene. - * \param entry The entry to remove. - */ - void remove(std::shared_ptr<SequenceEntry> entry); -}; - -AUD_NAMESPACE_END diff --git a/extern/audaspace/include/sequence/SequenceEntry.h b/extern/audaspace/include/sequence/SequenceEntry.h deleted file mode 100644 index 98f15faf7ff..00000000000 --- a/extern/audaspace/include/sequence/SequenceEntry.h +++ /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. - ******************************************************************************/ - -#pragma once - -/** - * @file SequenceEntry.h - * @ingroup sequence - * The SequenceEntry class. - */ - -#include "sequence/AnimateableProperty.h" -#include "util/ILockable.h" - -#include <mutex> -#include <memory> - -AUD_NAMESPACE_BEGIN - -class ISound; - -/** - * This class represents a sequenced entry in a sequencer sound. - */ -class AUD_API SequenceEntry : public ILockable -{ - friend class SequenceHandle; -private: - /// The status of the entry. Changes every time a non-animated parameter changes. - int m_status; - - /// The positional status of the entry. Changes every time the entry is moved. - int m_pos_status; - - /// The sound status, changed when the sound is changed. - int m_sound_status; - - /// The unique (regarding the sound) ID of the entry. - int m_id; - - /// The sound this entry plays. - std::shared_ptr<ISound> m_sound; - - /// The begin time. - float m_begin; - - /// The end time. - float m_end; - - /// How many seconds are skipped at the beginning. - float m_skip; - - /// Whether the entry is muted. - bool m_muted; - - /// 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; - - /// The mutex for locking. - std::recursive_mutex m_mutex; - - /// The animated volume. - AnimateableProperty m_volume; - - /// The animated panning. - AnimateableProperty m_panning; - - /// The animated pitch. - AnimateableProperty m_pitch; - - /// The animated location. - AnimateableProperty m_location; - - /// The animated orientation. - AnimateableProperty m_orientation; - - // delete copy constructor and operator= - SequenceEntry(const SequenceEntry&) = delete; - SequenceEntry& operator=(const SequenceEntry&) = delete; - -public: - /** - * Creates a new sequenced entry. - * \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. - * \param id The ID of the entry. - */ - SequenceEntry(std::shared_ptr<ISound> sound, float begin, float end, float skip, int id); - virtual ~SequenceEntry(); - - /** - * Locks the entry. - */ - virtual void lock(); - - /** - * Unlocks the previously locked entry. - */ - virtual void unlock(); - - /** - * Retrieves the sound of the entry. - * \return The sound. - */ - std::shared_ptr<ISound> getSound(); - - /** - * Sets the sound of the entry. - * \param sound The new sound. - */ - void setSound(std::shared_ptr<ISound> sound); - - /** - * Moves the 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. - */ - void move(float begin, float end, float skip); - - /** - * Retrieves the muting state of the entry. - * \return Whether the entry should is muted or not. - */ - bool isMuted(); - - /** - * Sets the muting state of the entry. - * \param mute Whether the entry should be muted or not. - */ - void mute(bool mute); - - /** - * Retrieves the ID of the entry. - * \return The ID of the entry. - */ - int getID() const; - - /** - * Retrieves one of the animated properties of the entry. - * \param type Which animated property to retrieve. - * \return A pointer to the animated property, valid as long as the - * entry is. - */ - AnimateableProperty* getAnimProperty(AnimateablePropertyType type); - - /** - * Checks whether the source location, velocity and orientation are relative - * to the listener. - * \return Whether the source is relative. - */ - bool isRelative(); - - /** - * 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. - */ - void setRelative(bool relative); - - /** - * Retrieves the maximum volume of a source. - * \return The maximum volume. - */ - float getVolumeMaximum(); - - /** - * Sets the maximum volume of a source. - * \param volume The new maximum volume. - * \return Whether the action succeeded. - */ - void setVolumeMaximum(float volume); - - /** - * Retrieves the minimum volume of a source. - * \return The minimum volume. - */ - float getVolumeMinimum(); - - /** - * Sets the minimum volume of a source. - * \param volume The new minimum volume. - * \return Whether the action succeeded. - */ - void setVolumeMinimum(float volume); - - /** - * 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. - */ - float getDistanceMaximum(); - - /** - * 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. - */ - void setDistanceMaximum(float distance); - - /** - * Retrieves the reference distance of a source. - * \return The reference distance. - */ - float getDistanceReference(); - - /** - * Sets the reference distance of a source. - * \param distance The new reference distance. - * \return Whether the action succeeded. - */ - void setDistanceReference(float distance); - - /** - * Retrieves the attenuation of a source. - * \return The attenuation. - */ - float getAttenuation(); - - /** - * Sets the attenuation of a source. - * This value is used for distance calculation. - * \param factor The new attenuation. - * \return Whether the action succeeded. - */ - void setAttenuation(float factor); - - /** - * Retrieves the outer angle of the cone of a source. - * \return The outer angle of the cone. - */ - float getConeAngleOuter(); - - /** - * Sets the outer angle of the cone of a source. - * \param angle The new outer angle of the cone. - * \return Whether the action succeeded. - */ - void setConeAngleOuter(float angle); - - /** - * Retrieves the inner angle of the cone of a source. - * \return The inner angle of the cone. - */ - float getConeAngleInner(); - - /** - * Sets the inner angle of the cone of a source. - * \param angle The new inner angle of the cone. - * \return Whether the action succeeded. - */ - void setConeAngleInner(float angle); - - /** - * 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. - */ - float getConeVolumeOuter(); - - /** - * 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. - */ - void setConeVolumeOuter(float volume); -}; - -AUD_NAMESPACE_END diff --git a/extern/audaspace/include/sequence/SequenceReader.h b/extern/audaspace/include/sequence/SequenceReader.h deleted file mode 100644 index 196d969e102..00000000000 --- a/extern/audaspace/include/sequence/SequenceReader.h +++ /dev/null @@ -1,94 +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 SequenceReader.h - * @ingroup sequence - * The SequenceReader class. - */ - -#include "IReader.h" -#include "devices/ReadDevice.h" - -AUD_NAMESPACE_BEGIN - -class SequenceHandle; -class SequenceData; - -/** - * This reader plays back sequenced entries. - */ -class AUD_API SequenceReader : public IReader -{ -private: - /** - * The current position. - */ - int m_position; - - /** - * The read device used to mix the sounds correctly. - */ - ReadDevice m_device; - - /** - * Saves the sequence the reader belongs to. - */ - std::shared_ptr<SequenceData> m_sequence; - - /** - * The list of playback handles for the entries. - */ - std::list<std::shared_ptr<SequenceHandle> > m_handles; - - /** - * Last status read from the sequence. - */ - int m_status; - - /** - * Last entry status read from the sequence. - */ - int m_entry_status; - - // delete copy constructor and operator= - SequenceReader(const SequenceReader&) = delete; - SequenceReader& operator=(const SequenceReader&) = delete; - -public: - /** - * Creates a resampling reader. - * \param sequence The sequence data. - * \param quality Whether a high quality resample should be used for resampling. - */ - SequenceReader(std::shared_ptr<SequenceData> sequence, bool quality = false); - - /** - * Destroys the reader. - */ - ~SequenceReader(); - - virtual bool isSeekable() const; - virtual void seek(int position); - virtual int getLength() const; - virtual int getPosition() const; - virtual Specs getSpecs() const; - virtual void read(int& length, bool& eos, sample_t* buffer); -}; - -AUD_NAMESPACE_END diff --git a/extern/audaspace/include/sequence/Superpose.h b/extern/audaspace/include/sequence/Superpose.h deleted file mode 100644 index 2a3a6166b3b..00000000000 --- a/extern/audaspace/include/sequence/Superpose.h +++ /dev/null @@ -1,62 +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 Superpose.h - * @ingroup sequence - * The Superpose class. - */ - -#include "ISound.h" - -AUD_NAMESPACE_BEGIN - -/** - * This sound mixes two other factories, playing them the same time. - * \note Readers from the underlying factories must have the same sample rate - * and channel count. - */ -class AUD_API Superpose : public ISound -{ -private: - /** - * First played sound. - */ - std::shared_ptr<ISound> m_sound1; - - /** - * Second played sound. - */ - std::shared_ptr<ISound> m_sound2; - - // delete copy constructor and operator= - Superpose(const Superpose&) = delete; - Superpose& operator=(const Superpose&) = delete; - -public: - /** - * Creates a new superpose sound. - * \param sound1 The first input sound. - * \param sound2 The second input sound. - */ - Superpose(std::shared_ptr<ISound> sound1, std::shared_ptr<ISound> sound2); - - virtual std::shared_ptr<IReader> createReader(); -}; - -AUD_NAMESPACE_END diff --git a/extern/audaspace/include/sequence/SuperposeReader.h b/extern/audaspace/include/sequence/SuperposeReader.h deleted file mode 100644 index 8bd38ade4c3..00000000000 --- a/extern/audaspace/include/sequence/SuperposeReader.h +++ /dev/null @@ -1,79 +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 SuperposeReader.h - * @ingroup sequence - * The SuperposeReader class. - */ - -#include "IReader.h" -#include "util/Buffer.h" - -#include <memory> - -AUD_NAMESPACE_BEGIN - -/** - * This reader plays two readers with the same specs in parallel. - */ -class AUD_API SuperposeReader : public IReader -{ -private: - /** - * The first reader. - */ - std::shared_ptr<IReader> m_reader1; - - /** - * The second reader. - */ - std::shared_ptr<IReader> m_reader2; - - /** - * Buffer used for mixing. - */ - Buffer m_buffer; - - // delete copy constructor and operator= - SuperposeReader(const SuperposeReader&) = delete; - SuperposeReader& operator=(const SuperposeReader&) = delete; - -public: - /** - * Creates a new superpose reader. - * \param reader1 The first reader to read from. - * \param reader2 The second reader to read from. - * \exception Exception Thrown if the specs from the readers differ. - */ - SuperposeReader(std::shared_ptr<IReader> reader1, std::shared_ptr<IReader> reader2); - - /** - * Destroys the reader. - */ - virtual ~SuperposeReader(); - - virtual bool isSeekable() const; - virtual void seek(int position); - virtual int getLength() const; - virtual int getPosition() const; - virtual Specs getSpecs() const; - virtual void read(int& length, bool& eos, sample_t* buffer); -}; - -AUD_NAMESPACE_END diff --git a/extern/audaspace/include/util/Barrier.h b/extern/audaspace/include/util/Barrier.h deleted file mode 100644 index d9e8bf07f82..00000000000 --- a/extern/audaspace/include/util/Barrier.h +++ /dev/null @@ -1,78 +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 - -/** -* @file Barrier.h -* @ingroup util -* The Barrier class. -*/ - -#include "Audaspace.h" - -#include <mutex> -#include <condition_variable> - -AUD_NAMESPACE_BEGIN -/** -* This represents a barrier mechanism for thread sychronization. -*/ -class Barrier -{ -private: - /** - * A mutex needed to use a condition variable. - */ - std::mutex m_mutex; - - /** - * Condition varieble used to sync threads. - */ - std::condition_variable m_condition; - - /** - * Number of threads that need to reach the barrier for it to lift. - */ - unsigned int m_threshold; - - /** - * Conter that count from threshold to 0. - */ - unsigned int m_count; - - /** - * Variable used for predicate check in the condition variable wait. - */ - unsigned int m_generation; - - // delete copy constructor and operator= - Barrier(const Barrier&) = delete; - Barrier& operator=(const Barrier&) = delete; -public: - /** - * Creates a new Barrier object. - * \param count the number of threads that need to reach the barrier for it to lift. - */ - Barrier(unsigned int count); - virtual ~Barrier(); - - /** - * Makes the caller thread wait until enough threads are stopped by this method. - */ - void wait(); -}; -AUD_NAMESPACE_END
\ No newline at end of file diff --git a/extern/audaspace/include/util/Buffer.h b/extern/audaspace/include/util/Buffer.h deleted file mode 100644 index 9934e53625e..00000000000 --- a/extern/audaspace/include/util/Buffer.h +++ /dev/null @@ -1,87 +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 Buffer.h - * @ingroup util - * The Buffer class. - */ - -#include "Audaspace.h" - -AUD_NAMESPACE_BEGIN - -/** - * This class is a simple buffer in RAM which is 32 Byte aligned and provides - * resize functionality. - */ -class AUD_API Buffer -{ -private: - /// The size of the buffer in bytes. - int m_size; - - /// The pointer to the buffer memory. - data_t* m_buffer; - - // delete copy constructor and operator= - Buffer(const Buffer&) = delete; - Buffer& operator=(const Buffer&) = delete; - -public: - /** - * Creates a new buffer. - * \param size The size of the buffer in bytes. - */ - Buffer(int size = 0); - - /** - * Destroys the buffer. - */ - ~Buffer(); - - /** - * Returns the pointer to the buffer in memory. - */ - sample_t* getBuffer() const; - - /** - * Returns the size of the buffer in bytes. - */ - int getSize() const; - - /** - * Resizes the buffer. - * \param size The new size of the buffer, measured in bytes. - * \param keep Whether to keep the old data. If the new buffer is smaller, - * the data at the end will be lost. - */ - void resize(int size, bool keep = false); - - /** - * Makes sure the buffer has a minimum size. - * If size is >= current size, nothing will happen. - * Otherwise the buffer is resized with keep as parameter. - * \param size The new minimum size of the buffer, measured in bytes. - * \param keep Whether to keep the old data. If the new buffer is smaller, - * the data at the end will be lost. - */ - void assureSize(int size, bool keep = false); -}; - -AUD_NAMESPACE_END diff --git a/extern/audaspace/include/util/BufferReader.h b/extern/audaspace/include/util/BufferReader.h deleted file mode 100644 index b98313726bc..00000000000 --- a/extern/audaspace/include/util/BufferReader.h +++ /dev/null @@ -1,76 +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 BufferReader.h - * @ingroup util - * The BufferReader class. - */ - -#include "IReader.h" - -#include <memory> - -AUD_NAMESPACE_BEGIN - -class Buffer; - -/** - * This class represents a simple reader from a buffer that exists in memory. - * \warning Notice that the buffer is not multi-threading ready, so changing the - * buffer while the reader is reading is potentially dangerous. - */ -class AUD_API BufferReader : public IReader -{ -private: - /** - * The current position in the buffer. - */ - int m_position; - - /** - * The buffer that is read. - */ - std::shared_ptr<Buffer> m_buffer; - - /** - * The specification of the sample data in the buffer. - */ - Specs m_specs; - - // delete copy constructor and operator= - BufferReader(const BufferReader&) = delete; - BufferReader& operator=(const BufferReader&) = delete; - -public: - /** - * Creates a new buffer reader. - * \param buffer The buffer to read from. - * \param specs The specification of the sample data in the buffer. - */ - BufferReader(std::shared_ptr<Buffer> buffer, Specs specs); - - virtual bool isSeekable() const; - virtual void seek(int position); - virtual int getLength() const; - virtual int getPosition() const; - virtual Specs getSpecs() const; - virtual void read(int& length, bool& eos, sample_t* buffer); -}; - -AUD_NAMESPACE_END diff --git a/extern/audaspace/include/util/FFTPlan.h b/extern/audaspace/include/util/FFTPlan.h deleted file mode 100644 index 7d533ca8773..00000000000 --- a/extern/audaspace/include/util/FFTPlan.h +++ /dev/null @@ -1,120 +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 - -/** -* @file FFTPlan.h -* @ingroup util -* The FFTPlan class. -*/ - -#include <complex> -#include <fftw3.h> -#include "Audaspace.h" - -#include <memory> -#include <vector> - -/**Default FFT size.*/ -#define DEFAULT_N 4096 - -AUD_NAMESPACE_BEGIN - -/** -* Thas class represents an plan object that allows to calculate FFTs and IFFTs. -*/ -class AUD_API FFTPlan -{ -private: - /** - * The size of the FFT plan. - */ - int m_N; - - /** - * The plan to transform the input to the frequency domain. - */ - fftwf_plan m_fftPlanR2C; - - /** - * The plan to transform the input to the time domain again. - */ - fftwf_plan m_fftPlanC2R; - - /** - * The size of a buffer for its use with the FFT plan (in bytes). - */ - unsigned int m_bufferSize; - - // delete copy constructor and operator= - FFTPlan(const FFTPlan&) = delete; - FFTPlan& operator=(const FFTPlan&) = delete; - -public: - /** - * Creates a new FFTPlan object with DEFAULT_N size (4096). - * \param measureTime The aproximate amount of seconds that FFTW will spend searching for the optimal plan, - * which means faster FFTs and IFFTs while using this plan. If measureTime is negative, it will take all the time it needs. - */ - FFTPlan(double measureTime = 0); - - /** - * Creates a new FFTPlan object with a custom size. - * \param n The size of the FFT plan. Values that are a power of two are faster. - * The useful range usually is between 2048 and 8192, but bigger values can be useful - * in certain situations (when using the StreamBuffer class per example). - * Generally, low values use more CPU power and are a bit faster than large ones, - * there is also a huge decrease in efficiency when n is lower than 2048. - * \param measureTime The aproximate amount of seconds that FFTW will spend searching for the optimal plan, - * which means faster FFTs while using this plan. If measureTime is negative, it will take all the time it needs. - */ - FFTPlan(int n, double measureTime = 0); - ~FFTPlan(); - - /** - * Retrieves the size of the FFT plan. - * \return The size of the plan. - */ - int getSize(); - - /** - * Calculates the FFT of an input buffer with the current plan. - * \param[in,out] buffer A buffer with the input data an in which the output data will be written. - */ - void FFT(void* buffer); - - /** - * Calculates the IFFT of an input buffer with the current plan. - * \param[in,out] buffer A buffer with the input data an in which the output data will be written. - */ - void IFFT(void* buffer); - - /** - * Reserves memory for a buffer that can be used for inplace transformations with this plan. - * \return A pointer to a buffer of size ((N/2)+1)*2*sizeof(fftwf_complex). - * \warning The returned buffer must be freed with the freeBuffer method of this class. - */ - void* getBuffer(); - - /** - * Frees one of the buffers reserved with the getRealOnlyBuffer(), getComplexOnlyBuffer() or getInplaceBuffer() method. - * \param buffer A pointer to the buufer taht must be freed. - */ - void freeBuffer(void* buffer); -}; - -AUD_NAMESPACE_END diff --git a/extern/audaspace/include/util/ILockable.h b/extern/audaspace/include/util/ILockable.h deleted file mode 100644 index 8300fbd2845..00000000000 --- a/extern/audaspace/include/util/ILockable.h +++ /dev/null @@ -1,46 +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 ILockable.h - * @ingroup util - * The ILockable interface. - */ - -#include "Audaspace.h" - -AUD_NAMESPACE_BEGIN - -/** - * @interface ILockable - * This class provides an interface for lockable objects. - */ -class AUD_API ILockable -{ -public: - /** - * Locks the object. - */ - virtual void lock()=0; - /** - * Unlocks the previously locked object. - */ - virtual void unlock()=0; -}; - -AUD_NAMESPACE_END diff --git a/extern/audaspace/include/util/Math3D.h b/extern/audaspace/include/util/Math3D.h deleted file mode 100644 index 7ded12c1ba8..00000000000 --- a/extern/audaspace/include/util/Math3D.h +++ /dev/null @@ -1,324 +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 Math3D.h - * @ingroup util - * Defines the Vector3 and Quaternion classes. - */ - -#include "Audaspace.h" - -#include <cmath> -#include <cstring> - -AUD_NAMESPACE_BEGIN - -/** - * This class represents a 3 dimensional vector. - */ -class AUD_API Vector3 -{ -private: - /** - * The vector components. - */ - union - { - float m_v[3]; - struct - { - float m_x; - float m_y; - float m_z; - }; - }; - -public: - /** - * Creates a new 3 dimensional vector. - * \param x The x component. - * \param y The y component. - * \param z The z component. - */ - inline Vector3(float x = 0, float y = 0, float z = 0) : - m_x(x), m_y(y), m_z(z) - { - } - - /** - * Retrieves the x component of the vector. - * \return The x component. - */ - inline const float& x() const - { - return m_x; - } - - /** - * Retrieves the y component of the vector. - * \return The y component. - */ - inline const float& y() const - { - return m_y; - } - - /** - * Retrieves the z component of the vector. - * \return The z component. - */ - inline const float& z() const - { - return m_z; - } - - /** - * Retrieves the components of the vector. - * \param destination Where the 3 float values should be saved to. - */ - inline void get(float* destination) const - { - std::memcpy(destination, m_v, sizeof(m_v)); - } - - /** - * Retrieves the components of the vector. - * \return The components as float[3]. - */ - inline float* get() - { - return m_v; - } - - /** - * Retrieves the components of the vector. - * \return The components as float[3]. - */ - inline const float* get() const - { - return m_v; - } - - /** - * Retrieves the length of the vector. - * \return The length of the vector. - */ - inline float length() const - { - return std::sqrt(m_x*m_x + m_y*m_y + m_z*m_z); - } - - /** - * Retrieves the cross product. - * \param op The second operand. - * \return The cross product of the two vectors. - */ - inline Vector3 cross(const Vector3& op) const - { - return Vector3(m_y * op.m_z - m_z * op.m_y, - m_z * op.m_x - m_x * op.m_z, - m_x * op.m_y - m_y * op.m_x); - } - - /** - * Retrieves the dot product. - * \param op The second operand. - * \return The dot product of the two vectors. - */ - inline float operator*(const Vector3& op) const - { - return m_x * op.m_x + m_y * op.m_y + m_z * op.m_z; - } - - /** - * Retrieves the product with a scalar. - * \param op The second operand. - * \return The scaled vector. - */ - inline Vector3 operator*(const float& op) const - { - return Vector3(m_x * op, m_y * op, m_z * op); - } - - /** - * Adds two vectors. - * \param op The second operand. - * \return The sum vector. - */ - inline Vector3 operator+(const Vector3& op) const - { - return Vector3(m_x + op.m_x, m_y + op.m_y, m_z + op.m_z); - } - - /** - * Subtracts two vectors. - * \param op The second operand. - * \return The difference vector. - */ - inline Vector3 operator-(const Vector3& op) const - { - return Vector3(m_x - op.m_x, m_y - op.m_y, m_z - op.m_z); - } - - /** - * Negates the vector. - * \return The vector facing in the opposite direction. - */ - inline Vector3 operator-() const - { - return Vector3(-m_x, -m_y, -m_z); - } - - /** - * Subtracts the second vector. - * \param op The second operand. - * \return The difference vector. - */ - inline Vector3& operator-=(const Vector3& op) - { - m_x -= op.m_x; - m_y -= op.m_y; - m_z -= op.m_z; - return *this; - } -}; - -/** - * This class represents a quaternion used for 3D rotations. - */ -class AUD_API Quaternion -{ -private: - /** - * The quaternion components. - */ - union - { - float m_v[4]; - struct - { - float m_w; - float m_x; - float m_y; - float m_z; - }; - }; - -public: - /** - * Creates a new quaternion. - * \param w The w component. - * \param x The x component. - * \param y The y component. - * \param z The z component. - */ - inline Quaternion(float w = 1, float x = 0, float y = 0, float z = 0) : - m_w(w), m_x(x), m_y(y), m_z(z) - { - } - - /** - * Retrieves the w component of the quarternion. - * \return The w component. - */ - inline const float& w() const - { - return m_w; - } - - /** - * Retrieves the x component of the quarternion. - * \return The x component. - */ - inline const float& x() const - { - return m_x; - } - - /** - * Retrieves the y component of the quarternion. - * \return The y component. - */ - inline const float& y() const - { - return m_y; - } - - /** - * Retrieves the z component of the quarternion. - * \return The z component. - */ - inline const float& z() const - { - return m_z; - } - - /** - * Retrieves the components of the vector. - * \param destination Where the 4 float values should be saved to. - */ - inline void get(float* destination) const - { - std::memcpy(destination, m_v, sizeof(m_v)); - } - - /** - * Retrieves the components of the vector. - * \return The components as float[4]. - */ - inline float* get() - { - return m_v; - } - - /** - * Retrieves the components of the vector. - * \return The components as float[4]. - */ - inline const float* get() const - { - return m_v; - } - - /** - * When the quaternion represents an orientation, this returns the negative - * z axis vector. - * \return The negative z axis vector. - */ - inline Vector3 getLookAt() const - { - return Vector3(-2 * (m_w * m_y + m_x * m_z), - 2 * (m_x * m_w - m_z * m_y), - 2 * (m_x * m_x + m_y * m_y) - 1); - } - - /** - * When the quaternion represents an orientation, this returns the y axis - * vector. - * \return The y axis vector. - */ - inline Vector3 getUp() const - { - return Vector3(2 * (m_x * m_y - m_w * m_z), - 1 - 2 * (m_x * m_x + m_z * m_z), - 2 * (m_w * m_x + m_y * m_z)); - } -}; - -AUD_NAMESPACE_END diff --git a/extern/audaspace/include/util/StreamBuffer.h b/extern/audaspace/include/util/StreamBuffer.h deleted file mode 100644 index 8ec4cfcf46d..00000000000 --- a/extern/audaspace/include/util/StreamBuffer.h +++ /dev/null @@ -1,85 +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 StreamBuffer.h - * @ingroup util - * The StreamBuffer class. - */ - -#include "ISound.h" -#include "respec/Specification.h" - -AUD_NAMESPACE_BEGIN - -class Buffer; - -/** - * This sound creates a buffer out of a reader. This way normally streamed - * sound sources can be loaded into memory for buffered playback. - */ -class AUD_API StreamBuffer : public ISound -{ -private: - /** - * The buffer that holds the audio data. - */ - std::shared_ptr<Buffer> m_buffer; - - /** - * The specification of the samples. - */ - Specs m_specs; - - // delete copy constructor and operator= - StreamBuffer(const StreamBuffer&) = delete; - StreamBuffer& operator=(const StreamBuffer&) = delete; - -public: - /** - * Creates the sound and reads the reader created by the sound supplied - * to the buffer. - * \param sound The sound that creates the reader for buffering. - * \exception Exception Thrown if the reader cannot be created. - */ - StreamBuffer(std::shared_ptr<ISound> sound); - - /** - * Creates the sound from an preexisting buffer. - * \param buffer The buffer to stream from. - * \param specs The specification of the data in the buffer. - * \exception Exception Thrown if the reader cannot be created. - */ - StreamBuffer(std::shared_ptr<Buffer> buffer, Specs specs); - - /** - * Returns the buffer to be streamed. - * @return The buffer to stream. - */ - std::shared_ptr<Buffer> getBuffer(); - - /** - * Returns the specification of the buffer. - * @return The specification of the buffer. - */ - Specs getSpecs(); - - virtual std::shared_ptr<IReader> createReader(); -}; - -AUD_NAMESPACE_END diff --git a/extern/audaspace/include/util/ThreadPool.h b/extern/audaspace/include/util/ThreadPool.h deleted file mode 100644 index 24ec089d52c..00000000000 --- a/extern/audaspace/include/util/ThreadPool.h +++ /dev/null @@ -1,119 +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 - -/** -* @file ThreadPool.h -* @ingroup util -* The ThreadPool class. -*/ - -#include "Audaspace.h" - -#include <mutex> -#include <condition_variable> -#include <vector> -#include <thread> -#include <queue> -#include <future> -#include <functional> - -AUD_NAMESPACE_BEGIN -/** -* This represents pool of threads. -*/ -class AUD_API ThreadPool -{ -private: - /** - * A queue of tasks. - */ - std::queue<std::function<void()>> m_queue; - - /** - * A vector of thread objects. - */ - std::vector<std::thread> m_threads; - - /** - * A mutex for synchronization. - */ - std::mutex m_mutex; - - /** - * A condition variable used to stop the threads when there are no tasks. - */ - std::condition_variable m_condition; - - /** - * Stop flag. - */ - bool m_stopFlag; - - /** - * The number fo threads. - */ - unsigned int m_numThreads; - - // delete copy constructor and operator= - ThreadPool(const ThreadPool&) = delete; - ThreadPool& operator=(const ThreadPool&) = delete; -public: - /** - * Creates a new ThreadPool object. - * \param count The number of threads of the pool. It must not be 0. - */ - ThreadPool(unsigned int count); - - virtual ~ThreadPool(); - - /** - * Enqueues a new task for the threads to realize. - * \param t A function that realices a task. - * \param args The arguments of the task. - * \return A future of the same type as the return type of the task. - */ - template<class T, class... Args> - std::future<typename std::result_of<T(Args...)>::type> enqueue(T&& t, Args&&... args) - { - using pkgdTask = std::packaged_task<typename std::result_of<T(Args...)>::type()>; - - std::shared_ptr<pkgdTask> task = std::make_shared<pkgdTask>(std::bind(std::forward<T>(t), std::forward<Args>(args)...)); - auto result = task->get_future(); - - m_mutex.lock(); - m_queue.emplace([task]() { (*task)(); }); - m_mutex.unlock(); - - m_condition.notify_one(); - return result; - } - - /** - * Retrieves the number of threads of the pool. - * \return The number of threads. - */ - unsigned int getNumOfThreads(); - -private: - - /** - * Worker thread function. - */ - void threadFunction(); -}; -AUD_NAMESPACE_END |