2015-04-10 22:06:17 +02:00
|
|
|
#!/usr/bin/python
|
2015-05-08 22:35:39 +02:00
|
|
|
import lutin.module as module
|
|
|
|
import lutin.tools as tools
|
|
|
|
import lutin.debug as debug
|
2015-04-10 22:06:17 +02:00
|
|
|
|
|
|
|
def get_desc():
|
2015-06-11 21:39:56 +02:00
|
|
|
return "Generic wrapper on all audio interface"
|
2015-04-10 22:06:17 +02:00
|
|
|
|
|
|
|
|
|
|
|
def create(target):
|
2015-06-15 19:27:55 +02:00
|
|
|
myModule = module.Module(__file__, 'audio-orchestra', 'LIBRARY')
|
2015-04-10 22:06:17 +02:00
|
|
|
|
|
|
|
myModule.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'
|
|
|
|
])
|
|
|
|
myModule.add_module_depend(['audio', 'etk'])
|
|
|
|
# add all the time the dummy interface
|
2015-05-08 22:35:39 +02:00
|
|
|
myModule.add_export_flag('c++', ['-DORCHESTRA_BUILD_DUMMY'])
|
2015-04-10 22:06:17 +02:00
|
|
|
# TODO : Add a FILE interface:
|
|
|
|
|
|
|
|
if target.name=="Windows":
|
|
|
|
myModule.add_src_file([
|
|
|
|
'audio/orchestra/api/Asio.cpp',
|
|
|
|
'audio/orchestra/api/Ds.cpp',
|
|
|
|
])
|
|
|
|
# load optionnal API:
|
2015-05-08 22:35:39 +02:00
|
|
|
myModule.add_optionnal_module_depend('asio', ["c++", "-DORCHESTRA_BUILD_ASIO"])
|
|
|
|
myModule.add_optionnal_module_depend('ds', ["c++", "-DORCHESTRA_BUILD_DS"])
|
|
|
|
myModule.add_optionnal_module_depend('wasapi', ["c++", "-DORCHESTRA_BUILD_WASAPI"])
|
2015-04-10 22:06:17 +02:00
|
|
|
elif target.name=="Linux":
|
|
|
|
myModule.add_src_file([
|
|
|
|
'audio/orchestra/api/Alsa.cpp',
|
|
|
|
'audio/orchestra/api/Jack.cpp',
|
|
|
|
'audio/orchestra/api/Pulse.cpp',
|
2015-06-13 11:50:30 +02:00
|
|
|
'audio/orchestra/api/PulseDeviceList.cpp',
|
2015-04-10 22:06:17 +02:00
|
|
|
'audio/orchestra/api/Oss.cpp'
|
|
|
|
])
|
2015-05-08 22:35:39 +02:00
|
|
|
myModule.add_optionnal_module_depend('alsa', ["c++", "-DORCHESTRA_BUILD_ALSA"])
|
|
|
|
myModule.add_optionnal_module_depend('jack', ["c++", "-DORCHESTRA_BUILD_JACK"])
|
|
|
|
myModule.add_optionnal_module_depend('pulse', ["c++", "-DORCHESTRA_BUILD_PULSE"])
|
|
|
|
myModule.add_optionnal_module_depend('oss', ["c++", "-DORCHESTRA_BUILD_OSS"])
|
2015-04-10 22:06:17 +02:00
|
|
|
elif target.name=="MacOs":
|
|
|
|
myModule.add_src_file([
|
|
|
|
'audio/orchestra/api/Core.cpp',
|
|
|
|
'audio/orchestra/api/Oss.cpp'
|
|
|
|
])
|
|
|
|
# MacOsX core
|
2015-05-08 22:35:39 +02:00
|
|
|
myModule.add_optionnal_module_depend('CoreAudio', ["c++", "-DORCHESTRA_BUILD_MACOSX_CORE"])
|
2015-04-10 22:06:17 +02:00
|
|
|
elif target.name=="IOs":
|
|
|
|
myModule.add_src_file('audio/orchestra/api/CoreIos.mm')
|
|
|
|
# IOsX core
|
2015-05-08 22:35:39 +02:00
|
|
|
myModule.add_optionnal_module_depend('CoreAudio', ["c++", "-DORCHESTRA_BUILD_IOS_CORE"])
|
2015-04-10 22:06:17 +02:00
|
|
|
elif target.name=="Android":
|
2015-06-30 23:25:34 +02:00
|
|
|
myModule.add_src_file('android/org/musicdsp/orchestra/OrchestraConstants.java')
|
|
|
|
myModule.add_src_file('android/org/musicdsp/orchestra/OrchestraManagerCallback.java')
|
|
|
|
myModule.add_src_file('android/org/musicdsp/orchestra/OrchestraNative.java')
|
|
|
|
myModule.add_src_file('android/org/musicdsp/orchestra/OrchestraInterfaceInput.java')
|
|
|
|
myModule.add_src_file('android/org/musicdsp/orchestra/OrchestraInterfaceOutput.java')
|
|
|
|
myModule.add_src_file('android/org/musicdsp/orchestra/OrchestraManager.java')
|
2015-06-21 21:58:15 +02:00
|
|
|
# create inter language interface
|
2015-06-30 23:25:34 +02:00
|
|
|
myModule.add_src_file('org.musicdsp.orchestra.OrchestraConstants.javah')
|
2015-06-21 21:58:15 +02:00
|
|
|
myModule.add_path(tools.get_current_path(__file__) + '/android/', type='java')
|
2015-06-22 21:39:29 +02:00
|
|
|
myModule.add_module_depend(['SDK', 'jvm-basics', 'ejson'])
|
2015-06-21 21:58:15 +02:00
|
|
|
myModule.add_export_flag('c++', ['-DORCHESTRA_BUILD_JAVA'])
|
|
|
|
|
2015-04-10 22:06:17 +02:00
|
|
|
myModule.add_src_file('audio/orchestra/api/Android.cpp')
|
2015-06-21 21:58:15 +02:00
|
|
|
myModule.add_src_file('audio/orchestra/api/AndroidNativeInterface.cpp')
|
2015-06-22 21:39:29 +02:00
|
|
|
# add tre creator of the basic java class ...
|
|
|
|
target.add_action("PACKAGE", 11, "audio-orchestra-out-wrapper", tool_generate_add_java_section_in_class)
|
2015-04-10 22:06:17 +02:00
|
|
|
else:
|
|
|
|
debug.warning("unknow target for audio_orchestra : " + target.name);
|
|
|
|
|
|
|
|
myModule.add_export_path(tools.get_current_path(__file__))
|
|
|
|
|
|
|
|
return myModule
|
|
|
|
|
|
|
|
|
2015-06-22 21:39:29 +02:00
|
|
|
|
|
|
|
##################################################################
|
|
|
|
##
|
|
|
|
## Android specific section
|
|
|
|
##
|
|
|
|
##################################################################
|
|
|
|
def tool_generate_add_java_section_in_class(target, module, package_name):
|
|
|
|
module.pkg_add("GENERATE_SECTION__IMPORT", [
|
2015-06-30 23:25:34 +02:00
|
|
|
"import org.musicdsp.orchestra.OrchestraManager;"
|
2015-06-22 21:39:29 +02:00
|
|
|
])
|
|
|
|
module.pkg_add("GENERATE_SECTION__DECLARE", [
|
2015-06-30 23:25:34 +02:00
|
|
|
"private OrchestraManager m_audioManagerHandle;"
|
2015-06-22 21:39:29 +02:00
|
|
|
])
|
|
|
|
module.pkg_add("GENERATE_SECTION__CONSTRUCTOR", [
|
|
|
|
"// load audio maneger if it does not work, it is not critical ...",
|
|
|
|
"try {",
|
2015-06-30 23:25:34 +02:00
|
|
|
" m_audioManagerHandle = new OrchestraManager();",
|
2015-06-22 21:39:29 +02:00
|
|
|
"} catch (RuntimeException e) {",
|
|
|
|
" Log.e(\"" + package_name + "\", \"Can not load Audio interface (maybe not really needed) :\" + e);",
|
|
|
|
"}"
|
|
|
|
])
|
2015-06-26 22:07:50 +02:00
|
|
|
module.pkg_add("GENERATE_SECTION__ON_CREATE", [
|
|
|
|
"if (m_audioManagerHandle != null) {",
|
|
|
|
" m_audioManagerHandle.onCreate();",
|
|
|
|
"}"
|
|
|
|
])
|
|
|
|
module.pkg_add("GENERATE_SECTION__ON_START", [
|
|
|
|
"if (m_audioManagerHandle != null) {",
|
|
|
|
" m_audioManagerHandle.onStart();",
|
|
|
|
"}"
|
|
|
|
])
|
|
|
|
module.pkg_add("GENERATE_SECTION__ON_RESTART", [
|
|
|
|
"if (m_audioManagerHandle != null) {",
|
|
|
|
" m_audioManagerHandle.onRestart();",
|
|
|
|
"}"
|
|
|
|
])
|
|
|
|
module.pkg_add("GENERATE_SECTION__ON_RESUME", [
|
|
|
|
"if (m_audioManagerHandle != null) {",
|
|
|
|
" m_audioManagerHandle.onResume();",
|
|
|
|
"}"
|
|
|
|
])
|
|
|
|
module.pkg_add("GENERATE_SECTION__ON_PAUSE", [
|
|
|
|
"if (m_audioManagerHandle != null) {",
|
|
|
|
" m_audioManagerHandle.onPause();",
|
|
|
|
"}"
|
|
|
|
])
|
|
|
|
module.pkg_add("GENERATE_SECTION__ON_STOP", [
|
|
|
|
"if (m_audioManagerHandle != null) {",
|
|
|
|
" m_audioManagerHandle.onStop();",
|
|
|
|
"}"
|
|
|
|
])
|
|
|
|
module.pkg_add("GENERATE_SECTION__ON_DESTROY", [
|
|
|
|
"// Destroy the AdView.",
|
|
|
|
"if (m_audioManagerHandle != null) {",
|
|
|
|
" m_audioManagerHandle.onDestroy();",
|
|
|
|
"}"
|
|
|
|
])
|
2015-06-22 21:39:29 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|