2015-04-10 22:06:17 +02:00
|
|
|
#!/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-04-10 22:06:17 +02:00
|
|
|
|
2015-10-14 21:21:03 +02:00
|
|
|
|
|
|
|
def get_type():
|
|
|
|
return "LIBRARY"
|
|
|
|
|
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
|
|
|
|
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"
|
2015-04-10 22:06:17 +02:00
|
|
|
|
2016-10-04 23:41:29 +02:00
|
|
|
def configure(target, my_module):
|
2015-09-24 21:44:04 +02:00
|
|
|
my_module.add_src_file([
|
2015-04-10 22:06:17 +02:00
|
|
|
'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'
|
|
|
|
])
|
2015-09-24 21:44:04 +02:00
|
|
|
my_module.add_header_file([
|
2016-10-02 23:42:15 +02:00
|
|
|
'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'
|
|
|
|
])
|
2015-04-10 22:06:17 +02:00
|
|
|
# add all the time the dummy interface
|
2016-09-07 22:05:42 +02:00
|
|
|
my_module.add_flag('c++', ['-DORCHESTRA_BUILD_DUMMY'], export=True)
|
2015-04-10 22:06:17 +02:00
|
|
|
# TODO : Add a FILE interface:
|
|
|
|
|
2016-09-08 21:35:02 +02:00
|
|
|
if "Windows" in target.get_type():
|
2015-09-24 21:44:04 +02:00
|
|
|
my_module.add_src_file([
|
2016-10-04 23:41:29 +02:00
|
|
|
'audio/orchestra/api/Asio.cpp',
|
|
|
|
'audio/orchestra/api/Ds.cpp',
|
|
|
|
])
|
2015-04-10 22:06:17 +02:00
|
|
|
# load optionnal API:
|
2016-09-07 22:05:42 +02:00
|
|
|
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():
|
2015-09-24 21:44:04 +02:00
|
|
|
my_module.add_src_file([
|
2016-10-04 23:41:29 +02:00
|
|
|
'audio/orchestra/api/Alsa.cpp',
|
|
|
|
'audio/orchestra/api/Jack.cpp',
|
|
|
|
'audio/orchestra/api/Pulse.cpp',
|
|
|
|
'audio/orchestra/api/PulseDeviceList.cpp'
|
|
|
|
])
|
2016-09-07 22:05:42 +02:00
|
|
|
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():
|
2015-09-24 21:44:04 +02:00
|
|
|
my_module.add_src_file([
|
2016-10-04 23:41:29 +02:00
|
|
|
'audio/orchestra/api/Core.cpp'
|
|
|
|
])
|
2015-04-10 22:06:17 +02:00
|
|
|
# MacOsX core
|
2016-09-07 22:05:42 +02:00
|
|
|
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():
|
2015-09-24 21:44:04 +02:00
|
|
|
my_module.add_src_file('audio/orchestra/api/CoreIos.mm')
|
2015-04-10 22:06:17 +02:00
|
|
|
# IOsX core
|
2016-09-07 22:05:42 +02:00
|
|
|
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():
|
2015-09-24 21:44:04 +02:00
|
|
|
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
|
2015-09-24 21:44:04 +02:00
|
|
|
my_module.add_src_file('org.musicdsp.orchestra.OrchestraConstants.javah')
|
2016-10-04 23:41:29 +02:00
|
|
|
my_module.add_path('android', type='java')
|
2016-09-07 22:05:42 +02:00
|
|
|
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
|
|
|
|
2015-09-24 21:44:04 +02:00
|
|
|
my_module.add_src_file('audio/orchestra/api/Android.cpp')
|
|
|
|
my_module.add_src_file('audio/orchestra/api/AndroidNativeInterface.cpp')
|
2015-06-22 21:39:29 +02:00
|
|
|
# add tre creator of the basic java class ...
|
2015-09-24 21:44:04 +02:00
|
|
|
target.add_action("BINARY", 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);
|
|
|
|
|
2016-10-04 23:41:29 +02:00
|
|
|
my_module.add_path(".")
|
2015-04-10 22:06:17 +02:00
|
|
|
|
2016-10-04 23:41:29 +02:00
|
|
|
return True
|
2015-04-10 22:06:17 +02:00
|
|
|
|
|
|
|
|
2015-06-22 21:39:29 +02:00
|
|
|
|
|
|
|
##################################################################
|
|
|
|
##
|
|
|
|
## 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", [
|
2015-06-30 23:25:34 +02:00
|
|
|
"import org.musicdsp.orchestra.OrchestraManager;"
|
2015-06-22 21:39:29 +02:00
|
|
|
])
|
2016-10-06 22:19:47 +02:00
|
|
|
module.add_pkg("GENERATE_SECTION__DECLARE", [
|
2015-06-30 23:25:34 +02:00
|
|
|
"private OrchestraManager m_audioManagerHandle;"
|
2015-06-22 21:39:29 +02:00
|
|
|
])
|
2016-10-06 22:19:47 +02:00
|
|
|
module.add_pkg("GENERATE_SECTION__CONSTRUCTOR", [
|
2015-06-22 21:39:29 +02:00
|
|
|
"// 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);",
|
|
|
|
"}"
|
|
|
|
])
|
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();",
|
|
|
|
"}"
|
|
|
|
])
|
2015-06-22 21:39:29 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|