├── .clang-format ├── ci ├── llvm-run.sh ├── requirements.txt ├── Dockerfile ├── ci.yaml └── osx.sh ├── NFSmartPlayer.png ├── NFSmartPlayer.pxm ├── resources ├── smart-player-test-audio │ ├── 2478c8c11b7a1eff5f401393a1a4bf5f.flac │ ├── 253b8e6458fbe5a46ed18d114e6e1f60.flac │ ├── 2a83716e9bfabca2e22c10bdc8f9780a.flac │ ├── 5d2d42c9e3baec1a5605ceb947c9a028.flac │ ├── 7ca6385ed2e09e89691d10cb683748dd.flac │ ├── 8a30808c97573e87f4bccbafbc71a2cc.flac │ ├── 90e05f78e8ff35739443d0c926bde602.flac │ ├── a95d4efdea46762fa5fc525e9ee181f0.flac │ ├── b458ac690dc515a160b9c24481cd592e.flac │ └── e8256968a885259b4516eef2e0b095b0.flac ├── ogg-graph.json ├── scripting.json ├── ogg-loop-4x.json └── nf-logging │ └── expected │ └── example2.json ├── source ├── plugins │ ├── eq │ │ ├── tests │ │ │ ├── CMakeLists.txt │ │ │ └── EQPluginTestRunner.cpp │ │ ├── CMakeLists.txt │ │ ├── EQPluginFactory.h │ │ ├── README.md │ │ ├── EQPluginFactory.cpp │ │ └── FilterPlugin.h │ ├── wave │ │ ├── tests │ │ │ ├── CMakeLists.txt │ │ │ ├── WavePluginTestRunner.cpp │ │ │ └── SineWavePluginTest.cpp │ │ ├── CMakeLists.txt │ │ ├── README.md │ │ ├── WavePluginFactory.h │ │ ├── WavePluginFactory.cpp │ │ └── SineWavePlugin.h │ ├── CMakeLists.txt │ ├── time │ │ ├── tests │ │ │ ├── CMakeLists.txt │ │ │ ├── TimePluginTestRunner.cpp │ │ │ └── LoopPluginTest.cpp │ │ ├── CMakeLists.txt │ │ ├── README.md │ │ ├── TimePluginFactory.h │ │ ├── TimePluginFactory.cpp │ │ └── LoopPlugin.h │ ├── file │ │ ├── tests │ │ │ ├── CMakeLists.txt │ │ │ └── FilePluginTestRunner.cpp │ │ ├── CMakeLists.txt │ │ ├── README.md │ │ └── FilePluginFactory.h │ ├── noise │ │ ├── tests │ │ │ ├── CMakeLists.txt │ │ │ ├── NoisePluginTestRunner.cpp │ │ │ └── NoisePluginTest.cpp │ │ ├── README.md │ │ ├── CMakeLists.txt │ │ ├── NoisePluginFactory.h │ │ ├── NoisePluginFactory.cpp │ │ ├── SilencePlugin.h │ │ └── NoisePlugin.h │ ├── util │ │ ├── tests │ │ │ ├── CMakeLists.txt │ │ │ └── PluginUtilTestRunner.cpp │ │ ├── CMakeLists.txt │ │ └── BandSplitter.h │ ├── waa │ │ ├── tests │ │ │ ├── CMakeLists.txt │ │ │ ├── WAAPluginTestRunner.cpp │ │ │ ├── GainPluginTest.cpp │ │ │ └── DelayPluginTest.cpp │ │ ├── CMakeLists.txt │ │ ├── README.md │ │ ├── WAAPluginFactory.h │ │ ├── GainPlugin.h │ │ └── DelayPlugin.h │ ├── channel │ │ ├── tests │ │ │ ├── CMakeLists.txt │ │ │ ├── ChannelPluginTestRunner.cpp │ │ │ └── ChannelPluginTest.cpp │ │ ├── README.md │ │ ├── CMakeLists.txt │ │ ├── PluginFactory.h │ │ ├── PluginFactory.cpp │ │ └── ChannelPlugin.h │ └── compressor │ │ ├── README.md │ │ ├── tests │ │ ├── CMakeLists.txt │ │ ├── CompressorPluginTestRunner.cpp │ │ └── CompressorPluginTest.cpp │ │ ├── CMakeLists.txt │ │ ├── CompressorPluginFactory.h │ │ ├── types.h │ │ ├── Detector.h │ │ ├── PeakDetector.h │ │ └── RmsDetector.h ├── tests │ ├── CMakeLists.txt │ ├── NFSmartPlayerTestRunner.cpp │ ├── ClientTest.cpp │ ├── CallbackTypesTest.cpp │ ├── EdgeTest.cpp │ ├── EdgeImplementationTest.cpp │ └── GraphTest.cpp ├── HTTPLogSink.h ├── cli │ └── CMakeLists.txt ├── Node.cpp ├── README.md ├── Edge.cpp ├── HTTPLogSink.cpp ├── EdgeImplementation.h ├── GraphDelegate.h ├── Authoriser.h ├── GlobalLogger.cpp ├── EdgeImplementation.cpp ├── Notification.h ├── Limiter.h ├── Notification.cpp ├── Client.cpp ├── CallbackTypes.cpp ├── Graph.cpp ├── ScriptDelegate.h └── Limiter.cpp ├── CONTRIBUTING.md ├── .github └── ISSUE_TEMPLATE.md ├── interfaces ├── java │ ├── com │ │ └── spotify │ │ │ └── nativeformat │ │ │ ├── DriverType.java │ │ │ ├── MessageType.java │ │ │ ├── PlayerListener.java │ │ │ ├── OSValidator.java │ │ │ └── Player.java │ └── CMakeLists.txt ├── objc │ ├── check-lib-pre.sh │ ├── tests │ │ ├── CMakeLists.txt │ │ ├── NFSmartPlayerObjCTestRunner.cpp │ │ ├── NFSmartPlayerGraphDelegateMock.m │ │ ├── NFSmartPlayerObjCDelegateMock.h │ │ ├── NFSmartPlayerGraphDelegateMock.h │ │ ├── NFSmartPlayerObjCDelegateMock.m │ │ └── NFSmartPlayerGraphTest.mm │ ├── include │ │ └── NFSmartPlayerObjC │ │ │ ├── NFSmartPlayerParam.h │ │ │ ├── NFSmartPlayerScript.h │ │ │ ├── NFSmartPlayerEdge.h │ │ │ ├── NFSmartPlayerNode.h │ │ │ └── NFSmartPlayerGraph.h │ ├── NFSmartPlayerEdge+Private.h │ ├── NFSmartPlayerNode+Private.h │ ├── NFSmartPlayerGraph+Private.h │ ├── NFSmartPlayerParam+Private.h │ ├── NFSmartPlayerScript+Private.h │ ├── NFSmartPlayerParam.m │ ├── NFSmartPlayerScript.m │ └── NFSmartPlayerEdge.m ├── CMakeLists.txt ├── csharp │ └── CMakeLists.txt ├── python │ └── CMakeLists.txt └── NFSmartPlayer.i ├── tools ├── generate-version.py └── generate-integration-audio.py ├── .gitmodules ├── .gitignore └── include └── NFSmartPlayer ├── Script.h ├── Edge.h ├── GlobalLogger.h ├── ErrorCode.h ├── CallbackTypes.h ├── Node.h └── Factory.h /.clang-format: -------------------------------------------------------------------------------- 1 | BasedOnStyle: Google 2 | -------------------------------------------------------------------------------- /ci/llvm-run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | exec xcrun llvm-cov gcov "$@" -------------------------------------------------------------------------------- /NFSmartPlayer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nativeformat/NFSmartPlayer/HEAD/NFSmartPlayer.png -------------------------------------------------------------------------------- /NFSmartPlayer.pxm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nativeformat/NFSmartPlayer/HEAD/NFSmartPlayer.pxm -------------------------------------------------------------------------------- /resources/smart-player-test-audio/2478c8c11b7a1eff5f401393a1a4bf5f.flac: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nativeformat/NFSmartPlayer/HEAD/resources/smart-player-test-audio/2478c8c11b7a1eff5f401393a1a4bf5f.flac -------------------------------------------------------------------------------- /resources/smart-player-test-audio/253b8e6458fbe5a46ed18d114e6e1f60.flac: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nativeformat/NFSmartPlayer/HEAD/resources/smart-player-test-audio/253b8e6458fbe5a46ed18d114e6e1f60.flac -------------------------------------------------------------------------------- /resources/smart-player-test-audio/2a83716e9bfabca2e22c10bdc8f9780a.flac: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nativeformat/NFSmartPlayer/HEAD/resources/smart-player-test-audio/2a83716e9bfabca2e22c10bdc8f9780a.flac -------------------------------------------------------------------------------- /resources/smart-player-test-audio/5d2d42c9e3baec1a5605ceb947c9a028.flac: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nativeformat/NFSmartPlayer/HEAD/resources/smart-player-test-audio/5d2d42c9e3baec1a5605ceb947c9a028.flac -------------------------------------------------------------------------------- /resources/smart-player-test-audio/7ca6385ed2e09e89691d10cb683748dd.flac: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nativeformat/NFSmartPlayer/HEAD/resources/smart-player-test-audio/7ca6385ed2e09e89691d10cb683748dd.flac -------------------------------------------------------------------------------- /resources/smart-player-test-audio/8a30808c97573e87f4bccbafbc71a2cc.flac: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nativeformat/NFSmartPlayer/HEAD/resources/smart-player-test-audio/8a30808c97573e87f4bccbafbc71a2cc.flac -------------------------------------------------------------------------------- /resources/smart-player-test-audio/90e05f78e8ff35739443d0c926bde602.flac: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nativeformat/NFSmartPlayer/HEAD/resources/smart-player-test-audio/90e05f78e8ff35739443d0c926bde602.flac -------------------------------------------------------------------------------- /resources/smart-player-test-audio/a95d4efdea46762fa5fc525e9ee181f0.flac: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nativeformat/NFSmartPlayer/HEAD/resources/smart-player-test-audio/a95d4efdea46762fa5fc525e9ee181f0.flac -------------------------------------------------------------------------------- /resources/smart-player-test-audio/b458ac690dc515a160b9c24481cd592e.flac: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nativeformat/NFSmartPlayer/HEAD/resources/smart-player-test-audio/b458ac690dc515a160b9c24481cd592e.flac -------------------------------------------------------------------------------- /resources/smart-player-test-audio/e8256968a885259b4516eef2e0b095b0.flac: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nativeformat/NFSmartPlayer/HEAD/resources/smart-player-test-audio/e8256968a885259b4516eef2e0b095b0.flac -------------------------------------------------------------------------------- /ci/requirements.txt: -------------------------------------------------------------------------------- 1 | llvmlite==0.26.0 2 | numba==0.41.0 3 | pyyaml 4 | flake8 5 | cmakelint 6 | pycparser 7 | pysoundfile 8 | numpy 9 | requests 10 | scikit-learn==0.20.3 11 | librosa==0.6.3 12 | ffmpeg 13 | ruamel.yaml -------------------------------------------------------------------------------- /source/plugins/eq/tests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | add_executable(EQPluginTests EQPluginTestRunner.cpp EQPluginTest.cpp) 3 | target_link_libraries(EQPluginTests 4 | EQPlugin 5 | NFSPLogger 6 | ${Boost_LIBRARIES}) 7 | target_include_directories( 8 | EQPluginTests 9 | PUBLIC 10 | "${EQPLUGIN_INCLUDE_DIRECTORY}") 11 | -------------------------------------------------------------------------------- /source/plugins/wave/tests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(WavePluginTests WavePluginTestRunner.cpp SineWavePluginTest.cpp) 2 | target_link_libraries(WavePluginTests 3 | WavePlugin 4 | NFSPLogger 5 | ${Boost_LIBRARIES}) 6 | target_include_directories( 7 | WavePluginTests 8 | PUBLIC 9 | "${WAVEPLUGIN_INCLUDE_DIRECTORY}") 10 | -------------------------------------------------------------------------------- /source/plugins/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(COMMON_PLUGIN_LIBS NFGrapherParam nlohmann_json) 2 | 3 | add_subdirectory(util) 4 | add_subdirectory(waa) 5 | add_subdirectory(noise) 6 | add_subdirectory(wave) 7 | add_subdirectory(file) 8 | add_subdirectory(channel) 9 | add_subdirectory(compressor) 10 | add_subdirectory(eq) 11 | add_subdirectory(time) 12 | -------------------------------------------------------------------------------- /source/plugins/time/tests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | add_executable(TimePluginTests 3 | TimePluginTestRunner.cpp LoopPluginTest.cpp) 4 | target_link_libraries(TimePluginTests 5 | TimePlugin 6 | NFSPLogger 7 | ${Boost_LIBRARIES}) 8 | target_include_directories( 9 | TimePluginTests 10 | PUBLIC 11 | "${TIMEPLUGIN_INCLUDE_DIRECTORY}") 12 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | Contributions are welcomed. Open a pull-request or an issue. 3 | 4 | ## Code of conduct 5 | This project adheres to the [Open Code of Conduct][code-of-conduct]. By participating, you are expected to honor this code. 6 | 7 | [code-of-conduct]: https://github.com/spotify/code-of-conduct/blob/master/code-of-conduct.md 8 | -------------------------------------------------------------------------------- /source/plugins/file/tests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(FilePluginTests FilePluginTestRunner.cpp) 2 | target_link_libraries(FilePluginTests 3 | FilePlugin 4 | NFSPLogger 5 | ${Boost_LIBRARIES}) 6 | target_include_directories( 7 | FilePluginTests 8 | PUBLIC 9 | ${NF_LOGGING_SCHEMA_SRC_DIR} 10 | ${FILEPLUGIN_INCLUDE_DIRECTORY}) 11 | -------------------------------------------------------------------------------- /source/plugins/noise/tests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | add_executable(NoisePluginTests NoisePluginTestRunner.cpp NoisePluginTest.cpp) 3 | target_link_libraries(NoisePluginTests 4 | NoisePlugin 5 | NFSPLogger 6 | ${Boost_LIBRARIES}) 7 | target_include_directories( 8 | NoisePluginTests 9 | PUBLIC 10 | "${NOISEPLUGIN_INCLUDE_DIRECTORY}") 11 | -------------------------------------------------------------------------------- /source/plugins/util/tests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(PluginUtilTests PluginUtilTestRunner.cpp PluginUtilTests.cpp) 2 | target_link_libraries(PluginUtilTests 3 | PluginUtil 4 | ${Boost_LIBRARIES}) 5 | target_include_directories( 6 | PluginUtilTests 7 | PUBLIC 8 | "${Boost_INCLUDE_DIR}" 9 | "${PLUGIN_UTIL_INCLUDE_DIRECTORY}") 10 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | Please answer the following: 2 | 3 | ### Enviroment details: 4 | 5 | - [ ] Component (CLI, NF Playground, iOS Framework, etc): XXXXX 6 | - [ ] Player build (something like `9999-abcdef`, or version if using nodejs): XXXXX 7 | - [ ] OS & OS Version (e.g. Mac 10.12.6, Windows 10): XXXXX 8 | 9 | ### Issue Detail: 10 | 11 | -------------------------------------------------------------------------------- /source/plugins/waa/tests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(WAAPluginTests 2 | WAAPluginTestRunner.cpp 3 | DelayPluginTest.cpp 4 | GainPluginTest.cpp) 5 | target_link_libraries(WAAPluginTests 6 | WAAPlugin 7 | NFSPLogger 8 | ${Boost_LIBRARIES}) 9 | target_include_directories( 10 | WAAPluginTests 11 | PUBLIC 12 | "${WAAPLUGIN_INCLUDE_DIRECTORY}") 13 | -------------------------------------------------------------------------------- /interfaces/java/com/spotify/nativeformat/DriverType.java: -------------------------------------------------------------------------------- 1 | package com.spotify.nativeformat; 2 | 3 | public enum DriverType { 4 | Soundcard(0), 5 | File(1); 6 | 7 | private int numVal; 8 | 9 | DriverType(int numVal) { 10 | this.numVal = numVal; 11 | } 12 | 13 | public int getNumVal() { 14 | return numVal; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /interfaces/java/com/spotify/nativeformat/MessageType.java: -------------------------------------------------------------------------------- 1 | package com.spotify.nativeformat; 2 | 3 | public enum MessageType { 4 | None(0), 5 | Generic(1); 6 | 7 | private int numVal; 8 | 9 | MessageType(int numVal) { 10 | this.numVal = numVal; 11 | } 12 | 13 | public int getNumVal() { 14 | return numVal; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /interfaces/objc/check-lib-pre.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | 4 | #mainlib=$1 5 | #shift 6 | while [[ $# > 0 ]] ; do 7 | dep=$1 8 | if [ "$dep" -nt "$mainlib" ]; then 9 | # echo "'$dep' is newer than '$mainlib'" 10 | # rm -f $mainlib 11 | find $TEMP_DIR -name "*-master.o" -print -delete 12 | exit 0 13 | fi 14 | shift 15 | done 16 | -------------------------------------------------------------------------------- /source/plugins/channel/tests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(ChannelPluginTests 2 | ChannelPluginTestRunner.cpp 3 | ChannelPluginTest.cpp) 4 | 5 | target_link_libraries(ChannelPluginTests 6 | ChannelPlugin 7 | NFSPLogger 8 | ${Boost_LIBRARIES}) 9 | target_include_directories( 10 | ChannelPluginTests 11 | PUBLIC 12 | "${CHANNELPLUGIN_INCLUDE_DIRECTORY}") 13 | -------------------------------------------------------------------------------- /source/plugins/compressor/README.md: -------------------------------------------------------------------------------- 1 | # Compressor Factory 2 | A set of plugins that performs dynamic range compression. 3 | 4 | ## Namespace 5 | 6 | com.nativeformat.plugins.compressor 7 | 8 | ## Plugins 9 | 10 | A list of the plugins the compressor factory provides 11 | 12 | ### Compressor 13 | 14 | `com.nativeformat.plugin.compressor.compressor` 15 | 16 | #### Commands 17 | 18 | -------------------------------------------------------------------------------- /source/plugins/compressor/tests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | add_executable(CompressorPluginTests 3 | CompressorPluginTestRunner.cpp 4 | CompressorPluginTest.cpp) 5 | target_link_libraries(CompressorPluginTests 6 | CompressorPlugin 7 | NFSPLogger 8 | ${Boost_LIBRARIES}) 9 | target_include_directories( 10 | CompressorPluginTests 11 | PUBLIC 12 | "${COMPRESSORPLUGIN_INCLUDE_DIRECTORY}") 13 | -------------------------------------------------------------------------------- /interfaces/java/com/spotify/nativeformat/PlayerListener.java: -------------------------------------------------------------------------------- 1 | package com.spotify.nativeformat; 2 | 3 | interface PlayerListener { 4 | String nativeFormatResolveVariable(String pluginNamespace, String variableIdentifier); 5 | void nativeFormatDidLoad(boolean success, String errorMessage); 6 | void nativeFormatReceivedMessage(String messageIdentifier, String senderIdentifier, MessageType messageType, Object payload); 7 | } -------------------------------------------------------------------------------- /interfaces/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(NATIVEFORMAT_INTERFACE_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}") 2 | 3 | # temporary, haven't dealt with these on Linux yet 4 | if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") 5 | find_package(SWIG REQUIRED) 6 | 7 | add_subdirectory(csharp) 8 | 9 | add_subdirectory(python) 10 | add_subdirectory(objc) 11 | endif() 12 | 13 | if((NOT IOS) OR (NOT ANDROID)) 14 | add_subdirectory(java) 15 | endif() 16 | -------------------------------------------------------------------------------- /source/plugins/channel/README.md: -------------------------------------------------------------------------------- 1 | # Channel Factory 2 | A set of plugins that modify certain channels. 3 | 4 | ## Namespace 5 | 6 | com.nativeformat.plugins.channel 7 | 8 | ## Plugins 9 | 10 | A list of the plugins the Channel factory provides 11 | 12 | ### Channel 13 | 14 | `com.nativeformat.plugin.channel.channel` 15 | 16 | #### Commands 17 | 18 | * `channels` An array of integers defining which channels to keep (starting at 0) 19 | -------------------------------------------------------------------------------- /source/plugins/util/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(PLUGIN_UTIL_INCLUDE_DIRECTORY 2 | "${CMAKE_CURRENT_SOURCE_DIR}" 3 | CACHE STRING "Include directory for plugin utils" FORCE) 4 | add_library( 5 | PluginUtil 6 | STATIC 7 | ButterFilter.h 8 | ButterFilter.cpp 9 | BandSplitter.h 10 | BandSplitter.cpp) 11 | target_include_directories( 12 | PluginUtil 13 | PUBLIC 14 | ${NFSMARTPLAYER_INCLUDE_DIRS}) 15 | 16 | add_subdirectory(tests) 17 | -------------------------------------------------------------------------------- /source/plugins/wave/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(WAVEPLUGIN_INCLUDE_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}") 2 | add_library( 3 | WavePlugin 4 | STATIC 5 | SineWavePlugin.h 6 | SineWavePlugin.cpp 7 | WavePluginFactory.h 8 | WavePluginFactory.cpp) 9 | target_include_directories( 10 | WavePlugin 11 | PUBLIC 12 | ${NFSMARTPLAYER_INCLUDE_DIRS}) 13 | target_link_libraries(WavePlugin 14 | ${Boost_LIBRARIES} 15 | ${COMMON_PLUGIN_LIBS}) 16 | add_subdirectory(tests) 17 | -------------------------------------------------------------------------------- /source/plugins/channel/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(CHANNELPLUGIN_INCLUDE_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}") 2 | add_library( 3 | ChannelPlugin 4 | STATIC 5 | PluginFactory.h 6 | PluginFactory.cpp 7 | ChannelPlugin.h 8 | ChannelPlugin.cpp) 9 | target_include_directories( 10 | ChannelPlugin 11 | PUBLIC 12 | ${NFSMARTPLAYER_INCLUDE_DIRS}) 13 | target_link_libraries( 14 | ChannelPlugin 15 | ${Boost_LIBRARIES} 16 | ${COMMON_PLUGIN_LIBS}) 17 | add_subdirectory(tests) 18 | -------------------------------------------------------------------------------- /ci/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:bionic as intermediate 2 | 3 | WORKDIR /NFSmartPlayerEnv 4 | 5 | # copy the bare minimum to get linux.sh to execute 6 | COPY ./ci ./ci 7 | COPY ./tools ./tools 8 | RUN ./ci/linux.sh --help 9 | 10 | # Rely on the copy that will be VOLUME-ed in at runtime 11 | RUN rm -rf ./ci ./tools 12 | 13 | ENV CC=clang 14 | ENV CXX=clang++ 15 | 16 | # https://pythonspeed.com/articles/activate-virtualenv-dockerfile/ 17 | ENV VIRTUAL_ENV=/NFSmartPlayerEnv/smartplayer_env 18 | ENV PATH="$VIRTUAL_ENV/bin:$PATH" -------------------------------------------------------------------------------- /source/plugins/noise/README.md: -------------------------------------------------------------------------------- 1 | # Noise Factory 2 | A set of plugins that output different types of noise. 3 | 4 | ## Namespace 5 | 6 | com.nativeformat.plugins.noise 7 | 8 | ## Plugins 9 | 10 | A list of the plugins the Noise factory provides 11 | 12 | ### Noise 13 | 14 | `com.nativeformat.plugin.noise.noise` 15 | 16 | #### Commands 17 | 18 | * `setStartTime: absolutetime start_time` This tells the plugin when to start producing the noise 19 | * `setDuration: relativetime duration` This tells the plugin how long to produce the noise for 20 | -------------------------------------------------------------------------------- /source/plugins/noise/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(NOISEPLUGIN_INCLUDE_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}") 2 | add_library( 3 | NoisePlugin 4 | STATIC 5 | NoisePlugin.h 6 | NoisePlugin.cpp 7 | NoisePluginFactory.h 8 | NoisePluginFactory.cpp 9 | SilencePlugin.cpp 10 | SilencePlugin.h) 11 | target_include_directories( 12 | NoisePlugin 13 | PUBLIC 14 | ${NFSMARTPLAYER_INCLUDE_DIRS} 15 | ${JSON_INCLUDE_DIR}) 16 | target_link_libraries( 17 | NoisePlugin 18 | ${Boost_LIBRARIES} 19 | ${COMMON_PLUGIN_LIBS}) 20 | add_subdirectory(tests) 21 | -------------------------------------------------------------------------------- /interfaces/objc/tests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(NFSmartPlayerObjCTests 2 | NFSmartPlayerObjCTestRunner.cpp 3 | NFSmartPlayerGraphTest.mm 4 | NFSmartPlayerObjCTest.mm 5 | NFSmartPlayerObjCDelegateMock.h 6 | NFSmartPlayerObjCDelegateMock.m 7 | NFSmartPlayerGraphDelegateMock.h 8 | NFSmartPlayerGraphDelegateMock.m) 9 | target_link_libraries(NFSmartPlayerObjCTests 10 | NFSmartPlayerObjC 11 | NFGrapher 12 | ${Boost_LIBRARIES}) 13 | target_include_directories( 14 | NFSmartPlayerObjCTests 15 | PUBLIC 16 | "${NFSMARTPLAYEROBJC_INCLUDE_DIR}") 17 | -------------------------------------------------------------------------------- /source/plugins/wave/README.md: -------------------------------------------------------------------------------- 1 | # Wave Factory 2 | A set of plugins that generate wave signals. 3 | 4 | ## Namespace 5 | 6 | com.nativeformat.plugins.wave 7 | 8 | ## Plugins 9 | 10 | A list of the plugins the WAA factory provides 11 | 12 | ### Sine 13 | 14 | `com.nativeformat.plugin.wave.sine` 15 | 16 | #### Commands 17 | 18 | * `frequency: number frequency` The frequency to generate the sine wave at. 19 | * `setStartTime: absolutetime start_time` The absolute time to start playing the wave at. 20 | * `setDuration: relativetime duration` The length of time to play the wave for. 21 | -------------------------------------------------------------------------------- /interfaces/csharp/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include(${SWIG_USE_FILE}) 2 | set(CMAKE_SWIG_FLAGS "") 3 | 4 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}) 5 | 6 | # Generate C# interfaces 7 | set(CMAKE_SWIG_FLAGS -w451) 8 | set(CMAKE_SWIG_OUTDIR "${CMAKE_CURRENT_SOURCE_DIR}") 9 | set_source_files_properties( 10 | "${NATIVEFORMAT_INTERFACE_DIRECTORY}/NFSmartPlayer.i" 11 | PROPERTIES 12 | CPLUSPLUS ON) 13 | swig_add_module( 14 | NFSmartPlayerCS 15 | csharp 16 | "${NATIVEFORMAT_INTERFACE_DIRECTORY}/NFSmartPlayer.i") 17 | swig_link_libraries(NFSmartPlayerCS NFSmartPlayer ${CSHARP_LIBRARIES}) 18 | -------------------------------------------------------------------------------- /source/plugins/eq/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(EQPLUGIN_INCLUDE_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}") 2 | add_library( 3 | EQPlugin 4 | STATIC 5 | EQPluginFactory.h 6 | EQPluginFactory.cpp 7 | EQPlugin.h 8 | EQPlugin.cpp 9 | FilterPlugin.h 10 | FilterPlugin.cpp) 11 | target_include_directories( 12 | EQPlugin 13 | PUBLIC 14 | ${NFSMARTPLAYER_INCLUDE_DIRS} 15 | ${NFSMARTPLAYER_LIBRARIES_DIRECTORY}/PeqBank/include 16 | ${PLUGIN_UTIL_INCLUDE_DIRECTORY} 17 | PRIVATE 18 | ${Boost_INCLUDE_DIR}) 19 | target_link_libraries(EQPlugin 20 | ${COMMON_PLUGIN_LIBS} 21 | PluginUtil 22 | ${Boost_LIBRARIES} 23 | PeqBank) 24 | add_subdirectory(tests) 25 | -------------------------------------------------------------------------------- /source/plugins/file/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(FILEPLUGIN_INCLUDE_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}") 2 | add_library( 3 | FilePlugin 4 | STATIC 5 | FilePluginFactory.h 6 | FilePluginFactory.cpp 7 | FilePlugin.h 8 | FilePlugin.cpp) 9 | target_link_libraries( 10 | FilePlugin 11 | NFHTTP 12 | NFDecoder 13 | ${COMMON_PLUGIN_LIBS}) 14 | target_include_directories( 15 | FilePlugin 16 | PUBLIC 17 | ${NFSMARTPLAYER_INCLUDE_DIRS} 18 | ${NFSMARTPLAYER_OUTPUT_DIRECTORY} 19 | ${Boost_INCLUDE_DIR} 20 | ${NF_LOGGING_SCHEMA_SRC_DIR}) 21 | target_compile_definitions( 22 | FilePlugin 23 | PUBLIC 24 | -DNF_LOG_ERROR=1) 25 | add_subdirectory(tests) 26 | -------------------------------------------------------------------------------- /interfaces/java/com/spotify/nativeformat/OSValidator.java: -------------------------------------------------------------------------------- 1 | package com.spotify.nativeformat; 2 | 3 | public class OSValidator { 4 | 5 | private static String OS = System.getProperty("os.name").toLowerCase(); 6 | 7 | public static boolean isWindows() { 8 | 9 | return (OS.indexOf("win") >= 0); 10 | 11 | } 12 | 13 | public static boolean isMac() { 14 | 15 | return (OS.indexOf("mac") >= 0); 16 | 17 | } 18 | 19 | public static boolean isUnix() { 20 | 21 | return (OS.indexOf("nix") >= 0 || OS.indexOf("nux") >= 0 || OS.indexOf("aix") > 0 ); 22 | 23 | } 24 | 25 | public static boolean isSolaris() { 26 | 27 | return (OS.indexOf("sunos") >= 0); 28 | 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /interfaces/python/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include(${SWIG_USE_FILE}) 2 | 3 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}) 4 | 5 | # Generate Python interfaces 6 | find_package(PythonLibs) 7 | include_directories(${PYTHON_INCLUDE_PATH}) 8 | set(CMAKE_SWIG_FLAGS -w451 "-DV8_VERSION=${V8_VERSION_HEX}") 9 | set(CMAKE_SWIG_OUTDIR "${CMAKE_CURRENT_SOURCE_DIR}") 10 | set_source_files_properties( 11 | "${NATIVEFORMAT_INTERFACE_DIRECTORY}/NFSmartPlayer.i" 12 | PROPERTIES 13 | CPLUSPLUS ON) 14 | swig_add_library( 15 | NFSmartPlayerPython 16 | LANGUAGE python 17 | SOURCES "${NATIVEFORMAT_INTERFACE_DIRECTORY}/NFSmartPlayer.i") 18 | swig_link_libraries(NFSmartPlayerPython NFSmartPlayer ${PYTHON_LIBRARIES}) 19 | -------------------------------------------------------------------------------- /source/plugins/waa/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(WAAPLUGIN_INCLUDE_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}") 2 | add_library( 3 | WAAPlugin 4 | STATIC 5 | GainPlugin.h 6 | GainPlugin.cpp 7 | WAAPluginFactory.h 8 | WAAPluginFactory.cpp 9 | DelayPlugin.h 10 | DelayPlugin.cpp) 11 | target_include_directories( 12 | WAAPlugin 13 | PUBLIC 14 | ${NFSMARTPLAYER_INCLUDE_DIRS} 15 | ${Boost_INCLUDE_DIR}) 16 | 17 | set(LIBRARIES ${COMMON_PLUGIN_LIBS}) 18 | if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") 19 | find_library(ACCELERATE_FRAMEWORK Accelerate) 20 | list(APPEND LIBRARIES ${ACCELERATE_FRAMEWORK}) 21 | endif() 22 | target_link_libraries( 23 | WAAPlugin 24 | ${LIBRARIES}) 25 | add_subdirectory(tests) 26 | -------------------------------------------------------------------------------- /source/tests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable( 2 | NFSmartPlayerTests 3 | NFSmartPlayerTestRunner.cpp 4 | ClientTest.cpp 5 | EdgeTest.cpp 6 | GraphTest.cpp 7 | nf_smart_player_test.cpp 8 | EdgeImplementationTest.cpp 9 | GraphImplementationTest.cpp 10 | CallbackTypesTest.cpp 11 | ClientImplementationTest.cpp 12 | ErrorCodeTest.cpp) 13 | set(TEST_LINK_LIBS NFSmartPlayer ${Boost_LIBRARIES}) 14 | if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") 15 | list(APPEND TEST_LINK_LIBS /usr/lib/x86_64-linux-gnu/libstdc++.so.6) 16 | endif() 17 | target_link_libraries(NFSmartPlayerTests ${TEST_LINK_LIBS}) 18 | target_include_directories( 19 | NFSmartPlayer 20 | PUBLIC 21 | ${NFSMARTPLAYER_SOURCE_DIRECTORY}) 22 | -------------------------------------------------------------------------------- /resources/ogg-graph.json: -------------------------------------------------------------------------------- 1 | { 2 | "graph": { 3 | "id": "com.nativeformat.graph:67352cd747ca928eccf57b5b29727068", 4 | "loadingPolicy": "allContentPlaythrough", 5 | "nodes": [ 6 | { 7 | "id": "node-0", 8 | "kind": "com.nativeformat.plugin.file.file", 9 | "config": { 10 | "file": "https://upload.wikimedia.org/wikipedia/en/4/45/ACDC_-_Back_In_Black-sample.ogg", 11 | "when": 0, 12 | "duration": 25000000000, 13 | "offset": 0 14 | }, 15 | "params": {}, 16 | "metadata": { 17 | "editor.x": 65, 18 | "editor.y": 104 19 | }, 20 | "label": "Back in Black" 21 | } 22 | ], 23 | "edges": [] 24 | }, 25 | "version": "0.2.0" 26 | } 27 | -------------------------------------------------------------------------------- /resources/scripting.json: -------------------------------------------------------------------------------- 1 | { 2 | "graph": { 3 | "nodes": [ 4 | { 5 | "loading_policy": "none", 6 | "kind": "com.nativeformat.plugin.wave.sine", 7 | "id": "37e715c2-2e32-460d-ba16-8551ef57bafb", 8 | "config": { 9 | "frequency": 440.0, 10 | "when": 0.0, 11 | "duration": 5000000000.0 12 | }, 13 | "params": {} 14 | } 15 | ], 16 | "loading_policy": "none", 17 | "id": "611892c1-8811-49fe-be06-d7782bbb7bcd", 18 | "scripts": [{ 19 | "name": "test-script", 20 | "code": "print('Hello from a script');\nprint(NF)" 21 | }], 22 | "edges": [] 23 | }, 24 | "version": "0.5.0" 25 | } 26 | -------------------------------------------------------------------------------- /source/HTTPLogSink.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | namespace nativeformat { 7 | 8 | using logger::LogSink; 9 | using logger::Severity; 10 | 11 | class HTTPLogSink : public LogSink { 12 | public: 13 | HTTPLogSink(std::string url, std::string token_type = "", 14 | std::string token = ""); 15 | virtual ~HTTPLogSink(); 16 | 17 | virtual void write(const std::string &serialized_msg, Severity level); 18 | 19 | private: 20 | void write(const std::string &serialized_msg); 21 | static void callback(const std::shared_ptr &response); 22 | 23 | const std::string _url; 24 | std::string _token_type; 25 | std::string _token; 26 | std::shared_ptr _client; 27 | }; 28 | } // namespace nativeformat 29 | -------------------------------------------------------------------------------- /source/plugins/compressor/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(COMPRESSORPLUGIN_INCLUDE_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}") 2 | add_library( 3 | CompressorPlugin 4 | STATIC 5 | CompressorPluginFactory.h 6 | CompressorPluginFactory.cpp 7 | CompressorPlugin.h 8 | CompressorPlugin.cpp 9 | ExpanderPlugin.h 10 | ExpanderPlugin.cpp 11 | Knee.h 12 | Drc.h 13 | PeakDetector.h 14 | RmsDetector.h 15 | Detector.h 16 | CompanderPlugin.h 17 | CompanderPlugin.cpp) 18 | target_include_directories( 19 | CompressorPlugin 20 | PUBLIC 21 | ${PLUGIN_UTIL_INCLUDE_DIRECTORY} 22 | ${NFSMARTPLAYER_INCLUDE_DIRS}) 23 | target_link_libraries( 24 | CompressorPlugin 25 | PluginUtil 26 | ${COMMON_PLUGIN_LIBS}) 27 | target_compile_definitions( 28 | CompressorPlugin 29 | PUBLIC 30 | -DNF_LOG_ERROR=1) 31 | add_subdirectory(tests) 32 | -------------------------------------------------------------------------------- /source/plugins/file/README.md: -------------------------------------------------------------------------------- 1 | # File Factory 2 | A set of plugins that play different types of media files. 3 | 4 | ## Namespace 5 | 6 | com.nativeformat.plugins.file 7 | 8 | ## Plugins 9 | 10 | A list of the plugins the File factory provides 11 | 12 | ### OGG 13 | 14 | `com.nativeformat.plugin.file.ogg` 15 | 16 | #### Commands 17 | 18 | * `setFile: string file_location` This tells the plugin where to pull the file from, it supports both local files and HTTP based files 19 | * `setStartTime: absolutetime start_time` This tells the plugin when to start playing the OGG file 20 | * `setDuration: relativetime duration` This tells the plugin how long to play the OGG for 21 | * `setTrackStartTime: relativetime track_start_time` This tells the plugin when to start within the track 22 | * `setChannel: number channel` This tells the plugin which channel to play (useful for MOGG files) 23 | -------------------------------------------------------------------------------- /tools/generate-version.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import os 4 | import subprocess 5 | 6 | 7 | def main(): 8 | output_dir = os.path.join(os.path.join('build', 'output')) 9 | if not os.path.exists(output_dir): 10 | os.makedirs(output_dir) 11 | generated_header_filename = os.path.join(output_dir, 'nf_generated_header.h') 12 | generated_header = open(generated_header_filename, 'w') 13 | generated_header.write('// This is a generated header from generate-version.py\n') 14 | cwd = os.getcwd() 15 | print 'PYTHON CWD: ' + cwd 16 | git_count = subprocess.check_output(['git', 'rev-list', '--count', 'HEAD'], cwd = cwd) 17 | git_describe = subprocess.check_output(['git', 'describe', '--always'], cwd = cwd) 18 | generated_header.write('#define SMARTPLAYER_VERSION "' + git_count.strip() + '-' + git_describe.strip() + '"\n') 19 | 20 | 21 | if __name__ == "__main__": 22 | main() 23 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "libraries/NFDriver"] 2 | path = libraries/NFDriver 3 | url = https://github.com/spotify/NFDriver.git 4 | [submodule "libraries/NFDecoder"] 5 | path = libraries/NFDecoder 6 | url = https://github.com/spotify/NFDecoder.git 7 | [submodule "libraries/oscpack"] 8 | path = libraries/oscpack 9 | url = https://github.com/MariadeAnton/oscpack.git 10 | [submodule "libraries/duktape"] 11 | path = libraries/duktape 12 | url = https://github.com/svaarala/duktape-releases.git 13 | [submodule "tools/gyp"] 14 | path = tools/gyp 15 | url = https://chromium.googlesource.com/external/gyp 16 | [submodule "libraries/PeqBank"] 17 | path = libraries/PeqBank 18 | url = https://github.com/spotify/PeqBank.git 19 | [submodule "libraries/NFLogger"] 20 | path = libraries/NFLogger 21 | url = https://github.com/spotify/NFLogger.git 22 | [submodule "libraries/NFGrapher"] 23 | path = libraries/NFGrapher 24 | url = https://github.com/spotify/NFGrapher.git 25 | -------------------------------------------------------------------------------- /source/cli/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | message(STATUS "NFSmartPlayer source/cli: BOOST Info") 2 | message(STATUS 3 | "NFSmartPlayer source/cli: Boost_INCLUDE_DIR ${Boost_INCLUDE_DIR}") 4 | message(STATUS 5 | "NFSmartPlayer source/cli: Boost_INCLUDE_DIRS ${Boost_INCLUDE_DIRS}") 6 | message(STATUS 7 | "NFSmartPlayer source/cli: Boost_LIBRARIES ${Boost_LIBRARIES}") 8 | message(STATUS "NFSmartPlayer source/cli: Boost_FOUND ${Boost_FOUND}") 9 | message(STATUS "NFSmartPlayer source/cli: BOOST_ROOT ${BOOST_ROOT}") 10 | 11 | # Add the player CLI 12 | add_executable(NFSmartPlayerCLI main.cpp) 13 | target_compile_definitions(NFSmartPlayerCLI PUBLIC -DNF_LOG_ERROR=1) 14 | 15 | if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") 16 | target_link_libraries(NFSmartPlayerCLI NFSmartPlayer) 17 | else() 18 | target_link_libraries(NFSmartPlayerCLI 19 | NFSmartPlayer 20 | /usr/lib/x86_64-linux-gnu/libstdc++.so.6) 21 | endif() 22 | 23 | install(TARGETS NFSmartPlayerCLI DESTINATION /usr/bin) 24 | 25 | -------------------------------------------------------------------------------- /source/plugins/time/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(TIMEPLUGIN_INCLUDE_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}") 2 | 3 | set(TIME_SOURCE_FILES 4 | LoopPlugin.h 5 | LoopPlugin.cpp 6 | TimePluginFactory.h 7 | TimePluginFactory.cpp 8 | ) 9 | 10 | set(TIME_LINK_LIBS 11 | ${Boost_LIBRARIES} 12 | NFDriver 13 | ${COMMON_PLUGIN_LIBS}) 14 | 15 | if(WITH_ELASTIQUE) 16 | set(TIME_SOURCE_FILES ${TIME_SOURCE_FILES} StretchPlugin.h StretchPlugin.cpp) 17 | set(TIME_LINK_LIBS 18 | ${TIME_LINK_LIBS} 19 | ${ELASTIQUE_LIBRARIES} 20 | ) 21 | endif() 22 | 23 | add_library(TimePlugin STATIC ${TIME_SOURCE_FILES}) 24 | 25 | target_include_directories( 26 | TimePlugin 27 | PUBLIC 28 | ${NFSMARTPLAYER_INCLUDE_DIRS} 29 | ) 30 | 31 | if(WITH_ELASTIQUE) 32 | target_include_directories( 33 | TimePlugin 34 | PRIVATE 35 | ${ELASTIQUE_INCLUDE_DIR}) 36 | endif() 37 | 38 | target_link_libraries(TimePlugin 39 | PUBLIC 40 | ${TIME_LINK_LIBS}) 41 | 42 | add_subdirectory(tests) 43 | -------------------------------------------------------------------------------- /interfaces/java/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Generate Java interfaces 2 | message("Generating JNI Interface") 3 | 4 | if(ANDROID) 5 | # https://stackoverflow.com/a/51764145 6 | set(JAVA_AWT_LIBRARY NotNeeded) 7 | set(JAVA_JVM_LIBRARY NotNeeded) 8 | set(JAVA_INCLUDE_PATH2 NotNeeded) 9 | set(JAVA_AWT_INCLUDE_PATH NotNeeded) 10 | endif() 11 | 12 | find_package(Java REQUIRED COMPONENTS Runtime Development) 13 | find_package(JNI REQUIRED) 14 | execute_process(COMMAND 15 | ${Java_JAVAC_EXECUTABLE} -h . com/spotify/nativeformat/Player.java 16 | WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} 17 | RESULT_VARIABLE JAVAC_CODE) 18 | if(NOT JAVAC_CODE STREQUAL "0") 19 | message(FATAL_ERROR "JNI Generation Error: Exited with code ${JAVAC_CODE}") 20 | endif() 21 | add_library(NFSmartPlayerJava 22 | SHARED 23 | Player.cpp) 24 | target_link_libraries(NFSmartPlayerJava 25 | NFSmartPlayer 26 | ${JNI_LIBRARIES}) 27 | target_include_directories(NFSmartPlayerJava 28 | PRIVATE 29 | ${JNI_INCLUDE_DIRS}) 30 | 31 | message("End of Generating JNI Interface") -------------------------------------------------------------------------------- /source/plugins/eq/tests/EQPluginTestRunner.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Spotify AB. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | #define BOOST_TEST_MODULE EQPluginTests 22 | #include 23 | -------------------------------------------------------------------------------- /source/tests/NFSmartPlayerTestRunner.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Spotify AB. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | #define BOOST_TEST_MODULE NFSmartPlayerTests 22 | #include 23 | -------------------------------------------------------------------------------- /source/plugins/waa/tests/WAAPluginTestRunner.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Spotify AB. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | #define BOOST_TEST_MODULE WAAPluginTests 22 | #include 23 | -------------------------------------------------------------------------------- /source/plugins/file/tests/FilePluginTestRunner.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Spotify AB. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | #define BOOST_TEST_MODULE FilePluginTests 22 | #include 23 | -------------------------------------------------------------------------------- /source/plugins/noise/tests/NoisePluginTestRunner.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Spotify AB. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | #define BOOST_TEST_MODULE NoisePluginTests 22 | #include 23 | -------------------------------------------------------------------------------- /source/plugins/time/tests/TimePluginTestRunner.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Spotify AB. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | #define BOOST_TEST_MODULE TimePluginTests 22 | #include 23 | -------------------------------------------------------------------------------- /source/plugins/util/tests/PluginUtilTestRunner.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Spotify AB. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | #define BOOST_TEST_MODULE PluginUtilTests 22 | #include 23 | -------------------------------------------------------------------------------- /source/plugins/wave/tests/WavePluginTestRunner.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Spotify AB. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | #define BOOST_TEST_MODULE WavePluginTests 22 | #include 23 | -------------------------------------------------------------------------------- /source/plugins/channel/tests/ChannelPluginTestRunner.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Spotify AB. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | #define BOOST_TEST_MODULE ChannelPluginTests 22 | #include 23 | -------------------------------------------------------------------------------- /interfaces/objc/tests/NFSmartPlayerObjCTestRunner.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Spotify AB. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | #define BOOST_TEST_MODULE NFSmartPlayerObjCTests 22 | #include 23 | -------------------------------------------------------------------------------- /source/plugins/compressor/tests/CompressorPluginTestRunner.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Spotify AB. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | #define BOOST_TEST_MODULE CompressorPluginTests 22 | #include 23 | -------------------------------------------------------------------------------- /interfaces/objc/include/NFSmartPlayerObjC/NFSmartPlayerParam.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Spotify AB. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | #import 22 | 23 | @interface NFSmartPlayerParam : NSObject 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /interfaces/NFSmartPlayer.i: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Spotify AB. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | %module smartplayer 22 | %{ 23 | #include "../include/NFSmartPlayer/nf_smart_player.h" 24 | %} 25 | %include "../include/NFSmartPlayer/nf_smart_player.h" 26 | -------------------------------------------------------------------------------- /source/plugins/time/README.md: -------------------------------------------------------------------------------- 1 | # Time Factory 2 | A set of plugins that can manipulate time in the graph. 3 | 4 | ## Namespace 5 | 6 | com.nativeformat.plugins.time 7 | 8 | ## Plugins 9 | 10 | A list of the plugins the Time factory provides 11 | 12 | ### Loop 13 | 14 | `com.nativeformat.plugin.time.loop` 15 | 16 | #### Commands 17 | 18 | * `node.start: absolutetime start_time, relativetime duration, optional number loops` Activates the loop node. 19 | 20 | ### Stretch 21 | 22 | `com.nativeformat.plugin.time.stretch` 23 | 24 | A plugin that can independently stretch time and shift the pitch of an audio stream. 25 | 26 | #### Commands 27 | 28 | * `stretch` An [audio parameter](../..) specifying the time stretch multiplier. For example, a stretch value of 2.0 will make audio play at half the original speed. Defaults to 1.0, which leaves the time unchanged. 29 | * `pitchRatio` An [audio parameter](../..) specifying the pitch multiplier. For example, a pitchRatio value of 2.0 will double the original audio frequencies. Defaults to 1.0, which will leave the pitch unchanged. 30 | 31 | Note that this node can be used to alter just the time, just the pitch, or both. -------------------------------------------------------------------------------- /resources/ogg-loop-4x.json: -------------------------------------------------------------------------------- 1 | { 2 | "graph": { 3 | "id": "8fd81747-ea13-47df-99c1-6efc49262b68", 4 | "loadingPolicy": "allContentPlaythrough", 5 | "nodes": [ 6 | { 7 | "id": "751da8fc-36c6-4986-8efa-f44447392db4", 8 | "kind": "com.nativeformat.plugin.file.file", 9 | "config": { 10 | "file": "https://upload.wikimedia.org/wikipedia/en/4/45/ACDC_-_Back_In_Black-sample.ogg", 11 | "when": 0, 12 | "duration": 25000000000, 13 | "offset": 0 14 | }, 15 | "params": {} 16 | }, 17 | { 18 | "id": "35ae64c7-0321-4d55-be3f-8f67a3929b54", 19 | "kind": "com.nativeformat.plugin.time.loop", 20 | "config": { 21 | "when": 1978000000, 22 | "duration": 5277000000, 23 | "loopCount": 4 24 | }, 25 | "params": {} 26 | } 27 | ], 28 | "edges": [ 29 | { 30 | "id": "0484c617-ed37-4db9-baa9-9500af7053da", 31 | "source": "751da8fc-36c6-4986-8efa-f44447392db4", 32 | "target": "35ae64c7-0321-4d55-be3f-8f67a3929b54" 33 | } 34 | ], 35 | "scripts": [] 36 | }, 37 | "version": "1.2.24" 38 | } 39 | -------------------------------------------------------------------------------- /interfaces/objc/tests/NFSmartPlayerGraphDelegateMock.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Spotify AB. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | #import "NFSmartPlayerGraphDelegateMock.h" 22 | 23 | @implementation NFSmartPlayerGraphDelegateMock 24 | 25 | - (void)graphDidLoad:(NFSmartPlayerGraph *)graph errorMessage:(NSString *)errorMessage { 26 | if (self.loadedBlock) { 27 | self.loadedBlock(YES); 28 | } 29 | } 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /interfaces/objc/NFSmartPlayerEdge+Private.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Spotify AB. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | #import 22 | 23 | #include 24 | 25 | @interface NFSmartPlayerEdge (Private) 26 | 27 | @property(nonatomic, assign, readonly) NF_SMART_PLAYER_EDGE_HANDLE edgeHandle; 28 | 29 | - (instancetype)initWithEdge:(NF_SMART_PLAYER_EDGE_HANDLE)edge; 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /interfaces/objc/NFSmartPlayerNode+Private.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Spotify AB. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | #import 22 | 23 | #include 24 | 25 | @interface NFSmartPlayerNode (Private) 26 | 27 | @property(nonatomic, assign, readonly) NF_SMART_PLAYER_NODE_HANDLE nodeHandle; 28 | 29 | - (instancetype)initWithNode:(NF_SMART_PLAYER_NODE_HANDLE)node; 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /interfaces/objc/NFSmartPlayerGraph+Private.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Spotify AB. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | #import 22 | 23 | #include 24 | 25 | @interface NFSmartPlayerGraph (Private) 26 | 27 | @property(nonatomic, assign, readonly) NF_SMART_PLAYER_GRAPH_HANDLE graphHandle; 28 | 29 | - (instancetype)initWithGraph:(NF_SMART_PLAYER_GRAPH_HANDLE)graph; 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /interfaces/objc/NFSmartPlayerParam+Private.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Spotify AB. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | #import 22 | 23 | #include 24 | 25 | @interface NFSmartPlayerParam (Private) 26 | 27 | @property(nonatomic, assign, readonly) NF_SMART_PLAYER_PARAM_HANDLE paramHandle; 28 | 29 | - (instancetype)initWithParam:(NF_SMART_PLAYER_PARAM_HANDLE)param; 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /interfaces/objc/NFSmartPlayerScript+Private.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Spotify AB. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | #import 22 | 23 | #include 24 | 25 | @interface NFSmartPlayerScript (Private) 26 | 27 | @property(nonatomic, assign, readonly) NF_SMART_PLAYER_SCRIPT_HANDLE scriptHandle; 28 | 29 | - (instancetype)initWithScript:(NF_SMART_PLAYER_SCRIPT_HANDLE)script; 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /interfaces/objc/tests/NFSmartPlayerObjCDelegateMock.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Spotify AB. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | #import 22 | 23 | typedef void (^NFSmartPlayerObjCDelegateMockLoadedBlock)(BOOL); 24 | 25 | @interface NFSmartPlayerObjCDelegateMock : NSObject 26 | 27 | @property(nonatomic, strong, readwrite) NFSmartPlayerObjCDelegateMockLoadedBlock loadedBlock; 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /interfaces/objc/tests/NFSmartPlayerGraphDelegateMock.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Spotify AB. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | #import 22 | 23 | typedef void (^NFSmartPlayerGraphDelegateMockLoadedBlock)(BOOL); 24 | 25 | @interface NFSmartPlayerGraphDelegateMock : NSObject 26 | 27 | @property(nonatomic, strong, readwrite) NFSmartPlayerGraphDelegateMockLoadedBlock loadedBlock; 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Environment normalization: 2 | /.bundle 3 | /vendor/bundle 4 | 5 | # Xcode 6 | # 7 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 8 | 9 | ## Build generated 10 | build/ 11 | DerivedData 12 | 13 | ## Various settings 14 | *.pbxuser 15 | !default.pbxuser 16 | *.mode1v3 17 | !default.mode1v3 18 | *.mode2v3 19 | !default.mode2v3 20 | *.perspectivev3 21 | !default.perspectivev3 22 | xcuserdata 23 | project.xcworkspace 24 | 25 | ## Other 26 | *.xccheckout 27 | *.moved-aside 28 | *.xcuserstate 29 | *.xcscmblueprint 30 | .DS_Store 31 | .idea 32 | .vscode 33 | 34 | ## Obj-C/Swift specific 35 | *.hmap 36 | *.ipa 37 | 38 | # Carthage 39 | Carthage/Build 40 | 41 | # Ignore changes to our project.xcconfig that gets overridden by the build system 42 | project.xcconfig 43 | 44 | # Python 45 | *.egg* 46 | *.pyc 47 | smartplayer_env 48 | 49 | # SWIG generated 50 | interfaces/python/ 51 | interfaces/csharp/ 52 | 53 | # CI Artifacts 54 | /artifacts 55 | 56 | # Java Artifacts 57 | *.class 58 | interfaces/java/*.h 59 | 60 | # Directory for creating integration test packages 61 | test-creation 62 | 63 | # Boost 64 | libraries/boost* 65 | 66 | # Integration test output 67 | /input.wav 68 | /output.wav 69 | /output.flac 70 | /nfsmartplayer.wav 71 | 72 | # Android 73 | android-ndk-* -------------------------------------------------------------------------------- /source/plugins/channel/tests/ChannelPluginTest.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Spotify AB. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | #include 22 | 23 | #include "ChannelPlugin.h" 24 | 25 | BOOST_AUTO_TEST_SUITE(ChannelPluginTests) 26 | 27 | BOOST_AUTO_TEST_CASE(testLocalRenderTimeIsZero) { 28 | nativeformat::plugin::channel::ChannelPlugin plugin({}, 2, 44100.0, nullptr); 29 | BOOST_CHECK_EQUAL(plugin.localRenderSampleIndex(0), 0); 30 | } 31 | 32 | BOOST_AUTO_TEST_SUITE_END() 33 | -------------------------------------------------------------------------------- /source/Node.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Spotify AB. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | #include 22 | 23 | #include "NodeImplementation.h" 24 | 25 | namespace nativeformat { 26 | namespace smartplayer { 27 | 28 | std::shared_ptr createNode(const std::string &json) { 29 | auto j = nlohmann::json::parse(json); 30 | nfgrapher::Node grapher_node = j; 31 | return std::make_shared(grapher_node, false); 32 | } 33 | 34 | } // namespace smartplayer 35 | } // namespace nativeformat 36 | -------------------------------------------------------------------------------- /interfaces/objc/include/NFSmartPlayerObjC/NFSmartPlayerScript.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Spotify AB. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | #import 22 | 23 | typedef NS_ENUM(NSInteger, NFSmartPlayerScriptScope) { 24 | NFSmartPlayerScriptScopeNone, 25 | NFSmartPlayerScriptScopeGraph, 26 | NFSmartPlayerScriptScopeSession 27 | }; 28 | 29 | @interface NFSmartPlayerScript : NSObject 30 | 31 | @property(nonatomic, strong, readonly, nonnull) NSString *name; 32 | @property(nonatomic, assign, readonly) NFSmartPlayerScriptScope scope; 33 | 34 | - (nonnull instancetype)init NS_UNAVAILABLE; 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /source/README.md: -------------------------------------------------------------------------------- 1 | # Audio Parameter 2 | 3 | A meta type within other plugins that can define a value over time using complex transforms to figure out what its current value is. These are special parameters in the sense that are also interactable via OSC from the player as well as the get/setVariable interface the player provides. 4 | 5 | ## Parameter Path Format 6 | 7 | `node-identifier/node-type.parameter-name` 8 | 9 | * Node Identifier: The id of the node in graph (e.g. gain-17) 10 | * Node Type: The type of the node (e.g. com.nativeformat.plugin.waa.gain) 11 | * Parameter Name: The name of the parameter within the node (e.g. gain) 12 | 13 | ## Commands 14 | 15 | * `setValueAtTime: number value, absolutetime time` A concrete value to set at a given time. 16 | * `value: number value` Sets the value at time 0. 17 | * `linearRampToValueAtTime: number value, absolutetime time` Specifies a linear ramp that will reach the given value at a certain time. 18 | * `setTargetAtTime: number target, absolutetime time, number time_constant` Specifies a target to reach starting at a given time and gives a constant with which to guide the curve along. 19 | * `exponentialRampToValueAtTime: number value, absolutetime time` Specifies an exponential ramp that will reach the given value at a certain time. 20 | * `setValueAtCurveAtTime: string values, absolutetime start_time, relativetime duration` Specifies a curve to render based on the comma separated float values contained within the values string. 21 | -------------------------------------------------------------------------------- /source/Edge.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Spotify AB. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | #include 22 | #include 23 | 24 | #include "EdgeImplementation.h" 25 | 26 | namespace nativeformat { 27 | namespace smartplayer { 28 | 29 | std::shared_ptr createEdge(const nfgrapher::Edge &edge) { 30 | return std::make_shared(edge); 31 | } 32 | 33 | std::shared_ptr createEdge(const std::string &json) { 34 | nlohmann::json j = nlohmann::json::parse(json); 35 | nfgrapher::Edge e = j; 36 | return createEdge(e); 37 | } 38 | 39 | } // namespace smartplayer 40 | } // namespace nativeformat 41 | -------------------------------------------------------------------------------- /include/NFSmartPlayer/Script.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Spotify AB. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | #pragma once 22 | 23 | #include 24 | 25 | namespace nativeformat { 26 | namespace smartplayer { 27 | 28 | typedef enum : int { 29 | ScriptScopeNone, 30 | ScriptScopeGraph, 31 | ScriptScopeSession 32 | } ScriptScope; 33 | 34 | class Script { 35 | public: 36 | virtual std::string name() const = 0; 37 | virtual ScriptScope scope() const = 0; 38 | virtual void run() = 0; 39 | virtual void close() = 0; 40 | virtual std::string code() const = 0; 41 | virtual bool isRunning() const = 0; 42 | }; 43 | 44 | } // namespace smartplayer 45 | } // namespace nativeformat 46 | -------------------------------------------------------------------------------- /source/tests/ClientTest.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Spotify AB. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | #include 22 | 23 | #include 24 | 25 | BOOST_AUTO_TEST_SUITE(ClientTests) 26 | 27 | BOOST_AUTO_TEST_CASE(testCreateClient) { 28 | std::shared_ptr client = 29 | nativeformat::smartplayer::createClient( 30 | [](const std::string &plugin_namespace, 31 | const std::string &variable_name) { return ""; }, 32 | [](nativeformat::Load::ERROR_INFO info) {}, 33 | nativeformat::smartplayer::DriverTypeSoundCard, ""); 34 | BOOST_CHECK(client); 35 | } 36 | 37 | BOOST_AUTO_TEST_SUITE_END() 38 | -------------------------------------------------------------------------------- /include/NFSmartPlayer/Edge.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Spotify AB. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | #pragma once 22 | 23 | #include 24 | 25 | #include 26 | #include 27 | 28 | namespace nativeformat { 29 | namespace smartplayer { 30 | 31 | class Edge { 32 | public: 33 | virtual std::string source() const = 0; 34 | virtual std::string target() const = 0; 35 | virtual std::string identifier() const = 0; 36 | virtual std::string json() const = 0; 37 | }; 38 | 39 | extern std::shared_ptr createEdge(const nfgrapher::Edge &edge); 40 | extern std::shared_ptr createEdge(const std::string &json); 41 | 42 | } // namespace smartplayer 43 | } // namespace nativeformat 44 | -------------------------------------------------------------------------------- /include/NFSmartPlayer/GlobalLogger.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 Spotify AB. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | #pragma once 22 | 23 | #include 24 | 25 | #define NF_INFO(i) INFO(nativeformat::getGlobalLogger(), i) 26 | #define NF_WARN(i) WARN(nativeformat::getGlobalLogger(), i) 27 | #define NF_ERROR(i) ERROR(nativeformat::getGlobalLogger(), i) 28 | #define NF_REPORT(i) REPORT(nativeformat::getGlobalLogger(), i) 29 | 30 | namespace nativeformat { 31 | using logger::Logger; 32 | using logger::LogInfoHandler; 33 | 34 | typedef Logger> NF_LOGGER_TYPE; 35 | 36 | void configGlobalLogger(std::string token_type, std::string token); 37 | NF_LOGGER_TYPE &getGlobalLogger(); 38 | } // namespace nativeformat 39 | -------------------------------------------------------------------------------- /interfaces/objc/include/NFSmartPlayerObjC/NFSmartPlayerEdge.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Spotify AB. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | #import 22 | 23 | @interface NFSmartPlayerEdge : NSObject 24 | 25 | @property(nonatomic, strong, readonly, nonnull) NSString *source; 26 | @property(nonatomic, strong, readonly, nonnull) NSString *target; 27 | @property(nonatomic, strong, readonly, nonnull) NSString *json; 28 | @property(nonatomic, strong, readonly, nonnull) NSString *identifier; 29 | 30 | - (nonnull instancetype)initWithSource:(nonnull NSString *)source target:(nonnull NSString *)target; 31 | - (nonnull instancetype)initWithJSON:(nonnull NSString *)json; 32 | - (nonnull instancetype)init NS_UNAVAILABLE; 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /source/HTTPLogSink.cpp: -------------------------------------------------------------------------------- 1 | #include "HTTPLogSink.h" 2 | 3 | #include 4 | 5 | using nativeformat::logger::LogInfo; 6 | 7 | nativeformat::HTTPLogSink::HTTPLogSink(std::string url, std::string token_type, 8 | std::string token) 9 | : LogSink(""), 10 | _url(url), 11 | _token_type(token_type), 12 | _token(token), 13 | _client( 14 | http::createClient(http::standardCacheLocation(), "NFHTTPLogSink")) {} 15 | 16 | nativeformat::HTTPLogSink::~HTTPLogSink() {} 17 | 18 | void nativeformat::HTTPLogSink::write(const std::string &serialized_msg, 19 | Severity level) { 20 | write(serialized_msg); 21 | } 22 | 23 | void nativeformat::HTTPLogSink::callback( 24 | const std::shared_ptr &response) { 25 | int code = response->statusCode(); 26 | if (!(code >= 200 && code < 300)) 27 | fprintf(stderr, "HTTPLogSink error: response code %d\n", 28 | response->statusCode()); 29 | } 30 | 31 | void nativeformat::HTTPLogSink::write(const std::string &serialized_msg) { 32 | // Generate a POST with serialized proto message as payload 33 | std::unordered_map header_map = {}; 34 | std::shared_ptr req = http::createRequest(_url, header_map); 35 | req->setMethod(http::PostMethod); 36 | req->setData((const unsigned char *)serialized_msg.c_str(), 37 | serialized_msg.size()); 38 | (*req)["Authorization"] = _token_type + " " + _token; 39 | _client->performRequest(req, callback); 40 | } 41 | -------------------------------------------------------------------------------- /source/tests/CallbackTypesTest.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Spotify AB. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | #include 22 | 23 | #include 24 | 25 | using nativeformat::logger::LogInfo; 26 | 27 | BOOST_AUTO_TEST_SUITE(CallbackTypesTest) 28 | 29 | BOOST_AUTO_TEST_CASE(testErrorMessageFromLoad) { 30 | nativeformat::Load load(false, "unit.test.domain", "Some error message"); 31 | std::string msg = load._info.front().toString(); 32 | BOOST_CHECK_EQUAL(msg, "Error: unit.test.domain: Some error message"); 33 | } 34 | 35 | BOOST_AUTO_TEST_CASE(testErrorMessageFromEmptyLoad) { 36 | nativeformat::Load load(false); 37 | BOOST_CHECK_EQUAL(load._info.size(), 0); 38 | } 39 | 40 | BOOST_AUTO_TEST_SUITE_END() 41 | -------------------------------------------------------------------------------- /interfaces/objc/NFSmartPlayerParam.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Spotify AB. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | #import 22 | 23 | #import "NFSmartPlayerParam+Private.h" 24 | 25 | @interface NFSmartPlayerParam () 26 | 27 | @property(nonatomic, assign, readonly) NF_SMART_PLAYER_PARAM_HANDLE paramHandle; 28 | 29 | @end 30 | 31 | @implementation NFSmartPlayerParam 32 | 33 | #pragma mark NFSmartPlayerParam 34 | 35 | - (instancetype)initWithParam:(NF_SMART_PLAYER_PARAM_HANDLE)param { 36 | self = [super init]; 37 | if (self) { 38 | _paramHandle = param; 39 | } 40 | return self; 41 | } 42 | 43 | #pragma mark NSObject 44 | 45 | - (void)dealloc { 46 | smartplayer_param_close(self.paramHandle); 47 | } 48 | 49 | @end 50 | -------------------------------------------------------------------------------- /include/NFSmartPlayer/ErrorCode.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Spotify AB. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | #pragma once 22 | 23 | #include 24 | 25 | namespace nativeformat { 26 | namespace smartplayer { 27 | 28 | typedef enum : int { 29 | ErrorCodeNone = 0, 30 | ErrorCodePluginNotFound, 31 | ErrorCodeJSONDecodeFailed, 32 | ErrorCodeGraphIsSame, 33 | ErrorCodeNoGraphsFound, 34 | ErrorCodeCommandsFailedToParse, 35 | ErrorCodeFailedToLoadPluginFactories, 36 | ErrorCodeReloadCalledBeforeLoaded, 37 | ErrorCodePluginFailedToLoad 38 | } ErrorCode; 39 | 40 | extern ErrorCode errorCodeFromString(const std::string &error_code); 41 | extern const std::string stringFromErrorCode(ErrorCode error_code); 42 | 43 | } // namespace smartplayer 44 | } // namespace nativeformat 45 | -------------------------------------------------------------------------------- /source/EdgeImplementation.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Spotify AB. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | #pragma once 22 | 23 | #include 24 | 25 | #include 26 | #include 27 | 28 | namespace nativeformat { 29 | namespace smartplayer { 30 | 31 | class EdgeImplementation : public Edge { 32 | public: 33 | EdgeImplementation(const nfgrapher::Edge& e); 34 | virtual ~EdgeImplementation(); 35 | 36 | // Edge 37 | std::string source() const override; 38 | std::string target() const override; 39 | std::string identifier() const override; 40 | std::string json() const override; 41 | 42 | private: 43 | const std::string _id; 44 | const std::string _source; 45 | const std::string _target; 46 | }; 47 | 48 | } // namespace smartplayer 49 | } // namespace nativeformat 50 | -------------------------------------------------------------------------------- /source/tests/EdgeTest.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Spotify AB. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | #include 22 | 23 | #include 24 | 25 | BOOST_AUTO_TEST_SUITE(EdgeTests) 26 | 27 | BOOST_AUTO_TEST_CASE(testCreateEdge) { 28 | nfgrapher::Edge ge; 29 | ge.id = "123"; 30 | ge.source = "test"; 31 | ge.target = "test2"; 32 | std::shared_ptr edge = 33 | nativeformat::smartplayer::createEdge(ge); 34 | BOOST_CHECK(edge); 35 | } 36 | 37 | BOOST_AUTO_TEST_CASE(testCreateEdgeJson) { 38 | std::shared_ptr edge = 39 | nativeformat::smartplayer::createEdge( 40 | "{\"id\":\"123\", \"source\":\"test\", \"target\":\"test2\"}"); 41 | BOOST_CHECK(edge); 42 | } 43 | 44 | BOOST_AUTO_TEST_SUITE_END() 45 | -------------------------------------------------------------------------------- /source/GraphDelegate.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Spotify AB. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | #pragma once 22 | 23 | #include 24 | 25 | #include 26 | #include 27 | 28 | namespace nativeformat { 29 | namespace smartplayer { 30 | 31 | class GraphDelegate { 32 | public: 33 | virtual std::shared_ptr