Hello community, here is the log from the commit of package audaspace for openSUSE:Factory checked in at 2017-02-14 00:47:10 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/audaspace (Old) and /work/SRC/openSUSE:Factory/.audaspace.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "audaspace" Changes: -------- --- /work/SRC/openSUSE:Factory/audaspace/audaspace.changes 2016-07-05 09:52:39.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.audaspace.new/audaspace.changes 2017-02-14 00:47:11.500481550 +0100 @@ -1,0 +2,16 @@ +Fri Feb 10 09:14:52 UTC 2017 - davejpla...@gmail.com + +- Update to release 1.3.0 +- Removed patch audaspace-findffmpeg.patch Fixed upstream +- Upstream changes: + * Audaspace 1.3.0 is a bug fixing release without changes to the + API, but two small new features: + linear interpolation for volume changes in the software mixer + dynamic Loading for JACK + * Bug fixes: + renamed Jack to JACK + C API was not working + filter python API parameter check + finding ffmpeg with pkgconfig + +------------------------------------------------------------------- Old: ---- audaspace-1.2.tar.gz audaspace-findffmpeg.patch New: ---- audaspace-1.3.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ audaspace.spec ++++++ --- /var/tmp/diff_new_pack.8A8Gpz/_old 2017-02-14 00:47:12.424351127 +0100 +++ /var/tmp/diff_new_pack.8A8Gpz/_new 2017-02-14 00:47:12.424351127 +0100 @@ -1,7 +1,7 @@ # # spec file for package audaspace # -# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,18 +17,18 @@ # See also http://en.opensuse.org/openSUSE:Shared_library_packaging_policy -# NOTE: soname foillows version. -%define soname 1_2 +# NOTE: soname follows version. +%define soname 1_3 +%define soversion 1.3 Name: audaspace -Version: 1.2 +Version: 1.3.0 Release: 0 Summary: A High Level Audio Library License: Apache-2.0 Group: System/Libraries Url: https://github.com/audaspace/audaspace/releases/tag/v%{version} Source0: audaspace-%{version}.tar.gz -Patch1: audaspace-findffmpeg.patch BuildRequires: cmake > 3 BuildRequires: doxygen BuildRequires: fdupes @@ -125,7 +125,6 @@ %prep %setup -n audaspace-%{version} -q -%patch1 %build tmpflags="%{optflags}" @@ -182,19 +181,19 @@ %defattr (-, root, root) %dir %{_libdir}/%{name} %dir %{_libdir}/%{name}/plugins -%{_libdir}/%{name}/plugins/*.%{version} +%{_libdir}/%{name}/plugins/*.%{soversion} %files -n libaudaspace%{soname} %defattr (-, root, root) -%{_libdir}/libaudaspace.so.%{version} +%{_libdir}/libaudaspace.so.%{soversion} %files -n libaudaspace-c%{soname} %defattr (-, root, root) -%{_libdir}/libaudaspace-c.so.%{version} +%{_libdir}/libaudaspace-c.so.%{soversion} %files -n libaudaspace-py%{soname} %defattr (-, root, root) -%{_libdir}/libaudaspace-py.so.%{version} +%{_libdir}/libaudaspace-py.so.%{soversion} %files doc %defattr (-, root, root) ++++++ audaspace-1.2.tar.gz -> audaspace-1.3.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/audaspace-1.2/.travis.yml new/audaspace-1.3.0/.travis.yml --- old/audaspace-1.2/.travis.yml 2016-03-13 15:42:34.000000000 +0100 +++ new/audaspace-1.3.0/.travis.yml 2016-11-07 23:35:13.000000000 +0100 @@ -5,6 +5,8 @@ os: - osx +env: MACOSX_DEPLOYMENT_TARGET=10.11 + compiler: - clang # - gcc @@ -25,7 +27,7 @@ before_script: - mkdir build - cd build - - cmake -DPYTHON_INCLUDE_DIR=/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/include/python3.5m -DPYTHON_LIBRARY=/usr/local//Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/libpython3.5.dylib -DPython_FRAMEWORKS=/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework .. + - cmake -DPYTHON_INCLUDE_DIR=$(find /usr/local/Cellar/python3/3.*/Frameworks/Python.framework/Versions/3.*/include/ -name "python3.*m") -DPYTHON_LIBRARY=$(find /usr/local/Cellar/python3/3.*/Frameworks/Python.framework/Versions/3.*/lib -name "libpython3.*.dylib") -DPython_FRAMEWORKS=$(find /usr/local/Cellar/python3/3.*/Frameworks -name "Python.framework") .. script: - make diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/audaspace-1.2/CHANGES new/audaspace-1.3.0/CHANGES --- old/audaspace-1.2/CHANGES 2016-03-13 15:42:34.000000000 +0100 +++ new/audaspace-1.3.0/CHANGES 2016-11-07 23:35:13.000000000 +0100 @@ -1,3 +1,30 @@ +Audaspace 1.3 +============= + +- New features: + - linear interpolation for volume changes in the software mixer + - dynamic Loading for JACK +- Bug fixes: + - renamed Jack to JACK + - C API was not working + - filter python API parameter check + - finding ffmpeg with pkgconfig + +64884a7 Windows fixes. +53ba3e6 Implemented JACK dynamic loading. +5ee0ee1 Continues last commit. +c24b384 Trying to fix travis-ci python versioning once and for all (at least for python3). +1fbf3bf Rename Jack => JACK where possible. +6e4b31f Implemented linear interpolation for volume changes in the software mixer. +817043c Fixing C API not working. +c384daf Maybe travis-ci works now. +aa7ddd7 Fix (hopefully) for previous commit. +57c5dd7 Configure MACOSX_DEPLOYMENT_TARGET for travis-ci. +7ae6ff9 Fix travis-ci python path. +552fea4 Added posibillity to use math constants on MinGW +c18ed59 Bugfix: incorrect parameter check in python API. +6f048c3 CMake: fix finding ffmpeg with pkgconfig. + Audaspace 1.2 ============= diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/audaspace-1.2/CMakeLists.txt new/audaspace-1.3.0/CMakeLists.txt --- old/audaspace-1.2/CMakeLists.txt 2016-03-13 15:42:34.000000000 +0100 +++ new/audaspace-1.3.0/CMakeLists.txt 2016-11-07 23:35:13.000000000 +0100 @@ -23,8 +23,8 @@ project(audaspace) -set(AUDASPACE_VERSION 1.2) -set(AUDASPACE_LONG_VERSION ${AUDASPACE_VERSION}) +set(AUDASPACE_VERSION 1.3) +set(AUDASPACE_LONG_VERSION ${AUDASPACE_VERSION}.0) # sources @@ -302,12 +302,13 @@ cmake_dependent_option(SEPARATE_C "Build C Binding as separate library" TRUE "WITH_C" FALSE) cmake_dependent_option(PLUGIN_FFMPEG "Build FFMPEG Plugin" TRUE "WITH_FFMPEG;SHARED_LIBRARY" FALSE) -cmake_dependent_option(PLUGIN_JACK "Build Jack Plugin" TRUE "WITH_JACK;SHARED_LIBRARY" FALSE) +cmake_dependent_option(PLUGIN_JACK "Build JACK Plugin" TRUE "WITH_JACK;SHARED_LIBRARY" FALSE) cmake_dependent_option(PLUGIN_LIBSNDFILE "Build LibSndFile Plugin" TRUE "WITH_LIBSNDFILE;SHARED_LIBRARY" FALSE) cmake_dependent_option(PLUGIN_OPENAL "Build OpenAL Plugin" TRUE "WITH_OPENAL;SHARED_LIBRARY" FALSE) cmake_dependent_option(PLUGIN_SDL "Build SDL Plugin" TRUE "WITH_SDL;SHARED_LIBRARY" FALSE) cmake_dependent_option(WITH_PYTHON_MODULE "Build Python Module" TRUE "WITH_PYTHON" FALSE) 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) # compiler options @@ -339,6 +340,12 @@ set(CMAKE_OSX_DEPLOYMENT_TARGET "10.9" CACHE STRING "" FORCE) endif() +# platform specific options + +if(MSYS OR MINGW) + add_definitions(-D_USE_MATH_DEFINES) +endif() + # C if(WITH_C) set(C_SRC @@ -421,7 +428,7 @@ list(APPEND DLLS ${FFTW_DLLS}) endif() -# Jack +# JACK if(WITH_JACK) find_package(Jack ${PACKAGE_OPTION}) @@ -429,15 +436,24 @@ set(JACK_SRC plugins/jack/JackDevice.cpp plugins/jack/JackSynchronizer.cpp + plugins/jack/JackLibrary.cpp ) set(JACK_HDR plugins/jack/JackDevice.h plugins/jack/JackSynchronizer.h + plugins/jack/JackLibrary.h + plugins/jack/JackSymbols.h ) + if(DYNLOAD_JACK) + add_definitions(-DDYNLOAD_JACK) + endif() + if(NOT PLUGIN_JACK) list(APPEND INCLUDE ${JACK_INCLUDE_DIRS}) - list(APPEND LIBRARIES ${JACK_LIBRARIES}) + if(NOT DYNLOAD_JACK) + list(APPEND LIBRARIES ${JACK_LIBRARIES}) + endif() list(APPEND SRC ${JACK_SRC}) list(APPEND HDR ${JACK_HDR}) list(APPEND STATIC_PLUGINS JackDevice) @@ -449,7 +465,7 @@ endif() else() set(WITH_JACK FALSE CACHE BOOL "Build With Plugin" FORCE) - message(WARNING "Jack not found, plugin will not be built.") + message(WARNING "JACK not found, plugin will not be built.") endif() endif() @@ -678,7 +694,11 @@ add_definitions(-DJACK_PLUGIN) include_directories(${INCLUDE} ${JACK_INCLUDE_DIRS}) add_library(audjack SHARED ${JACK_SRC} ${JACK_HDR} ${HDR}) - target_link_libraries(audjack audaspace ${JACK_LIBRARIES}) + if(DYNLOAD_JACK) + target_link_libraries(audjack audaspace) + else() + target_link_libraries(audjack audaspace ${JACK_LIBRARIES}) + endif() set_target_properties(audjack PROPERTIES SOVERSION ${AUDASPACE_VERSION}) install(TARGETS audjack DESTINATION ${DEFAULT_PLUGIN_PATH}) endif() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/audaspace-1.2/bindings/C/AUD_Sound.h new/audaspace-1.3.0/bindings/C/AUD_Sound.h --- old/audaspace-1.2/bindings/C/AUD_Sound.h 2016-03-13 15:42:34.000000000 +0100 +++ new/audaspace-1.3.0/bindings/C/AUD_Sound.h 2016-11-07 23:35:13.000000000 +0100 @@ -269,7 +269,7 @@ * \param high_quality When true use a higher quality but slower resampler. * \return The resampled sound. */ -extern AUD_API AUD_Sound* AUD_Sound_resample(AUD_Sound* sound, AUD_SampleRate rate, bool high_quality = false); +extern AUD_API AUD_Sound* AUD_Sound_resample(AUD_Sound* sound, AUD_SampleRate rate, bool high_quality); /** * Reverses a sound. Make sure the sound source can be reversed. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/audaspace-1.2/bindings/C/AUD_Special.h new/audaspace-1.3.0/bindings/C/AUD_Special.h --- old/audaspace-1.2/bindings/C/AUD_Special.h 2016-03-13 15:42:34.000000000 +0100 +++ new/audaspace-1.3.0/bindings/C/AUD_Special.h 2016-11-07 23:35:13.000000000 +0100 @@ -104,7 +104,7 @@ extern AUD_API AUD_Device* AUD_openMixdownDevice(AUD_DeviceSpecs specs, AUD_Sound* sequencer, float volume, float start); /** - * Initializes audio rutines (FFMPEG/Jack if it is enabled). + * Initializes audio routines (FFMPEG/JACK if it is enabled). */ extern AUD_API void AUD_initOnce(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/audaspace-1.2/bindings/C/AUD_Types.h new/audaspace-1.3.0/bindings/C/AUD_Types.h --- old/audaspace-1.2/bindings/C/AUD_Types.h 2016-03-13 15:42:34.000000000 +0100 +++ new/audaspace-1.3.0/bindings/C/AUD_Types.h 2016-11-07 23:35:13.000000000 +0100 @@ -18,6 +18,10 @@ #include "Audaspace.h" +#ifdef __cplusplus +using namespace aud; +#endif + #ifdef AUD_CAPI_IMPLEMENTATION #include "ISound.h" #include "devices/IHandle.h" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/audaspace-1.2/bindings/python/PySound.cpp new/audaspace-1.3.0/bindings/python/PySound.cpp --- old/audaspace-1.2/bindings/python/PySound.cpp 2016-03-13 15:42:34.000000000 +0100 +++ new/audaspace-1.3.0/bindings/python/PySound.cpp 2016-11-07 23:35:13.000000000 +0100 @@ -904,7 +904,7 @@ py_a_len= py_a ? PySequence_Size(py_a) : 0; py_b_len= PySequence_Size(py_b); - if(!py_b_len || ((py_a != nullptr) && !py_b_len)) + if(!py_b_len || ((py_a != nullptr) && !py_a_len)) { PyErr_SetString(PyExc_ValueError, "The sequence has to contain at least one value!"); return nullptr; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/audaspace-1.2/cmake/FindFFMPEG.cmake new/audaspace-1.3.0/cmake/FindFFMPEG.cmake --- old/audaspace-1.2/cmake/FindFFMPEG.cmake 2016-03-13 15:42:34.000000000 +0100 +++ new/audaspace-1.3.0/cmake/FindFFMPEG.cmake 2016-11-07 23:35:13.000000000 +0100 @@ -6,32 +6,34 @@ # FFMPEG_LIBRARIES - link these to use FFMPEG # Use pkg-config to get hints about paths -#find_package(PkgConfig QUIET) -#if(PKG_CONFIG_FOUND) -# pkg_check_modules(FFMPEG_PKGCONF ffmpeg) -#endif(PKG_CONFIG_FOUND) +find_package(PkgConfig QUIET) + +if(PKG_CONFIG_FOUND) + pkg_check_modules(AVCODEC_PKGCONF libavcodec) + pkg_check_modules(AVFORMAT_PKGCONF libavformat) + pkg_check_modules(AVUTIL_PKGCONF libavutil) +endif(PKG_CONFIG_FOUND) # Include dir find_path(FFMPEG_INCLUDE_DIR NAMES libavcodec/avcodec.h libavformat/avformat.h libavformat/avio.h -# PATH_SUFFIXES include -# PATHS ${FFMPEG_PKGCONF_INCLUDE_DIRS} + PATHS ${AVCODEC_PKGCONF_INCLUDE_DIRS} ${AVFORMAT_PKGCONF_INCLUDE_DIRS} ${AVUTIL_PKGCONF_INCLUDE_DIRS} ) # Libraries find_library(AVCODEC_LIBRARY NAMES avcodec -# PATHS ${FFMPEG_PKGCONF_LIBRARY_DIRS} + PATHS ${AVCODEC_PKGCONF_LIBRARY_DIRS} ) find_library(AVFORMAT_LIBRARY NAMES avformat -# PATHS ${FFMPEG_PKGCONF_LIBRARY_DIRS} + PATHS ${AVFORMAT_PKGCONF_LIBRARY_DIRS} ) find_library(AVUTIL_LIBRARY NAMES avutil -# PATHS ${FFMPEG_PKGCONF_LIBRARY_DIRS} + PATHS ${AVUTIL_PKGCONF_LIBRARY_DIRS} ) find_package(PackageHandleStandardArgs) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/audaspace-1.2/cmake/FindJack.cmake new/audaspace-1.3.0/cmake/FindJack.cmake --- old/audaspace-1.2/cmake/FindJack.cmake 2016-03-13 15:42:34.000000000 +0100 +++ new/audaspace-1.3.0/cmake/FindJack.cmake 2016-11-07 23:35:13.000000000 +0100 @@ -1,9 +1,9 @@ -# - Try to find Jack +# - Try to find JACK # Once done, this will define # -# JACK_FOUND - system has Jack -# JACK_INCLUDE_DIRS - the Jack include directories -# JACK_LIBRARIES - link these to use Jack +# JACK_FOUND - system has JACK +# JACK_INCLUDE_DIRS - the JACK include directories +# JACK_LIBRARIES - link these to use JACK # Use pkg-config to get hints about paths find_package(PkgConfig QUIET) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/audaspace-1.2/config/Audaspace.h.in new/audaspace-1.3.0/config/Audaspace.h.in --- old/audaspace-1.2/config/Audaspace.h.in 2016-03-13 15:42:34.000000000 +0100 +++ new/audaspace-1.3.0/config/Audaspace.h.in 2016-11-07 23:35:13.000000000 +0100 @@ -110,6 +110,16 @@ /// Closes the audaspace namespace aud. #define AUD_NAMESPACE_END } +#else + +/// Opens the audaspace namespace aud. +#define AUD_NAMESPACE_BEGIN + +/// Closes the audaspace namespace aud. +#define AUD_NAMESPACE_END + +#endif + AUD_NAMESPACE_BEGIN /// Sample type.(float samples) @@ -119,5 +129,3 @@ typedef unsigned char data_t; AUD_NAMESPACE_END - -#endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/audaspace-1.2/include/devices/ISynchronizer.h new/audaspace-1.3.0/include/devices/ISynchronizer.h --- old/audaspace-1.2/include/devices/ISynchronizer.h 2016-03-13 15:42:34.000000000 +0100 +++ new/audaspace-1.3.0/include/devices/ISynchronizer.h 2016-11-07 23:35:13.000000000 +0100 @@ -33,7 +33,7 @@ /** * @interface ISynchronizer * This class enables global synchronization of several audio applications if supported. - * Jack for example supports synchronization through Jack Transport. + * JACK for example supports synchronization through JACK Transport. */ class AUD_API ISynchronizer { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/audaspace-1.2/include/devices/SoftwareDevice.h new/audaspace-1.3.0/include/devices/SoftwareDevice.h --- old/audaspace-1.2/include/devices/SoftwareDevice.h 2016-03-13 15:42:34.000000000 +0100 +++ new/audaspace-1.3.0/include/devices/SoftwareDevice.h 2016-11-07 23:35:13.000000000 +0100 @@ -87,6 +87,9 @@ /// 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; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/audaspace-1.2/include/plugin/PluginManager.h new/audaspace-1.3.0/include/plugin/PluginManager.h --- old/audaspace-1.2/include/plugin/PluginManager.h 2016-03-13 15:42:34.000000000 +0100 +++ new/audaspace-1.3.0/include/plugin/PluginManager.h 2016-11-07 23:35:13.000000000 +0100 @@ -44,6 +44,27 @@ 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. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/audaspace-1.2/include/respec/Mixer.h new/audaspace-1.3.0/include/respec/Mixer.h --- old/audaspace-1.2/include/respec/Mixer.h 2016-03-13 15:42:34.000000000 +0100 +++ new/audaspace-1.3.0/include/respec/Mixer.h 2016-11-07 23:35:13.000000000 +0100 @@ -97,6 +97,16 @@ 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. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/audaspace-1.2/plugins/jack/JackDevice.cpp new/audaspace-1.3.0/plugins/jack/JackDevice.cpp --- old/audaspace-1.2/plugins/jack/JackDevice.cpp 2016-03-13 15:42:34.000000000 +0100 +++ new/audaspace-1.3.0/plugins/jack/JackDevice.cpp 2016-11-07 23:35:13.000000000 +0100 @@ -15,6 +15,7 @@ ******************************************************************************/ #include "JackDevice.h" +#include "JackLibrary.h" #include "devices/DeviceManager.h" #include "devices/IDeviceFactory.h" #include "Exception.h" @@ -44,17 +45,17 @@ { if(m_syncFunc) { - state = jack_transport_query(m_client, &position); + state = AUD_jack_transport_query(m_client, &position); m_syncFunc(m_syncFuncData, state != JackTransportStopped, position.frame / (float) m_specs.rate); } for(i = 0; i < channels; i++) - jack_ringbuffer_reset(m_ringbuffers[i]); + AUD_jack_ringbuffer_reset(m_ringbuffers[i]); } - size = jack_ringbuffer_write_space(m_ringbuffers[0]); + size = AUD_jack_ringbuffer_write_space(m_ringbuffers[0]); for(i = 1; i < channels; i++) - if((temp = jack_ringbuffer_write_space(m_ringbuffers[i])) < size) + if((temp = AUD_jack_ringbuffer_write_space(m_ringbuffers[i])) < size) size = temp; while(size > samplesize) @@ -65,12 +66,12 @@ { for(j = 0; j < size; j++) deinterleave[i * size + j] = buffer[i + j * channels]; - jack_ringbuffer_write(m_ringbuffers[i], (char*)(deinterleave + i * size), size * sizeof(float)); + AUD_jack_ringbuffer_write(m_ringbuffers[i], (char*)(deinterleave + i * size), size * sizeof(float)); } - size = jack_ringbuffer_write_space(m_ringbuffers[0]); + size = AUD_jack_ringbuffer_write_space(m_ringbuffers[0]); for(i = 1; i < channels; i++) - if((temp = jack_ringbuffer_write_space(m_ringbuffers[i])) < size) + if((temp = AUD_jack_ringbuffer_write_space(m_ringbuffers[i])) < size) size = temp; } @@ -94,22 +95,22 @@ { // play silence while syncing for(unsigned int i = 0; i < count; i++) - std::memset(jack_port_get_buffer(device->m_ports[i], length), 0, length * sizeof(float)); + std::memset(AUD_jack_port_get_buffer(device->m_ports[i], length), 0, length * sizeof(float)); } else { size_t temp; - size_t readsamples = jack_ringbuffer_read_space(device->m_ringbuffers[0]); + size_t readsamples = AUD_jack_ringbuffer_read_space(device->m_ringbuffers[0]); for(i = 1; i < count; i++) - if((temp = jack_ringbuffer_read_space(device->m_ringbuffers[i])) < readsamples) + if((temp = AUD_jack_ringbuffer_read_space(device->m_ringbuffers[i])) < readsamples) readsamples = temp; readsamples = std::min(readsamples / sizeof(float), size_t(length)); for(unsigned int i = 0; i < count; i++) { - buffer = (char*)jack_port_get_buffer(device->m_ports[i], length); - jack_ringbuffer_read(device->m_ringbuffers[i], buffer, readsamples * sizeof(float)); + buffer = (char*)AUD_jack_port_get_buffer(device->m_ports[i], length); + AUD_jack_ringbuffer_read(device->m_ringbuffers[i], buffer, readsamples * sizeof(float)); if(readsamples < length) std::memset(buffer + readsamples * sizeof(float), 0, (length - readsamples) * sizeof(float)); } @@ -175,14 +176,14 @@ jack_status_t status; // open client - m_client = jack_client_open(name.c_str(), options, &status); + m_client = AUD_jack_client_open(name.c_str(), options, &status); if(m_client == nullptr) - AUD_THROW(DeviceException, "Connecting to the Jack server failed."); + AUD_THROW(DeviceException, "Connecting to the JACK server failed."); // set callbacks - jack_set_process_callback(m_client, JackDevice::jack_mix, this); - jack_on_shutdown(m_client, JackDevice::jack_shutdown, this); - jack_set_sync_callback(m_client, JackDevice::jack_sync, this); + AUD_jack_set_process_callback(m_client, JackDevice::jack_mix, this); + AUD_jack_on_shutdown(m_client, JackDevice::jack_shutdown, this); + AUD_jack_set_sync_callback(m_client, JackDevice::jack_sync, this); // register our output channels which are called ports in jack m_ports = new jack_port_t*[m_specs.channels]; @@ -193,24 +194,24 @@ for(int i = 0; i < m_specs.channels; i++) { sprintf(portname, "out %d", i+1); - m_ports[i] = jack_port_register(m_client, portname, JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput, 0); + m_ports[i] = AUD_jack_port_register(m_client, portname, JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput, 0); if(m_ports[i] == nullptr) - AUD_THROW(DeviceException, "Registering output port with Jack failed."); + AUD_THROW(DeviceException, "Registering output port with JACK failed."); } } catch(Exception&) { - jack_client_close(m_client); + AUD_jack_client_close(m_client); delete[] m_ports; throw; } - m_specs.rate = (SampleRate)jack_get_sample_rate(m_client); + m_specs.rate = (SampleRate)AUD_jack_get_sample_rate(m_client); buffersize *= sizeof(sample_t); m_ringbuffers = new jack_ringbuffer_t*[specs.channels]; for(unsigned int i = 0; i < specs.channels; i++) - m_ringbuffers[i] = jack_ringbuffer_create(buffersize); + m_ringbuffers[i] = AUD_jack_ringbuffer_create(buffersize); buffersize *= specs.channels; m_deinterleavebuf.resize(buffersize); m_buffer.resize(buffersize); @@ -220,29 +221,29 @@ m_valid = true; m_sync = 0; m_syncFunc = nullptr; - m_nextState = m_state = jack_transport_query(m_client, nullptr); + m_nextState = m_state = AUD_jack_transport_query(m_client, nullptr); // activate the client - if(jack_activate(m_client)) + if(AUD_jack_activate(m_client)) { - jack_client_close(m_client); + AUD_jack_client_close(m_client); delete[] m_ports; for(unsigned int i = 0; i < specs.channels; i++) - jack_ringbuffer_free(m_ringbuffers[i]); + AUD_jack_ringbuffer_free(m_ringbuffers[i]); delete[] m_ringbuffers; destroy(); - AUD_THROW(DeviceException, "Client activation with Jack failed."); + AUD_THROW(DeviceException, "Client activation with JACK failed."); } - const char** ports = jack_get_ports(m_client, nullptr, nullptr, + const char** ports = AUD_jack_get_ports(m_client, nullptr, nullptr, JackPortIsPhysical | JackPortIsInput); if(ports != nullptr) { for(int i = 0; i < m_specs.channels && ports[i]; i++) - jack_connect(m_client, jack_port_name(m_ports[i]), ports[i]); + AUD_jack_connect(m_client, AUD_jack_port_name(m_ports[i]), ports[i]); - jack_free(ports); + AUD_jack_free(ports); } m_mixingThread = std::thread(&JackDevice::updateRingBuffers, this); @@ -251,7 +252,7 @@ JackDevice::~JackDevice() { if(m_valid) - jack_client_close(m_client); + AUD_jack_client_close(m_client); m_valid = false; delete[] m_ports; @@ -263,7 +264,7 @@ m_mixingThread.join(); for(unsigned int i = 0; i < m_specs.channels; i++) - jack_ringbuffer_free(m_ringbuffers[i]); + AUD_jack_ringbuffer_free(m_ringbuffers[i]); delete[] m_ringbuffers; destroy(); @@ -281,20 +282,20 @@ void JackDevice::startPlayback() { - jack_transport_start(m_client); + AUD_jack_transport_start(m_client); m_nextState = JackTransportRolling; } void JackDevice::stopPlayback() { - jack_transport_stop(m_client); + AUD_jack_transport_stop(m_client); m_nextState = JackTransportStopped; } void JackDevice::seekPlayback(float time) { if(time >= 0.0f) - jack_transport_locate(m_client, time * m_specs.rate); + AUD_jack_transport_locate(m_client, time * m_specs.rate); } void JackDevice::setSyncCallback(ISynchronizer::syncFunction sync, void* data) @@ -306,13 +307,13 @@ float JackDevice::getPlaybackPosition() { jack_position_t position; - jack_transport_query(m_client, &position); + AUD_jack_transport_query(m_client, &position); return position.frame / (float) m_specs.rate; } bool JackDevice::doesPlayback() { - jack_transport_state_t state = jack_transport_query(m_client, nullptr); + jack_transport_state_t state = AUD_jack_transport_query(m_client, nullptr); if(state != m_state) m_nextState = m_state = state; @@ -365,7 +366,8 @@ void JackDevice::registerPlugin() { - DeviceManager::registerDevice("Jack", std::shared_ptr<IDeviceFactory>(new JackDeviceFactory)); + if(loadJACK()) + DeviceManager::registerDevice("JACK", std::shared_ptr<IDeviceFactory>(new JackDeviceFactory)); } #ifdef JACK_PLUGIN @@ -376,7 +378,7 @@ extern "C" AUD_PLUGIN_API const char* getName() { - return "Jack"; + return "JACK"; } #endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/audaspace-1.2/plugins/jack/JackDevice.h new/audaspace-1.3.0/plugins/jack/JackDevice.h --- old/audaspace-1.2/plugins/jack/JackDevice.h 2016-03-13 15:42:34.000000000 +0100 +++ new/audaspace-1.3.0/plugins/jack/JackDevice.h 2016-11-07 23:35:13.000000000 +0100 @@ -39,7 +39,7 @@ AUD_NAMESPACE_BEGIN /** - * This device plays back through Jack. + * This device plays back through JACK. */ class AUD_PLUGIN_API JackDevice : public SoftwareDevice { @@ -91,7 +91,7 @@ AUD_LOCAL static int jack_sync(jack_transport_state_t state, jack_position_t* pos, void* data); /** - * Next Jack Transport state (-1 if not expected to change). + * Next JACK Transport state (-1 if not expected to change). */ jack_transport_state_t m_nextState; @@ -144,7 +144,7 @@ public: /** - * Creates a Jack client for audio output. + * Creates a JACK client for audio output. * \param name The client name. * \param specs The wanted audio specification, where only the channel count * is important. @@ -154,7 +154,7 @@ JackDevice(std::string name, DeviceSpecs specs, int buffersize = AUD_DEFAULT_BUFFER_SIZE); /** - * Closes the Jack client. + * Closes the JACK client. */ virtual ~JackDevice(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/audaspace-1.2/plugins/jack/JackLibrary.cpp new/audaspace-1.3.0/plugins/jack/JackLibrary.cpp --- old/audaspace-1.2/plugins/jack/JackLibrary.cpp 1970-01-01 01:00:00.000000000 +0100 +++ new/audaspace-1.3.0/plugins/jack/JackLibrary.cpp 2016-11-07 23:35:13.000000000 +0100 @@ -0,0 +1,59 @@ +/******************************************************************************* + * 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. + ******************************************************************************/ + +#define JACK_LIBRARY_IMPLEMENTATION + +#include <string> +#include <array> + +#include "JackLibrary.h" + +#ifdef DYNLOAD_JACK +#include "plugin/PluginManager.h" +#endif + +AUD_NAMESPACE_BEGIN + +bool loadJACK() +{ +#ifdef DYNLOAD_JACK + std::array<const std::string, 5> names = {"libjack.so", "libjack.so.0", "libjack.so.1", "libjack.so.2", "libjack.dll"}; + + void* handle = nullptr; + + for(auto& name : names) + { + handle = PluginManager::openLibrary(name); + if(handle) + break; + } + + if (!handle) + return false; + +#define JACK_SYMBOL(sym) AUD_##sym = reinterpret_cast<decltype(&sym)>(PluginManager::lookupLibrary(handle, #sym)) +#else +#define JACK_SYMBOL(sym) AUD_##sym = &sym +#endif + +#include "JackSymbols.h" + +#undef JACK_SYMBOL + + return AUD_jack_client_open != nullptr; +} + +AUD_NAMESPACE_END diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/audaspace-1.2/plugins/jack/JackLibrary.h new/audaspace-1.3.0/plugins/jack/JackLibrary.h --- old/audaspace-1.2/plugins/jack/JackLibrary.h 1970-01-01 01:00:00.000000000 +0100 +++ new/audaspace-1.3.0/plugins/jack/JackLibrary.h 2016-11-07 23:35:13.000000000 +0100 @@ -0,0 +1,48 @@ +/******************************************************************************* + * 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 + +#ifdef JACK_PLUGIN +#define AUD_BUILD_PLUGIN +#endif + +/** + * @file JackDevice.h + * @ingroup plugin + * The JackDevice class. + */ + +#include "Audaspace.h" + +#include <jack/jack.h> +#include <jack/ringbuffer.h> + +AUD_NAMESPACE_BEGIN + +#ifdef JACK_LIBRARY_IMPLEMENTATION +#define JACK_SYMBOL(sym) decltype(&sym) AUD_##sym +#else +#define JACK_SYMBOL(sym) extern decltype(&sym) AUD_##sym +#endif + +#include "JackSymbols.h" + +#undef JACK_SYMBOL + +bool loadJACK(); + +AUD_NAMESPACE_END diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/audaspace-1.2/plugins/jack/JackSymbols.h new/audaspace-1.3.0/plugins/jack/JackSymbols.h --- old/audaspace-1.2/plugins/jack/JackSymbols.h 1970-01-01 01:00:00.000000000 +0100 +++ new/audaspace-1.3.0/plugins/jack/JackSymbols.h 2016-11-07 23:35:13.000000000 +0100 @@ -0,0 +1,45 @@ +/******************************************************************************* + * 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. + ******************************************************************************/ + +JACK_SYMBOL(jack_transport_query); +JACK_SYMBOL(jack_transport_locate); + +JACK_SYMBOL(jack_transport_start); +JACK_SYMBOL(jack_transport_stop); + +JACK_SYMBOL(jack_ringbuffer_reset); +JACK_SYMBOL(jack_ringbuffer_write); +JACK_SYMBOL(jack_ringbuffer_write_space); +JACK_SYMBOL(jack_ringbuffer_write_advance); +JACK_SYMBOL(jack_ringbuffer_read); +JACK_SYMBOL(jack_ringbuffer_create); +JACK_SYMBOL(jack_ringbuffer_free); +JACK_SYMBOL(jack_ringbuffer_read_space); +JACK_SYMBOL(jack_set_sync_callback); + +JACK_SYMBOL(jack_port_get_buffer); + +JACK_SYMBOL(jack_client_open); +JACK_SYMBOL(jack_set_process_callback); +JACK_SYMBOL(jack_on_shutdown); +JACK_SYMBOL(jack_port_register); +JACK_SYMBOL(jack_client_close); +JACK_SYMBOL(jack_get_sample_rate); +JACK_SYMBOL(jack_activate); +JACK_SYMBOL(jack_get_ports); +JACK_SYMBOL(jack_port_name); +JACK_SYMBOL(jack_connect); +JACK_SYMBOL(jack_free); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/audaspace-1.2/plugins/jack/JackSynchronizer.h new/audaspace-1.3.0/plugins/jack/JackSynchronizer.h --- old/audaspace-1.2/plugins/jack/JackSynchronizer.h 2016-03-13 15:42:34.000000000 +0100 +++ new/audaspace-1.3.0/plugins/jack/JackSynchronizer.h 2016-11-07 23:35:13.000000000 +0100 @@ -33,7 +33,7 @@ class JackDevice; /** - * This class is a Synchronizer implementation using Jack Transport. + * This class is a Synchronizer implementation using JACK Transport. */ class AUD_PLUGIN_API JackSynchronizer : public ISynchronizer { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/audaspace-1.2/src/devices/SoftwareDevice.cpp new/audaspace-1.3.0/src/devices/SoftwareDevice.cpp --- old/audaspace-1.2/src/devices/SoftwareDevice.cpp 2016-03-13 15:42:34.000000000 +0100 +++ new/audaspace-1.3.0/src/devices/SoftwareDevice.cpp 2016-11-07 23:35:13.000000000 +0100 @@ -78,7 +78,7 @@ } SoftwareDevice::SoftwareHandle::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) : - m_reader(reader), m_pitch(pitch), m_resampler(resampler), m_mapper(mapper), m_keep(keep), m_user_pitch(1.0f), m_user_volume(1.0f), m_user_pan(0.0f), m_volume(1.0f), m_loopcount(0), + m_reader(reader), m_pitch(pitch), m_resampler(resampler), m_mapper(mapper), m_keep(keep), m_user_pitch(1.0f), m_user_volume(1.0f), m_user_pan(0.0f), m_volume(1.0f), m_old_volume(0), m_loopcount(0), m_relative(true), m_volume_max(1.0f), m_volume_min(0), m_distance_max(std::numeric_limits<float>::max()), m_distance_reference(1.0f), m_attenuation(1.0f), m_cone_angle_outer(M_PI), m_cone_angle_inner(M_PI), m_cone_volume_outer(0), m_flags(RENDER_CONE), m_stop(nullptr), m_stop_data(nullptr), m_status(STATUS_PLAYING), m_device(device) @@ -89,6 +89,8 @@ { int flags = 0; + m_old_volume = m_volume; + Vector3 SL; if(m_relative) SL = -m_location; @@ -396,7 +398,7 @@ if(volume == 0) { - m_volume = volume; + m_old_volume = m_volume = volume; m_flags |= RENDER_VOLUME; } else @@ -749,7 +751,7 @@ // in case of looping while(pos + len < length && sound->m_loopcount && eos) { - m_mixer->mix(buf, pos, len, sound->m_volume); + m_mixer->mix(buf, pos, len, sound->m_volume, sound->m_old_volume); pos += len; @@ -772,7 +774,7 @@ std::cerr << "Caught exception while reading sound data during playback with software mixing: " << e.getMessage() << std::endl; } - m_mixer->mix(buf, pos, len, sound->m_volume); + m_mixer->mix(buf, pos, len, sound->m_volume, sound->m_old_volume); // in case the end of the sound is reached if(eos && !sound->m_loopcount) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/audaspace-1.2/src/plugin/PluginManagerUnix.cpp.in new/audaspace-1.3.0/src/plugin/PluginManagerUnix.cpp.in --- old/audaspace-1.2/src/plugin/PluginManagerUnix.cpp.in 2016-03-13 15:42:34.000000000 +0100 +++ new/audaspace-1.3.0/src/plugin/PluginManagerUnix.cpp.in 2016-11-07 23:35:13.000000000 +0100 @@ -23,19 +23,34 @@ std::unordered_map<std::string, void*> PluginManager::m_plugins; +void* PluginManager::openLibrary(const std::string& path) +{ + return dlopen(path.c_str(), RTLD_LAZY); +} + +void *PluginManager::lookupLibrary(void *handle, const std::string &name) +{ + return dlsym(handle, name.c_str()); +} + +void PluginManager::closeLibrary(void *handle) +{ + dlclose(handle); +} + bool PluginManager::loadPlugin(const std::string& path) { - void* handle = dlopen(path.c_str(), RTLD_LAZY); + void* handle = openLibrary(path); if (!handle) return false; - void (*registerPlugin)() = (void (*)())dlsym(handle, "registerPlugin"); - const char* (*getName)() = (const char* (*)())dlsym(handle, "getName"); + void (*registerPlugin)() = (void (*)())lookupLibrary(handle, "registerPlugin"); + const char* (*getName)() = (const char* (*)())lookupLibrary(handle, "getName"); if(!registerPlugin || !getName) { - dlclose(handle); + closeLibrary(handle); return false; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/audaspace-1.2/src/plugin/PluginManagerWindows.cpp.in new/audaspace-1.3.0/src/plugin/PluginManagerWindows.cpp.in --- old/audaspace-1.2/src/plugin/PluginManagerWindows.cpp.in 2016-03-13 15:42:34.000000000 +0100 +++ new/audaspace-1.3.0/src/plugin/PluginManagerWindows.cpp.in 2016-11-07 23:35:13.000000000 +0100 @@ -22,19 +22,34 @@ std::unordered_map<std::string, void*> PluginManager::m_plugins; +void* PluginManager::openLibrary(const std::string& path) +{ + return reinterpret_cast<void*>(LoadLibrary(path.c_str())); +} + +void *PluginManager::lookupLibrary(void *handle, const std::string &name) +{ + return GetProcAddress(reinterpret_cast<HMODULE>(handle), name.c_str()); +} + +void PluginManager::closeLibrary(void *handle) +{ + FreeLibrary(reinterpret_cast<HMODULE>(handle)); +} + bool PluginManager::loadPlugin(const std::string& path) { - HMODULE handle = LoadLibrary(path.c_str()); + void* handle = openLibrary(path); if (!handle) return false; - void(*registerPlugin)() = (void(*)())GetProcAddress(handle, "registerPlugin"); - const char* (*getName)() = (const char* (*)())GetProcAddress(handle, "getName"); + void (*registerPlugin)() = (void (*)())lookupLibrary(handle, "registerPlugin"); + const char* (*getName)() = (const char* (*)())lookupLibrary(handle, "getName"); if(!registerPlugin || !getName) { - FreeLibrary(handle); + closeLibrary(handle); return false; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/audaspace-1.2/src/respec/Mixer.cpp new/audaspace-1.3.0/src/respec/Mixer.cpp --- old/audaspace-1.2/src/respec/Mixer.cpp 2016-03-13 15:42:34.000000000 +0100 +++ new/audaspace-1.3.0/src/respec/Mixer.cpp 2016-11-07 23:35:13.000000000 +0100 @@ -84,6 +84,21 @@ out[i + start] += buffer[i] * volume; } +void Mixer::mix(sample_t* buffer, int start, int length, float volume_to, float volume_from) +{ + sample_t* out = m_buffer.getBuffer(); + + length = (std::min(m_length, length + start) - start); + + for(int i = 0; i < length; i++) + { + float volume = volume_from * (1.0f - i / float(length)) + volume_to * (i / float(length)); + + for(int c = 0; c < m_specs.channels; c++) + out[(i + start) * m_specs.channels + c] += buffer[i * m_specs.channels + c] * volume; + } +} + void Mixer::read(data_t* buffer, float volume) { sample_t* out = m_buffer.getBuffer();