audio-orchestra/lutin_audio-orchestra.py

183 lines
5.7 KiB
Python
Raw Normal View History

#!/usr/bin/python
2015-05-08 22:35:39 +02:00
import lutin.tools as tools
2019-05-03 10:18:23 +02:00
import realog.debug as debug
2015-10-14 21:21:03 +02:00
def get_type():
return "LIBRARY"
def get_desc():
return "Generic wrapper on all audio interface"
2015-10-14 21:21:03 +02:00
def get_licence():
return "APACHE-2"
def get_compagny_type():
return "com"
def get_compagny_name():
return "atria-soft"
def get_maintainer():
2016-09-12 21:06:37 +02:00
return "authors.txt"
2015-10-14 21:21:03 +02:00
def get_version():
2016-09-12 21:06:37 +02:00
return "version.txt"
def configure(target, my_module):
my_module.add_src_file([
'audio/orchestra/debug.cpp',
'audio/orchestra/status.cpp',
'audio/orchestra/type.cpp',
'audio/orchestra/mode.cpp',
'audio/orchestra/state.cpp',
'audio/orchestra/error.cpp',
'audio/orchestra/base.cpp',
'audio/orchestra/Interface.cpp',
'audio/orchestra/Flags.cpp',
'audio/orchestra/Api.cpp',
'audio/orchestra/DeviceInfo.cpp',
'audio/orchestra/StreamOptions.cpp',
'audio/orchestra/api/Dummy.cpp'
])
my_module.add_header_file([
'audio/orchestra/debug.hpp',
'audio/orchestra/status.hpp',
'audio/orchestra/type.hpp',
'audio/orchestra/mode.hpp',
'audio/orchestra/state.hpp',
'audio/orchestra/error.hpp',
'audio/orchestra/base.hpp',
'audio/orchestra/Interface.hpp',
'audio/orchestra/Flags.hpp',
'audio/orchestra/Api.hpp',
'audio/orchestra/DeviceInfo.hpp',
'audio/orchestra/StreamOptions.hpp',
'audio/orchestra/CallbackInfo.hpp',
'audio/orchestra/StreamParameters.hpp'
2015-09-14 21:11:04 +02:00
])
2016-09-14 22:00:12 +02:00
my_module.add_depend([
'audio',
'etk'
])
# add all the time the dummy interface
my_module.add_flag('c++', ['-DORCHESTRA_BUILD_DUMMY'], export=True)
# TODO : Add a FILE interface:
2016-09-08 21:35:02 +02:00
if "Windows" in target.get_type():
my_module.add_src_file([
'audio/orchestra/api/Asio.cpp',
'audio/orchestra/api/Ds.cpp',
])
# load optionnal API:
my_module.add_optionnal_depend('asio', ["c++", "-DORCHESTRA_BUILD_ASIO"])
my_module.add_optionnal_depend('ds', ["c++", "-DORCHESTRA_BUILD_DS"])
my_module.add_optionnal_depend('wasapi', ["c++", "-DORCHESTRA_BUILD_WASAPI"])
2016-09-08 21:35:02 +02:00
elif "Linux" in target.get_type():
my_module.add_src_file([
'audio/orchestra/api/Alsa.cpp',
'audio/orchestra/api/Jack.cpp',
'audio/orchestra/api/Pulse.cpp',
'audio/orchestra/api/PulseDeviceList.cpp'
])
my_module.add_optionnal_depend('alsa', ["c++", "-DORCHESTRA_BUILD_ALSA"])
my_module.add_optionnal_depend('jack', ["c++", "-DORCHESTRA_BUILD_JACK"])
my_module.add_optionnal_depend('pulse', ["c++", "-DORCHESTRA_BUILD_PULSE"])
2016-09-08 21:35:02 +02:00
elif "MacOs" in target.get_type():
my_module.add_src_file([
'audio/orchestra/api/Core.cpp'
])
# MacOsX core
my_module.add_optionnal_depend('CoreAudio', ["c++", "-DORCHESTRA_BUILD_MACOSX_CORE"])
2016-09-08 21:35:02 +02:00
elif "IOs" in target.get_type():
my_module.add_src_file('audio/orchestra/api/CoreIos.mm')
# IOsX core
my_module.add_optionnal_depend('CoreAudio', ["c++", "-DORCHESTRA_BUILD_IOS_CORE"])
2016-09-08 21:35:02 +02:00
elif "Android" in target.get_type():
my_module.add_src_file('android/org/musicdsp/orchestra/OrchestraConstants.java')
my_module.add_src_file('android/org/musicdsp/orchestra/OrchestraManagerCallback.java')
my_module.add_src_file('android/org/musicdsp/orchestra/OrchestraNative.java')
my_module.add_src_file('android/org/musicdsp/orchestra/OrchestraInterfaceInput.java')
my_module.add_src_file('android/org/musicdsp/orchestra/OrchestraInterfaceOutput.java')
my_module.add_src_file('android/org/musicdsp/orchestra/OrchestraManager.java')
2016-09-23 23:17:39 +02:00
# create inter language interfacef
my_module.add_src_file('org.musicdsp.orchestra.OrchestraConstants.javah')
my_module.add_path('android', type='java')
my_module.add_depend(['SDK', 'jvm-basics', 'ejson'])
2016-09-23 23:17:39 +02:00
my_module.add_flag('c++', ['-DORCHESTRA_BUILD_JAVA'], export=True)
2015-06-21 21:58:15 +02:00
my_module.add_src_file('audio/orchestra/api/Android.cpp')
my_module.add_src_file('audio/orchestra/api/AndroidNativeInterface.cpp')
# add tre creator of the basic java class ...
target.add_action("BINARY", 11, "audio-orchestra-out-wrapper", tool_generate_add_java_section_in_class)
else:
debug.warning("unknow target for audio_orchestra : " + target.name);
my_module.add_path(".")
return True
##################################################################
##
## Android specific section
##
##################################################################
def tool_generate_add_java_section_in_class(target, module, package_name):
2016-10-06 22:19:47 +02:00
module.add_pkg("GENERATE_SECTION__IMPORT", [
"import org.musicdsp.orchestra.OrchestraManager;"
])
2016-10-06 22:19:47 +02:00
module.add_pkg("GENERATE_SECTION__DECLARE", [
"private OrchestraManager m_audioManagerHandle;"
])
2016-10-06 22:19:47 +02:00
module.add_pkg("GENERATE_SECTION__CONSTRUCTOR", [
"// load audio maneger if it does not work, it is not critical ...",
"try {",
" m_audioManagerHandle = new OrchestraManager();",
"} catch (RuntimeException e) {",
" Log.e(\"" + package_name + "\", \"Can not load Audio interface (maybe not really needed) :\" + e);",
"}"
])
2016-10-06 22:19:47 +02:00
module.add_pkg("GENERATE_SECTION__ON_CREATE", [
2015-06-26 22:07:50 +02:00
"if (m_audioManagerHandle != null) {",
" m_audioManagerHandle.onCreate();",
"}"
])
2016-10-06 22:19:47 +02:00
module.add_pkg("GENERATE_SECTION__ON_START", [
2015-06-26 22:07:50 +02:00
"if (m_audioManagerHandle != null) {",
" m_audioManagerHandle.onStart();",
"}"
])
2016-10-06 22:19:47 +02:00
module.add_pkg("GENERATE_SECTION__ON_RESTART", [
2015-06-26 22:07:50 +02:00
"if (m_audioManagerHandle != null) {",
" m_audioManagerHandle.onRestart();",
"}"
])
2016-10-06 22:19:47 +02:00
module.add_pkg("GENERATE_SECTION__ON_RESUME", [
2015-06-26 22:07:50 +02:00
"if (m_audioManagerHandle != null) {",
" m_audioManagerHandle.onResume();",
"}"
])
2016-10-06 22:19:47 +02:00
module.add_pkg("GENERATE_SECTION__ON_PAUSE", [
2015-06-26 22:07:50 +02:00
"if (m_audioManagerHandle != null) {",
" m_audioManagerHandle.onPause();",
"}"
])
2016-10-06 22:19:47 +02:00
module.add_pkg("GENERATE_SECTION__ON_STOP", [
2015-06-26 22:07:50 +02:00
"if (m_audioManagerHandle != null) {",
" m_audioManagerHandle.onStop();",
"}"
])
2016-10-06 22:19:47 +02:00
module.add_pkg("GENERATE_SECTION__ON_DESTROY", [
2015-06-26 22:07:50 +02:00
"// Destroy the AdView.",
"if (m_audioManagerHandle != null) {",
" m_audioManagerHandle.onDestroy();",
"}"
])