[DEV] add support of multiple input stream type

This commit is contained in:
Edouard DUPIN 2016-08-22 21:52:31 +02:00
parent db89c092be
commit 8174d45416
3 changed files with 17 additions and 9 deletions

View File

@ -12,7 +12,7 @@ namespace audio {
namespace orchestra {
enum timestampMode {
timestampMode_Hardware, //!< enable harware timestamp
timestampMode_trigered, //!< get harware triger time stamp and ingrement with duration
timestampMode_trigered, //!< get harware triger time stamp and increment with duration
timestampMode_soft, //!< Simulate all timestamp.
};
std::ostream& operator <<(std::ostream& _os, enum audio::orchestra::timestampMode _obj);

View File

@ -282,6 +282,7 @@ audio::orchestra::DeviceInfo audio::orchestra::api::Alsa::getDeviceInfo(uint32_t
ATA_WARNING("control next device, card = " << card << ", " << snd_strerror(result) << ".");
break;
}
ATA_WARNING(" ==> nbSubdevice = " << subdevice);
if (subdevice < 0) {
break;
}
@ -1098,6 +1099,7 @@ audio::Time audio::orchestra::api::Alsa::getStreamTime() {
}
void audio::orchestra::api::Alsa::callbackEventOneCycleRead() {
ATA_VERBOSE("One cycle read ...");
if (m_state == audio::orchestra::state::closed) {
ATA_CRITICAL("the stream is closed ... this shouldn't happen!");
return; // TODO : notify appl: audio::orchestra::error_warning;
@ -1149,7 +1151,8 @@ void audio::orchestra::api::Alsa::callbackEventOneCycleRead() {
}
// get timestamp : (to init here ...
streamTime = getStreamTime();
if (result < (int) m_bufferSize) {
ATA_VERBOSE("get data :" << result << " request:" << int32_t(m_bufferSize));
if (result < int32_t(m_bufferSize)) {
// Either an error or overrun occured.
if (result == -EPIPE) {
snd_pcm_state_t state = snd_pcm_state(m_private->handle);
@ -1449,6 +1452,7 @@ unlock:
}
}
void audio::orchestra::api::Alsa::callbackEventOneCycleMMAPRead() {
ATA_VERBOSE("One cycle read ...");
if (m_state == audio::orchestra::state::closed) {
ATA_CRITICAL("the stream is closed ... this shouldn't happen!");
return; // TODO : notify appl: audio::orchestra::error_warning;
@ -1498,9 +1502,11 @@ void audio::orchestra::api::Alsa::callbackEventOneCycleMMAPRead() {
ATA_ERROR("Xrun...");
}
}
// get timestamp : (to init here ...
streamTime = getStreamTime();
ATA_VERBOSE("get data :" << result << " request:" << int32_t(m_bufferSize));
if (result < (int) m_bufferSize) {
if (result<0) {
ATA_PRINT("HAVE AN ERROR " << strerror(-result));
}
// Either an error or overrun occured.
if (result == -EPIPE) {
snd_pcm_state_t state = snd_pcm_state(m_private->handle);
@ -1520,6 +1526,8 @@ void audio::orchestra::api::Alsa::callbackEventOneCycleMMAPRead() {
// TODO : Notify application ... audio::orchestra::error_warning;
goto noInput;
}
// get timestamp : (to init here ...
streamTime = getStreamTime();
// Do byte swapping if necessary.
if (m_doByteSwap[1]) {
byteSwapBuffer(buffer, m_bufferSize * channels, format);

View File

@ -63,7 +63,7 @@ def create(target, module_name):
my_module.add_export_flag('c++', ['-DORCHESTRA_BUILD_DUMMY'])
# TODO : Add a FILE interface:
if target.name=="Windows":
if target.config_based_on=="Windows":
my_module.add_src_file([
'audio/orchestra/api/Asio.cpp',
'audio/orchestra/api/Ds.cpp',
@ -72,7 +72,7 @@ def create(target, module_name):
my_module.add_optionnal_module_depend('asio', ["c++", "-DORCHESTRA_BUILD_ASIO"])
my_module.add_optionnal_module_depend('ds', ["c++", "-DORCHESTRA_BUILD_DS"])
my_module.add_optionnal_module_depend('wasapi', ["c++", "-DORCHESTRA_BUILD_WASAPI"])
elif target.name=="Linux":
elif target.config_based_on=="Linux":
my_module.add_src_file([
'audio/orchestra/api/Alsa.cpp',
'audio/orchestra/api/Jack.cpp',
@ -82,17 +82,17 @@ def create(target, module_name):
my_module.add_optionnal_module_depend('alsa', ["c++", "-DORCHESTRA_BUILD_ALSA"])
my_module.add_optionnal_module_depend('jack', ["c++", "-DORCHESTRA_BUILD_JACK"])
my_module.add_optionnal_module_depend('pulse', ["c++", "-DORCHESTRA_BUILD_PULSE"])
elif target.name=="MacOs":
elif target.config_based_on=="MacOs":
my_module.add_src_file([
'audio/orchestra/api/Core.cpp'
])
# MacOsX core
my_module.add_optionnal_module_depend('CoreAudio', ["c++", "-DORCHESTRA_BUILD_MACOSX_CORE"])
elif target.name=="IOs":
elif target.config_based_on=="IOs":
my_module.add_src_file('audio/orchestra/api/CoreIos.mm')
# IOsX core
my_module.add_optionnal_module_depend('CoreAudio', ["c++", "-DORCHESTRA_BUILD_IOS_CORE"])
elif target.name=="Android":
elif target.config_based_on=="Android":
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')