audaspace: Fix exports for mingw. Add upstream patches to be compatible

with blender. Fix dependencies
This commit is contained in:
Alexey Pavlov
2019-08-02 14:09:11 +03:00
parent 8a1945ba2f
commit b9eebb628a
19 changed files with 1783 additions and 72 deletions

View File

@@ -0,0 +1,25 @@
From 10413c522900d3aaadd5f5ae12163eee80ef18ae Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=B6rg=20M=C3=BCller?= <nexyon@gmail.com>
Date: Sun, 5 Mar 2017 12:22:00 +0100
Subject: [PATCH 01/16] Fix for seeking with modified pitch.
Check Blender bug report T50843: Pitched Audio renders incorrectly in VSE.
---
src/devices/SoftwareDevice.cpp | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/devices/SoftwareDevice.cpp b/src/devices/SoftwareDevice.cpp
index 5fbb68c..c944b9e 100644
--- a/src/devices/SoftwareDevice.cpp
+++ b/src/devices/SoftwareDevice.cpp
@@ -357,6 +357,7 @@ bool SoftwareDevice::SoftwareHandle::seek(float position)
if(!m_status)
return false;
+ m_pitch->setPitch(m_user_pitch);
m_reader->seek((int)(position * m_reader->getSpecs().rate));
if(m_status == STATUS_STOPPED)
--
2.22.0

View File

@@ -1,7 +1,7 @@
From aa11968dbf60f7e329a53ed49f67a5849d58114a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=B6rg=20M=C3=BCller?= <nexyon@gmail.com>
Date: Fri, 31 Mar 2017 18:33:47 +0200
Subject: [PATCH] Bugfix for building with gcc7.
Subject: [PATCH 02/16] Bugfix for building with gcc7.
Thanks for reporting @ Dave Plater.
---
@@ -20,32 +20,13 @@ index 2f62276..24ec089 100644
AUD_NAMESPACE_BEGIN
/**
@@ -115,4 +116,4 @@ class AUD_API ThreadPool
@@ -115,4 +116,4 @@ private:
*/
void threadFunction();
};
-AUD_NAMESPACE_END
\ No newline at end of file
+AUD_NAMESPACE_END
--
2.22.0
From 2fb9862bfd7dd953a51f9bf4763bf0b308ddee13 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=B6rg=20M=C3=BCller?= <nexyon@gmail.com>
Date: Fri, 10 May 2019 23:04:14 +0200
Subject: [PATCH] Fix: Missing include in FileManager.h.
---
include/file/FileManager.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/include/file/FileManager.h b/include/file/FileManager.h
index 03943ea..5670860 100644
--- a/include/file/FileManager.h
+++ b/include/file/FileManager.h
@@ -27,6 +27,7 @@
#include <list>
#include <memory>
+#include <string>
AUD_NAMESPACE_BEGIN

View File

@@ -0,0 +1,491 @@
From 19c8d9f5f2f0fbe386ba52e7b04fc3e4a1c8a553 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=B6rg=20M=C3=BCller?= <nexyon@gmail.com>
Date: Sun, 13 Aug 2017 14:29:33 +0200
Subject: [PATCH 03/16] Make fftw3 optional.
---
CMakeLists.txt | 130 ++++++++++++++++++++++++------------
bindings/C/AUD_Sound.cpp | 4 ++
bindings/C/AUD_Sound.h | 6 +-
bindings/python/PyAPI.cpp | 18 +++--
bindings/python/PySound.cpp | 20 ++++--
bindings/python/setup.py.in | 4 +-
6 files changed, 126 insertions(+), 56 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0d549b5..d82dc21 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -42,14 +42,9 @@ set(SRC
src/fx/ADSR.cpp
src/fx/ADSRReader.cpp
src/fx/BaseIIRFilterReader.cpp
- src/fx/BinauralSound.cpp
- src/fx/BinauralReader.cpp
src/fx/ButterworthCalculator.cpp
src/fx/Butterworth.cpp
src/fx/CallbackIIRFilterReader.cpp
- src/fx/Convolver.cpp
- src/fx/ConvolverReader.cpp
- src/fx/ConvolverSound.cpp
src/fx/Delay.cpp
src/fx/DelayReader.cpp
src/fx/DynamicIIRFilter.cpp
@@ -60,13 +55,10 @@ set(SRC
src/fx/Envelope.cpp
src/fx/Fader.cpp
src/fx/FaderReader.cpp
- src/fx/FFTConvolver.cpp
src/fx/HighpassCalculator.cpp
src/fx/Highpass.cpp
- src/fx/HRTF.cpp
src/fx/IIRFilter.cpp
src/fx/IIRFilterReader.cpp
- src/fx/ImpulseResponse.cpp
src/fx/Limiter.cpp
src/fx/LimiterReader.cpp
src/fx/Loop.cpp
@@ -126,7 +118,6 @@ set(SRC
src/util/Barrier.cpp
src/util/Buffer.cpp
src/util/BufferReader.cpp
- src/util/FFTPlan.cpp
src/util/StreamBuffer.cpp
src/util/ThreadPool.cpp
)
@@ -158,14 +149,9 @@ set(PUBLIC_HDR
include/fx/ADSR.h
include/fx/ADSRReader.h
include/fx/BaseIIRFilterReader.h
- include/fx/BinauralSound.h
- include/fx/BinauralReader.h
include/fx/ButterworthCalculator.h
include/fx/Butterworth.h
include/fx/CallbackIIRFilterReader.h
- include/fx/Convolver.h
- include/fx/ConvolverReader.h
- include/fx/ConvolverSound.h
include/fx/Delay.h
include/fx/DelayReader.h
include/fx/DynamicIIRFilter.h
@@ -176,15 +162,11 @@ set(PUBLIC_HDR
include/fx/Envelope.h
include/fx/Fader.h
include/fx/FaderReader.h
- include/fx/FFTConvolver.h
include/fx/HighpassCalculator.h
include/fx/Highpass.h
- include/fx/HRTF.h
- include/fx/HRTFLoader.h
include/fx/IDynamicIIRFilterCalculator.h
include/fx/IIRFilter.h
include/fx/IIRFilterReader.h
- include/fx/ImpulseResponse.h
include/fx/Limiter.h
include/fx/LimiterReader.h
include/fx/Loop.h
@@ -246,7 +228,6 @@ set(PUBLIC_HDR
include/util/Barrier.h
include/util/Buffer.h
include/util/BufferReader.h
- include/util/FFTPlan.h
include/util/ILockable.h
include/util/Math3D.h
include/util/StreamBuffer.h
@@ -281,6 +262,7 @@ option(SHARED_LIBRARY "Build Shared Library" TRUE)
option(WITH_C "Build C Module" TRUE)
option(WITH_DOCS "Build C++ HTML Documentation with Doxygen" TRUE)
option(WITH_FFMPEG "Build With FFMPEG" TRUE)
+option(WITH_FFTW "Build With FFTW" TRUE)
option(WITH_JACK "Build With Plugin" TRUE)
option(WITH_LIBSNDFILE "Build With LibSndFile" TRUE)
option(WITH_OPENAL "Build With OpenAL" TRUE)
@@ -351,8 +333,6 @@ if(WITH_C)
set(C_SRC
bindings/C/AUD_ThreadPool.cpp
bindings/C/AUD_Source.cpp
- bindings/C/AUD_HRTF.cpp
- bindings/C/AUD_ImpulseResponse.cpp
bindings/C/AUD_Device.cpp
bindings/C/AUD_DynamicMusic.cpp
bindings/C/AUD_Handle.cpp
@@ -364,8 +344,6 @@ if(WITH_C)
set(C_HDR
bindings/C/AUD_ThreadPool.h
bindings/C/AUD_Source.h
- bindings/C/AUD_HRTF.h
- bindings/C/AUD_ImpulseResponse.h
bindings/C/AUD_Device.h
bindings/C/AUD_DynamicMusic.h
bindings/C/AUD_Handle.h
@@ -376,6 +354,18 @@ if(WITH_C)
bindings/C/AUD_Types.h
)
+if(WITH_FFTW)
+ list(APPEND C_SRC
+ bindings/C/AUD_HRTF.cpp
+ bindings/C/AUD_ImpulseResponse.cpp
+ )
+
+ list(APPEND C_HDR
+ bindings/C/AUD_HRTF.h
+ bindings/C/AUD_ImpulseResponse.h
+ )
+ endif()
+
if(NOT SEPARATE_C)
list(APPEND SRC ${C_SRC})
list(APPEND HDR ${C_HDR})
@@ -419,13 +409,50 @@ if(WITH_FFMPEG)
endif()
# FFTW
-find_package(FFTW REQUIRED)
-list(APPEND INCLUDE ${FFTW_INCLUDE_DIR})
-list(APPEND LIBRARIES ${FFTW_LIBRARY})
+if(WITH_FFTW)
+ find_package(FFTW ${PACKAGE_OPTION})
+
+ if(FFTW_FOUND)
+ set(FFTW_SRC
+ src/fx/BinauralSound.cpp
+ src/fx/BinauralReader.cpp
+ src/fx/Convolver.cpp
+ src/fx/ConvolverReader.cpp
+ src/fx/ConvolverSound.cpp
+ src/fx/FFTConvolver.cpp
+ src/fx/HRTF.cpp
+ src/fx/ImpulseResponse.cpp
+ src/util/FFTPlan.cpp
+ )
+ set(FFTW_HDR
+ include/fx/BinauralSound.h
+ include/fx/BinauralReader.h
+ include/fx/Convolver.h
+ include/fx/ConvolverReader.h
+ include/fx/ConvolverSound.h
+ include/fx/FFTConvolver.h
+ include/fx/HRTF.h
+ include/fx/HRTFLoader.h
+ include/fx/ImpulseResponse.h
+ include/util/FFTPlan.h
+ )
-if(WIN32)
- file(GLOB FFTW_DLLS ${LIBRARY_PATH}/fftw/bin/*.dll)
- list(APPEND DLLS ${FFTW_DLLS})
+ add_definitions(-DWITH_CONVOLUTION)
+
+ list(APPEND INCLUDE ${FFTW_INCLUDE_DIR})
+ list(APPEND LIBRARIES ${FFTW_LIBRARY})
+
+ list(APPEND SRC ${FFTW_SRC})
+ list(APPEND HDR ${FFTW_HDR})
+
+ if(WIN32)
+ file(GLOB FFTW_DLLS ${LIBRARY_PATH}/fftw/bin/*.dll)
+ list(APPEND DLLS ${FFTW_DLLS})
+ endif()
+ else()
+ set(WITH_FFTW FALSE CACHE BOOL "Build With FFTW" FORCE)
+ message(WARNING "FFTW not found, convolution functionality will not be built.")
+ endif()
endif()
# JACK
@@ -445,7 +472,7 @@ if(WITH_JACK)
plugins/jack/JackSymbols.h
)
- if(DYNLOAD_JACK)
+ if(DYNLOAD_JACK)
add_definitions(-DDYNLOAD_JACK)
endif()
@@ -464,7 +491,7 @@ if(WITH_JACK)
list(APPEND DLLS ${JACK_DLLS})
endif()
else()
- set(WITH_JACK FALSE CACHE BOOL "Build With Plugin" FORCE)
+ set(WITH_JACK FALSE CACHE BOOL "Build With JACK" FORCE)
message(WARNING "JACK not found, plugin will not be built.")
endif()
endif()
@@ -635,14 +662,20 @@ string(CONCAT STATIC_PLUGIN_REGISTERS ${STATIC_PLUGIN_REGISTERS})
if(WIN32)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/plugin/PluginManagerWindows.cpp.in ${CMAKE_CURRENT_BINARY_DIR}/PluginManager.cpp ESCAPE_QUOTES @ONLY)
- configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/fx/HRTFLoaderWindows.cpp ${CMAKE_CURRENT_BINARY_DIR}/HRTFLoader.cpp COPYONLY)
+ if(WITH_FFTW)
+ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/fx/HRTFLoaderWindows.cpp ${CMAKE_CURRENT_BINARY_DIR}/HRTFLoader.cpp COPYONLY)
+ endif()
else()
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/plugin/PluginManagerUnix.cpp.in ${CMAKE_CURRENT_BINARY_DIR}/PluginManager.cpp ESCAPE_QUOTES @ONLY)
- configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/fx/HRTFLoaderUnix.cpp ${CMAKE_CURRENT_BINARY_DIR}/HRTFLoader.cpp COPYONLY)
+ if(WITH_FFTW)
+ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/fx/HRTFLoaderUnix.cpp ${CMAKE_CURRENT_BINARY_DIR}/HRTFLoader.cpp COPYONLY)
+ endif()
endif()
list(APPEND SRC ${CMAKE_CURRENT_BINARY_DIR}/PluginManager.cpp)
-list(APPEND SRC ${CMAKE_CURRENT_BINARY_DIR}/HRTFLoader.cpp)
+if(WITH_FFTW)
+ list(APPEND SRC ${CMAKE_CURRENT_BINARY_DIR}/HRTFLoader.cpp)
+endif()
# directories
@@ -743,7 +776,7 @@ endif()
if(BUILD_DEMOS)
include_directories(${INCLUDE})
- set(DEMOS audaplay audaconvert audaremap signalgen randsounds dynamicmusic playbackmanager convolution binaural)
+ set(DEMOS audaplay audaconvert audaremap signalgen randsounds dynamicmusic playbackmanager)
add_executable(audaplay demos/audaplay.cpp)
target_link_libraries(audaplay audaspace)
@@ -766,11 +799,15 @@ if(BUILD_DEMOS)
add_executable(playbackmanager demos/playbackmanager.cpp)
target_link_libraries(playbackmanager audaspace)
- add_executable(convolution demos/convolution.cpp)
- target_link_libraries(convolution audaspace)
+ if(WITH_FFTW)
+ list(APPEND DEMOS convolution binaural)
+
+ add_executable(convolution demos/convolution.cpp)
+ target_link_libraries(convolution audaspace)
- add_executable(binaural demos/binaural.cpp)
- target_link_libraries(binaural audaspace)
+ add_executable(binaural demos/binaural.cpp)
+ target_link_libraries(binaural audaspace)
+ endif()
if(WITH_OPENAL)
list(APPEND DEMOS openaldevices)
@@ -813,8 +850,6 @@ if(WITH_PYTHON)
bindings/python/PyDevice.cpp
bindings/python/PyDynamicMusic.cpp
bindings/python/PyHandle.cpp
- bindings/python/PyHRTF.cpp
- bindings/python/PyImpulseResponse.cpp
bindings/python/PyPlaybackManager.cpp
bindings/python/PySequence.cpp
bindings/python/PySequenceEntry.cpp
@@ -827,8 +862,6 @@ if(WITH_PYTHON)
bindings/python/PyDevice.h
bindings/python/PyDynamicMusic.h
bindings/python/PyHandle.h
- bindings/python/PyHRTF.h
- bindings/python/PyImpulseResponse.h
bindings/python/PyPlaybackManager.h
bindings/python/PySequence.h
bindings/python/PySequenceEntry.h
@@ -837,6 +870,17 @@ if(WITH_PYTHON)
bindings/python/PyThreadPool.h
)
+if(WITH_FFTW)
+ list(APPEND PYTHON_SRC
+ bindings/python/PyHRTF.cpp
+ bindings/python/PyImpulseResponse.cpp
+ )
+ list(APPEND PYTHON_HDR
+ bindings/python/PyHRTF.h
+ bindings/python/PyImpulseResponse.h
+ )
+ endif()
+
add_library(audaspace-py ${LIBRARY_TYPE} ${PYTHON_SRC} ${PYTHON_HDR})
target_link_libraries(audaspace-py audaspace ${PYTHON_LIBRARIES})
set_target_properties(audaspace-py PROPERTIES SOVERSION ${AUDASPACE_VERSION})
diff --git a/bindings/C/AUD_Sound.cpp b/bindings/C/AUD_Sound.cpp
index 8d024b2..9c572cf 100644
--- a/bindings/C/AUD_Sound.cpp
+++ b/bindings/C/AUD_Sound.cpp
@@ -668,6 +668,8 @@ AUD_API AUD_Sound* AUD_Sound_mutable(AUD_Sound* sound)
}
}
+#ifdef WITH_CONVOLUTION
+
AUD_API AUD_Sound* AUD_Sound_Convolver(AUD_Sound* sound, AUD_ImpulseResponse* filter, AUD_ThreadPool* threadPool)
{
assert(sound);
@@ -700,3 +702,5 @@ AUD_API AUD_Sound* AUD_Sound_Binaural(AUD_Sound* sound, AUD_HRTF* hrtfs, AUD_Sou
return nullptr;
}
}
+
+#endif
diff --git a/bindings/C/AUD_Sound.h b/bindings/C/AUD_Sound.h
index 7d205fa..b18e3c3 100644
--- a/bindings/C/AUD_Sound.h
+++ b/bindings/C/AUD_Sound.h
@@ -360,8 +360,10 @@ extern AUD_API int AUD_SoundList_addSound(AUD_Sound* list, AUD_Sound* sound);
*/
extern AUD_API AUD_Sound* AUD_Sound_mutable(AUD_Sound* sound);
-extern AUD_API AUD_Sound* AUD_Sound_Convolver(AUD_Sound* sound, AUD_ImpulseResponse* filter, AUD_ThreadPool* threadPool);
-extern AUD_API AUD_Sound* AUD_Sound_Binaural(AUD_Sound* sound, AUD_HRTF* hrtfs, AUD_Source* source, AUD_ThreadPool* threadPool);
+#ifdef WITH_CONVOLUTION
+ extern AUD_API AUD_Sound* AUD_Sound_Convolver(AUD_Sound* sound, AUD_ImpulseResponse* filter, AUD_ThreadPool* threadPool);
+ extern AUD_API AUD_Sound* AUD_Sound_Binaural(AUD_Sound* sound, AUD_HRTF* hrtfs, AUD_Source* source, AUD_ThreadPool* threadPool);
+#endif
#ifdef __cplusplus
}
diff --git a/bindings/python/PyAPI.cpp b/bindings/python/PyAPI.cpp
index e2b307c..cceadbc 100644
--- a/bindings/python/PyAPI.cpp
+++ b/bindings/python/PyAPI.cpp
@@ -23,9 +23,12 @@
#include "PyPlaybackManager.h"
#include "PyDynamicMusic.h"
#include "PyThreadPool.h"
+#include "PySource.h"
+
+#ifdef WITH_CONVOLUTION
#include "PyImpulseResponse.h"
#include "PyHRTF.h"
-#include "PySource.h"
+#endif
#include "respec/Specification.h"
#include "devices/IHandle.h"
@@ -95,14 +98,16 @@ PyInit_aud()
if(!initializeThreadPool())
return nullptr;
- if(!initializeImpulseResponse())
+ if(!initializeSource())
return nullptr;
- if(!initializeHRTF())
+#ifdef WITH_CONVOLUTION
+ if(!initializeImpulseResponse())
return nullptr;
- if(!initializeSource())
+ if(!initializeHRTF())
return nullptr;
+#endif
module = PyModule_Create(&audmodule);
if(module == nullptr)
@@ -116,9 +121,12 @@ PyInit_aud()
addDynamicMusicToModule(module);
addPlaybackManagerToModule(module);
addThreadPoolToModule(module);
+ addSourceToModule(module);
+
+#ifdef WITH_CONVOLUTION
addImpulseResponseToModule(module);
addHRTFToModule(module);
- addSourceToModule(module);
+#endif
AUDError = PyErr_NewException("aud.error", nullptr, nullptr);
Py_INCREF(AUDError);
diff --git a/bindings/python/PySound.cpp b/bindings/python/PySound.cpp
index 635ac19..2ab1974 100644
--- a/bindings/python/PySound.cpp
+++ b/bindings/python/PySound.cpp
@@ -14,12 +14,15 @@
* limitations under the License.
******************************************************************************/
-#include "PyHRTF.h"
-#include "PyImpulseResponse.h"
#include "PySound.h"
#include "PySource.h"
#include "PyThreadPool.h"
+#ifdef WITH_CONVOLUTION
+#include "PyHRTF.h"
+#include "PyImpulseResponse.h"
+#endif
+
#include "Exception.h"
#include "file/File.h"
#include "file/FileWriter.h"
@@ -31,8 +34,6 @@
#include "generator/Triangle.h"
#include "fx/Accumulator.h"
#include "fx/ADSR.h"
-#include "fx/BinauralSound.h"
-#include "fx/ConvolverSound.h"
#include "fx/Delay.h"
#include "fx/Envelope.h"
#include "fx/Fader.h"
@@ -57,6 +58,11 @@
#include "sequence/PingPong.h"
#include "sequence/Superpose.h"
+#ifdef WITH_CONVOLUTION
+#include "fx/BinauralSound.h"
+#include "fx/ConvolverSound.h"
+#endif
+
#include <cstring>
#include <structmember.h>
#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
@@ -1614,6 +1620,8 @@ Sound_list_addSound(Sound* self, PyObject* object)
}
}
+#ifdef WITH_CONVOLUTION
+
PyDoc_STRVAR(M_aud_Sound_convolver_doc,
"convolver()\n\n"
"Creates a sound that will apply convolution to another sound.\n\n"
@@ -1719,6 +1727,8 @@ Sound_binaural(Sound* self, PyObject* args)
return (PyObject *)parent;
}
+#endif
+
static PyMethodDef Sound_methods[] = {
{"data", (PyCFunction)Sound_data, METH_NOARGS,
M_aud_Sound_data_doc
@@ -1822,12 +1832,14 @@ static PyMethodDef Sound_methods[] = {
{ "addSound", (PyCFunction)Sound_list_addSound, METH_O,
M_aud_Sound_list_addSound_doc
},
+#ifdef WITH_CONVOLUTION
{ "convolver", (PyCFunction)Sound_convolver, METH_VARARGS,
M_aud_Sound_convolver_doc
},
{ "binaural", (PyCFunction)Sound_binaural, METH_VARARGS,
M_aud_Sound_binaural_doc
},
+#endif
{nullptr} /* Sentinel */
};
diff --git a/bindings/python/setup.py.in b/bindings/python/setup.py.in
index 949e12b..add1a2d 100644
--- a/bindings/python/setup.py.in
+++ b/bindings/python/setup.py.in
@@ -43,7 +43,7 @@ audaspace = Extension(
library_dirs = ['.', 'Release', 'Debug'],
language = 'c++',
extra_compile_args = extra_args,
- sources = [os.path.join(source_directory, file) for file in ['PyAPI.cpp', 'PyDevice.cpp', 'PyHandle.cpp', 'PySound.cpp', 'PySequenceEntry.cpp', 'PySequence.cpp', 'PyPlaybackManager.cpp', 'PyDynamicMusic.cpp', 'PyThreadPool.cpp', 'PyImpulseResponse.cpp', 'PyHRTF.cpp', 'PySource.cpp']]
+ sources = [os.path.join(source_directory, file) for file in ['PyAPI.cpp', 'PyDevice.cpp', 'PyHandle.cpp', 'PySound.cpp', 'PySequenceEntry.cpp', 'PySequence.cpp', 'PyPlaybackManager.cpp', 'PyDynamicMusic.cpp', 'PyThreadPool.cpp', 'PySource.cpp'] + (['PyImpulseResponse.cpp', 'PyHRTF.cpp'] if '@WITH_FFTW@' == 'ON' else [])]
)
setup(
@@ -56,6 +56,6 @@ setup(
license = 'Apache License 2.0',
long_description = codecs.open(os.path.join(source_directory, '../../README.md'), 'r', 'utf-8').read(),
ext_modules = [audaspace],
- headers = [os.path.join(source_directory, file) for file in ['PyAPI.h', 'PyDevice.h', 'PyHandle.h', 'PySound.h', 'PySequenceEntry.h', 'PySequence.h', 'PyPlaybackManager.h', 'PyDynamicMusic.h', 'PyThreadPool.h', 'PyImpulseResponse.h', 'PyHRTF.h', 'PySource.h']] + ['Audaspace.h']
+ headers = [os.path.join(source_directory, file) for file in ['PyAPI.h', 'PyDevice.h', 'PyHandle.h', 'PySound.h', 'PySequenceEntry.h', 'PySequence.h', 'PyPlaybackManager.h', 'PyDynamicMusic.h', 'PyThreadPool.h', 'PySource.h'] + (['PyImpulseResponse.h', 'PyHRTF.h'] if '@WITH_FFTW@' == 'ON' else [])] + ['Audaspace.h']
)
--
2.22.0

View File

@@ -0,0 +1,80 @@
From d27746ca8550e2adae6ba54ded0c6dfac58d69b8 Mon Sep 17 00:00:00 2001
From: Joerg Mueller <nexyon@gmail.com>
Date: Mon, 23 Oct 2017 16:36:55 +0200
Subject: [PATCH 04/16] Build option: configure whether to build versioned
plugins.
---
CMakeLists.txt | 21 ++++++++++++++++-----
1 file changed, 16 insertions(+), 5 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d82dc21..5c667ca 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -292,6 +292,7 @@ cmake_dependent_option(WITH_PYTHON_MODULE "Build Python Module" TRUE "WITH_PYTHO
cmake_dependent_option(USE_SDL2 "Use SDL2 instead of 1 if available" TRUE "WITH_SDL" FALSE)
cmake_dependent_option(DYNLOAD_JACK "Dynamically load JACK" FALSE "WITH_JACK" FALSE)
cmake_dependent_option(WITH_BINDING_DOCS "Build C/Python HTML Documentation with Sphinx" TRUE "WITH_PYTHON_MODULE" FALSE)
+cmake_dependent_option(WITH_VERSIONED_PLUGINS "Build Plugins With Sonumber" TRUE "SHARED_LIBRARY" FALSE)
# compiler options
@@ -719,7 +720,9 @@ if(WITH_FFMPEG AND PLUGIN_FFMPEG)
include_directories(${INCLUDE} ${FFMPEG_INCLUDE_DIRS})
add_library(audffmpeg SHARED ${FFMPEG_SRC} ${FFMPEG_HDR} ${HDR})
target_link_libraries(audffmpeg audaspace ${FFMPEG_LIBRARIES})
- set_target_properties(audffmpeg PROPERTIES SOVERSION ${AUDASPACE_VERSION})
+ if(WITH_VERSIONED_PLUGINS)
+ set_target_properties(audffmpeg PROPERTIES SOVERSION ${AUDASPACE_VERSION})
+ endif()
install(TARGETS audffmpeg DESTINATION ${DEFAULT_PLUGIN_PATH})
endif()
@@ -732,7 +735,9 @@ if(WITH_JACK AND PLUGIN_JACK)
else()
target_link_libraries(audjack audaspace ${JACK_LIBRARIES})
endif()
- set_target_properties(audjack PROPERTIES SOVERSION ${AUDASPACE_VERSION})
+ if(WITH_VERSIONED_PLUGINS)
+ set_target_properties(audjack PROPERTIES SOVERSION ${AUDASPACE_VERSION})
+ endif()
install(TARGETS audjack DESTINATION ${DEFAULT_PLUGIN_PATH})
endif()
@@ -740,7 +745,9 @@ if(WITH_LIBSNDFILE AND PLUGIN_LIBSNDFILE)
add_definitions(-DLIBSNDFILE_PLUGIN)
include_directories(${INCLUDE} ${LIBSNDFILE_INCLUDE_DIRS})
add_library(audlibsndfile SHARED ${LIBSNDFILE_SRC} ${LIBSNDFILE_HDR} ${HDR})
- set_target_properties(audlibsndfile PROPERTIES SOVERSION ${AUDASPACE_VERSION})
+ if(WITH_VERSIONED_PLUGINS)
+ set_target_properties(audlibsndfile PROPERTIES SOVERSION ${AUDASPACE_VERSION})
+ endif()
target_link_libraries(audlibsndfile audaspace ${LIBSNDFILE_LIBRARIES})
install(TARGETS audlibsndfile DESTINATION ${DEFAULT_PLUGIN_PATH})
endif()
@@ -749,7 +756,9 @@ if(WITH_OPENAL AND PLUGIN_OPENAL)
add_definitions(-DOPENAL_PLUGIN)
include_directories(${INCLUDE} ${OPENAL_INCLUDE_DIR})
add_library(audopenal SHARED ${OPENAL_SRC} ${OPENAL_HDR} ${HDR})
- set_target_properties(audopenal PROPERTIES SOVERSION ${AUDASPACE_VERSION})
+ if(WITH_VERSIONED_PLUGINS)
+ set_target_properties(audopenal PROPERTIES SOVERSION ${AUDASPACE_VERSION})
+ endif()
target_link_libraries(audopenal audaspace ${OPENAL_LIBRARY})
install(TARGETS audopenal DESTINATION ${DEFAULT_PLUGIN_PATH})
endif()
@@ -758,7 +767,9 @@ if(WITH_SDL AND PLUGIN_SDL)
add_definitions(-DSDL_PLUGIN)
include_directories(${INCLUDE} ${SDL_INCLUDE_DIR})
add_library(audsdl SHARED ${SDL_SRC} ${SDL_HDR} ${HDR})
- set_target_properties(audsdl PROPERTIES SOVERSION ${AUDASPACE_VERSION})
+ if(WITH_VERSIONED_PLUGINS)
+ set_target_properties(audsdl PROPERTIES SOVERSION ${AUDASPACE_VERSION})
+ endif()
target_link_libraries(audsdl audaspace ${SDL_LIBRARY})
install(TARGETS audsdl DESTINATION ${DEFAULT_PLUGIN_PATH})
endif()
--
2.22.0

View File

@@ -1,7 +1,7 @@
From 212b4b605d9a73b97a4bf95ec080731477b64741 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=B6rg=20M=C3=BCller?= <nexyon@gmail.com>
Date: Fri, 8 Jun 2018 18:18:09 +0200
Subject: [PATCH] Support newer ffmpeg versions.
Subject: [PATCH 05/16] Support newer ffmpeg versions.
---
plugins/ffmpeg/FFMPEG.cpp | 2 +
@@ -279,7 +279,7 @@ diff --git a/plugins/ffmpeg/FFMPEGReader.h b/plugins/ffmpeg/FFMPEGReader.h
index e2ae959..a69ac77 100644
--- a/plugins/ffmpeg/FFMPEGReader.h
+++ b/plugins/ffmpeg/FFMPEGReader.h
@@ -79,6 +79,11 @@ class AUD_PLUGIN_API FFMPEGReader : public IReader
@@ -79,6 +79,11 @@ private:
*/
AVCodecContext* m_codecCtx;
@@ -682,7 +682,7 @@ diff --git a/plugins/ffmpeg/FFMPEGWriter.h b/plugins/ffmpeg/FFMPEGWriter.h
index 690185d..c22f479 100644
--- a/plugins/ffmpeg/FFMPEGWriter.h
+++ b/plugins/ffmpeg/FFMPEGWriter.h
@@ -66,14 +66,19 @@ class AUD_PLUGIN_API FFMPEGWriter : public IWriter
@@ -66,14 +66,19 @@ private:
AVCodecContext* m_codecCtx;
/**
@@ -706,3 +706,6 @@ index 690185d..c22f479 100644
/**
* The input buffer for the format converted data before encoding.
--
2.22.0

View File

@@ -0,0 +1,25 @@
From 40a0a34ca0a9276795c6814d6cdb05ab01329b72 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=B6rg=20M=C3=BCller?= <nexyon@gmail.com>
Date: Fri, 8 Jun 2018 18:25:25 +0200
Subject: [PATCH 06/16] Udpate for travis.ci.
---
.travis.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.travis.yml b/.travis.yml
index 31d8a7f..b144e36 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -15,7 +15,7 @@ before_install:
- brew update
- brew install cmake || brew outdated cmake || brew upgrade cmake
- brew install ffmpeg
- - brew install python3
+ - brew upgrade python
- brew install sdl2
- brew install libsndfile
- brew install jack
--
2.22.0

View File

@@ -1,30 +1,7 @@
From 10413c522900d3aaadd5f5ae12163eee80ef18ae Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=B6rg=20M=C3=BCller?= <nexyon@gmail.com>
Date: Sun, 5 Mar 2017 12:22:00 +0100
Subject: [PATCH] Fix for seeking with modified pitch.
Check Blender bug report T50843: Pitched Audio renders incorrectly in VSE.
---
src/devices/SoftwareDevice.cpp | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/devices/SoftwareDevice.cpp b/src/devices/SoftwareDevice.cpp
index 5fbb68c..c944b9e 100644
--- a/src/devices/SoftwareDevice.cpp
+++ b/src/devices/SoftwareDevice.cpp
@@ -357,6 +357,7 @@ bool SoftwareDevice::SoftwareHandle::seek(float position)
if(!m_status)
return false;
+ m_pitch->setPitch(m_user_pitch);
m_reader->seek((int)(position * m_reader->getSpecs().rate));
if(m_status == STATUS_STOPPED)
From 9b38605bb1d2927bf9313ee7ac4c13654e2bb513 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=B6rg=20M=C3=BCller?= <nexyon@gmail.com>
Date: Fri, 8 Jun 2018 23:00:13 +0200
Subject: [PATCH] Some fixes backported from Blender.
Subject: [PATCH 07/16] Some fixes backported from Blender.
---
bindings/C/AUD_Sound.cpp | 7 +++++--
@@ -150,3 +127,6 @@ index e09a74c..1891be9 100644
{
}
--
2.22.0

View File

@@ -0,0 +1,158 @@
From 5fb21bbcd82b6c48f06599eb8abc1d7a8e8af028 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=B6rg=20M=C3=BCller?= <nexyon@gmail.com>
Date: Thu, 17 Jan 2019 19:35:31 +0100
Subject: [PATCH 08/16] Silence some warnings.
---
bindings/C/AUD_Sound.cpp | 2 +-
plugins/ffmpeg/FFMPEGWriter.cpp | 2 +
src/respec/ChannelMapperReader.cpp | 77 ++++++++++++++++--------------
3 files changed, 44 insertions(+), 37 deletions(-)
diff --git a/bindings/C/AUD_Sound.cpp b/bindings/C/AUD_Sound.cpp
index 30860ac..1f40f5c 100644
--- a/bindings/C/AUD_Sound.cpp
+++ b/bindings/C/AUD_Sound.cpp
@@ -212,7 +212,7 @@ AUD_API const char* AUD_Sound_write(AUD_Sound* sound, const char* filename, AUD_
std::shared_ptr<IWriter> writer = FileWriter::createWriter(filename, specs, static_cast<Container>(container), static_cast<Codec>(codec), bitrate);
FileWriter::writeReader(reader, writer, 0, buffersize);
}
- catch(Exception& e)
+ catch(Exception&)
{
return "An exception occured while writing.";
}
diff --git a/plugins/ffmpeg/FFMPEGWriter.cpp b/plugins/ffmpeg/FFMPEGWriter.cpp
index 09b7089..2cd3261 100644
--- a/plugins/ffmpeg/FFMPEGWriter.cpp
+++ b/plugins/ffmpeg/FFMPEGWriter.cpp
@@ -261,6 +261,8 @@ FFMPEGWriter::FFMPEGWriter(std::string filename, DeviceSpecs specs, Container fo
case CHANNELS_SURROUND71:
channel_layout = AV_CH_LAYOUT_7POINT1;
break;
+ default:
+ AUD_THROW(FileException, "File couldn't be written, channel layout not supported.");
}
try
diff --git a/src/respec/ChannelMapperReader.cpp b/src/respec/ChannelMapperReader.cpp
index 850e54b..1af5e70 100644
--- a/src/respec/ChannelMapperReader.cpp
+++ b/src/respec/ChannelMapperReader.cpp
@@ -296,72 +296,77 @@ const Channel* ChannelMapperReader::CHANNEL_MAPS[] =
ChannelMapperReader::SURROUND71_MAP
};
+constexpr float deg2rad(double angle)
+{
+ return float(angle * M_PI / 180.0);
+}
+
const float ChannelMapperReader::MONO_ANGLES[] =
{
- 0.0f * M_PI / 180.0f
+ deg2rad(0.0)
};
const float ChannelMapperReader::STEREO_ANGLES[] =
{
- -90.0f * M_PI / 180.0f,
- 90.0f * M_PI / 180.0f
+ deg2rad(-90.0),
+ deg2rad( 90.0)
};
const float ChannelMapperReader::STEREO_LFE_ANGLES[] =
{
- -90.0f * M_PI / 180.0f,
- 90.0f * M_PI / 180.0f,
- 0.0f * M_PI / 180.0f
+ deg2rad(-90.0),
+ deg2rad( 90.0),
+ deg2rad( 0.0)
};
const float ChannelMapperReader::SURROUND4_ANGLES[] =
{
- -45.0f * M_PI / 180.0f,
- 45.0f * M_PI / 180.0f,
- -135.0f * M_PI / 180.0f,
- 135.0f * M_PI / 180.0f
+ deg2rad( -45.0),
+ deg2rad( 45.0),
+ deg2rad(-135.0),
+ deg2rad( 135.0)
};
const float ChannelMapperReader::SURROUND5_ANGLES[] =
{
- -30.0f * M_PI / 180.0f,
- 30.0f * M_PI / 180.0f,
- 0.0f * M_PI / 180.0f,
- -110.0f * M_PI / 180.0f,
- 110.0f * M_PI / 180.0f
+ deg2rad( -30.0),
+ deg2rad( 30.0),
+ deg2rad( 0.0),
+ deg2rad(-110.0),
+ deg2rad( 110.0)
};
const float ChannelMapperReader::SURROUND51_ANGLES[] =
{
- -30.0f * M_PI / 180.0f,
- 30.0f * M_PI / 180.0f,
- 0.0f * M_PI / 180.0f,
- 0.0f * M_PI / 180.0f,
- -110.0f * M_PI / 180.0f,
- 110.0f * M_PI / 180.0f
+ deg2rad( -30.0),
+ deg2rad( 30.0),
+ deg2rad( 0.0),
+ deg2rad( 0.0),
+ deg2rad(-110.0),
+ deg2rad( 110.0)
};
const float ChannelMapperReader::SURROUND61_ANGLES[] =
{
- -30.0f * M_PI / 180.0f,
- 30.0f * M_PI / 180.0f,
- 0.0f * M_PI / 180.0f,
- 0.0f * M_PI / 180.0f,
- 180.0f * M_PI / 180.0f,
- -110.0f * M_PI / 180.0f,
- 110.0f * M_PI / 180.0f
+ deg2rad( -30.0),
+ deg2rad( 30.0),
+ deg2rad( 0.0),
+ deg2rad( 0.0),
+ deg2rad( 180.0),
+ deg2rad(-110.0),
+ deg2rad( 110.0)
};
const float ChannelMapperReader::SURROUND71_ANGLES[] =
{
- -30.0f * M_PI / 180.0f,
- 30.0f * M_PI / 180.0f,
- 0.0f * M_PI / 180.0f,
- 0.0f * M_PI / 180.0f,
- -110.0f * M_PI / 180.0f,
- 110.0f * M_PI / 180.0f,
- -150.0f * M_PI / 180.0f,
- 150.0f * M_PI / 180.0f
+ deg2rad( -30.0),
+ deg2rad( 30.0),
+ deg2rad( 0.0),
+ deg2rad( 0.0),
+ deg2rad(-110.0),
+ deg2rad( 110.0),
+ deg2rad(-150.0),
+ deg2rad( 150.0)
};
const float* ChannelMapperReader::CHANNEL_ANGLES[] =
--
2.22.0

View File

@@ -1,7 +1,7 @@
From a2ff4e8c55199ec622d30dc2e5d49f01e37cd40e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=B6rg=20M=C3=BCller?= <nexyon@gmail.com>
Date: Thu, 17 Jan 2019 19:35:42 +0100
Subject: [PATCH] Bugfix: memory leak in python API.
Subject: [PATCH 09/16] Bugfix: memory leak in python API.
---
bindings/python/PySound.cpp | 2 --
@@ -20,3 +20,6 @@ index 2ab1974..82c6036 100644
return reinterpret_cast<PyObject*>(array);
}
--
2.22.0

View File

@@ -1,7 +1,7 @@
From 7ad99dfb7790dfa70434391656f14444201d5e4b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=B6rg=20M=C3=BCller?= <nexyon@gmail.com>
Date: Thu, 17 Jan 2019 20:53:36 +0100
Subject: [PATCH] OpenAL: recreate device if disconnected.
Subject: [PATCH 10/16] OpenAL: recreate device if disconnected.
---
plugins/openal/OpenALDevice.cpp | 153 +++++++++++++++++++++++++++++---
@@ -246,7 +246,7 @@ diff --git a/plugins/openal/OpenALDevice.h b/plugins/openal/OpenALDevice.h
index b9b461a..c2bec44 100644
--- a/plugins/openal/OpenALDevice.h
+++ b/plugins/openal/OpenALDevice.h
@@ -95,11 +95,16 @@ class AUD_PLUGIN_API OpenALDevice : public IDevice, public I3DDevice
@@ -95,11 +95,16 @@ private:
/// Current status of the handle
Status m_status;
@@ -263,7 +263,7 @@ index b9b461a..c2bec44 100644
// delete copy constructor and operator=
OpenALHandle(const OpenALHandle&) = delete;
OpenALHandle& operator=(const OpenALHandle&) = delete;
@@ -173,11 +178,21 @@ class AUD_PLUGIN_API OpenALDevice : public IDevice, public I3DDevice
@@ -173,11 +178,21 @@ private:
*/
DeviceSpecs m_specs;
@@ -285,3 +285,6 @@ index b9b461a..c2bec44 100644
/**
* The list of sounds that are currently playing.
*/
--
2.22.0

View File

@@ -0,0 +1,31 @@
From 101c714e1856c4c461f43741eac6d7ddb40ff6f5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=B6rg=20M=C3=BCller?= <nexyon@gmail.com>
Date: Sun, 10 Mar 2019 23:28:10 +0100
Subject: [PATCH 11/16] Bugfix: don't add non-existing devices to the device
manager.
---
src/devices/DeviceManager.cpp | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/devices/DeviceManager.cpp b/src/devices/DeviceManager.cpp
index 2ebc3d5..304f8b4 100644
--- a/src/devices/DeviceManager.cpp
+++ b/src/devices/DeviceManager.cpp
@@ -35,7 +35,12 @@ void DeviceManager::registerDevice(std::string name, std::shared_ptr<IDeviceFact
std::shared_ptr<IDeviceFactory> DeviceManager::getDeviceFactory(std::string name)
{
- return m_factories[name];
+ auto it = m_factories.find(name);
+
+ if(it == m_factories.end())
+ return nullptr;
+
+ return it->second;
}
std::shared_ptr<IDeviceFactory> DeviceManager::getDefaultDeviceFactory()
--
2.22.0

View File

@@ -0,0 +1,463 @@
From cb7a314092f6c10b6683473a63484662f13d5f35 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=B6rg=20M=C3=BCller?= <nexyon@gmail.com>
Date: Wed, 3 Apr 2019 19:36:47 +0200
Subject: [PATCH 12/16] Adding a modulator sound effect.
---
CMakeLists.txt | 4 ++
bindings/C/AUD_Sound.cpp | 16 ++++++
bindings/C/AUD_Sound.h | 8 +++
bindings/python/PySound.cpp | 45 +++++++++++++++++
include/fx/Modulator.h | 62 +++++++++++++++++++++++
include/fx/ModulatorReader.h | 79 ++++++++++++++++++++++++++++++
src/fx/Modulator.cpp | 35 +++++++++++++
src/fx/ModulatorReader.cpp | 95 ++++++++++++++++++++++++++++++++++++
8 files changed, 344 insertions(+)
create mode 100644 include/fx/Modulator.h
create mode 100644 include/fx/ModulatorReader.h
create mode 100644 src/fx/Modulator.cpp
create mode 100644 src/fx/ModulatorReader.cpp
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5c667ca..0e88ee3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -65,6 +65,8 @@ set(SRC
src/fx/LoopReader.cpp
src/fx/LowpassCalculator.cpp
src/fx/Lowpass.cpp
+ src/fx/Modulator.cpp
+ src/fx/ModulatorReader.cpp
src/fx/MutableReader.cpp
src/fx/MutableSound.cpp
src/fx/Pitch.cpp
@@ -173,6 +175,8 @@ set(PUBLIC_HDR
include/fx/LoopReader.h
include/fx/LowpassCalculator.h
include/fx/Lowpass.h
+ include/fx/Modulator.h
+ include/fx/ModulatorReader.h
include/fx/MutableReader.h
include/fx/MutableSound.h
include/fx/Pitch.h
diff --git a/bindings/C/AUD_Sound.cpp b/bindings/C/AUD_Sound.cpp
index 1f40f5c..00a59f4 100644
--- a/bindings/C/AUD_Sound.cpp
+++ b/bindings/C/AUD_Sound.cpp
@@ -32,6 +32,7 @@
#include "fx/Limiter.h"
#include "fx/Loop.h"
#include "fx/Lowpass.h"
+#include "fx/Modulator.h"
#include "fx/Pitch.h"
#include "fx/Reverse.h"
#include "fx/Sum.h"
@@ -465,6 +466,21 @@ AUD_API AUD_Sound* AUD_Sound_lowpass(AUD_Sound* sound, float frequency, float Q)
}
}
+AUD_API AUD_Sound* AUD_Sound_modulate(AUD_Sound* first, AUD_Sound* second)
+{
+ assert(first);
+ assert(second);
+
+ try
+ {
+ return new AUD_Sound(new Modulator(*first, *second));
+ }
+ catch(Exception&)
+ {
+ return nullptr;
+ }
+}
+
AUD_API AUD_Sound* AUD_Sound_pitch(AUD_Sound* sound, float factor)
{
assert(sound);
diff --git a/bindings/C/AUD_Sound.h b/bindings/C/AUD_Sound.h
index b18e3c3..66d6c53 100644
--- a/bindings/C/AUD_Sound.h
+++ b/bindings/C/AUD_Sound.h
@@ -246,6 +246,14 @@ extern AUD_API AUD_Sound* AUD_Sound_loop(AUD_Sound* sound, int count);
*/
extern AUD_API AUD_Sound* AUD_Sound_lowpass(AUD_Sound* sound, float frequency, float Q);
+/**
+ * Modulates two sound, which means multiplying the sound samples.
+ * \param first The first sound.
+ * \param second The second sound.
+ * \return A handle of the modulated sound.
+ */
+extern AUD_API AUD_Sound* AUD_Sound_modulate(AUD_Sound* first, AUD_Sound* second);
+
/**
* Changes the pitch of a sound.
* \param sound The sound to change.
diff --git a/bindings/python/PySound.cpp b/bindings/python/PySound.cpp
index 82c6036..17fcdbe 100644
--- a/bindings/python/PySound.cpp
+++ b/bindings/python/PySound.cpp
@@ -42,6 +42,7 @@
#include "fx/Limiter.h"
#include "fx/Loop.h"
#include "fx/Lowpass.h"
+#include "fx/Modulator.h"
#include "fx/MutableSound.h"
#include "fx/Pitch.h"
#include "fx/Reverse.h"
@@ -1129,6 +1130,47 @@ Sound_lowpass(Sound* self, PyObject* args)
return (PyObject *)parent;
}
+PyDoc_STRVAR(M_aud_Sound_modulate_doc,
+ "modulate(sound)\n\n"
+ "Modulates two factories.\n\n"
+ ":arg sound: The sound to modulate over the other.\n"
+ ":type sound: :class:`Sound`\n"
+ ":return: The created :class:`Sound` object.\n"
+ ":rtype: :class:`Sound`\n\n"
+ ".. note:: The two factories have to have the same specifications "
+ "(channels and samplerate).");
+
+static PyObject *
+Sound_modulate(Sound* self, PyObject* object)
+{
+ PyTypeObject* type = Py_TYPE(self);
+
+ if(!PyObject_TypeCheck(object, type))
+ {
+ PyErr_SetString(PyExc_TypeError, "Object is not of type Sound!");
+ return nullptr;
+ }
+
+ Sound* parent = (Sound*)type->tp_alloc(type, 0);
+ Sound* child = (Sound*)object;
+
+ if(parent != nullptr)
+ {
+ try
+ {
+ parent->sound = new std::shared_ptr<ISound>(new Modulator(*reinterpret_cast<std::shared_ptr<ISound>*>(self->sound), *reinterpret_cast<std::shared_ptr<ISound>*>(child->sound)));
+ }
+ catch(Exception& e)
+ {
+ Py_DECREF(parent);
+ PyErr_SetString(AUDError, e.what());
+ return nullptr;
+ }
+ }
+
+ return (PyObject *)parent;
+}
+
PyDoc_STRVAR(M_aud_Sound_pitch_doc,
"pitch(factor)\n\n"
"Changes the pitch of a sound with a specific factor.\n\n"
@@ -1791,6 +1833,9 @@ static PyMethodDef Sound_methods[] = {
{"lowpass", (PyCFunction)Sound_lowpass, METH_VARARGS,
M_aud_Sound_lowpass_doc
},
+ {"modulate", (PyCFunction)Sound_modulate, METH_O,
+ M_aud_Sound_modulate_doc
+ },
{"pitch", (PyCFunction)Sound_pitch, METH_VARARGS,
M_aud_Sound_pitch_doc
},
diff --git a/include/fx/Modulator.h b/include/fx/Modulator.h
new file mode 100644
index 0000000..db79d4a
--- /dev/null
+++ b/include/fx/Modulator.h
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * 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 Modulator.h
+ * @ingroup fx
+ * The Modulator class.
+ */
+
+#include "ISound.h"
+
+AUD_NAMESPACE_BEGIN
+
+/**
+ * This sound plays two other factories, playing them the same time and modulating/multiplying them.
+ * \note Readers from the underlying factories must have the same sample rate
+ * and channel count.
+ */
+class AUD_API Modulator : 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=
+ Modulator(const Modulator&) = delete;
+ Modulator& operator=(const Modulator&) = delete;
+
+public:
+ /**
+ * Creates a new modulator sound.
+ * \param sound1 The first input sound.
+ * \param sound2 The second input sound.
+ */
+ Modulator(std::shared_ptr<ISound> sound1, std::shared_ptr<ISound> sound2);
+
+ virtual std::shared_ptr<IReader> createReader();
+};
+
+AUD_NAMESPACE_END
diff --git a/include/fx/ModulatorReader.h b/include/fx/ModulatorReader.h
new file mode 100644
index 0000000..40cc843
--- /dev/null
+++ b/include/fx/ModulatorReader.h
@@ -0,0 +1,79 @@
+/*******************************************************************************
+ * 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 ModulatorReader.h
+ * @ingroup fx
+ * The ModulatorReader class.
+ */
+
+#include "IReader.h"
+#include "util/Buffer.h"
+
+#include <memory>
+
+AUD_NAMESPACE_BEGIN
+
+/**
+ * This reader plays two readers with the same specs in parallel multiplying their samples.
+ */
+class AUD_API ModulatorReader : 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=
+ ModulatorReader(const ModulatorReader&) = delete;
+ ModulatorReader& operator=(const ModulatorReader&) = delete;
+
+public:
+ /**
+ * Creates a new modulator 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.
+ */
+ ModulatorReader(std::shared_ptr<IReader> reader1, std::shared_ptr<IReader> reader2);
+
+ /**
+ * Destroys the reader.
+ */
+ virtual ~ModulatorReader();
+
+ 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/src/fx/Modulator.cpp b/src/fx/Modulator.cpp
new file mode 100644
index 0000000..a1af1b8
--- /dev/null
+++ b/src/fx/Modulator.cpp
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright 2009-2016 Jörg Müller
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ ******************************************************************************/
+
+#include "fx/Modulator.h"
+#include "fx/ModulatorReader.h"
+
+AUD_NAMESPACE_BEGIN
+
+Modulator::Modulator(std::shared_ptr<ISound> sound1, std::shared_ptr<ISound> sound2) :
+ m_sound1(sound1), m_sound2(sound2)
+{
+}
+
+std::shared_ptr<IReader> Modulator::createReader()
+{
+ std::shared_ptr<IReader> reader1 = m_sound1->createReader();
+ std::shared_ptr<IReader> reader2 = m_sound2->createReader();
+
+ return std::shared_ptr<IReader>(new ModulatorReader(reader1, reader2));
+}
+
+AUD_NAMESPACE_END
diff --git a/src/fx/ModulatorReader.cpp b/src/fx/ModulatorReader.cpp
new file mode 100644
index 0000000..c17cee0
--- /dev/null
+++ b/src/fx/ModulatorReader.cpp
@@ -0,0 +1,95 @@
+/*******************************************************************************
+ * Copyright 2009-2016 Jörg Müller
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ ******************************************************************************/
+
+#include "fx/ModulatorReader.h"
+#include "Exception.h"
+
+#include <algorithm>
+#include <cstring>
+
+AUD_NAMESPACE_BEGIN
+
+ModulatorReader::ModulatorReader(std::shared_ptr<IReader> reader1, std::shared_ptr<IReader> reader2) :
+ m_reader1(reader1), m_reader2(reader2)
+{
+}
+
+ModulatorReader::~ModulatorReader()
+{
+}
+
+bool ModulatorReader::isSeekable() const
+{
+ return m_reader1->isSeekable() && m_reader2->isSeekable();
+}
+
+void ModulatorReader::seek(int position)
+{
+ m_reader1->seek(position);
+ m_reader2->seek(position);
+}
+
+int ModulatorReader::getLength() const
+{
+ int len1 = m_reader1->getLength();
+ int len2 = m_reader2->getLength();
+ if((len1 < 0) || (len2 < 0))
+ return -1;
+ return std::min(len1, len2);
+}
+
+int ModulatorReader::getPosition() const
+{
+ int pos1 = m_reader1->getPosition();
+ int pos2 = m_reader2->getPosition();
+ return std::max(pos1, pos2);
+}
+
+Specs ModulatorReader::getSpecs() const
+{
+ return m_reader1->getSpecs();
+}
+
+void ModulatorReader::read(int& length, bool& eos, sample_t* buffer)
+{
+ Specs specs = m_reader1->getSpecs();
+ Specs s2 = m_reader2->getSpecs();
+ if(!AUD_COMPARE_SPECS(specs, s2))
+ AUD_THROW(StateException, "Two readers with different specifiactions cannot be modulated.");
+
+ int samplesize = AUD_SAMPLE_SIZE(specs);
+
+ m_buffer.assureSize(length * samplesize);
+
+ int len1 = length;
+ m_reader1->read(len1, eos, buffer);
+
+ if(len1 < length)
+ std::memset(buffer + len1 * specs.channels, 0, (length - len1) * samplesize);
+
+ int len2 = length;
+ bool eos2;
+ sample_t* buf = m_buffer.getBuffer();
+ m_reader2->read(len2, eos2, buf);
+
+ for(int i = 0; i < len2 * specs.channels; i++)
+ buffer[i] *= buf[i];
+
+ length = std::max(len1, len2);
+ eos &= eos2;
+}
+
+AUD_NAMESPACE_END
--
2.22.0

View File

@@ -0,0 +1,73 @@
From ed50f3bb3ce492bd6190d2c264ba00766346daf6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=B6rg=20M=C3=BCller?= <nexyon@gmail.com>
Date: Fri, 10 May 2019 22:40:59 +0200
Subject: [PATCH 13/16] Bugfix: Return correct length for modulator and
superpose.
Also:
- Remove unnecessary includes in DynamicMusic.cpp
- Formatting fix in Sine.h
---
include/generator/Sine.h | 3 +--
src/fx/DynamicMusic.cpp | 3 ---
src/fx/ModulatorReader.cpp | 2 +-
src/sequence/SuperposeReader.cpp | 2 +-
4 files changed, 3 insertions(+), 7 deletions(-)
diff --git a/include/generator/Sine.h b/include/generator/Sine.h
index ee78fc7..0c7dd15 100644
--- a/include/generator/Sine.h
+++ b/include/generator/Sine.h
@@ -53,8 +53,7 @@ public:
* \param frequency The desired frequency.
* \param sampleRate The target sample rate for playback.
*/
- Sine(float frequency,
- SampleRate sampleRate = RATE_48000);
+ Sine(float frequency, SampleRate sampleRate = RATE_48000);
/**
* Returns the frequency of the sine wave.
diff --git a/src/fx/DynamicMusic.cpp b/src/fx/DynamicMusic.cpp
index 2b0acc0..c682108 100644
--- a/src/fx/DynamicMusic.cpp
+++ b/src/fx/DynamicMusic.cpp
@@ -15,9 +15,6 @@
******************************************************************************/
#include "fx/DynamicMusic.h"
-#include "generator/Silence.h"
-#include "fx/Fader.h"
-#include "fx/Limiter.h"
#include <mutex>
#include <condition_variable>
diff --git a/src/fx/ModulatorReader.cpp b/src/fx/ModulatorReader.cpp
index c17cee0..f7cdc1d 100644
--- a/src/fx/ModulatorReader.cpp
+++ b/src/fx/ModulatorReader.cpp
@@ -48,7 +48,7 @@ int ModulatorReader::getLength() const
int len2 = m_reader2->getLength();
if((len1 < 0) || (len2 < 0))
return -1;
- return std::min(len1, len2);
+ return std::max(len1, len2);
}
int ModulatorReader::getPosition() const
diff --git a/src/sequence/SuperposeReader.cpp b/src/sequence/SuperposeReader.cpp
index 9206a7a..a65185a 100644
--- a/src/sequence/SuperposeReader.cpp
+++ b/src/sequence/SuperposeReader.cpp
@@ -48,7 +48,7 @@ int SuperposeReader::getLength() const
int len2 = m_reader2->getLength();
if((len1 < 0) || (len2 < 0))
return -1;
- return std::min(len1, len2);
+ return std::max(len1, len2);
}
int SuperposeReader::getPosition() const
--
2.22.0

View File

@@ -0,0 +1,274 @@
From 734ef038a1db1f6dd819eb7f78a2b99ac10b79c0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=B6rg=20M=C3=BCller?= <nexyon@gmail.com>
Date: Fri, 10 May 2019 22:41:49 +0200
Subject: [PATCH 14/16] Add sample rate parameter to silence generation.
Also: minor documentation bug fixes.
---
bindings/C/AUD_Sound.cpp | 4 ++--
bindings/C/AUD_Sound.h | 3 ++-
bindings/C/AUD_Special.cpp | 6 +++---
bindings/python/PySequence.cpp | 8 ++++----
bindings/python/PySound.cpp | 16 ++++++++++++----
demos/signalgen.cpp | 2 +-
include/generator/Silence.h | 9 ++++++++-
include/generator/SilenceReader.h | 8 +++++++-
src/generator/Silence.cpp | 5 +++--
src/generator/SilenceReader.cpp | 7 ++++---
10 files changed, 46 insertions(+), 22 deletions(-)
diff --git a/bindings/C/AUD_Sound.cpp b/bindings/C/AUD_Sound.cpp
index 00a59f4..8c99ce2 100644
--- a/bindings/C/AUD_Sound.cpp
+++ b/bindings/C/AUD_Sound.cpp
@@ -277,9 +277,9 @@ AUD_API AUD_Sound* AUD_Sound_sawtooth(float frequency, AUD_SampleRate rate)
return new AUD_Sound(new Sawtooth(frequency, rate));
}
-AUD_API AUD_Sound*AUD_Sound_silence()
+AUD_API AUD_Sound* AUD_Sound_silence(AUD_SampleRate rate)
{
- return new AUD_Sound(new Silence());
+ return new AUD_Sound(new Silence(rate));
}
AUD_API AUD_Sound* AUD_Sound_sine(float frequency, AUD_SampleRate rate)
diff --git a/bindings/C/AUD_Sound.h b/bindings/C/AUD_Sound.h
index 66d6c53..5317261 100644
--- a/bindings/C/AUD_Sound.h
+++ b/bindings/C/AUD_Sound.h
@@ -113,9 +113,10 @@ extern AUD_API AUD_Sound* AUD_Sound_sawtooth(float frequency, AUD_SampleRate rat
/**
* Creates a quiet sound.
+ * \param rate The sample rate of the silence sound.
* \return A handle of the sound.
*/
-extern AUD_API AUD_Sound* AUD_Sound_silence();
+extern AUD_API AUD_Sound* AUD_Sound_silence(AUD_SampleRate rate);
/**
* Creates a sine sound.
diff --git a/bindings/C/AUD_Special.cpp b/bindings/C/AUD_Special.cpp
index f8f4665..30148fa 100644
--- a/bindings/C/AUD_Special.cpp
+++ b/bindings/C/AUD_Special.cpp
@@ -177,11 +177,11 @@ static void pauseSound(AUD_Handle* handle)
AUD_API AUD_Handle* AUD_pauseAfter(AUD_Handle* handle, float seconds)
{
- std::shared_ptr<ISound> silence = std::shared_ptr<ISound>(new Silence);
- std::shared_ptr<ISound> limiter = std::shared_ptr<ISound>(new Limiter(silence, 0, seconds));
-
auto device = DeviceManager::getDevice();
+ std::shared_ptr<ISound> silence = std::shared_ptr<ISound>(new Silence(device->getSpecs().rate));
+ std::shared_ptr<ISound> limiter = std::shared_ptr<ISound>(new Limiter(silence, 0, seconds));
+
std::lock_guard<ILockable> lock(*device);
try
diff --git a/bindings/python/PySequence.cpp b/bindings/python/PySequence.cpp
index d4773c7..e574d76 100644
--- a/bindings/python/PySequence.cpp
+++ b/bindings/python/PySequence.cpp
@@ -100,7 +100,7 @@ Sequence_new(PyTypeObject* type, PyObject* args, PyObject* kwds)
PyDoc_STRVAR(M_aud_Sequence_add_doc,
"add()\n\n"
- "Adds a new entry to the scene.\n"
+ "Adds a new entry to the sequence.\n\n"
":arg sound: The sound this entry should play.\n"
":type sound: :class:`Sound`\n"
":arg begin: The start time.\n"
@@ -151,8 +151,8 @@ Sequence_add(Sequence* self, PyObject* args, PyObject* kwds)
}
PyDoc_STRVAR(M_aud_Sequence_remove_doc,
- "reomve()\n\n"
- "Adds a new entry to the scene.\n"
+ "remove()\n\n"
+ "Removes an entry from the sequence.\n\n"
":arg entry: The entry to remove.\n"
":type entry: :class:`SequenceEntry`\n");
@@ -579,7 +579,7 @@ static PyGetSetDef Sequence_properties[] = {
};
PyDoc_STRVAR(M_aud_Sequence_doc,
- "This sound represents sequenced entries to play a sound scene.");
+ "This sound represents sequenced entries to play a sound sequence.");
extern PyTypeObject SoundType;
diff --git a/bindings/python/PySound.cpp b/bindings/python/PySound.cpp
index 17fcdbe..c589e71 100644
--- a/bindings/python/PySound.cpp
+++ b/bindings/python/PySound.cpp
@@ -470,14 +470,22 @@ Sound_sawtooth(PyTypeObject* type, PyObject* args)
}
PyDoc_STRVAR(M_aud_Sound_silence_doc,
- "silence()\n\n"
+ "silence(rate=48000)\n\n"
"Creates a silence sound which plays simple silence.\n\n"
+ ":arg rate: The sampling rate in Hz. It's recommended to set this "
+ "value to the playback device's samling rate to avoid resamping.\n"
+ ":type rate: int\n"
":return: The created :class:`Sound` object.\n"
":rtype: :class:`Sound`");
static PyObject *
-Sound_silence(PyTypeObject* type)
+Sound_silence(PyTypeObject* type, PyObject* args)
{
+ double rate = 48000;
+
+ if(!PyArg_ParseTuple(args, "|d:sawtooth", &rate))
+ return nullptr;
+
Sound* self;
self = (Sound*)type->tp_alloc(type, 0);
@@ -485,7 +493,7 @@ Sound_silence(PyTypeObject* type)
{
try
{
- self->sound = new std::shared_ptr<ISound>(new Silence());
+ self->sound = new std::shared_ptr<ISound>(new Silence((SampleRate)rate));
}
catch(Exception& e)
{
@@ -1788,7 +1796,7 @@ static PyMethodDef Sound_methods[] = {
{"sawtooth", (PyCFunction)Sound_sawtooth, METH_VARARGS | METH_CLASS,
M_aud_Sound_sawtooth_doc
},
- {"silence", (PyCFunction)Sound_silence, METH_NOARGS | METH_CLASS,
+ {"silence", (PyCFunction)Sound_silence, METH_VARARGS | METH_CLASS,
M_aud_Sound_silence_doc
},
{"sine", (PyCFunction)Sound_sine, METH_VARARGS | METH_CLASS,
diff --git a/demos/signalgen.cpp b/demos/signalgen.cpp
index ad7a79b..678db9e 100644
--- a/demos/signalgen.cpp
+++ b/demos/signalgen.cpp
@@ -39,7 +39,7 @@ int main(int argc, char* argv[])
float duration = 1.0f;
auto sawtooth = std::shared_ptr<ISound>(new Sawtooth(frequency, sampleRate));
- auto silence = std::shared_ptr<ISound>(new Silence);
+ auto silence = std::shared_ptr<ISound>(new Silence(sampleRate));
auto sine = std::shared_ptr<ISound>(new Sine(frequency, sampleRate));
auto square = std::shared_ptr<ISound>(new Square(frequency, sampleRate));
auto triangle = std::shared_ptr<ISound>(new Triangle(frequency, sampleRate));
diff --git a/include/generator/Silence.h b/include/generator/Silence.h
index a35b83d..1aa26eb 100644
--- a/include/generator/Silence.h
+++ b/include/generator/Silence.h
@@ -23,6 +23,7 @@
*/
#include "ISound.h"
+#include "respec/Specification.h"
AUD_NAMESPACE_BEGIN
@@ -32,6 +33,11 @@ AUD_NAMESPACE_BEGIN
class AUD_API Silence : public ISound
{
private:
+ /**
+ * The target sample rate for output.
+ */
+ const SampleRate m_sampleRate;
+
// delete copy constructor and operator=
Silence(const Silence&) = delete;
Silence& operator=(const Silence&) = delete;
@@ -39,8 +45,9 @@ private:
public:
/**
* Creates a new silence sound.
+ * \param sampleRate The target sample rate for playback.
*/
- Silence();
+ Silence(SampleRate sampleRate = RATE_48000);
virtual std::shared_ptr<IReader> createReader();
};
diff --git a/include/generator/SilenceReader.h b/include/generator/SilenceReader.h
index ecc0ce8..c32db4b 100644
--- a/include/generator/SilenceReader.h
+++ b/include/generator/SilenceReader.h
@@ -38,6 +38,11 @@ private:
*/
int m_position;
+ /**
+ * The sample rate for the output.
+ */
+ const SampleRate m_sampleRate;
+
// delete copy constructor and operator=
SilenceReader(const SilenceReader&) = delete;
SilenceReader& operator=(const SilenceReader&) = delete;
@@ -45,8 +50,9 @@ private:
public:
/**
* Creates a new reader.
+ * \param sampleRate The output sample rate.
*/
- SilenceReader();
+ SilenceReader(SampleRate sampleRate);
virtual bool isSeekable() const;
virtual void seek(int position);
diff --git a/src/generator/Silence.cpp b/src/generator/Silence.cpp
index a173a1b..2919f89 100644
--- a/src/generator/Silence.cpp
+++ b/src/generator/Silence.cpp
@@ -19,13 +19,14 @@
AUD_NAMESPACE_BEGIN
-Silence::Silence()
+Silence::Silence(SampleRate sampleRate) :
+ m_sampleRate(sampleRate)
{
}
std::shared_ptr<IReader> Silence::createReader()
{
- return std::shared_ptr<IReader>(new SilenceReader());
+ return std::shared_ptr<IReader>(new SilenceReader(m_sampleRate));
}
AUD_NAMESPACE_END
diff --git a/src/generator/SilenceReader.cpp b/src/generator/SilenceReader.cpp
index 39358cc..746cc76 100644
--- a/src/generator/SilenceReader.cpp
+++ b/src/generator/SilenceReader.cpp
@@ -20,8 +20,9 @@
AUD_NAMESPACE_BEGIN
-SilenceReader::SilenceReader() :
- m_position(0)
+SilenceReader::SilenceReader(SampleRate sampleRate) :
+ m_position(0),
+ m_sampleRate(sampleRate)
{
}
@@ -48,7 +49,7 @@ int SilenceReader::getPosition() const
Specs SilenceReader::getSpecs() const
{
Specs specs;
- specs.rate = RATE_48000;
+ specs.rate = m_sampleRate;
specs.channels = CHANNELS_MONO;
return specs;
}
--
2.22.0

View File

@@ -0,0 +1,36 @@
From afadb94be358a08575bf2c55edf5966d1a5d19c1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=B6rg=20M=C3=BCller?= <nexyon@gmail.com>
Date: Fri, 10 May 2019 22:51:45 +0200
Subject: [PATCH 15/16] Minor CMakeLists.txt formatting fixes.
---
CMakeLists.txt | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0e88ee3..1c173ae 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -82,7 +82,7 @@ set(SRC
src/fx/Volume.cpp
src/fx/VolumeReader.cpp
src/fx/VolumeSound.cpp
- src/fx/VolumeStorage.cpp
+ src/fx/VolumeStorage.cpp
src/generator/Sawtooth.cpp
src/generator/SawtoothReader.cpp
src/generator/Silence.cpp
@@ -700,8 +700,8 @@ set(LIB_DESTINATION "lib${LIB_SUFFIX}")
# library
add_library(audaspace ${LIBRARY_TYPE} ${SRC} ${HDR})
-target_link_libraries(audaspace ${LIBRARIES})
-set_target_properties(audaspace PROPERTIES SOVERSION ${AUDASPACE_VERSION})
+target_link_libraries(audaspace ${LIBRARIES})
+set_target_properties(audaspace PROPERTIES SOVERSION ${AUDASPACE_VERSION})
install(TARGETS audaspace
RUNTIME DESTINATION ${BIN_DESTINATION}
--
2.22.0

View File

@@ -0,0 +1,24 @@
From 2fb9862bfd7dd953a51f9bf4763bf0b308ddee13 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=B6rg=20M=C3=BCller?= <nexyon@gmail.com>
Date: Fri, 10 May 2019 23:04:14 +0200
Subject: [PATCH 16/16] Fix: Missing include in FileManager.h.
---
include/file/FileManager.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/include/file/FileManager.h b/include/file/FileManager.h
index 03943ea..5670860 100644
--- a/include/file/FileManager.h
+++ b/include/file/FileManager.h
@@ -27,6 +27,7 @@
#include <list>
#include <memory>
+#include <string>
AUD_NAMESPACE_BEGIN
--
2.22.0

View File

@@ -0,0 +1,11 @@
--- audaspace-1.3.0/config/Audaspace.h.in.orig 2019-08-02 13:13:22.401199900 +0300
+++ audaspace-1.3.0/config/Audaspace.h.in 2019-08-02 13:13:36.722025100 +0300
@@ -65,7 +65,7 @@
#define @AUD_LIBRARY_TYPE@
-#ifdef _MSC_VER
+#ifdef _WIN32
#define AUD_EXPORT_API __declspec(dllexport)
#define AUD_USE_API __declspec(dllimport)
#define AUD_LOCAL

View File

@@ -13,35 +13,85 @@ depends=("${MINGW_PACKAGE_PREFIX}-ffmpeg"
"${MINGW_PACKAGE_PREFIX}-libsndfile"
"${MINGW_PACKAGE_PREFIX}-openal"
"${MINGW_PACKAGE_PREFIX}-python3"
"${MINGW_PACKAGE_PREFIX}-python3-numpy"
"${MINGW_PACKAGE_PREFIX}-SDL2")
makedepends=("${MINGW_PACKAGE_PREFIX}-cmake"
"${MINGW_PACKAGE_PREFIX}-doxygen"
"${MINGW_PACKAGE_PREFIX}-gcc"
"${MINGW_PACKAGE_PREFIX}-python3-sphinx"
"${MINGW_PACKAGE_PREFIX}-pkg-config")
url="https://audaspace.github.io/"
source=(${_realname}-${pkgver}.tar.gz::https://github.com/audaspace/audaspace/archive/v${pkgver}.tar.gz
01-gcc7-build.patch
02-support-new-ffmpeg.patch
03-backport-from-blender.patch
04-python-memory-leak.patch
05-openal-recreate-device.patch
10-mingw-relocate.patch)
0001-Fix-for-seeking-with-modified-pitch.patch
0002-Bugfix-for-building-with-gcc7.patch
0003-Make-fftw3-optional.patch
0004-Build-option-configure-whether-to-build-versioned-pl.patch
0005-Support-newer-ffmpeg-versions.patch
0006-Udpate-for-travis.ci.patch
0007-Some-fixes-backported-from-Blender.patch
0008-Silence-some-warnings.patch
0009-Bugfix-memory-leak-in-python-API.patch
0010-OpenAL-recreate-device-if-disconnected.patch
0011-Bugfix-don-t-add-non-existing-devices-to-the-device-.patch
0012-Adding-a-modulator-sound-effect.patch
0013-Bugfix-Return-correct-length-for-modulator-and-super.patch
0014-Add-sample-rate-parameter-to-silence-generation.patch
0015-Minor-CMakeLists.txt-formatting-fixes.patch
0016-Fix-Missing-include-in-FileManager.h.patch
0100-mingw-relocate.patch
0101-mingw-exports.patch)
options=('!strip' 'staticlibs')
sha256sums=('20f6669ca0b9403cdf0b21141a494315d153ad00afccaad72c2e4e86586591d2'
'fe5dfc6b6bc59edddaf923f6713903a55783523c75cad93841db4e36a493cca4'
'fb99e50be7313c8b82fe6a6bc47ef2f77efdab5b27d516576d3ff7a31a176b87'
'618873a31579427eba61529a14fad665285c9403c9e3196fc476605bf4e58cf3'
'a490c4f2c4aaf2fa3c87ba623b0179b731d9fb390c38ce04113e01c7cec3c7b7'
'b17869e66c784f96c01871ac06a519ef94804ec11ea367f4c9a2a95dbd5fabb1'
'cc68bcc7154c1b06e96e86c587aeafbd6befa5538cf813ee5c42a3ccc13e357d')
'1ebc506fa3be5128b5948b91a9457020ab01249f8a39f0dc274164a7c901c0b1'
'701c872920bf41c2906a75f3a5ff4b8dd8cb4584b545c1c6e4075356831e1578'
'c9769ed10b49347e247170eaad45a0c5aa3cd9d988ee72a5d3fd3bdf5705092d'
'8dcd74328ba96c2b7706dfed7bdeffb14aaa420542c84e624ca183e55ff7092e'
'9006274be9abcb20addff45e5d799f657cf883e66cd37fc189ee2cd2a626723b'
'22488e28874452d11344b257e6722e73f422a1428d1b5efa1ebf0065a032b541'
'f829c41015ae55ff2d62907ee810b37a2d19f359c0bf12bc404566920457cc43'
'677ac49db32619679789833d43bb9460aeef73181be983e038004d402e1a7182'
'2107ef93d741df438e1d496346e8ef8405b06917c05dfce3edc0e537962893f5'
'3feef32eda72f56934d26ca2bdd9f30c0601181f2560e6ca4b2ef11776806d28'
'90d40dd68196fd672191284abd8b294afd0e7f7a71cecbe0dc955ee95d0a0202'
'63dfea3c6eb8d1d7d630b74f8b8acb7c95521b15964c841ac5780c7c4f523648'
'890068f35cf1fd36cfd2f90e2b9d0993c9666d06ef283d28b73a872dba04b3cb'
'05c043204eb616c937716bcad4107eb09578f671bce77fadde7f608fbe84f8bb'
'fe084eabd8a82bd9a6a92013ff65450356a6d8b076c4dd95b027af6afaeef173'
'01cac25a1876b75e9ea246554314dca6ae07b13d5b6fcb7365f17a59ebc1b45d'
'cc68bcc7154c1b06e96e86c587aeafbd6befa5538cf813ee5c42a3ccc13e357d'
'8cf2aefb1973177ec3d75443e47ba95c66ca113076e615af0a8f6c8de1398da0')
# Helper macros to help make tasks easier #
apply_patch_with_msg() {
for _patch in "$@"
do
msg2 "Applying ${_patch}"
patch -Nbp1 -i "${srcdir}/${_patch}"
done
}
prepare() {
cd ${_realname}-${pkgver}
patch -p1 -i ${srcdir}/01-gcc7-build.patch
patch -p1 -i ${srcdir}/02-support-new-ffmpeg.patch
patch -p1 -i ${srcdir}/03-backport-from-blender.patch
patch -p1 -i ${srcdir}/04-python-memory-leak.patch
patch -p1 -i ${srcdir}/05-openal-recreate-device.patch
patch -p1 -i ${srcdir}/10-mingw-relocate.patch
apply_patch_with_msg \
0001-Fix-for-seeking-with-modified-pitch.patch \
0002-Bugfix-for-building-with-gcc7.patch \
0003-Make-fftw3-optional.patch \
0004-Build-option-configure-whether-to-build-versioned-pl.patch \
0005-Support-newer-ffmpeg-versions.patch \
0006-Udpate-for-travis.ci.patch \
0007-Some-fixes-backported-from-Blender.patch \
0008-Silence-some-warnings.patch \
0009-Bugfix-memory-leak-in-python-API.patch \
0010-OpenAL-recreate-device-if-disconnected.patch \
0011-Bugfix-don-t-add-non-existing-devices-to-the-device-.patch \
0012-Adding-a-modulator-sound-effect.patch \
0013-Bugfix-Return-correct-length-for-modulator-and-super.patch \
0014-Add-sample-rate-parameter-to-silence-generation.patch \
0015-Minor-CMakeLists.txt-formatting-fixes.patch \
0016-Fix-Missing-include-in-FileManager.h.patch \
0100-mingw-relocate.patch \
0101-mingw-exports.patch
}
build() {