Compare commits
23 Commits
Author | SHA1 | Date | |
---|---|---|---|
c3a13b4a39 | |||
7ab2025721 | |||
34eb6d5cf0 | |||
429a1cd062 | |||
6e534cbf22 | |||
c7d5c42ea8 | |||
918d573f18 | |||
fe23d699d1 | |||
e0a01e4280 | |||
fd1651924a | |||
ecb2b4d99e | |||
276e4ce356 | |||
943323947d | |||
62c2f2fd25 | |||
9a96211853 | |||
7e104a1f72 | |||
94e2bbabe3 | |||
b1eebd75e9 | |||
8174d45416 | |||
db89c092be | |||
151a3ddcf4 | |||
bc78a1858a | |||
f4f1ee888b |
88
.travis.yml
88
.travis.yml
@@ -1,11 +1,7 @@
|
|||||||
language:
|
language: cpp
|
||||||
- cpp
|
|
||||||
|
|
||||||
sudo: false
|
sudo: required
|
||||||
|
dist: trusty
|
||||||
os:
|
|
||||||
- linux
|
|
||||||
- osx
|
|
||||||
|
|
||||||
branches:
|
branches:
|
||||||
only:
|
only:
|
||||||
@@ -18,33 +14,81 @@ addons:
|
|||||||
- ubuntu-toolchain-r-test
|
- ubuntu-toolchain-r-test
|
||||||
packages:
|
packages:
|
||||||
- g++-4.9
|
- g++-4.9
|
||||||
|
- expect
|
||||||
|
- binutils-mingw-w64-x86-64 # 64bit MinGW
|
||||||
|
- gcc-mingw-w64-x86-64
|
||||||
|
- g++-mingw-w64-x86-64
|
||||||
|
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- os: linux
|
||||||
|
env: CONF=release BUILDER=gcc TARGET=Linux TAG=Linux COMPILATOR_OPTION="--compilator-version=4.9" GCOV=--gcov
|
||||||
|
compiler: gcc
|
||||||
|
- os: linux
|
||||||
|
env: CONF=debug BUILDER=clang TARGET=Linux
|
||||||
|
compiler: clang
|
||||||
|
- os: linux
|
||||||
|
env: CONF=release BUILDER=gcc TARGET=Windows TAG=Mingw
|
||||||
|
compiler: x86_64-w64-mingw32-gcc
|
||||||
|
- os: linux
|
||||||
|
env: CONF=release BUILDER=gcc TARGET=Android TAG=Android DISABLE_PACKAGE=-p
|
||||||
|
compiler: gcc
|
||||||
|
- os: osx
|
||||||
|
env: CONF=release BUILDER=clang TARGET=MacOs TAG=MacOs
|
||||||
|
compiler: clang
|
||||||
|
- os: osx
|
||||||
|
env: CONF=release BUILDER=clang TARGET=IOs TAG=IOs
|
||||||
|
compiler: clang
|
||||||
|
|
||||||
|
|
||||||
install:
|
install:
|
||||||
|
- cd ..
|
||||||
- pip install --user lutin
|
- pip install --user lutin
|
||||||
|
- if [ "$TAG" == "Android" ]; then
|
||||||
env:
|
git clone --depth 1 --branch master https://github.com/HeeroYui/android-download-tool;
|
||||||
- CONF=debug BOARD=Linux BUILDER=clang GCOV=
|
./android-download-tool/dl-android.sh;
|
||||||
- CONF=release BOARD=Linux BUILDER=clang GCOV=
|
fi
|
||||||
- CONF=debug BOARD=Linux BUILDER=gcc GCOV=
|
- git clone --depth 1 --branch master https://github.com/atria-soft/ci.git
|
||||||
- CONF=release BOARD=Linux BUILDER=gcc GCOV=
|
- cd -
|
||||||
- CONF=debug BOARD=Linux BUILDER=gcc GCOV=--gcov
|
|
||||||
|
|
||||||
before_script:
|
before_script:
|
||||||
- cd ..
|
- cd ..
|
||||||
- wget http://atria-soft.com/ci/coverage_send.py
|
- git clone https://github.com/atria-soft/etk.git -b $TRAVIS_BRANCH
|
||||||
- wget http://atria-soft.com/ci/test_send.py
|
- git clone https://github.com/atria-soft/elog.git -b $TRAVIS_BRANCH
|
||||||
- wget http://atria-soft.com/ci/warning_send.py
|
- git clone https://github.com/atria-soft/ememory.git -b $TRAVIS_BRANCH
|
||||||
- git clone https://github.com/atria-soft/etk.git
|
- git clone https://github.com/atria-soft/echrono.git -b $TRAVIS_BRANCH
|
||||||
- git clone https://github.com/musicdsp/audio.git
|
- git clone https://github.com/atria-soft/ethread.git -b $TRAVIS_BRANCH
|
||||||
|
- git clone https://github.com/atria-soft/ejson.git -b $TRAVIS_BRANCH
|
||||||
|
- git clone https://github.com/atria-soft/jvm-basics.git -b $TRAVIS_BRANCH
|
||||||
|
- git clone https://github.com/musicdsp/audio.git -b $TRAVIS_BRANCH
|
||||||
|
- git clone https://github.com/generic-library/gtest-lutin.git --recursive
|
||||||
|
- git clone https://github.com/generic-library/z-lutin.git --recursive
|
||||||
- pwd
|
- pwd
|
||||||
- ls -l
|
- ls -l
|
||||||
- if [ "$BUILDER" == "gcc" ]; then COMPILATOR_OPTION="--compilator-version=4.9"; else COMPILATOR_OPTION=""; fi
|
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then
|
||||||
|
export PATH=$PATH:/Users/travis/Library/Python/2.7/bin/;
|
||||||
|
fi
|
||||||
|
- ./ci/build_send.py --tag=$TAG --status=START;
|
||||||
|
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- lutin -w -j4 -C -P -c $BUILDER $COMPILATOR_OPTION -m $CONF $GCOV -p audio-orchestra
|
- lutin -w -j4 -C -P -t$TARGET -c $BUILDER $COMPILATOR_OPTION $BUS -m $CONF $GCOV $DISABLE_PACKAGE audio-orchestra; STATUS=$?
|
||||||
# - ./out/Linux_x86_64/$CONF/staging/$BUILDER/audio-orchestra/usr/bin/audio-orchestra -l6
|
- ./ci/build_send.py --tag=$TAG --status="$STATUS";
|
||||||
|
|
||||||
|
after_script:
|
||||||
|
- if [ "$GCOV" != "" ]; then
|
||||||
|
./ci/warning_send.py --find-path ./out/Linux_x86_64/$CONF/build/$BUILDER/audio-orchestra/;
|
||||||
|
fi
|
||||||
|
#- lutin -w -j4 -C -P -t$TARGET -c $BUILDER $COMPILATOR_OPTION $BUS -m $CONF $GCOV $DISABLE_PACKAGE audio-orchestra-test?run:--elog-level=3 | tee out_test.txt
|
||||||
|
#- if [ "$GCOV" != "" ]; then
|
||||||
|
# ./ci/test_send.py --file=out_test.txt;
|
||||||
|
# lutin -C -P -t $TARGET -c $BUILDER $COMPILATOR_OPTION $BUS -m $CONF -p audio-orchestra?gcov;
|
||||||
|
# ./ci/coverage_send.py --json=out/Linux_x86_64/$CONF/build/$BUILDER/audio-orchestra/audio-orchestra_coverage.json;
|
||||||
|
# fi
|
||||||
|
|
||||||
notifications:
|
notifications:
|
||||||
email:
|
email:
|
||||||
- yui.heero@gmail.com
|
- yui.heero@gmail.com
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@@ -5,17 +5,14 @@
|
|||||||
* @fork from RTAudio
|
* @fork from RTAudio
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//#include <etk/types.h>
|
//#include <etk/types.hpp>
|
||||||
#include <audio/orchestra/Interface.h>
|
#include <audio/orchestra/Interface.hpp>
|
||||||
#include <audio/orchestra/debug.h>
|
#include <audio/orchestra/debug.hpp>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <climits>
|
#include <climits>
|
||||||
|
|
||||||
#undef __class__
|
|
||||||
#define __class__ "api"
|
|
||||||
|
|
||||||
// Static variable definitions.
|
// Static variable definitions.
|
||||||
const std::vector<uint32_t>& audio::orchestra::genericSampleRate() {
|
const std::vector<uint32_t>& audio::orchestra::genericSampleRate() {
|
||||||
static std::vector<uint32_t> list;
|
static std::vector<uint32_t> list;
|
||||||
@@ -47,7 +44,7 @@ audio::orchestra::Api::Api() :
|
|||||||
m_deviceBuffer(nullptr) {
|
m_deviceBuffer(nullptr) {
|
||||||
m_device[0] = 11111;
|
m_device[0] = 11111;
|
||||||
m_device[1] = 11111;
|
m_device[1] = 11111;
|
||||||
m_state = audio::orchestra::state_closed;
|
m_state = audio::orchestra::state::closed;
|
||||||
m_mode = audio::orchestra::mode_unknow;
|
m_mode = audio::orchestra::mode_unknow;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -69,7 +66,7 @@ enum audio::orchestra::error audio::orchestra::Api::openStream(audio::orchestra:
|
|||||||
uint32_t* _bufferFrames,
|
uint32_t* _bufferFrames,
|
||||||
audio::orchestra::AirTAudioCallback _callback,
|
audio::orchestra::AirTAudioCallback _callback,
|
||||||
const audio::orchestra::StreamOptions& _options) {
|
const audio::orchestra::StreamOptions& _options) {
|
||||||
if (m_state != audio::orchestra::state_closed) {
|
if (m_state != audio::orchestra::state::closed) {
|
||||||
ATA_ERROR("a stream is already open!");
|
ATA_ERROR("a stream is already open!");
|
||||||
return audio::orchestra::error_invalidUse;
|
return audio::orchestra::error_invalidUse;
|
||||||
}
|
}
|
||||||
@@ -168,7 +165,7 @@ enum audio::orchestra::error audio::orchestra::Api::openStream(audio::orchestra:
|
|||||||
}
|
}
|
||||||
m_callback = _callback;
|
m_callback = _callback;
|
||||||
//_options.numberOfBuffers = m_nBuffers;
|
//_options.numberOfBuffers = m_nBuffers;
|
||||||
m_state = audio::orchestra::state_stopped;
|
m_state = audio::orchestra::state::stopped;
|
||||||
return audio::orchestra::error_none;
|
return audio::orchestra::error_none;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -237,7 +234,7 @@ uint32_t audio::orchestra::Api::getStreamSampleRate() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
enum audio::orchestra::error audio::orchestra::Api::verifyStream() {
|
enum audio::orchestra::error audio::orchestra::Api::verifyStream() {
|
||||||
if (m_state == audio::orchestra::state_closed) {
|
if (m_state == audio::orchestra::state::closed) {
|
||||||
ATA_ERROR("a stream is not open!");
|
ATA_ERROR("a stream is not open!");
|
||||||
return audio::orchestra::error_invalidUse;
|
return audio::orchestra::error_invalidUse;
|
||||||
}
|
}
|
||||||
@@ -246,7 +243,7 @@ enum audio::orchestra::error audio::orchestra::Api::verifyStream() {
|
|||||||
|
|
||||||
void audio::orchestra::Api::clearStreamInfo() {
|
void audio::orchestra::Api::clearStreamInfo() {
|
||||||
m_mode = audio::orchestra::mode_unknow;
|
m_mode = audio::orchestra::mode_unknow;
|
||||||
m_state = audio::orchestra::state_closed;
|
m_state = audio::orchestra::state::closed;
|
||||||
m_sampleRate = 0;
|
m_sampleRate = 0;
|
||||||
m_bufferSize = 0;
|
m_bufferSize = 0;
|
||||||
m_nBuffers = 0;
|
m_nBuffers = 0;
|
||||||
|
@@ -7,15 +7,20 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <audio/orchestra/debug.h>
|
#include <audio/orchestra/debug.hpp>
|
||||||
#include <audio/orchestra/type.h>
|
#include <audio/orchestra/type.hpp>
|
||||||
#include <audio/orchestra/state.h>
|
#include <audio/orchestra/state.hpp>
|
||||||
#include <audio/orchestra/mode.h>
|
#include <audio/orchestra/mode.hpp>
|
||||||
#include <audio/Time.h>
|
#include <audio/Time.hpp>
|
||||||
#include <audio/Duration.h>
|
#include <audio/Duration.hpp>
|
||||||
#include <memory>
|
#include <ememory/memory.hpp>
|
||||||
|
/**
|
||||||
|
* @brief Audio library namespace
|
||||||
|
*/
|
||||||
namespace audio {
|
namespace audio {
|
||||||
|
/**
|
||||||
|
* @brief Audio-orchestra library namespace
|
||||||
|
*/
|
||||||
namespace orchestra {
|
namespace orchestra {
|
||||||
const std::vector<uint32_t>& genericSampleRate();
|
const std::vector<uint32_t>& genericSampleRate();
|
||||||
/**
|
/**
|
||||||
@@ -45,7 +50,7 @@ namespace audio {
|
|||||||
std::vector<int> outOffset;
|
std::vector<int> outOffset;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Api : public std::enable_shared_from_this<Api>{
|
class Api : public ememory::EnableSharedFromThis<Api>{
|
||||||
protected:
|
protected:
|
||||||
std::string m_name;
|
std::string m_name;
|
||||||
public:
|
public:
|
||||||
@@ -78,10 +83,10 @@ namespace audio {
|
|||||||
uint32_t getStreamSampleRate();
|
uint32_t getStreamSampleRate();
|
||||||
virtual audio::Time getStreamTime();
|
virtual audio::Time getStreamTime();
|
||||||
bool isStreamOpen() const {
|
bool isStreamOpen() const {
|
||||||
return m_state != audio::orchestra::state_closed;
|
return m_state != audio::orchestra::state::closed;
|
||||||
}
|
}
|
||||||
bool isStreamRunning() const {
|
bool isStreamRunning() const {
|
||||||
return m_state == audio::orchestra::state_running;
|
return m_state == audio::orchestra::state::running;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@@ -166,7 +171,7 @@ namespace audio {
|
|||||||
uint32_t _firstChannel);
|
uint32_t _firstChannel);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual bool isMasterOf(std::shared_ptr<audio::orchestra::Api> _api) {
|
virtual bool isMasterOf(ememory::SharedPtr<audio::orchestra::Api> _api) {
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
};
|
};
|
@@ -5,15 +5,12 @@
|
|||||||
* @fork from RTAudio
|
* @fork from RTAudio
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//#include <etk/types.h>
|
//#include <etk/types.hpp>
|
||||||
#include <audio/orchestra/debug.h>
|
#include <audio/orchestra/debug.hpp>
|
||||||
#include <audio/orchestra/DeviceInfo.h>
|
#include <audio/orchestra/DeviceInfo.hpp>
|
||||||
#include <etk/stdTools.h>
|
#include <etk/stdTools.hpp>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#undef __class__
|
|
||||||
#define __class__ "DeviceInfo"
|
|
||||||
|
|
||||||
void audio::orchestra::DeviceInfo::display(int32_t _tabNumber) const {
|
void audio::orchestra::DeviceInfo::display(int32_t _tabNumber) const {
|
||||||
std::string space;
|
std::string space;
|
||||||
for (int32_t iii=0; iii<_tabNumber; ++iii) {
|
for (int32_t iii=0; iii<_tabNumber; ++iii) {
|
||||||
|
@@ -6,8 +6,8 @@
|
|||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <audio/format.h>
|
#include <audio/format.hpp>
|
||||||
#include <audio/channel.h>
|
#include <audio/channel.hpp>
|
||||||
|
|
||||||
namespace audio {
|
namespace audio {
|
||||||
namespace orchestra {
|
namespace orchestra {
|
@@ -5,5 +5,5 @@
|
|||||||
* @fork from RTAudio
|
* @fork from RTAudio
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <audio/orchestra/Flags.h>
|
#include <audio/orchestra/Flags.hpp>
|
||||||
#include <audio/orchestra/debug.h>
|
#include <audio/orchestra/debug.hpp>
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <etk/types.h>
|
#include <etk/types.hpp>
|
||||||
|
|
||||||
namespace audio {
|
namespace audio {
|
||||||
namespace orchestra {
|
namespace orchestra {
|
@@ -5,22 +5,19 @@
|
|||||||
* @fork from RTAudio
|
* @fork from RTAudio
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//#include <etk/types.h>
|
//#include <etk/types.hpp>
|
||||||
#include <audio/orchestra/Interface.h>
|
#include <audio/orchestra/Interface.hpp>
|
||||||
#include <audio/orchestra/debug.h>
|
#include <audio/orchestra/debug.hpp>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <audio/orchestra/api/Alsa.h>
|
#include <audio/orchestra/api/Alsa.hpp>
|
||||||
#include <audio/orchestra/api/Android.h>
|
#include <audio/orchestra/api/Android.hpp>
|
||||||
#include <audio/orchestra/api/Asio.h>
|
#include <audio/orchestra/api/Asio.hpp>
|
||||||
#include <audio/orchestra/api/Core.h>
|
#include <audio/orchestra/api/Core.hpp>
|
||||||
#include <audio/orchestra/api/CoreIos.h>
|
#include <audio/orchestra/api/CoreIos.hpp>
|
||||||
#include <audio/orchestra/api/Ds.h>
|
#include <audio/orchestra/api/Ds.hpp>
|
||||||
#include <audio/orchestra/api/Dummy.h>
|
#include <audio/orchestra/api/Dummy.hpp>
|
||||||
#include <audio/orchestra/api/Jack.h>
|
#include <audio/orchestra/api/Jack.hpp>
|
||||||
#include <audio/orchestra/api/Pulse.h>
|
#include <audio/orchestra/api/Pulse.hpp>
|
||||||
|
|
||||||
#undef __class__
|
|
||||||
#define __class__ "Interface"
|
|
||||||
|
|
||||||
std::vector<std::string> audio::orchestra::Interface::getListApi() {
|
std::vector<std::string> audio::orchestra::Interface::getListApi() {
|
||||||
std::vector<std::string> apis;
|
std::vector<std::string> apis;
|
||||||
@@ -55,36 +52,36 @@ audio::orchestra::Interface::Interface() :
|
|||||||
m_api(nullptr) {
|
m_api(nullptr) {
|
||||||
ATA_DEBUG("Add interface:");
|
ATA_DEBUG("Add interface:");
|
||||||
#if defined(ORCHESTRA_BUILD_JACK)
|
#if defined(ORCHESTRA_BUILD_JACK)
|
||||||
addInterface(audio::orchestra::type_jack, audio::orchestra::api::Jack::create);
|
addInterface(audio::orchestra::typeJack, audio::orchestra::api::Jack::create);
|
||||||
#endif
|
#endif
|
||||||
#if defined(ORCHESTRA_BUILD_ALSA)
|
#if defined(ORCHESTRA_BUILD_ALSA)
|
||||||
addInterface(audio::orchestra::type_alsa, audio::orchestra::api::Alsa::create);
|
addInterface(audio::orchestra::typeAlsa, audio::orchestra::api::Alsa::create);
|
||||||
#endif
|
#endif
|
||||||
#if defined(ORCHESTRA_BUILD_PULSE)
|
#if defined(ORCHESTRA_BUILD_PULSE)
|
||||||
addInterface(audio::orchestra::type_pulse, audio::orchestra::api::Pulse::create);
|
addInterface(audio::orchestra::typePulse, audio::orchestra::api::Pulse::create);
|
||||||
#endif
|
#endif
|
||||||
#if defined(ORCHESTRA_BUILD_ASIO)
|
#if defined(ORCHESTRA_BUILD_ASIO)
|
||||||
addInterface(audio::orchestra::type_asio, audio::orchestra::api::Asio::create);
|
addInterface(audio::orchestra::typeAsio, audio::orchestra::api::Asio::create);
|
||||||
#endif
|
#endif
|
||||||
#if defined(ORCHESTRA_BUILD_DS)
|
#if defined(ORCHESTRA_BUILD_DS)
|
||||||
addInterface(audio::orchestra::type_ds, audio::orchestra::api::Ds::create);
|
addInterface(audio::orchestra::typeDs, audio::orchestra::api::Ds::create);
|
||||||
#endif
|
#endif
|
||||||
#if defined(ORCHESTRA_BUILD_MACOSX_CORE)
|
#if defined(ORCHESTRA_BUILD_MACOSX_CORE)
|
||||||
addInterface(audio::orchestra::type_coreOSX, audio::orchestra::api::Core::create);
|
addInterface(audio::orchestra::typeCoreOSX, audio::orchestra::api::Core::create);
|
||||||
#endif
|
#endif
|
||||||
#if defined(ORCHESTRA_BUILD_IOS_CORE)
|
#if defined(ORCHESTRA_BUILD_IOS_CORE)
|
||||||
addInterface(audio::orchestra::type_coreIOS, audio::orchestra::api::CoreIos::create);
|
addInterface(audio::orchestra::typeCoreIOS, audio::orchestra::api::CoreIos::create);
|
||||||
#endif
|
#endif
|
||||||
#if defined(ORCHESTRA_BUILD_JAVA)
|
#if defined(ORCHESTRA_BUILD_JAVA)
|
||||||
addInterface(audio::orchestra::type_java, audio::orchestra::api::Android::create);
|
addInterface(audio::orchestra::typeJava, audio::orchestra::api::Android::create);
|
||||||
#endif
|
#endif
|
||||||
#if defined(ORCHESTRA_BUILD_DUMMY)
|
#if defined(ORCHESTRA_BUILD_DUMMY)
|
||||||
addInterface(audio::orchestra::type_dummy, audio::orchestra::api::Dummy::create);
|
addInterface(audio::orchestra::typeDummy, audio::orchestra::api::Dummy::create);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void audio::orchestra::Interface::addInterface(const std::string& _api, std::shared_ptr<Api> (*_callbackCreate)()) {
|
void audio::orchestra::Interface::addInterface(const std::string& _api, ememory::SharedPtr<Api> (*_callbackCreate)()) {
|
||||||
m_apiAvaillable.push_back(std::pair<std::string, std::shared_ptr<Api> (*)()>(_api, _callbackCreate));
|
m_apiAvaillable.push_back(std::pair<std::string, ememory::SharedPtr<Api> (*)()>(_api, _callbackCreate));
|
||||||
}
|
}
|
||||||
|
|
||||||
enum audio::orchestra::error audio::orchestra::Interface::clear() {
|
enum audio::orchestra::error audio::orchestra::Interface::clear() {
|
||||||
@@ -103,7 +100,7 @@ enum audio::orchestra::error audio::orchestra::Interface::instanciate(const std:
|
|||||||
ATA_WARNING("Interface already started!");
|
ATA_WARNING("Interface already started!");
|
||||||
return audio::orchestra::error_none;
|
return audio::orchestra::error_none;
|
||||||
}
|
}
|
||||||
if (_api != audio::orchestra::type_undefined) {
|
if (_api != audio::orchestra::typeUndefined) {
|
||||||
ATA_INFO("API specified : " << _api);
|
ATA_INFO("API specified : " << _api);
|
||||||
// Attempt to open the specified API.
|
// Attempt to open the specified API.
|
||||||
openApi(_api);
|
openApi(_api);
|
||||||
@@ -181,8 +178,8 @@ bool audio::orchestra::Interface::isMasterOf(audio::orchestra::Interface& _inter
|
|||||||
ATA_ERROR("Can not link 2 Interface with not the same Low level type (?)");//" << _interface.m_adac->getCurrentApi() << " != " << m_adac->getCurrentApi() << ")");
|
ATA_ERROR("Can not link 2 Interface with not the same Low level type (?)");//" << _interface.m_adac->getCurrentApi() << " != " << m_adac->getCurrentApi() << ")");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (m_api->getCurrentApi() != audio::orchestra::type_alsa) {
|
if (m_api->getCurrentApi() != audio::orchestra::typeAlsa) {
|
||||||
ATA_ERROR("Link 2 device together work only if the interafec is ?");// << audio::orchestra::type_alsa << " not for " << m_api->getCurrentApi());
|
ATA_ERROR("Link 2 device together work only if the interafec is ?");// << audio::orchestra::type::alsa << " not for " << m_api->getCurrentApi());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return m_api->isMasterOf(_interface.m_api);
|
return m_api->isMasterOf(_interface.m_api);
|
||||||
|
@@ -8,9 +8,9 @@
|
|||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <audio/orchestra/base.h>
|
#include <audio/orchestra/base.hpp>
|
||||||
#include <audio/orchestra/CallbackInfo.h>
|
#include <audio/orchestra/CallbackInfo.hpp>
|
||||||
#include <audio/orchestra/Api.h>
|
#include <audio/orchestra/Api.hpp>
|
||||||
|
|
||||||
namespace audio {
|
namespace audio {
|
||||||
namespace orchestra {
|
namespace orchestra {
|
||||||
@@ -26,9 +26,9 @@ namespace audio {
|
|||||||
*/
|
*/
|
||||||
class Interface {
|
class Interface {
|
||||||
protected:
|
protected:
|
||||||
std::vector<std::pair<std::string, std::shared_ptr<Api> (*)()> > m_apiAvaillable;
|
std::vector<std::pair<std::string, ememory::SharedPtr<Api> (*)()> > m_apiAvaillable;
|
||||||
protected:
|
protected:
|
||||||
std::shared_ptr<audio::orchestra::Api> m_api;
|
ememory::SharedPtr<audio::orchestra::Api> m_api;
|
||||||
public:
|
public:
|
||||||
void setName(const std::string& _name) {
|
void setName(const std::string& _name) {
|
||||||
if (m_api == nullptr) {
|
if (m_api == nullptr) {
|
||||||
@@ -46,7 +46,7 @@ namespace audio {
|
|||||||
* @param[in] _api Type of the interface.
|
* @param[in] _api Type of the interface.
|
||||||
* @param[in] _callbackCreate API creation callback.
|
* @param[in] _callbackCreate API creation callback.
|
||||||
*/
|
*/
|
||||||
void addInterface(const std::string& _api, std::shared_ptr<Api> (*_callbackCreate)());
|
void addInterface(const std::string& _api, ememory::SharedPtr<Api> (*_callbackCreate)());
|
||||||
/**
|
/**
|
||||||
* @brief The class constructor.
|
* @brief The class constructor.
|
||||||
* @note the creating of the basic instance is done by Instanciate
|
* @note the creating of the basic instance is done by Instanciate
|
||||||
@@ -66,13 +66,13 @@ namespace audio {
|
|||||||
/**
|
/**
|
||||||
* @brief Create an interface instance
|
* @brief Create an interface instance
|
||||||
*/
|
*/
|
||||||
enum audio::orchestra::error instanciate(const std::string& _api = audio::orchestra::type_undefined);
|
enum audio::orchestra::error instanciate(const std::string& _api = audio::orchestra::typeUndefined);
|
||||||
/**
|
/**
|
||||||
* @return the audio API specifier for the current instance of airtaudio.
|
* @return the audio API specifier for the current instance of airtaudio.
|
||||||
*/
|
*/
|
||||||
const std::string& getCurrentApi() {
|
const std::string& getCurrentApi() {
|
||||||
if (m_api == nullptr) {
|
if (m_api == nullptr) {
|
||||||
return audio::orchestra::type_undefined;
|
return audio::orchestra::typeUndefined;
|
||||||
}
|
}
|
||||||
return m_api->getCurrentApi();
|
return m_api->getCurrentApi();
|
||||||
}
|
}
|
@@ -5,9 +5,9 @@
|
|||||||
* @fork from RTAudio
|
* @fork from RTAudio
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <audio/orchestra/StreamOptions.h>
|
#include <audio/orchestra/StreamOptions.hpp>
|
||||||
#include <etk/stdTools.h>
|
#include <etk/stdTools.hpp>
|
||||||
#include <audio/orchestra/debug.h>
|
#include <audio/orchestra/debug.hpp>
|
||||||
|
|
||||||
static const char* listValue[] = {
|
static const char* listValue[] = {
|
||||||
"hardware",
|
"hardware",
|
||||||
|
@@ -6,13 +6,13 @@
|
|||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <audio/orchestra/Flags.h>
|
#include <audio/orchestra/Flags.hpp>
|
||||||
|
|
||||||
namespace audio {
|
namespace audio {
|
||||||
namespace orchestra {
|
namespace orchestra {
|
||||||
enum timestampMode {
|
enum timestampMode {
|
||||||
timestampMode_Hardware, //!< enable harware timestamp
|
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.
|
timestampMode_soft, //!< Simulate all timestamp.
|
||||||
};
|
};
|
||||||
std::ostream& operator <<(std::ostream& _os, enum audio::orchestra::timestampMode _obj);
|
std::ostream& operator <<(std::ostream& _os, enum audio::orchestra::timestampMode _obj);
|
@@ -9,29 +9,27 @@
|
|||||||
#if defined(ORCHESTRA_BUILD_ALSA)
|
#if defined(ORCHESTRA_BUILD_ALSA)
|
||||||
|
|
||||||
#include <alsa/asoundlib.h>
|
#include <alsa/asoundlib.h>
|
||||||
#include <unistd.h>
|
|
||||||
#include <audio/orchestra/Interface.h>
|
#include <audio/orchestra/Interface.hpp>
|
||||||
#include <audio/orchestra/debug.h>
|
#include <audio/orchestra/debug.hpp>
|
||||||
#include <etk/stdTools.h>
|
#include <etk/stdTools.hpp>
|
||||||
#include <ethread/tools.h>
|
#include <ethread/tools.hpp>
|
||||||
#include <limits.h>
|
#include <climits>
|
||||||
#include <audio/orchestra/api/Alsa.h>
|
#include <audio/orchestra/api/Alsa.hpp>
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <sched.h>
|
#include <sched.h>
|
||||||
#include <errno.h>
|
|
||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <math.h>
|
|
||||||
#include <poll.h>
|
#include <poll.h>
|
||||||
}
|
}
|
||||||
#undef __class__
|
#include <cerrno>
|
||||||
#define __class__ "api::Alsa"
|
#include <cstdio>
|
||||||
|
#include <cstdlib>
|
||||||
|
#include <cstring>
|
||||||
|
#include <cmath>
|
||||||
|
|
||||||
std::shared_ptr<audio::orchestra::Api> audio::orchestra::api::Alsa::create() {
|
ememory::SharedPtr<audio::orchestra::Api> audio::orchestra::api::Alsa::create() {
|
||||||
return std::shared_ptr<audio::orchestra::Api>(new audio::orchestra::api::Alsa());
|
return ememory::SharedPtr<audio::orchestra::api::Alsa>(new audio::orchestra::api::Alsa());
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace audio {
|
namespace audio {
|
||||||
@@ -65,12 +63,12 @@ namespace audio {
|
|||||||
}
|
}
|
||||||
|
|
||||||
audio::orchestra::api::Alsa::Alsa() :
|
audio::orchestra::api::Alsa::Alsa() :
|
||||||
m_private(std::make_shared<audio::orchestra::api::AlsaPrivate>()) {
|
m_private(ememory::makeShared<audio::orchestra::api::AlsaPrivate>()) {
|
||||||
// Nothing to do here.
|
// Nothing to do here.
|
||||||
}
|
}
|
||||||
|
|
||||||
audio::orchestra::api::Alsa::~Alsa() {
|
audio::orchestra::api::Alsa::~Alsa() {
|
||||||
if (m_state != audio::orchestra::state_closed) {
|
if (m_state != audio::orchestra::state::closed) {
|
||||||
closeStream();
|
closeStream();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -284,6 +282,7 @@ audio::orchestra::DeviceInfo audio::orchestra::api::Alsa::getDeviceInfo(uint32_t
|
|||||||
ATA_WARNING("control next device, card = " << card << ", " << snd_strerror(result) << ".");
|
ATA_WARNING("control next device, card = " << card << ", " << snd_strerror(result) << ".");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
ATA_WARNING(" ==> nbSubdevice = " << subdevice);
|
||||||
if (subdevice < 0) {
|
if (subdevice < 0) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -322,7 +321,7 @@ foundDevice:
|
|||||||
snd_ctl_close(chandle);
|
snd_ctl_close(chandle);
|
||||||
// If a stream is already open, we cannot probe the stream devices.
|
// If a stream is already open, we cannot probe the stream devices.
|
||||||
// Thus, use the saved results.
|
// Thus, use the saved results.
|
||||||
if ( m_state != audio::orchestra::state_closed
|
if ( m_state != audio::orchestra::state::closed
|
||||||
&& ( m_device[0] == _device
|
&& ( m_device[0] == _device
|
||||||
|| m_device[1] == _device)) {
|
|| m_device[1] == _device)) {
|
||||||
if (_device >= m_devices.size()) {
|
if (_device >= m_devices.size()) {
|
||||||
@@ -795,7 +794,7 @@ bool audio::orchestra::api::Alsa::openName(const std::string& _deviceName,
|
|||||||
m_nBuffers = periods;
|
m_nBuffers = periods;
|
||||||
ATA_INFO("ALSA NB buffer = " << m_nBuffers);
|
ATA_INFO("ALSA NB buffer = " << m_nBuffers);
|
||||||
// TODO : m_device[modeToIdTable(_mode)] = _device;
|
// TODO : m_device[modeToIdTable(_mode)] = _device;
|
||||||
m_state = audio::orchestra::state_stopped;
|
m_state = audio::orchestra::state::stopped;
|
||||||
// Setup the buffer conversion information structure.
|
// Setup the buffer conversion information structure.
|
||||||
if (m_doConvertBuffer[modeToIdTable(_mode)]) {
|
if (m_doConvertBuffer[modeToIdTable(_mode)]) {
|
||||||
setConvertInfo(_mode, _firstChannel);
|
setConvertInfo(_mode, _firstChannel);
|
||||||
@@ -824,18 +823,18 @@ error:
|
|||||||
free(m_deviceBuffer);
|
free(m_deviceBuffer);
|
||||||
m_deviceBuffer = 0;
|
m_deviceBuffer = 0;
|
||||||
}
|
}
|
||||||
m_state = audio::orchestra::state_closed;
|
m_state = audio::orchestra::state::closed;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum audio::orchestra::error audio::orchestra::api::Alsa::closeStream() {
|
enum audio::orchestra::error audio::orchestra::api::Alsa::closeStream() {
|
||||||
if (m_state == audio::orchestra::state_closed) {
|
if (m_state == audio::orchestra::state::closed) {
|
||||||
ATA_ERROR("no open stream to close!");
|
ATA_ERROR("no open stream to close!");
|
||||||
return audio::orchestra::error_warning;
|
return audio::orchestra::error_warning;
|
||||||
}
|
}
|
||||||
m_private->threadRunning = false;
|
m_private->threadRunning = false;
|
||||||
m_mutex.lock();
|
m_mutex.lock();
|
||||||
if (m_state == audio::orchestra::state_stopped) {
|
if (m_state == audio::orchestra::state::stopped) {
|
||||||
m_private->runnable = true;
|
m_private->runnable = true;
|
||||||
m_private->runnable_cv.notify_one();
|
m_private->runnable_cv.notify_one();
|
||||||
}
|
}
|
||||||
@@ -844,8 +843,8 @@ enum audio::orchestra::error audio::orchestra::api::Alsa::closeStream() {
|
|||||||
m_private->thread->join();
|
m_private->thread->join();
|
||||||
m_private->thread = nullptr;
|
m_private->thread = nullptr;
|
||||||
}
|
}
|
||||||
if (m_state == audio::orchestra::state_running) {
|
if (m_state == audio::orchestra::state::running) {
|
||||||
m_state = audio::orchestra::state_stopped;
|
m_state = audio::orchestra::state::stopped;
|
||||||
snd_pcm_drop(m_private->handle);
|
snd_pcm_drop(m_private->handle);
|
||||||
}
|
}
|
||||||
// close all stream :
|
// close all stream :
|
||||||
@@ -861,7 +860,7 @@ enum audio::orchestra::error audio::orchestra::api::Alsa::closeStream() {
|
|||||||
m_deviceBuffer = 0;
|
m_deviceBuffer = 0;
|
||||||
}
|
}
|
||||||
m_mode = audio::orchestra::mode_unknow;
|
m_mode = audio::orchestra::mode_unknow;
|
||||||
m_state = audio::orchestra::state_closed;
|
m_state = audio::orchestra::state::closed;
|
||||||
return audio::orchestra::error_none;
|
return audio::orchestra::error_none;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -872,7 +871,7 @@ enum audio::orchestra::error audio::orchestra::api::Alsa::startStream() {
|
|||||||
if (verifyStream() != audio::orchestra::error_none) {
|
if (verifyStream() != audio::orchestra::error_none) {
|
||||||
return audio::orchestra::error_fail;
|
return audio::orchestra::error_fail;
|
||||||
}
|
}
|
||||||
if (m_state == audio::orchestra::state_running) {
|
if (m_state == audio::orchestra::state::running) {
|
||||||
ATA_ERROR("the stream is already running!");
|
ATA_ERROR("the stream is already running!");
|
||||||
return audio::orchestra::error_warning;
|
return audio::orchestra::error_warning;
|
||||||
}
|
}
|
||||||
@@ -891,7 +890,7 @@ enum audio::orchestra::error audio::orchestra::api::Alsa::startStream() {
|
|||||||
goto unlock;
|
goto unlock;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_state = audio::orchestra::state_running;
|
m_state = audio::orchestra::state::running;
|
||||||
unlock:
|
unlock:
|
||||||
m_private->runnable = true;
|
m_private->runnable = true;
|
||||||
m_private->runnable_cv.notify_one();
|
m_private->runnable_cv.notify_one();
|
||||||
@@ -905,11 +904,11 @@ enum audio::orchestra::error audio::orchestra::api::Alsa::stopStream() {
|
|||||||
if (verifyStream() != audio::orchestra::error_none) {
|
if (verifyStream() != audio::orchestra::error_none) {
|
||||||
return audio::orchestra::error_fail;
|
return audio::orchestra::error_fail;
|
||||||
}
|
}
|
||||||
if (m_state == audio::orchestra::state_stopped) {
|
if (m_state == audio::orchestra::state::stopped) {
|
||||||
ATA_ERROR("the stream is already stopped!");
|
ATA_ERROR("the stream is already stopped!");
|
||||||
return audio::orchestra::error_warning;
|
return audio::orchestra::error_warning;
|
||||||
}
|
}
|
||||||
m_state = audio::orchestra::state_stopped;
|
m_state = audio::orchestra::state::stopped;
|
||||||
std::unique_lock<std::mutex> lck(m_mutex);
|
std::unique_lock<std::mutex> lck(m_mutex);
|
||||||
int32_t result = 0;
|
int32_t result = 0;
|
||||||
if (m_mode == audio::orchestra::mode_output) {
|
if (m_mode == audio::orchestra::mode_output) {
|
||||||
@@ -932,11 +931,11 @@ enum audio::orchestra::error audio::orchestra::api::Alsa::abortStream() {
|
|||||||
if (verifyStream() != audio::orchestra::error_none) {
|
if (verifyStream() != audio::orchestra::error_none) {
|
||||||
return audio::orchestra::error_fail;
|
return audio::orchestra::error_fail;
|
||||||
}
|
}
|
||||||
if (m_state == audio::orchestra::state_stopped) {
|
if (m_state == audio::orchestra::state::stopped) {
|
||||||
ATA_ERROR("the stream is already stopped!");
|
ATA_ERROR("the stream is already stopped!");
|
||||||
return audio::orchestra::error_warning;
|
return audio::orchestra::error_warning;
|
||||||
}
|
}
|
||||||
m_state = audio::orchestra::state_stopped;
|
m_state = audio::orchestra::state::stopped;
|
||||||
std::unique_lock<std::mutex> lck(m_mutex);
|
std::unique_lock<std::mutex> lck(m_mutex);
|
||||||
int32_t result = 0;
|
int32_t result = 0;
|
||||||
result = snd_pcm_drop(m_private->handle);
|
result = snd_pcm_drop(m_private->handle);
|
||||||
@@ -979,12 +978,12 @@ static int32_t wait_for_poll(snd_pcm_t* _handle, struct pollfd* _ufds, unsigned
|
|||||||
|
|
||||||
void audio::orchestra::api::Alsa::callbackEvent() {
|
void audio::orchestra::api::Alsa::callbackEvent() {
|
||||||
// Lock while the system is not started ...
|
// Lock while the system is not started ...
|
||||||
if (m_state == audio::orchestra::state_stopped) {
|
if (m_state == audio::orchestra::state::stopped) {
|
||||||
std::unique_lock<std::mutex> lck(m_mutex);
|
std::unique_lock<std::mutex> lck(m_mutex);
|
||||||
while (!m_private->runnable) {
|
while (!m_private->runnable) {
|
||||||
m_private->runnable_cv.wait(lck);
|
m_private->runnable_cv.wait(lck);
|
||||||
}
|
}
|
||||||
if (m_state != audio::orchestra::state_running) {
|
if (m_state != audio::orchestra::state::running) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1100,7 +1099,8 @@ audio::Time audio::orchestra::api::Alsa::getStreamTime() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void audio::orchestra::api::Alsa::callbackEventOneCycleRead() {
|
void audio::orchestra::api::Alsa::callbackEventOneCycleRead() {
|
||||||
if (m_state == audio::orchestra::state_closed) {
|
ATA_VERBOSE("One cycle read ...");
|
||||||
|
if (m_state == audio::orchestra::state::closed) {
|
||||||
ATA_CRITICAL("the stream is closed ... this shouldn't happen!");
|
ATA_CRITICAL("the stream is closed ... this shouldn't happen!");
|
||||||
return; // TODO : notify appl: audio::orchestra::error_warning;
|
return; // TODO : notify appl: audio::orchestra::error_warning;
|
||||||
}
|
}
|
||||||
@@ -1108,7 +1108,7 @@ void audio::orchestra::api::Alsa::callbackEventOneCycleRead() {
|
|||||||
audio::Time streamTime;
|
audio::Time streamTime;
|
||||||
std::vector<enum audio::orchestra::status> status;
|
std::vector<enum audio::orchestra::status> status;
|
||||||
if (m_private->xrun[0] == true) {
|
if (m_private->xrun[0] == true) {
|
||||||
status.push_back(audio::orchestra::status_underflow);
|
status.push_back(audio::orchestra::status::underflow);
|
||||||
m_private->xrun[0] = false;
|
m_private->xrun[0] = false;
|
||||||
}
|
}
|
||||||
int32_t result;
|
int32_t result;
|
||||||
@@ -1117,7 +1117,7 @@ void audio::orchestra::api::Alsa::callbackEventOneCycleRead() {
|
|||||||
snd_pcm_sframes_t frames;
|
snd_pcm_sframes_t frames;
|
||||||
audio::format format;
|
audio::format format;
|
||||||
|
|
||||||
if (m_state == audio::orchestra::state_stopped) {
|
if (m_state == audio::orchestra::state::stopped) {
|
||||||
// !!! goto unlock;
|
// !!! goto unlock;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1151,7 +1151,8 @@ void audio::orchestra::api::Alsa::callbackEventOneCycleRead() {
|
|||||||
}
|
}
|
||||||
// get timestamp : (to init here ...
|
// get timestamp : (to init here ...
|
||||||
streamTime = getStreamTime();
|
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.
|
// Either an error or overrun occured.
|
||||||
if (result == -EPIPE) {
|
if (result == -EPIPE) {
|
||||||
snd_pcm_state_t state = snd_pcm_state(m_private->handle);
|
snd_pcm_state_t state = snd_pcm_state(m_private->handle);
|
||||||
@@ -1166,7 +1167,7 @@ void audio::orchestra::api::Alsa::callbackEventOneCycleRead() {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ATA_ERROR("audio read error, " << snd_strerror(result) << ".");
|
ATA_ERROR("audio read error, " << snd_strerror(result) << ".");
|
||||||
usleep(10000);
|
std::this_thread::sleep_for(std::chrono::milliseconds(10));
|
||||||
}
|
}
|
||||||
// TODO : Notify application ... audio::orchestra::error_warning;
|
// TODO : Notify application ... audio::orchestra::error_warning;
|
||||||
goto noInput;
|
goto noInput;
|
||||||
@@ -1216,7 +1217,7 @@ unlock:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void audio::orchestra::api::Alsa::callbackEventOneCycleWrite() {
|
void audio::orchestra::api::Alsa::callbackEventOneCycleWrite() {
|
||||||
if (m_state == audio::orchestra::state_closed) {
|
if (m_state == audio::orchestra::state::closed) {
|
||||||
ATA_CRITICAL("the stream is closed ... this shouldn't happen!");
|
ATA_CRITICAL("the stream is closed ... this shouldn't happen!");
|
||||||
return; // TODO : notify appl: audio::orchestra::error_warning;
|
return; // TODO : notify appl: audio::orchestra::error_warning;
|
||||||
}
|
}
|
||||||
@@ -1224,7 +1225,7 @@ void audio::orchestra::api::Alsa::callbackEventOneCycleWrite() {
|
|||||||
audio::Time streamTime;
|
audio::Time streamTime;
|
||||||
std::vector<enum audio::orchestra::status> status;
|
std::vector<enum audio::orchestra::status> status;
|
||||||
if (m_private->xrun[1] == true) {
|
if (m_private->xrun[1] == true) {
|
||||||
status.push_back(audio::orchestra::status_overflow);
|
status.push_back(audio::orchestra::status::overflow);
|
||||||
m_private->xrun[1] = false;
|
m_private->xrun[1] = false;
|
||||||
}
|
}
|
||||||
int32_t result;
|
int32_t result;
|
||||||
@@ -1233,7 +1234,7 @@ void audio::orchestra::api::Alsa::callbackEventOneCycleWrite() {
|
|||||||
snd_pcm_sframes_t frames;
|
snd_pcm_sframes_t frames;
|
||||||
audio::format format;
|
audio::format format;
|
||||||
|
|
||||||
if (m_state == audio::orchestra::state_stopped) {
|
if (m_state == audio::orchestra::state::stopped) {
|
||||||
// !!! goto unlock;
|
// !!! goto unlock;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1318,7 +1319,7 @@ unlock:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void audio::orchestra::api::Alsa::callbackEventOneCycleMMAPWrite() {
|
void audio::orchestra::api::Alsa::callbackEventOneCycleMMAPWrite() {
|
||||||
if (m_state == audio::orchestra::state_closed) {
|
if (m_state == audio::orchestra::state::closed) {
|
||||||
ATA_CRITICAL("the stream is closed ... this shouldn't happen!");
|
ATA_CRITICAL("the stream is closed ... this shouldn't happen!");
|
||||||
return; // TODO : notify appl: audio::orchestra::error_warning;
|
return; // TODO : notify appl: audio::orchestra::error_warning;
|
||||||
}
|
}
|
||||||
@@ -1326,7 +1327,7 @@ void audio::orchestra::api::Alsa::callbackEventOneCycleMMAPWrite() {
|
|||||||
audio::Time streamTime;
|
audio::Time streamTime;
|
||||||
std::vector<enum audio::orchestra::status> status;
|
std::vector<enum audio::orchestra::status> status;
|
||||||
if (m_private->xrun[1] == true) {
|
if (m_private->xrun[1] == true) {
|
||||||
status.push_back(audio::orchestra::status_overflow);
|
status.push_back(audio::orchestra::status::overflow);
|
||||||
m_private->xrun[1] = false;
|
m_private->xrun[1] = false;
|
||||||
}
|
}
|
||||||
int32_t result;
|
int32_t result;
|
||||||
@@ -1335,7 +1336,7 @@ void audio::orchestra::api::Alsa::callbackEventOneCycleMMAPWrite() {
|
|||||||
snd_pcm_sframes_t frames;
|
snd_pcm_sframes_t frames;
|
||||||
audio::format format;
|
audio::format format;
|
||||||
|
|
||||||
if (m_state == audio::orchestra::state_stopped) {
|
if (m_state == audio::orchestra::state::stopped) {
|
||||||
// !!! goto unlock;
|
// !!! goto unlock;
|
||||||
}
|
}
|
||||||
int32_t avail = snd_pcm_avail_update(m_private->handle);
|
int32_t avail = snd_pcm_avail_update(m_private->handle);
|
||||||
@@ -1451,7 +1452,8 @@ unlock:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
void audio::orchestra::api::Alsa::callbackEventOneCycleMMAPRead() {
|
void audio::orchestra::api::Alsa::callbackEventOneCycleMMAPRead() {
|
||||||
if (m_state == audio::orchestra::state_closed) {
|
ATA_VERBOSE("One cycle read ...");
|
||||||
|
if (m_state == audio::orchestra::state::closed) {
|
||||||
ATA_CRITICAL("the stream is closed ... this shouldn't happen!");
|
ATA_CRITICAL("the stream is closed ... this shouldn't happen!");
|
||||||
return; // TODO : notify appl: audio::orchestra::error_warning;
|
return; // TODO : notify appl: audio::orchestra::error_warning;
|
||||||
}
|
}
|
||||||
@@ -1459,7 +1461,7 @@ void audio::orchestra::api::Alsa::callbackEventOneCycleMMAPRead() {
|
|||||||
audio::Time streamTime;
|
audio::Time streamTime;
|
||||||
std::vector<enum audio::orchestra::status> status;
|
std::vector<enum audio::orchestra::status> status;
|
||||||
if (m_private->xrun[0] == true) {
|
if (m_private->xrun[0] == true) {
|
||||||
status.push_back(audio::orchestra::status_underflow);
|
status.push_back(audio::orchestra::status::underflow);
|
||||||
m_private->xrun[0] = false;
|
m_private->xrun[0] = false;
|
||||||
}
|
}
|
||||||
int32_t result;
|
int32_t result;
|
||||||
@@ -1468,7 +1470,7 @@ void audio::orchestra::api::Alsa::callbackEventOneCycleMMAPRead() {
|
|||||||
snd_pcm_sframes_t frames;
|
snd_pcm_sframes_t frames;
|
||||||
audio::format format;
|
audio::format format;
|
||||||
|
|
||||||
if (m_state == audio::orchestra::state_stopped) {
|
if (m_state == audio::orchestra::state::stopped) {
|
||||||
goto unlock;
|
goto unlock;
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
@@ -1500,9 +1502,11 @@ void audio::orchestra::api::Alsa::callbackEventOneCycleMMAPRead() {
|
|||||||
ATA_ERROR("Xrun...");
|
ATA_ERROR("Xrun...");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// get timestamp : (to init here ...
|
ATA_VERBOSE("get data :" << result << " request:" << int32_t(m_bufferSize));
|
||||||
streamTime = getStreamTime();
|
|
||||||
if (result < (int) m_bufferSize) {
|
if (result < (int) m_bufferSize) {
|
||||||
|
if (result<0) {
|
||||||
|
ATA_PRINT("HAVE AN ERROR " << strerror(-result));
|
||||||
|
}
|
||||||
// Either an error or overrun occured.
|
// Either an error or overrun occured.
|
||||||
if (result == -EPIPE) {
|
if (result == -EPIPE) {
|
||||||
snd_pcm_state_t state = snd_pcm_state(m_private->handle);
|
snd_pcm_state_t state = snd_pcm_state(m_private->handle);
|
||||||
@@ -1517,11 +1521,13 @@ void audio::orchestra::api::Alsa::callbackEventOneCycleMMAPRead() {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ATA_ERROR("audio read error, " << snd_strerror(result) << ".");
|
ATA_ERROR("audio read error, " << snd_strerror(result) << ".");
|
||||||
usleep(10000);
|
std::this_thread::sleep_for(std::chrono::milliseconds(10));
|
||||||
}
|
}
|
||||||
// TODO : Notify application ... audio::orchestra::error_warning;
|
// TODO : Notify application ... audio::orchestra::error_warning;
|
||||||
goto noInput;
|
goto noInput;
|
||||||
}
|
}
|
||||||
|
// get timestamp : (to init here ...
|
||||||
|
streamTime = getStreamTime();
|
||||||
// Do byte swapping if necessary.
|
// Do byte swapping if necessary.
|
||||||
if (m_doByteSwap[1]) {
|
if (m_doByteSwap[1]) {
|
||||||
byteSwapBuffer(buffer, m_bufferSize * channels, format);
|
byteSwapBuffer(buffer, m_bufferSize * channels, format);
|
||||||
@@ -1566,17 +1572,17 @@ unlock:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool audio::orchestra::api::Alsa::isMasterOf(std::shared_ptr<audio::orchestra::Api> _api) {
|
bool audio::orchestra::api::Alsa::isMasterOf(ememory::SharedPtr<audio::orchestra::Api> _api) {
|
||||||
std::shared_ptr<audio::orchestra::api::Alsa> slave = std::dynamic_pointer_cast<audio::orchestra::api::Alsa>(_api);
|
ememory::SharedPtr<audio::orchestra::api::Alsa> slave = ememory::dynamicPointerCast<audio::orchestra::api::Alsa>(_api);
|
||||||
if (slave == nullptr) {
|
if (slave == nullptr) {
|
||||||
ATA_ERROR("NULL ptr API (not ALSA ...)");
|
ATA_ERROR("NULL ptr API (not ALSA ...)");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (m_state == audio::orchestra::state_running) {
|
if (m_state == audio::orchestra::state::running) {
|
||||||
ATA_ERROR("The MASTER stream is already running! ==> can not synchronize ...");
|
ATA_ERROR("The MASTER stream is already running! ==> can not synchronize ...");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (slave->m_state == audio::orchestra::state_running) {
|
if (slave->m_state == audio::orchestra::state::running) {
|
||||||
ATA_ERROR("The SLAVE stream is already running! ==> can not synchronize ...");
|
ATA_ERROR("The SLAVE stream is already running! ==> can not synchronize ...");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@@ -14,12 +14,12 @@ namespace audio {
|
|||||||
class AlsaPrivate;
|
class AlsaPrivate;
|
||||||
class Alsa: public audio::orchestra::Api {
|
class Alsa: public audio::orchestra::Api {
|
||||||
public:
|
public:
|
||||||
static std::shared_ptr<audio::orchestra::Api> create();
|
static ememory::SharedPtr<audio::orchestra::Api> create();
|
||||||
public:
|
public:
|
||||||
Alsa();
|
Alsa();
|
||||||
virtual ~Alsa();
|
virtual ~Alsa();
|
||||||
const std::string& getCurrentApi() {
|
const std::string& getCurrentApi() {
|
||||||
return audio::orchestra::type_alsa;
|
return audio::orchestra::typeAlsa;
|
||||||
}
|
}
|
||||||
uint32_t getDeviceCount();
|
uint32_t getDeviceCount();
|
||||||
private:
|
private:
|
||||||
@@ -50,7 +50,7 @@ namespace audio {
|
|||||||
private:
|
private:
|
||||||
static void alsaCallbackEvent(void* _userData);
|
static void alsaCallbackEvent(void* _userData);
|
||||||
private:
|
private:
|
||||||
std::shared_ptr<AlsaPrivate> m_private;
|
ememory::SharedPtr<AlsaPrivate> m_private;
|
||||||
std::vector<audio::orchestra::DeviceInfo> m_devices;
|
std::vector<audio::orchestra::DeviceInfo> m_devices;
|
||||||
void saveDeviceInfo();
|
void saveDeviceInfo();
|
||||||
bool open(uint32_t _device,
|
bool open(uint32_t _device,
|
||||||
@@ -72,7 +72,7 @@ namespace audio {
|
|||||||
const audio::orchestra::StreamOptions& _options);
|
const audio::orchestra::StreamOptions& _options);
|
||||||
virtual audio::Time getStreamTime();
|
virtual audio::Time getStreamTime();
|
||||||
public:
|
public:
|
||||||
bool isMasterOf(std::shared_ptr<audio::orchestra::Api> _api);
|
bool isMasterOf(ememory::SharedPtr<audio::orchestra::Api> _api);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -8,19 +8,16 @@
|
|||||||
#ifdef ORCHESTRA_BUILD_JAVA
|
#ifdef ORCHESTRA_BUILD_JAVA
|
||||||
|
|
||||||
//#include <ewol/context/Context.h>
|
//#include <ewol/context/Context.h>
|
||||||
#include <unistd.h>
|
|
||||||
#include <audio/orchestra/Interface.h>
|
|
||||||
#include <audio/orchestra/debug.h>
|
|
||||||
#include <audio/orchestra/api/AndroidNativeInterface.h>
|
|
||||||
#include <audio/orchestra/api/Android.h>
|
|
||||||
#include <limits.h>
|
|
||||||
|
|
||||||
#undef __class__
|
#include <audio/orchestra/Interface.hpp>
|
||||||
#define __class__ "api::Android"
|
#include <audio/orchestra/debug.hpp>
|
||||||
|
#include <audio/orchestra/api/AndroidNativeInterface.hpp>
|
||||||
|
#include <audio/orchestra/api/Android.hpp>
|
||||||
|
#include <climits>
|
||||||
|
|
||||||
std::shared_ptr<audio::orchestra::Api> audio::orchestra::api::Android::create() {
|
ememory::SharedPtr<audio::orchestra::Api> audio::orchestra::api::Android::create() {
|
||||||
ATA_INFO("Create Android device ... ");
|
ATA_INFO("Create Android device ... ");
|
||||||
return std::shared_ptr<audio::orchestra::Api>(new audio::orchestra::api::Android());
|
return ememory::SharedPtr<audio::orchestra::api::Android>(new audio::orchestra::api::Android());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -148,7 +145,7 @@ bool audio::orchestra::api::Android::open(uint32_t _device,
|
|||||||
m_userFormat = _format;
|
m_userFormat = _format;
|
||||||
m_nUserChannels[modeToIdTable(m_mode)] = _channels;
|
m_nUserChannels[modeToIdTable(m_mode)] = _channels;
|
||||||
|
|
||||||
m_uid = audio::orchestra::api::android::open(_device, m_mode, _channels, _firstChannel, _sampleRate, _format, _bufferSize, _options, std::static_pointer_cast<audio::orchestra::api::Android>(shared_from_this()));
|
m_uid = audio::orchestra::api::android::open(_device, m_mode, _channels, _firstChannel, _sampleRate, _format, _bufferSize, _options, ememory::staticPointerCast<audio::orchestra::api::Android>(sharedFromThis()));
|
||||||
if (m_uid < 0) {
|
if (m_uid < 0) {
|
||||||
ret = false;
|
ret = false;
|
||||||
} else {
|
} else {
|
||||||
|
@@ -7,19 +7,19 @@
|
|||||||
|
|
||||||
#ifdef ORCHESTRA_BUILD_JAVA
|
#ifdef ORCHESTRA_BUILD_JAVA
|
||||||
|
|
||||||
#include <audio/orchestra/Interface.h>
|
#include <audio/orchestra/Interface.hpp>
|
||||||
|
|
||||||
namespace audio {
|
namespace audio {
|
||||||
namespace orchestra {
|
namespace orchestra {
|
||||||
namespace api {
|
namespace api {
|
||||||
class Android: public audio::orchestra::Api {
|
class Android: public audio::orchestra::Api {
|
||||||
public:
|
public:
|
||||||
static std::shared_ptr<audio::orchestra::Api> create();
|
static ememory::SharedPtr<audio::orchestra::Api> create();
|
||||||
public:
|
public:
|
||||||
Android();
|
Android();
|
||||||
virtual ~Android();
|
virtual ~Android();
|
||||||
const std::string& getCurrentApi() {
|
const std::string& getCurrentApi() {
|
||||||
return audio::orchestra::type_java;
|
return audio::orchestra::typeJava;
|
||||||
}
|
}
|
||||||
uint32_t getDeviceCount();
|
uint32_t getDeviceCount();
|
||||||
audio::orchestra::DeviceInfo getDeviceInfo(uint32_t _device);
|
audio::orchestra::DeviceInfo getDeviceInfo(uint32_t _device);
|
@@ -7,15 +7,15 @@
|
|||||||
#include <jni.h>
|
#include <jni.h>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <audio/orchestra/debug.h>
|
#include <audio/orchestra/debug.hpp>
|
||||||
#include <audio/orchestra/error.h>
|
#include <audio/orchestra/error.hpp>
|
||||||
#include <audio/orchestra/api/AndroidNativeInterface.h>
|
#include <audio/orchestra/api/AndroidNativeInterface.hpp>
|
||||||
#include <audio/orchestra/api/Android.h>
|
#include <audio/orchestra/api/Android.hpp>
|
||||||
/* include auto generated file */
|
/* include auto generated file */
|
||||||
#include <org_musicdsp_orchestra_OrchestraConstants.h>
|
#include <org_musicdsp_orchestra_OrchestraConstants.h>
|
||||||
#include <jvm-basics/jvm-basics.h>
|
#include <jvm-basics/jvm-basics.hpp>
|
||||||
#include <memory>
|
#include <ememory/memory.hpp>
|
||||||
#include <ejson/ejson.h>
|
#include <ejson/ejson.hpp>
|
||||||
|
|
||||||
class AndroidOrchestraContext {
|
class AndroidOrchestraContext {
|
||||||
public:
|
public:
|
||||||
@@ -247,36 +247,36 @@ class AndroidOrchestraContext {
|
|||||||
|
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
info.name = doc.getStringValue("name", "no-name");
|
info.name = doc["name"].toString().get("no-name");
|
||||||
if (doc.getStringValue("type", "output") == "output") {
|
if (doc["type"].toString().get("output") == "output") {
|
||||||
info.input = false;
|
info.input = false;
|
||||||
} else {
|
} else {
|
||||||
info.input = true;
|
info.input = true;
|
||||||
}
|
}
|
||||||
std::shared_ptr<const ejson::Array> list = doc.getArray("sample-rate");
|
ejson::Array list = doc["sample-rate"].toArray();
|
||||||
if (list != nullptr) {
|
if (list.exist() == true) {
|
||||||
for (size_t iii=0; iii<list->size(); ++iii) {
|
for (auto it : list) {
|
||||||
info.sampleRates.push_back(int32_t(list->getNumberValue(iii, 48000)));
|
info.sampleRates.push_back(int32_t(it.toNumber().get(48000)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
list = doc.getArray("channels");
|
list = doc["channels"].toArray();
|
||||||
if (list != nullptr) {
|
if (list.exist() == true) {
|
||||||
for (size_t iii=0; iii<list->size(); ++iii) {
|
for (auto it : list) {
|
||||||
info.channels.push_back(audio::getChannelFromString(list->getStringValue(iii, "???")));
|
info.channels.push_back(audio::getChannelFromString(it.toString().get("???")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
list = doc.getArray("format");
|
list = doc["format"].toArray();
|
||||||
if (list != nullptr) {
|
if (list.exist() == true) {
|
||||||
for (size_t iii=0; iii<list->size(); ++iii) {
|
for (auto it : list) {
|
||||||
info.nativeFormats.push_back(audio::getFormatFromString(list->getStringValue(iii, "???")));
|
info.nativeFormats.push_back(audio::getFormatFromString(it.toString().get("???")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
info.isDefault = doc.getBooleanValue("default", false);
|
info.isDefault = doc["default"].toBoolean().get(false);
|
||||||
info.isCorrect = true;
|
info.isCorrect = true;
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
std::vector<std::weak_ptr<audio::orchestra::api::Android> > m_instanceList; // list of connected handle ...
|
std::vector<ememory::WeakPtr<audio::orchestra::api::Android> > m_instanceList; // list of connected handle ...
|
||||||
//AndroidAudioCallback m_audioCallBack;
|
//AndroidAudioCallback m_audioCallBack;
|
||||||
//void* m_audioCallBackUserData;
|
//void* m_audioCallBackUserData;
|
||||||
public:
|
public:
|
||||||
@@ -288,7 +288,7 @@ class AndroidOrchestraContext {
|
|||||||
audio::format _format,
|
audio::format _format,
|
||||||
uint32_t *_bufferSize,
|
uint32_t *_bufferSize,
|
||||||
const audio::orchestra::StreamOptions& _options,
|
const audio::orchestra::StreamOptions& _options,
|
||||||
std::shared_ptr<audio::orchestra::api::Android> _instance) {
|
ememory::SharedPtr<audio::orchestra::api::Android> _instance) {
|
||||||
ATA_DEBUG("C->java : audio open device");
|
ATA_DEBUG("C->java : audio open device");
|
||||||
int status;
|
int status;
|
||||||
if(!java_attach_current_thread(&status)) {
|
if(!java_attach_current_thread(&status)) {
|
||||||
@@ -395,7 +395,7 @@ class AndroidOrchestraContext {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static std::shared_ptr<AndroidOrchestraContext> s_localContext;
|
static ememory::SharedPtr<AndroidOrchestraContext> s_localContext;
|
||||||
static int32_t s_nbContextRequested(0);
|
static int32_t s_nbContextRequested(0);
|
||||||
|
|
||||||
|
|
||||||
@@ -422,7 +422,7 @@ int32_t audio::orchestra::api::android::open(uint32_t _device,
|
|||||||
audio::format _format,
|
audio::format _format,
|
||||||
uint32_t *_bufferSize,
|
uint32_t *_bufferSize,
|
||||||
const audio::orchestra::StreamOptions& _options,
|
const audio::orchestra::StreamOptions& _options,
|
||||||
std::shared_ptr<audio::orchestra::api::Android> _instance) {
|
ememory::SharedPtr<audio::orchestra::api::Android> _instance) {
|
||||||
if (s_localContext == nullptr) {
|
if (s_localContext == nullptr) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -468,7 +468,7 @@ extern "C" {
|
|||||||
if (s_localContext != nullptr) {
|
if (s_localContext != nullptr) {
|
||||||
s_nbContextRequested++;
|
s_nbContextRequested++;
|
||||||
}
|
}
|
||||||
s_localContext = std::make_shared<AndroidOrchestraContext>(_env, _classBase, _objCallback);
|
s_localContext = ememory::makeShared<AndroidOrchestraContext>(_env, _classBase, _objCallback);
|
||||||
if (s_localContext == nullptr) {
|
if (s_localContext == nullptr) {
|
||||||
ATA_ERROR("Can not allocate the orchestra main context instance");
|
ATA_ERROR("Can not allocate the orchestra main context instance");
|
||||||
return;
|
return;
|
||||||
|
@@ -7,12 +7,12 @@
|
|||||||
|
|
||||||
#ifdef ORCHESTRA_BUILD_JAVA
|
#ifdef ORCHESTRA_BUILD_JAVA
|
||||||
|
|
||||||
#include <audio/orchestra/DeviceInfo.h>
|
#include <audio/orchestra/DeviceInfo.hpp>
|
||||||
#include <audio/orchestra/mode.h>
|
#include <audio/orchestra/mode.hpp>
|
||||||
#include <audio/orchestra/error.h>
|
#include <audio/orchestra/error.hpp>
|
||||||
#include <audio/orchestra/StreamOptions.h>
|
#include <audio/orchestra/StreamOptions.hpp>
|
||||||
#include <audio/format.h>
|
#include <audio/format.hpp>
|
||||||
#include <memory>
|
#include <ememory/memory.hpp>
|
||||||
|
|
||||||
namespace audio {
|
namespace audio {
|
||||||
namespace orchestra {
|
namespace orchestra {
|
||||||
@@ -29,7 +29,7 @@ namespace audio {
|
|||||||
audio::format _format,
|
audio::format _format,
|
||||||
uint32_t *_bufferSize,
|
uint32_t *_bufferSize,
|
||||||
const audio::orchestra::StreamOptions& _options,
|
const audio::orchestra::StreamOptions& _options,
|
||||||
std::shared_ptr<audio::orchestra::api::Android> _instance);
|
ememory::SharedPtr<audio::orchestra::api::Android> _instance);
|
||||||
enum audio::orchestra::error closeStream(int32_t _id);
|
enum audio::orchestra::error closeStream(int32_t _id);
|
||||||
enum audio::orchestra::error startStream(int32_t _id);
|
enum audio::orchestra::error startStream(int32_t _id);
|
||||||
enum audio::orchestra::error stopStream(int32_t _id);
|
enum audio::orchestra::error stopStream(int32_t _id);
|
@@ -8,11 +8,11 @@
|
|||||||
|
|
||||||
#if defined(ORCHESTRA_BUILD_ASIO)
|
#if defined(ORCHESTRA_BUILD_ASIO)
|
||||||
|
|
||||||
#include <audio/orchestra/Interface.h>
|
#include <audio/orchestra/Interface.hpp>
|
||||||
#include <audio/orchestra/debug.h>
|
#include <audio/orchestra/debug.hpp>
|
||||||
|
|
||||||
std::shared_ptr<audio::orchestra::Api> audio::orchestra::api::Asio::create() {
|
ememory::SharedPtr<audio::orchestra::Api> audio::orchestra::api::Asio::create() {
|
||||||
return std::shared_ptr<audio::orchestra::Api>(new audio::orchestra::api::Asio());
|
return ememory::SharedPtr<audio::orchestra::api::Asio>(new audio::orchestra::api::Asio());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -38,9 +38,6 @@ std::shared_ptr<audio::orchestra::Api> audio::orchestra::api::Asio::create() {
|
|||||||
#include "asiodrivers.h"
|
#include "asiodrivers.h"
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
#undef __class__
|
|
||||||
#define __class__ "api::Asio"
|
|
||||||
|
|
||||||
static AsioDrivers drivers;
|
static AsioDrivers drivers;
|
||||||
static ASIOCallbacks asioCallbacks;
|
static ASIOCallbacks asioCallbacks;
|
||||||
static ASIODriverInfo driverInfo;
|
static ASIODriverInfo driverInfo;
|
||||||
@@ -90,7 +87,7 @@ audio::orchestra::api::Asio::Asio() :
|
|||||||
}
|
}
|
||||||
|
|
||||||
audio::orchestra::api::Asio::~Asio() {
|
audio::orchestra::api::Asio::~Asio() {
|
||||||
if (m_state != audio::orchestra::state_closed) {
|
if (m_state != audio::orchestra::state::closed) {
|
||||||
closeStream();
|
closeStream();
|
||||||
}
|
}
|
||||||
if (m_coInitialized) {
|
if (m_coInitialized) {
|
||||||
@@ -116,7 +113,7 @@ rtaudio::DeviceInfo audio::orchestra::api::Asio::getDeviceInfo(uint32_t _device)
|
|||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
// If a stream is already open, we cannot probe other devices. Thus, use the saved results.
|
// If a stream is already open, we cannot probe other devices. Thus, use the saved results.
|
||||||
if (m_state != audio::orchestra::state_closed) {
|
if (m_state != audio::orchestra::state::closed) {
|
||||||
if (_device >= m_devices.size()) {
|
if (_device >= m_devices.size()) {
|
||||||
ATA_ERROR("device ID was not present before stream was opened.");
|
ATA_ERROR("device ID was not present before stream was opened.");
|
||||||
return info;
|
return info;
|
||||||
@@ -503,7 +500,7 @@ bool audio::orchestra::api::Asio::open(uint32_t _device,
|
|||||||
}
|
}
|
||||||
m_sampleRate = _sampleRate;
|
m_sampleRate = _sampleRate;
|
||||||
m_device[modeToIdTable(_mode)] = _device;
|
m_device[modeToIdTable(_mode)] = _device;
|
||||||
m_state = audio::orchestra::state_stopped;
|
m_state = audio::orchestra::state::stopped;
|
||||||
if ( _mode == audio::orchestra::mode_output
|
if ( _mode == audio::orchestra::mode_output
|
||||||
&& _mode == audio::orchestra::mode_input) {
|
&& _mode == audio::orchestra::mode_input) {
|
||||||
// We had already set up an output stream.
|
// We had already set up an output stream.
|
||||||
@@ -550,12 +547,12 @@ error:
|
|||||||
}
|
}
|
||||||
|
|
||||||
enum audio::orchestra::error audio::orchestra::api::Asio::closeStream() {
|
enum audio::orchestra::error audio::orchestra::api::Asio::closeStream() {
|
||||||
if (m_state == audio::orchestra::state_closed) {
|
if (m_state == audio::orchestra::state::closed) {
|
||||||
ATA_ERROR("no open stream to close!");
|
ATA_ERROR("no open stream to close!");
|
||||||
return audio::orchestra::error_warning;
|
return audio::orchestra::error_warning;
|
||||||
}
|
}
|
||||||
if (m_state == audio::orchestra::state_running) {
|
if (m_state == audio::orchestra::state::running) {
|
||||||
m_state = audio::orchestra::state_stopped;
|
m_state = audio::orchestra::state::stopped;
|
||||||
ASIOStop();
|
ASIOStop();
|
||||||
}
|
}
|
||||||
ASIODisposeBuffers();
|
ASIODisposeBuffers();
|
||||||
@@ -575,7 +572,7 @@ enum audio::orchestra::error audio::orchestra::api::Asio::closeStream() {
|
|||||||
m_deviceBuffer = 0;
|
m_deviceBuffer = 0;
|
||||||
}
|
}
|
||||||
m_mode = audio::orchestra::mode_unknow;
|
m_mode = audio::orchestra::mode_unknow;
|
||||||
m_state = audio::orchestra::state_closed;
|
m_state = audio::orchestra::state::closed;
|
||||||
return audio::orchestra::error_none;
|
return audio::orchestra::error_none;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -587,7 +584,7 @@ enum audio::orchestra::error audio::orchestra::api::Asio::startStream() {
|
|||||||
if (verifyStream() != audio::orchestra::error_none) {
|
if (verifyStream() != audio::orchestra::error_none) {
|
||||||
return audio::orchestra::error_fail;
|
return audio::orchestra::error_fail;
|
||||||
}
|
}
|
||||||
if (m_state == audio::orchestra::state_running) {
|
if (m_state == audio::orchestra::state::running) {
|
||||||
ATA_ERROR("the stream is already running!");
|
ATA_ERROR("the stream is already running!");
|
||||||
return audio::orchestra::error_warning;
|
return audio::orchestra::error_warning;
|
||||||
}
|
}
|
||||||
@@ -599,7 +596,7 @@ enum audio::orchestra::error audio::orchestra::api::Asio::startStream() {
|
|||||||
m_private->drainCounter = 0;
|
m_private->drainCounter = 0;
|
||||||
m_private->internalDrain = false;
|
m_private->internalDrain = false;
|
||||||
ResetEvent(m_private->condition);
|
ResetEvent(m_private->condition);
|
||||||
m_state = audio::orchestra::state_running;
|
m_state = audio::orchestra::state::running;
|
||||||
asioXRun = false;
|
asioXRun = false;
|
||||||
unlock:
|
unlock:
|
||||||
stopThreadCalled = false;
|
stopThreadCalled = false;
|
||||||
@@ -613,7 +610,7 @@ enum audio::orchestra::error audio::orchestra::api::Asio::stopStream() {
|
|||||||
if (verifyStream() != audio::orchestra::error_none) {
|
if (verifyStream() != audio::orchestra::error_none) {
|
||||||
return audio::orchestra::error_fail;
|
return audio::orchestra::error_fail;
|
||||||
}
|
}
|
||||||
if (m_state == audio::orchestra::state_stopped) {
|
if (m_state == audio::orchestra::state::stopped) {
|
||||||
ATA_ERROR("the stream is already stopped!");
|
ATA_ERROR("the stream is already stopped!");
|
||||||
return audio::orchestra::error_warning;
|
return audio::orchestra::error_warning;
|
||||||
}
|
}
|
||||||
@@ -623,7 +620,7 @@ enum audio::orchestra::error audio::orchestra::api::Asio::stopStream() {
|
|||||||
WaitForSingleObject(m_private->condition, INFINITE); // block until signaled
|
WaitForSingleObject(m_private->condition, INFINITE); // block until signaled
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_state = audio::orchestra::state_stopped;
|
m_state = audio::orchestra::state::stopped;
|
||||||
ASIOError result = ASIOStop();
|
ASIOError result = ASIOStop();
|
||||||
if (result != ASE_OK) {
|
if (result != ASE_OK) {
|
||||||
ATA_ERROR("error (" << getAsioErrorString(result) << ") stopping device.");
|
ATA_ERROR("error (" << getAsioErrorString(result) << ") stopping device.");
|
||||||
@@ -638,7 +635,7 @@ enum audio::orchestra::error audio::orchestra::api::Asio::abortStream() {
|
|||||||
if (verifyStream() != audio::orchestra::error_none) {
|
if (verifyStream() != audio::orchestra::error_none) {
|
||||||
return audio::orchestra::error_fail;
|
return audio::orchestra::error_fail;
|
||||||
}
|
}
|
||||||
if (m_state == audio::orchestra::state_stopped) {
|
if (m_state == audio::orchestra::state::stopped) {
|
||||||
ATA_ERROR("the stream is already stopped!");
|
ATA_ERROR("the stream is already stopped!");
|
||||||
error(audio::orchestra::error_warning);
|
error(audio::orchestra::error_warning);
|
||||||
return;
|
return;
|
||||||
@@ -666,18 +663,18 @@ static unsigned __stdcall asioStopStream(void *_ptr) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool audio::orchestra::api::Asio::callbackEvent(long bufferIndex) {
|
bool audio::orchestra::api::Asio::callbackEvent(long bufferIndex) {
|
||||||
if ( m_state == audio::orchestra::state_stopped
|
if ( m_state == audio::orchestra::state::stopped
|
||||||
|| m_state == audio::orchestra::state_stopping) {
|
|| m_state == audio::orchestra::state::stopping) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (m_state == audio::orchestra::state_closed) {
|
if (m_state == audio::orchestra::state::closed) {
|
||||||
ATA_ERROR("the stream is closed ... this shouldn't happen!");
|
ATA_ERROR("the stream is closed ... this shouldn't happen!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
CallbackInfo *info = (CallbackInfo *) &m_callbackInfo;
|
CallbackInfo *info = (CallbackInfo *) &m_callbackInfo;
|
||||||
// Check if we were draining the stream and signal if finished.
|
// Check if we were draining the stream and signal if finished.
|
||||||
if (m_private->drainCounter > 3) {
|
if (m_private->drainCounter > 3) {
|
||||||
m_state = audio::orchestra::state_stopping;
|
m_state = audio::orchestra::state::stopping;
|
||||||
if (m_private->internalDrain == false) {
|
if (m_private->internalDrain == false) {
|
||||||
SetEvent(m_private->condition);
|
SetEvent(m_private->condition);
|
||||||
} else { // spawn a thread to stop the stream
|
} else { // spawn a thread to stop the stream
|
||||||
@@ -697,11 +694,11 @@ bool audio::orchestra::api::Asio::callbackEvent(long bufferIndex) {
|
|||||||
audio::Time streamTime = getStreamTime();
|
audio::Time streamTime = getStreamTime();
|
||||||
std::vector<enum audio::orchestra::status status;
|
std::vector<enum audio::orchestra::status status;
|
||||||
if (m_mode != audio::orchestra::mode_input && asioXRun == true) {
|
if (m_mode != audio::orchestra::mode_input && asioXRun == true) {
|
||||||
status.push_back(audio::orchestra::status_underflow);
|
status.push_back(audio::orchestra::status::underflow);
|
||||||
asioXRun = false;
|
asioXRun = false;
|
||||||
}
|
}
|
||||||
if (m_mode != audio::orchestra::mode_output && asioXRun == true) {
|
if (m_mode != audio::orchestra::mode_output && asioXRun == true) {
|
||||||
status.push_back(audio::orchestra::status_underflow;
|
status.push_back(audio::orchestra::status::underflow;
|
||||||
asioXRun = false;
|
asioXRun = false;
|
||||||
}
|
}
|
||||||
int32_t cbReturnValue = info->callback(m_userBuffer[1],
|
int32_t cbReturnValue = info->callback(m_userBuffer[1],
|
||||||
@@ -711,7 +708,7 @@ bool audio::orchestra::api::Asio::callbackEvent(long bufferIndex) {
|
|||||||
m_bufferSize,
|
m_bufferSize,
|
||||||
status);
|
status);
|
||||||
if (cbReturnValue == 2) {
|
if (cbReturnValue == 2) {
|
||||||
m_state = audio::orchestra::state_stopping;
|
m_state = audio::orchestra::state::stopping;
|
||||||
m_private->drainCounter = 2;
|
m_private->drainCounter = 2;
|
||||||
unsigned threadId;
|
unsigned threadId;
|
||||||
m_callbackInfo.thread = _beginthreadex(nullptr,
|
m_callbackInfo.thread = _beginthreadex(nullptr,
|
||||||
|
@@ -13,12 +13,12 @@ namespace audio {
|
|||||||
class AsioPrivate:
|
class AsioPrivate:
|
||||||
class Asio: public audio::orchestra::Api {
|
class Asio: public audio::orchestra::Api {
|
||||||
public:
|
public:
|
||||||
static std::shared_ptr<audio::orchestra::Api> create();
|
static ememory::SharedPtr<audio::orchestra::Api> create();
|
||||||
public:
|
public:
|
||||||
Asio();
|
Asio();
|
||||||
virtual ~Asio();
|
virtual ~Asio();
|
||||||
const std::string& getCurrentApi() {
|
const std::string& getCurrentApi() {
|
||||||
return audio::orchestra::WINDOWS_ASIO;
|
return audio::orchestra::typeAsio;
|
||||||
}
|
}
|
||||||
uint32_t getDeviceCount();
|
uint32_t getDeviceCount();
|
||||||
audio::orchestra::DeviceInfo getDeviceInfo(uint32_t _device);
|
audio::orchestra::DeviceInfo getDeviceInfo(uint32_t _device);
|
||||||
@@ -33,7 +33,7 @@ namespace audio {
|
|||||||
// will most likely produce highly undesireable results!
|
// will most likely produce highly undesireable results!
|
||||||
bool callbackEvent(long _bufferIndex);
|
bool callbackEvent(long _bufferIndex);
|
||||||
private:
|
private:
|
||||||
std::shared_ptr<AsioPrivate> m_private;
|
ememory::SharedPtr<AsioPrivate> m_private;
|
||||||
std::vector<audio::orchestra::DeviceInfo> m_devices;
|
std::vector<audio::orchestra::DeviceInfo> m_devices;
|
||||||
void saveDeviceInfo();
|
void saveDeviceInfo();
|
||||||
bool m_coInitialized;
|
bool m_coInitialized;
|
@@ -14,19 +14,16 @@
|
|||||||
|
|
||||||
#if defined(__MACOSX_CORE__) || defined(ORCHESTRA_BUILD_MACOSX_CORE)
|
#if defined(__MACOSX_CORE__) || defined(ORCHESTRA_BUILD_MACOSX_CORE)
|
||||||
|
|
||||||
#include <audio/orchestra/Interface.h>
|
#include <audio/orchestra/Interface.hpp>
|
||||||
#include <audio/orchestra/debug.h>
|
#include <audio/orchestra/debug.hpp>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
#include <ethread/tools.h>
|
#include <ethread/tools.hpp>
|
||||||
#include <audio/orchestra/api/Core.h>
|
#include <audio/orchestra/api/Core.hpp>
|
||||||
|
|
||||||
std::shared_ptr<audio::orchestra::Api> audio::orchestra::api::Core::create() {
|
ememory::SharedPtr<audio::orchestra::Api> audio::orchestra::api::Core::create() {
|
||||||
return std::shared_ptr<audio::orchestra::Api>(new audio::orchestra::api::Core());
|
return ememory::SharedPtr<audio::orchestra::api::Core>(new audio::orchestra::api::Core());
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef __class__
|
|
||||||
#define __class__ "api::Core"
|
|
||||||
|
|
||||||
namespace audio {
|
namespace audio {
|
||||||
namespace orchestra {
|
namespace orchestra {
|
||||||
namespace api {
|
namespace api {
|
||||||
@@ -88,7 +85,7 @@ audio::orchestra::api::Core::~Core() {
|
|||||||
// The subclass destructor gets called before the base class
|
// The subclass destructor gets called before the base class
|
||||||
// destructor, so close an existing stream before deallocating
|
// destructor, so close an existing stream before deallocating
|
||||||
// apiDeviceId memory.
|
// apiDeviceId memory.
|
||||||
if (m_state != audio::orchestra::state_closed) {
|
if (m_state != audio::orchestra::state::closed) {
|
||||||
closeStream();
|
closeStream();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -638,7 +635,7 @@ bool audio::orchestra::api::Core::open(uint32_t _device,
|
|||||||
if (microCounter > 5000000) {
|
if (microCounter > 5000000) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
usleep(5000);
|
std::this_thread::sleep_for(std::chrono::milliseconds(5));
|
||||||
}
|
}
|
||||||
// Remove the property listener.
|
// Remove the property listener.
|
||||||
AudioObjectRemovePropertyListener(id, &tmp, &rateListener, (void *) &reportedRate);
|
AudioObjectRemovePropertyListener(id, &tmp, &rateListener, (void *) &reportedRate);
|
||||||
@@ -828,7 +825,7 @@ bool audio::orchestra::api::Core::open(uint32_t _device,
|
|||||||
}
|
}
|
||||||
m_sampleRate = _sampleRate;
|
m_sampleRate = _sampleRate;
|
||||||
m_device[modeToIdTable(_mode)] = _device;
|
m_device[modeToIdTable(_mode)] = _device;
|
||||||
m_state = audio::orchestra::state_stopped;
|
m_state = audio::orchestra::state::stopped;
|
||||||
ATA_VERBOSE("Set state as stopped");
|
ATA_VERBOSE("Set state as stopped");
|
||||||
// Setup the buffer conversion information structure.
|
// Setup the buffer conversion information structure.
|
||||||
if (m_doConvertBuffer[modeToIdTable(_mode)]) {
|
if (m_doConvertBuffer[modeToIdTable(_mode)]) {
|
||||||
@@ -872,19 +869,19 @@ error:
|
|||||||
free(m_deviceBuffer);
|
free(m_deviceBuffer);
|
||||||
m_deviceBuffer = 0;
|
m_deviceBuffer = 0;
|
||||||
}
|
}
|
||||||
m_state = audio::orchestra::state_closed;
|
m_state = audio::orchestra::state::closed;
|
||||||
ATA_VERBOSE("Set state as closed");
|
ATA_VERBOSE("Set state as closed");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum audio::orchestra::error audio::orchestra::api::Core::closeStream() {
|
enum audio::orchestra::error audio::orchestra::api::Core::closeStream() {
|
||||||
if (m_state == audio::orchestra::state_closed) {
|
if (m_state == audio::orchestra::state::closed) {
|
||||||
ATA_ERROR("no open stream to close!");
|
ATA_ERROR("no open stream to close!");
|
||||||
return audio::orchestra::error_warning;
|
return audio::orchestra::error_warning;
|
||||||
}
|
}
|
||||||
if ( m_mode == audio::orchestra::mode_output
|
if ( m_mode == audio::orchestra::mode_output
|
||||||
|| m_mode == audio::orchestra::mode_duplex) {
|
|| m_mode == audio::orchestra::mode_duplex) {
|
||||||
if (m_state == audio::orchestra::state_running) {
|
if (m_state == audio::orchestra::state::running) {
|
||||||
AudioDeviceStop(m_private->id[0], &audio::orchestra::api::Core::callbackEvent);
|
AudioDeviceStop(m_private->id[0], &audio::orchestra::api::Core::callbackEvent);
|
||||||
}
|
}
|
||||||
#if defined(MAC_OS_X_VERSION_10_5) && (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5)
|
#if defined(MAC_OS_X_VERSION_10_5) && (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5)
|
||||||
@@ -897,7 +894,7 @@ enum audio::orchestra::error audio::orchestra::api::Core::closeStream() {
|
|||||||
if ( m_mode == audio::orchestra::mode_input
|
if ( m_mode == audio::orchestra::mode_input
|
||||||
|| ( m_mode == audio::orchestra::mode_duplex
|
|| ( m_mode == audio::orchestra::mode_duplex
|
||||||
&& m_device[0] != m_device[1])) {
|
&& m_device[0] != m_device[1])) {
|
||||||
if (m_state == audio::orchestra::state_running) {
|
if (m_state == audio::orchestra::state::running) {
|
||||||
AudioDeviceStop(m_private->id[1], &audio::orchestra::api::Core::callbackEvent);
|
AudioDeviceStop(m_private->id[1], &audio::orchestra::api::Core::callbackEvent);
|
||||||
}
|
}
|
||||||
#if defined(MAC_OS_X_VERSION_10_5) && (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5)
|
#if defined(MAC_OS_X_VERSION_10_5) && (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5)
|
||||||
@@ -914,7 +911,7 @@ enum audio::orchestra::error audio::orchestra::api::Core::closeStream() {
|
|||||||
m_deviceBuffer = nullptr;
|
m_deviceBuffer = nullptr;
|
||||||
}
|
}
|
||||||
m_mode = audio::orchestra::mode_unknow;
|
m_mode = audio::orchestra::mode_unknow;
|
||||||
m_state = audio::orchestra::state_closed;
|
m_state = audio::orchestra::state::closed;
|
||||||
ATA_VERBOSE("Set state as closed");
|
ATA_VERBOSE("Set state as closed");
|
||||||
return audio::orchestra::error_none;
|
return audio::orchestra::error_none;
|
||||||
}
|
}
|
||||||
@@ -925,7 +922,7 @@ enum audio::orchestra::error audio::orchestra::api::Core::startStream() {
|
|||||||
if (verifyStream() != audio::orchestra::error_none) {
|
if (verifyStream() != audio::orchestra::error_none) {
|
||||||
return audio::orchestra::error_fail;
|
return audio::orchestra::error_fail;
|
||||||
}
|
}
|
||||||
if (m_state == audio::orchestra::state_running) {
|
if (m_state == audio::orchestra::state::running) {
|
||||||
ATA_ERROR("the stream is already running!");
|
ATA_ERROR("the stream is already running!");
|
||||||
return audio::orchestra::error_warning;
|
return audio::orchestra::error_warning;
|
||||||
}
|
}
|
||||||
@@ -949,7 +946,7 @@ enum audio::orchestra::error audio::orchestra::api::Core::startStream() {
|
|||||||
}
|
}
|
||||||
m_private->drainCounter = 0;
|
m_private->drainCounter = 0;
|
||||||
m_private->internalDrain = false;
|
m_private->internalDrain = false;
|
||||||
m_state = audio::orchestra::state_running;
|
m_state = audio::orchestra::state::running;
|
||||||
ATA_VERBOSE("Set state as running");
|
ATA_VERBOSE("Set state as running");
|
||||||
unlock:
|
unlock:
|
||||||
if (result == noErr) {
|
if (result == noErr) {
|
||||||
@@ -962,7 +959,7 @@ enum audio::orchestra::error audio::orchestra::api::Core::stopStream() {
|
|||||||
if (verifyStream() != audio::orchestra::error_none) {
|
if (verifyStream() != audio::orchestra::error_none) {
|
||||||
return audio::orchestra::error_fail;
|
return audio::orchestra::error_fail;
|
||||||
}
|
}
|
||||||
if (m_state == audio::orchestra::state_stopped) {
|
if (m_state == audio::orchestra::state::stopped) {
|
||||||
ATA_ERROR("the stream is already stopped!");
|
ATA_ERROR("the stream is already stopped!");
|
||||||
return audio::orchestra::error_warning;
|
return audio::orchestra::error_warning;
|
||||||
}
|
}
|
||||||
@@ -989,7 +986,7 @@ enum audio::orchestra::error audio::orchestra::api::Core::stopStream() {
|
|||||||
goto unlock;
|
goto unlock;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_state = audio::orchestra::state_stopped;
|
m_state = audio::orchestra::state::stopped;
|
||||||
ATA_VERBOSE("Set state as stopped");
|
ATA_VERBOSE("Set state as stopped");
|
||||||
unlock:
|
unlock:
|
||||||
if (result == noErr) {
|
if (result == noErr) {
|
||||||
@@ -1002,7 +999,7 @@ enum audio::orchestra::error audio::orchestra::api::Core::abortStream() {
|
|||||||
if (verifyStream() != audio::orchestra::error_none) {
|
if (verifyStream() != audio::orchestra::error_none) {
|
||||||
return audio::orchestra::error_fail;
|
return audio::orchestra::error_fail;
|
||||||
}
|
}
|
||||||
if (m_state == audio::orchestra::state_stopped) {
|
if (m_state == audio::orchestra::state::stopped) {
|
||||||
ATA_ERROR("the stream is already stopped!");
|
ATA_ERROR("the stream is already stopped!");
|
||||||
return audio::orchestra::error_warning;
|
return audio::orchestra::error_warning;
|
||||||
}
|
}
|
||||||
@@ -1026,17 +1023,17 @@ bool audio::orchestra::api::Core::callbackEvent(AudioDeviceID _deviceId,
|
|||||||
const audio::Time& _inTime,
|
const audio::Time& _inTime,
|
||||||
const AudioBufferList *_outBufferList,
|
const AudioBufferList *_outBufferList,
|
||||||
const audio::Time& _outTime) {
|
const audio::Time& _outTime) {
|
||||||
if ( m_state == audio::orchestra::state_stopped
|
if ( m_state == audio::orchestra::state::stopped
|
||||||
|| m_state == audio::orchestra::state_stopping) {
|
|| m_state == audio::orchestra::state::stopping) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (m_state == audio::orchestra::state_closed) {
|
if (m_state == audio::orchestra::state::closed) {
|
||||||
ATA_ERROR("the stream is closed ... this shouldn't happen!");
|
ATA_ERROR("the stream is closed ... this shouldn't happen!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// Check if we were draining the stream and signal is finished.
|
// Check if we were draining the stream and signal is finished.
|
||||||
if (m_private->drainCounter > 3) {
|
if (m_private->drainCounter > 3) {
|
||||||
m_state = audio::orchestra::state_stopping;
|
m_state = audio::orchestra::state::stopping;
|
||||||
ATA_VERBOSE("Set state as stopping");
|
ATA_VERBOSE("Set state as stopping");
|
||||||
if (m_private->internalDrain == true) {
|
if (m_private->internalDrain == true) {
|
||||||
new std::thread(&audio::orchestra::api::Core::coreStopStream, this);
|
new std::thread(&audio::orchestra::api::Core::coreStopStream, this);
|
||||||
@@ -1054,12 +1051,12 @@ bool audio::orchestra::api::Core::callbackEvent(AudioDeviceID _deviceId,
|
|||||||
std::vector<enum audio::orchestra::status> status;
|
std::vector<enum audio::orchestra::status> status;
|
||||||
if ( m_mode != audio::orchestra::mode_input
|
if ( m_mode != audio::orchestra::mode_input
|
||||||
&& m_private->xrun[0] == true) {
|
&& m_private->xrun[0] == true) {
|
||||||
status.push_back(audio::orchestra::status_underflow);
|
status.push_back(audio::orchestra::status::underflow);
|
||||||
m_private->xrun[0] = false;
|
m_private->xrun[0] = false;
|
||||||
}
|
}
|
||||||
if ( m_mode != audio::orchestra::mode_output
|
if ( m_mode != audio::orchestra::mode_output
|
||||||
&& m_private->xrun[1] == true) {
|
&& m_private->xrun[1] == true) {
|
||||||
status.push_back(audio::orchestra::status_overflow);
|
status.push_back(audio::orchestra::status::overflow);
|
||||||
m_private->xrun[1] = false;
|
m_private->xrun[1] = false;
|
||||||
}
|
}
|
||||||
int32_t cbReturnValue = m_callback(&m_userBuffer[1][0],
|
int32_t cbReturnValue = m_callback(&m_userBuffer[1][0],
|
||||||
@@ -1069,7 +1066,7 @@ bool audio::orchestra::api::Core::callbackEvent(AudioDeviceID _deviceId,
|
|||||||
m_bufferSize,
|
m_bufferSize,
|
||||||
status);
|
status);
|
||||||
if (cbReturnValue == 2) {
|
if (cbReturnValue == 2) {
|
||||||
m_state = audio::orchestra::state_stopping;
|
m_state = audio::orchestra::state::stopping;
|
||||||
ATA_VERBOSE("Set state as stopping");
|
ATA_VERBOSE("Set state as stopping");
|
||||||
m_private->drainCounter = 2;
|
m_private->drainCounter = 2;
|
||||||
abortStream();
|
abortStream();
|
||||||
|
@@ -16,12 +16,12 @@ namespace audio {
|
|||||||
class CorePrivate;
|
class CorePrivate;
|
||||||
class Core: public audio::orchestra::Api {
|
class Core: public audio::orchestra::Api {
|
||||||
public:
|
public:
|
||||||
static std::shared_ptr<audio::orchestra::Api> create();
|
static ememory::SharedPtr<audio::orchestra::Api> create();
|
||||||
public:
|
public:
|
||||||
Core();
|
Core();
|
||||||
virtual ~Core();
|
virtual ~Core();
|
||||||
const std::string& getCurrentApi() {
|
const std::string& getCurrentApi() {
|
||||||
return audio::orchestra::type_coreOSX;
|
return audio::orchestra::typeCoreOSX;
|
||||||
}
|
}
|
||||||
uint32_t getDeviceCount();
|
uint32_t getDeviceCount();
|
||||||
audio::orchestra::DeviceInfo getDeviceInfo(uint32_t _device);
|
audio::orchestra::DeviceInfo getDeviceInfo(uint32_t _device);
|
||||||
@@ -46,7 +46,7 @@ namespace audio {
|
|||||||
void* _infoPointer);
|
void* _infoPointer);
|
||||||
static void coreStopStream(void *_userData);
|
static void coreStopStream(void *_userData);
|
||||||
private:
|
private:
|
||||||
std::shared_ptr<CorePrivate> m_private;
|
ememory::SharedPtr<CorePrivate> m_private;
|
||||||
bool open(uint32_t _device,
|
bool open(uint32_t _device,
|
||||||
audio::orchestra::mode _mode,
|
audio::orchestra::mode _mode,
|
||||||
uint32_t _channels,
|
uint32_t _channels,
|
@@ -13,12 +13,12 @@ namespace audio {
|
|||||||
class CoreIosPrivate;
|
class CoreIosPrivate;
|
||||||
class CoreIos: public audio::orchestra::Api {
|
class CoreIos: public audio::orchestra::Api {
|
||||||
public:
|
public:
|
||||||
static std::shared_ptr<audio::orchestra::Api> create();
|
static ememory::SharedPtr<audio::orchestra::Api> create();
|
||||||
public:
|
public:
|
||||||
CoreIos();
|
CoreIos();
|
||||||
virtual ~CoreIos();
|
virtual ~CoreIos();
|
||||||
const std::string& getCurrentApi() {
|
const std::string& getCurrentApi() {
|
||||||
return audio::orchestra::type_coreIOS;
|
return audio::orchestra::typeCoreIOS;
|
||||||
}
|
}
|
||||||
uint32_t getDeviceCount();
|
uint32_t getDeviceCount();
|
||||||
audio::orchestra::DeviceInfo getDeviceInfo(uint32_t _device);
|
audio::orchestra::DeviceInfo getDeviceInfo(uint32_t _device);
|
||||||
@@ -47,7 +47,9 @@ namespace audio {
|
|||||||
int32_t _nbChunk,
|
int32_t _nbChunk,
|
||||||
const audio::Time& _time);
|
const audio::Time& _time);
|
||||||
public:
|
public:
|
||||||
std::shared_ptr<CoreIosPrivate> m_private;
|
ememory::SharedPtr<CoreIosPrivate> m_private;
|
||||||
|
uint32_t getDefaultInputDevice();
|
||||||
|
uint32_t getDefaultOutputDevice();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -10,18 +10,15 @@
|
|||||||
#import <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
#import <AudioToolbox/AudioToolbox.h>
|
#import <AudioToolbox/AudioToolbox.h>
|
||||||
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <audio/orchestra/Interface.h>
|
|
||||||
#include <audio/orchestra/debug.h>
|
|
||||||
#include <limits.h>
|
|
||||||
#include <audio/orchestra/api/CoreIos.h>
|
|
||||||
|
|
||||||
#undef __class__
|
#include <audio/orchestra/Interface.hpp>
|
||||||
#define __class__ "api::CoreIos"
|
#include <audio/orchestra/debug.hpp>
|
||||||
|
#include <climits>
|
||||||
|
#include <audio/orchestra/api/CoreIos.hpp>
|
||||||
|
|
||||||
std::shared_ptr<audio::orchestra::Api> audio::orchestra::api::CoreIos::create() {
|
ememory::SharedPtr<audio::orchestra::Api> audio::orchestra::api::CoreIos::create() {
|
||||||
ATA_INFO("Create CoreIos device ... ");
|
ATA_INFO("Create CoreIos device ... ");
|
||||||
return std::shared_ptr<audio::orchestra::Api>(new audio::orchestra::api::CoreIos());
|
return ememory::SharedPtr<audio::orchestra::api::CoreIos>(new audio::orchestra::api::CoreIos());
|
||||||
}
|
}
|
||||||
|
|
||||||
#define kOutputBus 0
|
#define kOutputBus 0
|
||||||
@@ -40,7 +37,7 @@ namespace audio {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
audio::orchestra::api::CoreIos::CoreIos(void) :
|
audio::orchestra::api::CoreIos::CoreIos() :
|
||||||
m_private(new audio::orchestra::api::CoreIosPrivate()) {
|
m_private(new audio::orchestra::api::CoreIosPrivate()) {
|
||||||
ATA_INFO("new CoreIos");
|
ATA_INFO("new CoreIos");
|
||||||
int32_t deviceCount = 2;
|
int32_t deviceCount = 2;
|
||||||
@@ -48,45 +45,67 @@ audio::orchestra::api::CoreIos::CoreIos(void) :
|
|||||||
audio::orchestra::DeviceInfo tmp;
|
audio::orchestra::DeviceInfo tmp;
|
||||||
// Add default output format :
|
// Add default output format :
|
||||||
tmp.name = "speaker";
|
tmp.name = "speaker";
|
||||||
|
tmp.input = false;
|
||||||
tmp.sampleRates.push_back(48000);
|
tmp.sampleRates.push_back(48000);
|
||||||
tmp.channels.push_back(audio::channel_frontRight);
|
tmp.channels.push_back(audio::channel_frontRight);
|
||||||
tmp.channels.push_back(audio::channel_frontLeft);
|
tmp.channels.push_back(audio::channel_frontLeft);
|
||||||
tmp.isDefault = true;
|
|
||||||
tmp.nativeFormats.push_back(audio::format_int16);
|
tmp.nativeFormats.push_back(audio::format_int16);
|
||||||
|
tmp.isDefault = true;
|
||||||
|
tmp.isCorrect = true;
|
||||||
m_devices.push_back(tmp);
|
m_devices.push_back(tmp);
|
||||||
// add default input format:
|
// add default input format:
|
||||||
tmp.name = "microphone";
|
tmp.name = "microphone";
|
||||||
|
tmp.input = true;
|
||||||
tmp.sampleRates.push_back(48000);
|
tmp.sampleRates.push_back(48000);
|
||||||
tmp.channels.push_back(audio::channel_frontRight);
|
tmp.channels.push_back(audio::channel_frontRight);
|
||||||
tmp.channels.push_back(audio::channel_frontLeft);
|
tmp.channels.push_back(audio::channel_frontLeft);
|
||||||
tmp.isDefault = true;
|
|
||||||
tmp.nativeFormats.push_back(audio::format_int16);
|
tmp.nativeFormats.push_back(audio::format_int16);
|
||||||
|
tmp.isDefault = true;
|
||||||
|
tmp.isCorrect = true;
|
||||||
m_devices.push_back(tmp);
|
m_devices.push_back(tmp);
|
||||||
ATA_INFO("Create CoreIOs interface (end)");
|
ATA_INFO("Create CoreIOs interface (end)");
|
||||||
}
|
}
|
||||||
|
|
||||||
audio::orchestra::api::CoreIos::~CoreIos(void) {
|
uint32_t audio::orchestra::api::CoreIos::getDefaultInputDevice() {
|
||||||
|
// Should be implemented in subclasses if possible.
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t audio::orchestra::api::CoreIos::getDefaultOutputDevice() {
|
||||||
|
// Should be implemented in subclasses if possible.
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
audio::orchestra::api::CoreIos::~CoreIos() {
|
||||||
ATA_INFO("Destroy CoreIOs interface");
|
ATA_INFO("Destroy CoreIOs interface");
|
||||||
AudioUnitUninitialize(m_private->audioUnit);
|
AudioUnitUninitialize(m_private->audioUnit);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t audio::orchestra::api::CoreIos::getDeviceCount(void) {
|
uint32_t audio::orchestra::api::CoreIos::getDeviceCount() {
|
||||||
//ATA_INFO("Get device count:"<< m_devices.size());
|
//ATA_INFO("Get device count:"<< m_devices.size());
|
||||||
return m_devices.size();
|
return m_devices.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
audio::orchestra::DeviceInfo audio::orchestra::api::CoreIos::getDeviceInfo(uint32_t _device) {
|
audio::orchestra::DeviceInfo audio::orchestra::api::CoreIos::getDeviceInfo(uint32_t _device) {
|
||||||
//ATA_INFO("Get device info ...");
|
//ATA_INFO("Get device info ...");
|
||||||
|
if (_device >= m_devices.size()) {
|
||||||
|
audio::orchestra::DeviceInfo tmp;
|
||||||
|
tmp.sampleRates.push_back(0);
|
||||||
|
tmp.channels.push_back(audio::channel_frontCenter);
|
||||||
|
tmp.isDefault = false;
|
||||||
|
tmp.nativeFormats.push_back(audio::format_int8);
|
||||||
|
return tmp;
|
||||||
|
}
|
||||||
return m_devices[_device];
|
return m_devices[_device];
|
||||||
}
|
}
|
||||||
|
|
||||||
enum audio::orchestra::error audio::orchestra::api::CoreIos::closeStream(void) {
|
enum audio::orchestra::error audio::orchestra::api::CoreIos::closeStream() {
|
||||||
ATA_INFO("Close Stream");
|
ATA_INFO("Close Stream");
|
||||||
// Can not close the stream now...
|
// Can not close the stream now...
|
||||||
return audio::orchestra::error_none;
|
return audio::orchestra::error_none;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum audio::orchestra::error audio::orchestra::api::CoreIos::startStream(void) {
|
enum audio::orchestra::error audio::orchestra::api::CoreIos::startStream() {
|
||||||
ATA_INFO("Start Stream");
|
ATA_INFO("Start Stream");
|
||||||
// TODO : Check return ...
|
// TODO : Check return ...
|
||||||
audio::orchestra::Api::startStream();
|
audio::orchestra::Api::startStream();
|
||||||
@@ -95,14 +114,14 @@ enum audio::orchestra::error audio::orchestra::api::CoreIos::startStream(void) {
|
|||||||
return audio::orchestra::error_none;
|
return audio::orchestra::error_none;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum audio::orchestra::error audio::orchestra::api::CoreIos::stopStream(void) {
|
enum audio::orchestra::error audio::orchestra::api::CoreIos::stopStream() {
|
||||||
ATA_INFO("Stop stream");
|
ATA_INFO("Stop stream");
|
||||||
OSStatus status = AudioOutputUnitStop(m_private->audioUnit);
|
OSStatus status = AudioOutputUnitStop(m_private->audioUnit);
|
||||||
// Can not close the stream now...
|
// Can not close the stream now...
|
||||||
return audio::orchestra::error_none;
|
return audio::orchestra::error_none;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum audio::orchestra::error audio::orchestra::api::CoreIos::abortStream(void) {
|
enum audio::orchestra::error audio::orchestra::api::CoreIos::abortStream() {
|
||||||
ATA_INFO("Abort Stream");
|
ATA_INFO("Abort Stream");
|
||||||
OSStatus status = AudioOutputUnitStop(m_private->audioUnit);
|
OSStatus status = AudioOutputUnitStop(m_private->audioUnit);
|
||||||
// Can not close the stream now...
|
// Can not close the stream now...
|
||||||
@@ -114,7 +133,10 @@ void audio::orchestra::api::CoreIos::callBackEvent(void* _data,
|
|||||||
const audio::Time& _time) {
|
const audio::Time& _time) {
|
||||||
int32_t doStopStream = 0;
|
int32_t doStopStream = 0;
|
||||||
std::vector<enum audio::orchestra::status> status;
|
std::vector<enum audio::orchestra::status> status;
|
||||||
|
if ( m_mode == audio::orchestra::mode_output
|
||||||
|
|| m_mode == audio::orchestra::mode_duplex) {
|
||||||
if (m_doConvertBuffer[modeToIdTable(audio::orchestra::mode_output)] == true) {
|
if (m_doConvertBuffer[modeToIdTable(audio::orchestra::mode_output)] == true) {
|
||||||
|
ATA_INFO("get output DATA : " << uint64_t(&m_userBuffer[modeToIdTable(audio::orchestra::mode_output)][0]));
|
||||||
doStopStream = m_callback(nullptr,
|
doStopStream = m_callback(nullptr,
|
||||||
audio::Time(),
|
audio::Time(),
|
||||||
&m_userBuffer[modeToIdTable(audio::orchestra::mode_output)][0],
|
&m_userBuffer[modeToIdTable(audio::orchestra::mode_output)][0],
|
||||||
@@ -123,6 +145,18 @@ void audio::orchestra::api::CoreIos::callBackEvent(void* _data,
|
|||||||
status);
|
status);
|
||||||
convertBuffer((char*)_data, &m_userBuffer[modeToIdTable(audio::orchestra::mode_output)][0], m_convertInfo[modeToIdTable(audio::orchestra::mode_output)]);
|
convertBuffer((char*)_data, &m_userBuffer[modeToIdTable(audio::orchestra::mode_output)][0], m_convertInfo[modeToIdTable(audio::orchestra::mode_output)]);
|
||||||
} else {
|
} else {
|
||||||
|
ATA_INFO("have output DATA : " << uint64_t(_data));
|
||||||
|
doStopStream = m_callback(nullptr,
|
||||||
|
_time,
|
||||||
|
_data,
|
||||||
|
audio::Time(),
|
||||||
|
_nbChunk,
|
||||||
|
status);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ( m_mode == audio::orchestra::mode_input
|
||||||
|
|| m_mode == audio::orchestra::mode_duplex) {
|
||||||
|
ATA_INFO("have input DATA : " << uint64_t(_data));
|
||||||
doStopStream = m_callback(_data,
|
doStopStream = m_callback(_data,
|
||||||
_time,
|
_time,
|
||||||
nullptr,
|
nullptr,
|
||||||
@@ -157,7 +191,7 @@ static OSStatus playbackCallback(void *_userData,
|
|||||||
for (int32_t iii=0; iii < _ioData->mNumberBuffers; iii++) {
|
for (int32_t iii=0; iii < _ioData->mNumberBuffers; iii++) {
|
||||||
AudioBuffer buffer = _ioData->mBuffers[iii];
|
AudioBuffer buffer = _ioData->mBuffers[iii];
|
||||||
int32_t numberFrame = buffer.mDataByteSize/2/*stereo*/ /sizeof(int16_t);
|
int32_t numberFrame = buffer.mDataByteSize/2/*stereo*/ /sizeof(int16_t);
|
||||||
ATA_VERBOSE("request data size: " << numberFrame << " busNumber=" << _inBusNumber);
|
ATA_INFO("request data size: " << numberFrame << " busNumber=" << _inBusNumber);
|
||||||
myClass->callBackEvent(buffer.mData, numberFrame, tmpTimeime);
|
myClass->callBackEvent(buffer.mData, numberFrame, tmpTimeime);
|
||||||
}
|
}
|
||||||
return noErr;
|
return noErr;
|
||||||
@@ -178,7 +212,8 @@ bool audio::orchestra::api::CoreIos::open(uint32_t _device,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
bool ret = true;
|
bool ret = true;
|
||||||
|
// TODO : This is a bad ack ....
|
||||||
|
m_mode = audio::orchestra::mode_output;
|
||||||
// configure Airtaudio internal configuration:
|
// configure Airtaudio internal configuration:
|
||||||
m_userFormat = _format;
|
m_userFormat = _format;
|
||||||
m_nUserChannels[modeToIdTable(_mode)] = _channels;
|
m_nUserChannels[modeToIdTable(_mode)] = _channels;
|
||||||
|
@@ -7,16 +7,13 @@
|
|||||||
|
|
||||||
// Windows DirectSound API
|
// Windows DirectSound API
|
||||||
#if defined(ORCHESTRA_BUILD_DS)
|
#if defined(ORCHESTRA_BUILD_DS)
|
||||||
#include <audio/orchestra/Interface.h>
|
#include <audio/orchestra/Interface.hpp>
|
||||||
#include <audio/orchestra/debug.h>
|
#include <audio/orchestra/debug.hpp>
|
||||||
#include <ethread/tools.h>
|
#include <ethread/tools.hpp>
|
||||||
#include <audio/orchestra/api/Ds.h>
|
#include <audio/orchestra/api/Ds.hpp>
|
||||||
|
|
||||||
#undef __class__
|
ememory::SharedPtr<audio::orchestra::Api> audio::orchestra::api::Ds::create() {
|
||||||
#define __class__ "api::Ds"
|
return ememory::SharedPtr<audio::orchestra::api::Ds>(new audio::orchestra::api::Ds());
|
||||||
|
|
||||||
std::shared_ptr<audio::orchestra::Api> audio::orchestra::api::Ds::create() {
|
|
||||||
return std::shared_ptr<audio::orchestra::Api>(new audio::orchestra::api::Ds());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -28,7 +25,7 @@ std::shared_ptr<audio::orchestra::Api> audio::orchestra::api::Ds::create() {
|
|||||||
// Changed device query structure for RtAudio 4.0.7, January 2010
|
// Changed device query structure for RtAudio 4.0.7, January 2010
|
||||||
|
|
||||||
#include <dsound.h>
|
#include <dsound.h>
|
||||||
#include <assert.h>
|
#include <cassert>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
#if defined(__MINGW32__)
|
#if defined(__MINGW32__)
|
||||||
@@ -75,7 +72,7 @@ namespace audio {
|
|||||||
namespace api {
|
namespace api {
|
||||||
class DsPrivate {
|
class DsPrivate {
|
||||||
public:
|
public:
|
||||||
std::shared_ptr<std::thread> thread;
|
ememory::SharedPtr<std::thread> thread;
|
||||||
bool threadRunning;
|
bool threadRunning;
|
||||||
uint32_t drainCounter; // Tracks callback counts when draining
|
uint32_t drainCounter; // Tracks callback counts when draining
|
||||||
bool internalDrain; // Indicates if stop is initiated from callback or not.
|
bool internalDrain; // Indicates if stop is initiated from callback or not.
|
||||||
@@ -128,7 +125,7 @@ audio::orchestra::api::Ds::~Ds() {
|
|||||||
if (m_coInitialized) {
|
if (m_coInitialized) {
|
||||||
CoUninitialize(); // balanced call.
|
CoUninitialize(); // balanced call.
|
||||||
}
|
}
|
||||||
if (m_state != audio::orchestra::state_closed) {
|
if (m_state != audio::orchestra::state::closed) {
|
||||||
closeStream();
|
closeStream();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -748,7 +745,7 @@ bool audio::orchestra::api::Ds::open(uint32_t _device,
|
|||||||
m_private->dsBufferSize[modeToIdTable(_mode)] = dsBufferSize;
|
m_private->dsBufferSize[modeToIdTable(_mode)] = dsBufferSize;
|
||||||
m_private->dsPointerLeadTime[modeToIdTable(_mode)] = dsPointerLeadTime;
|
m_private->dsPointerLeadTime[modeToIdTable(_mode)] = dsPointerLeadTime;
|
||||||
m_device[modeToIdTable(_mode)] = _device;
|
m_device[modeToIdTable(_mode)] = _device;
|
||||||
m_state = audio::orchestra::state_stopped;
|
m_state = audio::orchestra::state::stopped;
|
||||||
if ( m_mode == audio::orchestra::mode_output
|
if ( m_mode == audio::orchestra::mode_output
|
||||||
&& _mode == audio::orchestra::mode_input) {
|
&& _mode == audio::orchestra::mode_input) {
|
||||||
// We had already set up an output stream.
|
// We had already set up an output stream.
|
||||||
@@ -765,14 +762,14 @@ bool audio::orchestra::api::Ds::open(uint32_t _device,
|
|||||||
// Setup the callback thread.
|
// Setup the callback thread.
|
||||||
if (m_private->threadRunning == false) {
|
if (m_private->threadRunning == false) {
|
||||||
m_private->threadRunning = true;
|
m_private->threadRunning = true;
|
||||||
std::shared_ptr<std::thread> tmpThread(new std::thread(&audio::orchestra::api::Ds::dsCallbackEvent, this));
|
ememory::SharedPtr<std::thread> tmpThread(new std::thread(&audio::orchestra::api::Ds::dsCallbackEvent, this));
|
||||||
m_private->thread = std::move(tmpThread);
|
m_private->thread = std::move(tmpThread);
|
||||||
if (m_private->thread == nullptr) {
|
if (m_private->thread == nullptr) {
|
||||||
ATA_ERROR("error creating callback thread!");
|
ATA_ERROR("error creating callback thread!");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
// Boost DS thread priority
|
// Boost DS thread priority
|
||||||
etk::thread::setPriority(*m_private->thread, -6);
|
ethread::setPriority(*m_private->thread, -6);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
error:
|
error:
|
||||||
@@ -800,12 +797,12 @@ error:
|
|||||||
free(m_deviceBuffer);
|
free(m_deviceBuffer);
|
||||||
m_deviceBuffer = 0;
|
m_deviceBuffer = 0;
|
||||||
}
|
}
|
||||||
m_state = audio::orchestra::state_closed;
|
m_state = audio::orchestra::state::closed;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum audio::orchestra::error audio::orchestra::api::Ds::closeStream() {
|
enum audio::orchestra::error audio::orchestra::api::Ds::closeStream() {
|
||||||
if (m_state == audio::orchestra::state_closed) {
|
if (m_state == audio::orchestra::state::closed) {
|
||||||
ATA_ERROR("no open stream to close!");
|
ATA_ERROR("no open stream to close!");
|
||||||
return audio::orchestra::error_warning;
|
return audio::orchestra::error_warning;
|
||||||
}
|
}
|
||||||
@@ -842,7 +839,7 @@ enum audio::orchestra::error audio::orchestra::api::Ds::closeStream() {
|
|||||||
m_deviceBuffer = 0;
|
m_deviceBuffer = 0;
|
||||||
}
|
}
|
||||||
m_mode = audio::orchestra::mode_unknow;
|
m_mode = audio::orchestra::mode_unknow;
|
||||||
m_state = audio::orchestra::state_closed;
|
m_state = audio::orchestra::state::closed;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum audio::orchestra::error audio::orchestra::api::Ds::startStream() {
|
enum audio::orchestra::error audio::orchestra::api::Ds::startStream() {
|
||||||
@@ -851,7 +848,7 @@ enum audio::orchestra::error audio::orchestra::api::Ds::startStream() {
|
|||||||
if (verifyStream() != audio::orchestra::error_none) {
|
if (verifyStream() != audio::orchestra::error_none) {
|
||||||
return audio::orchestra::error_fail;
|
return audio::orchestra::error_fail;
|
||||||
}
|
}
|
||||||
if (m_state == audio::orchestra::state_running) {
|
if (m_state == audio::orchestra::state::running) {
|
||||||
ATA_ERROR("the stream is already running!");
|
ATA_ERROR("the stream is already running!");
|
||||||
return audio::orchestra::error_warning;
|
return audio::orchestra::error_warning;
|
||||||
}
|
}
|
||||||
@@ -887,7 +884,7 @@ enum audio::orchestra::error audio::orchestra::api::Ds::startStream() {
|
|||||||
m_private->drainCounter = 0;
|
m_private->drainCounter = 0;
|
||||||
m_private->internalDrain = false;
|
m_private->internalDrain = false;
|
||||||
ResetEvent(m_private->condition);
|
ResetEvent(m_private->condition);
|
||||||
m_state = audio::orchestra::state_running;
|
m_state = audio::orchestra::state::running;
|
||||||
unlock:
|
unlock:
|
||||||
if (FAILED(result)) {
|
if (FAILED(result)) {
|
||||||
return audio::orchestra::error_systemError;
|
return audio::orchestra::error_systemError;
|
||||||
@@ -899,7 +896,7 @@ enum audio::orchestra::error audio::orchestra::api::Ds::stopStream() {
|
|||||||
if (verifyStream() != audio::orchestra::error_none) {
|
if (verifyStream() != audio::orchestra::error_none) {
|
||||||
return audio::orchestra::error_fail;
|
return audio::orchestra::error_fail;
|
||||||
}
|
}
|
||||||
if (m_state == audio::orchestra::state_stopped) {
|
if (m_state == audio::orchestra::state::stopped) {
|
||||||
ATA_ERROR("the stream is already stopped!");
|
ATA_ERROR("the stream is already stopped!");
|
||||||
return audio::orchestra::error_warning;
|
return audio::orchestra::error_warning;
|
||||||
}
|
}
|
||||||
@@ -912,7 +909,7 @@ enum audio::orchestra::error audio::orchestra::api::Ds::stopStream() {
|
|||||||
m_private->drainCounter = 2;
|
m_private->drainCounter = 2;
|
||||||
WaitForSingleObject(m_private->condition, INFINITE); // block until signaled
|
WaitForSingleObject(m_private->condition, INFINITE); // block until signaled
|
||||||
}
|
}
|
||||||
m_state = audio::orchestra::state_stopped;
|
m_state = audio::orchestra::state::stopped;
|
||||||
// Stop the buffer and clear memory
|
// Stop the buffer and clear memory
|
||||||
LPDIRECTSOUNDBUFFER buffer = (LPDIRECTSOUNDBUFFER) m_private->buffer[0];
|
LPDIRECTSOUNDBUFFER buffer = (LPDIRECTSOUNDBUFFER) m_private->buffer[0];
|
||||||
result = buffer->Stop();
|
result = buffer->Stop();
|
||||||
@@ -943,7 +940,7 @@ enum audio::orchestra::error audio::orchestra::api::Ds::stopStream() {
|
|||||||
LPDIRECTSOUNDCAPTUREBUFFER buffer = (LPDIRECTSOUNDCAPTUREBUFFER) m_private->buffer[1];
|
LPDIRECTSOUNDCAPTUREBUFFER buffer = (LPDIRECTSOUNDCAPTUREBUFFER) m_private->buffer[1];
|
||||||
audioPtr = nullptr;
|
audioPtr = nullptr;
|
||||||
dataLen = 0;
|
dataLen = 0;
|
||||||
m_state = audio::orchestra::state_stopped;
|
m_state = audio::orchestra::state::stopped;
|
||||||
result = buffer->Stop();
|
result = buffer->Stop();
|
||||||
if (FAILED(result)) {
|
if (FAILED(result)) {
|
||||||
ATA_ERROR(getErrorString(result) << ": stopping input buffer!");
|
ATA_ERROR(getErrorString(result) << ": stopping input buffer!");
|
||||||
@@ -979,7 +976,7 @@ enum audio::orchestra::error audio::orchestra::api::Ds::abortStream() {
|
|||||||
if (verifyStream() != audio::orchestra::error_none) {
|
if (verifyStream() != audio::orchestra::error_none) {
|
||||||
return audio::orchestra::error_fail;
|
return audio::orchestra::error_fail;
|
||||||
}
|
}
|
||||||
if (m_state == audio::orchestra::state_stopped) {
|
if (m_state == audio::orchestra::state::stopped) {
|
||||||
ATA_ERROR("the stream is already stopped!");
|
ATA_ERROR("the stream is already stopped!");
|
||||||
return audio::orchestra::error_warning;
|
return audio::orchestra::error_warning;
|
||||||
}
|
}
|
||||||
@@ -989,17 +986,18 @@ enum audio::orchestra::error audio::orchestra::api::Ds::abortStream() {
|
|||||||
|
|
||||||
void audio::orchestra::api::Ds::callbackEvent() {
|
void audio::orchestra::api::Ds::callbackEvent() {
|
||||||
ethread::setName("DS IO-" + m_name);
|
ethread::setName("DS IO-" + m_name);
|
||||||
if (m_state == audio::orchestra::state_stopped || m_state == audio::orchestra::state_stopping) {
|
if ( m_state == audio::orchestra::state::stopped
|
||||||
|
|| m_state == audio::orchestra::state::stopping) {
|
||||||
Sleep(50); // sleep 50 milliseconds
|
Sleep(50); // sleep 50 milliseconds
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (m_state == audio::orchestra::state_closed) {
|
if (m_state == audio::orchestra::state::closed) {
|
||||||
ATA_ERROR("the stream is closed ... this shouldn't happen!");
|
ATA_ERROR("the stream is closed ... this shouldn't happen!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Check if we were draining the stream and signal is finished.
|
// Check if we were draining the stream and signal is finished.
|
||||||
if (m_private->drainCounter > m_nBuffers + 2) {
|
if (m_private->drainCounter > m_nBuffers + 2) {
|
||||||
m_state = audio::orchestra::state_stopping;
|
m_state = audio::orchestra::state::stopping;
|
||||||
if (m_private->internalDrain == false) {
|
if (m_private->internalDrain == false) {
|
||||||
SetEvent(m_private->condition);
|
SetEvent(m_private->condition);
|
||||||
} else {
|
} else {
|
||||||
@@ -1014,12 +1012,12 @@ void audio::orchestra::api::Ds::callbackEvent() {
|
|||||||
std::vector<audio::orchestra::status> status;
|
std::vector<audio::orchestra::status> status;
|
||||||
if ( m_mode != audio::orchestra::mode_input
|
if ( m_mode != audio::orchestra::mode_input
|
||||||
&& m_private->xrun[0] == true) {
|
&& m_private->xrun[0] == true) {
|
||||||
status.push_back(audio::orchestra::status_underflow);
|
status.push_back(audio::orchestra::status::underflow);
|
||||||
m_private->xrun[0] = false;
|
m_private->xrun[0] = false;
|
||||||
}
|
}
|
||||||
if ( m_mode != audio::orchestra::mode_output
|
if ( m_mode != audio::orchestra::mode_output
|
||||||
&& m_private->xrun[1] == true) {
|
&& m_private->xrun[1] == true) {
|
||||||
status.push_back(audio::orchestra::status_overflow);
|
status.push_back(audio::orchestra::status::overflow);
|
||||||
m_private->xrun[1] = false;
|
m_private->xrun[1] = false;
|
||||||
}
|
}
|
||||||
int32_t cbReturnValue = m_callback(&m_userBuffer[1][0],
|
int32_t cbReturnValue = m_callback(&m_userBuffer[1][0],
|
||||||
@@ -1029,7 +1027,7 @@ void audio::orchestra::api::Ds::callbackEvent() {
|
|||||||
m_bufferSize,
|
m_bufferSize,
|
||||||
status);
|
status);
|
||||||
if (cbReturnValue == 2) {
|
if (cbReturnValue == 2) {
|
||||||
m_state = audio::orchestra::state_stopping;
|
m_state = audio::orchestra::state::stopping;
|
||||||
m_private->drainCounter = 2;
|
m_private->drainCounter = 2;
|
||||||
abortStream();
|
abortStream();
|
||||||
return;
|
return;
|
||||||
|
@@ -13,12 +13,12 @@ namespace audio {
|
|||||||
class DsPrivate;
|
class DsPrivate;
|
||||||
class Ds: public audio::orchestra::Api {
|
class Ds: public audio::orchestra::Api {
|
||||||
public:
|
public:
|
||||||
static std::shared_ptr<audio::orchestra::Api> create();
|
static ememory::SharedPtr<audio::orchestra::Api> create();
|
||||||
public:
|
public:
|
||||||
Ds();
|
Ds();
|
||||||
virtual ~Ds();
|
virtual ~Ds();
|
||||||
const std::string& getCurrentApi() {
|
const std::string& getCurrentApi() {
|
||||||
return audio::orchestra::type_ds;
|
return audio::orchestra::typeDs;
|
||||||
}
|
}
|
||||||
uint32_t getDeviceCount();
|
uint32_t getDeviceCount();
|
||||||
audio::orchestra::DeviceInfo getDeviceInfo(uint32_t _device);
|
audio::orchestra::DeviceInfo getDeviceInfo(uint32_t _device);
|
||||||
@@ -34,7 +34,7 @@ namespace audio {
|
|||||||
void callbackEvent();
|
void callbackEvent();
|
||||||
private:
|
private:
|
||||||
static void dsCallbackEvent(void *_userData);
|
static void dsCallbackEvent(void *_userData);
|
||||||
std::shared_ptr<DsPrivate> m_private;
|
ememory::SharedPtr<DsPrivate> m_private;
|
||||||
bool m_coInitialized;
|
bool m_coInitialized;
|
||||||
bool m_buffersRolling;
|
bool m_buffersRolling;
|
||||||
long m_duplexPrerollBytes;
|
long m_duplexPrerollBytes;
|
@@ -6,14 +6,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(ORCHESTRA_BUILD_DUMMY)
|
#if defined(ORCHESTRA_BUILD_DUMMY)
|
||||||
#include <audio/orchestra/api/Dummy.h>
|
#include <audio/orchestra/api/Dummy.hpp>
|
||||||
#include <audio/orchestra/debug.h>
|
#include <audio/orchestra/debug.hpp>
|
||||||
|
|
||||||
#undef __class__
|
ememory::SharedPtr<audio::orchestra::Api> audio::orchestra::api::Dummy::create() {
|
||||||
#define __class__ "api::Dummy"
|
return ememory::SharedPtr<audio::orchestra::api::Dummy>(new audio::orchestra::api::Dummy());
|
||||||
|
|
||||||
std::shared_ptr<audio::orchestra::Api> audio::orchestra::api::Dummy::create() {
|
|
||||||
return std::shared_ptr<audio::orchestra::Api>(new audio::orchestra::api::Dummy());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -8,18 +8,18 @@
|
|||||||
|
|
||||||
#ifdef ORCHESTRA_BUILD_DUMMY
|
#ifdef ORCHESTRA_BUILD_DUMMY
|
||||||
|
|
||||||
#include <audio/orchestra/Interface.h>
|
#include <audio/orchestra/Interface.hpp>
|
||||||
|
|
||||||
namespace audio {
|
namespace audio {
|
||||||
namespace orchestra {
|
namespace orchestra {
|
||||||
namespace api {
|
namespace api {
|
||||||
class Dummy: public audio::orchestra::Api {
|
class Dummy: public audio::orchestra::Api {
|
||||||
public:
|
public:
|
||||||
static std::shared_ptr<audio::orchestra::Api> create();
|
static ememory::SharedPtr<audio::orchestra::Api> create();
|
||||||
public:
|
public:
|
||||||
Dummy();
|
Dummy();
|
||||||
const std::string& getCurrentApi() {
|
const std::string& getCurrentApi() {
|
||||||
return audio::orchestra::type_dummy;
|
return audio::orchestra::typeDummy;
|
||||||
}
|
}
|
||||||
uint32_t getDeviceCount();
|
uint32_t getDeviceCount();
|
||||||
audio::orchestra::DeviceInfo getDeviceInfo(uint32_t _device);
|
audio::orchestra::DeviceInfo getDeviceInfo(uint32_t _device);
|
@@ -7,20 +7,17 @@
|
|||||||
|
|
||||||
// must run before :
|
// must run before :
|
||||||
#if defined(ORCHESTRA_BUILD_JACK)
|
#if defined(ORCHESTRA_BUILD_JACK)
|
||||||
#include <unistd.h>
|
|
||||||
#include <limits.h>
|
#include <climits>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <audio/orchestra/Interface.h>
|
#include <audio/orchestra/Interface.hpp>
|
||||||
#include <audio/orchestra/debug.h>
|
#include <audio/orchestra/debug.hpp>
|
||||||
#include <string.h>
|
#include <cstring>
|
||||||
#include <ethread/tools.h>
|
#include <ethread/tools.hpp>
|
||||||
#include <audio/orchestra/api/Jack.h>
|
#include <audio/orchestra/api/Jack.hpp>
|
||||||
|
|
||||||
#undef __class__
|
ememory::SharedPtr<audio::orchestra::Api> audio::orchestra::api::Jack::create() {
|
||||||
#define __class__ "api::Jack"
|
return ememory::SharedPtr<audio::orchestra::api::Jack>(new audio::orchestra::api::Jack());
|
||||||
|
|
||||||
std::shared_ptr<audio::orchestra::Api> audio::orchestra::api::Jack::create() {
|
|
||||||
return std::shared_ptr<audio::orchestra::Api>(new audio::orchestra::api::Jack());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -55,7 +52,7 @@ std::shared_ptr<audio::orchestra::Api> audio::orchestra::api::Jack::create() {
|
|||||||
// stream cannot be opened.
|
// stream cannot be opened.
|
||||||
|
|
||||||
#include <jack/jack.h>
|
#include <jack/jack.h>
|
||||||
#include <unistd.h>
|
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
|
|
||||||
|
|
||||||
@@ -92,7 +89,7 @@ audio::orchestra::api::Jack::Jack() :
|
|||||||
}
|
}
|
||||||
|
|
||||||
audio::orchestra::api::Jack::~Jack() {
|
audio::orchestra::api::Jack::~Jack() {
|
||||||
if (m_state != audio::orchestra::state_closed) {
|
if (m_state != audio::orchestra::state::closed) {
|
||||||
closeStream();
|
closeStream();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -426,7 +423,7 @@ bool audio::orchestra::api::Jack::open(uint32_t _device,
|
|||||||
}
|
}
|
||||||
m_device[modeToIdTable(_mode)] = _device;
|
m_device[modeToIdTable(_mode)] = _device;
|
||||||
m_channelOffset[modeToIdTable(_mode)] = _firstChannel;
|
m_channelOffset[modeToIdTable(_mode)] = _firstChannel;
|
||||||
m_state = audio::orchestra::state_stopped;
|
m_state = audio::orchestra::state::stopped;
|
||||||
if ( m_mode == audio::orchestra::mode_output
|
if ( m_mode == audio::orchestra::mode_output
|
||||||
&& _mode == audio::orchestra::mode_input) {
|
&& _mode == audio::orchestra::mode_input) {
|
||||||
// We had already set up the stream for output.
|
// We had already set up the stream for output.
|
||||||
@@ -486,12 +483,12 @@ error:
|
|||||||
}
|
}
|
||||||
|
|
||||||
enum audio::orchestra::error audio::orchestra::api::Jack::closeStream() {
|
enum audio::orchestra::error audio::orchestra::api::Jack::closeStream() {
|
||||||
if (m_state == audio::orchestra::state_closed) {
|
if (m_state == audio::orchestra::state::closed) {
|
||||||
ATA_ERROR("no open stream to close!");
|
ATA_ERROR("no open stream to close!");
|
||||||
return audio::orchestra::error_warning;
|
return audio::orchestra::error_warning;
|
||||||
}
|
}
|
||||||
if (m_private != nullptr) {
|
if (m_private != nullptr) {
|
||||||
if (m_state == audio::orchestra::state_running) {
|
if (m_state == audio::orchestra::state::running) {
|
||||||
jack_deactivate(m_private->client);
|
jack_deactivate(m_private->client);
|
||||||
}
|
}
|
||||||
jack_client_close(m_private->client);
|
jack_client_close(m_private->client);
|
||||||
@@ -512,7 +509,7 @@ enum audio::orchestra::error audio::orchestra::api::Jack::closeStream() {
|
|||||||
m_deviceBuffer = nullptr;
|
m_deviceBuffer = nullptr;
|
||||||
}
|
}
|
||||||
m_mode = audio::orchestra::mode_unknow;
|
m_mode = audio::orchestra::mode_unknow;
|
||||||
m_state = audio::orchestra::state_closed;
|
m_state = audio::orchestra::state::closed;
|
||||||
return audio::orchestra::error_none;
|
return audio::orchestra::error_none;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -522,7 +519,7 @@ enum audio::orchestra::error audio::orchestra::api::Jack::startStream() {
|
|||||||
if (verifyStream() != audio::orchestra::error_none) {
|
if (verifyStream() != audio::orchestra::error_none) {
|
||||||
return audio::orchestra::error_fail;
|
return audio::orchestra::error_fail;
|
||||||
}
|
}
|
||||||
if (m_state == audio::orchestra::state_running) {
|
if (m_state == audio::orchestra::state::running) {
|
||||||
ATA_ERROR("the stream is already running!");
|
ATA_ERROR("the stream is already running!");
|
||||||
return audio::orchestra::error_warning;
|
return audio::orchestra::error_warning;
|
||||||
}
|
}
|
||||||
@@ -580,7 +577,7 @@ enum audio::orchestra::error audio::orchestra::api::Jack::startStream() {
|
|||||||
}
|
}
|
||||||
m_private->drainCounter = 0;
|
m_private->drainCounter = 0;
|
||||||
m_private->internalDrain = false;
|
m_private->internalDrain = false;
|
||||||
m_state = audio::orchestra::state_running;
|
m_state = audio::orchestra::state::running;
|
||||||
unlock:
|
unlock:
|
||||||
if (result == 0) {
|
if (result == 0) {
|
||||||
return audio::orchestra::error_none;
|
return audio::orchestra::error_none;
|
||||||
@@ -592,7 +589,7 @@ enum audio::orchestra::error audio::orchestra::api::Jack::stopStream() {
|
|||||||
if (verifyStream() != audio::orchestra::error_none) {
|
if (verifyStream() != audio::orchestra::error_none) {
|
||||||
return audio::orchestra::error_fail;
|
return audio::orchestra::error_fail;
|
||||||
}
|
}
|
||||||
if (m_state == audio::orchestra::state_stopped) {
|
if (m_state == audio::orchestra::state::stopped) {
|
||||||
ATA_ERROR("the stream is already stopped!");
|
ATA_ERROR("the stream is already stopped!");
|
||||||
return audio::orchestra::error_warning;
|
return audio::orchestra::error_warning;
|
||||||
}
|
}
|
||||||
@@ -605,7 +602,7 @@ enum audio::orchestra::error audio::orchestra::api::Jack::stopStream() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
jack_deactivate(m_private->client);
|
jack_deactivate(m_private->client);
|
||||||
m_state = audio::orchestra::state_stopped;
|
m_state = audio::orchestra::state::stopped;
|
||||||
return audio::orchestra::error_none;
|
return audio::orchestra::error_none;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -613,7 +610,7 @@ enum audio::orchestra::error audio::orchestra::api::Jack::abortStream() {
|
|||||||
if (verifyStream() != audio::orchestra::error_none) {
|
if (verifyStream() != audio::orchestra::error_none) {
|
||||||
return audio::orchestra::error_fail;
|
return audio::orchestra::error_fail;
|
||||||
}
|
}
|
||||||
if (m_state == audio::orchestra::state_stopped) {
|
if (m_state == audio::orchestra::state::stopped) {
|
||||||
ATA_ERROR("the stream is already stopped!");
|
ATA_ERROR("the stream is already stopped!");
|
||||||
return audio::orchestra::error_warning;
|
return audio::orchestra::error_warning;
|
||||||
}
|
}
|
||||||
@@ -633,11 +630,11 @@ static void jackStopStream(void* _userData) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool audio::orchestra::api::Jack::callbackEvent(uint64_t _nframes) {
|
bool audio::orchestra::api::Jack::callbackEvent(uint64_t _nframes) {
|
||||||
if ( m_state == audio::orchestra::state_stopped
|
if ( m_state == audio::orchestra::state::stopped
|
||||||
|| m_state == audio::orchestra::state_stopping) {
|
|| m_state == audio::orchestra::state::stopping) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (m_state == audio::orchestra::state_closed) {
|
if (m_state == audio::orchestra::state::closed) {
|
||||||
ATA_ERROR("the stream is closed ... this shouldn't happen!");
|
ATA_ERROR("the stream is closed ... this shouldn't happen!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -647,7 +644,7 @@ bool audio::orchestra::api::Jack::callbackEvent(uint64_t _nframes) {
|
|||||||
}
|
}
|
||||||
// Check if we were draining the stream and signal is finished.
|
// Check if we were draining the stream and signal is finished.
|
||||||
if (m_private->drainCounter > 3) {
|
if (m_private->drainCounter > 3) {
|
||||||
m_state = audio::orchestra::state_stopping;
|
m_state = audio::orchestra::state::stopping;
|
||||||
if (m_private->internalDrain == true) {
|
if (m_private->internalDrain == true) {
|
||||||
new std::thread(jackStopStream, this);
|
new std::thread(jackStopStream, this);
|
||||||
} else {
|
} else {
|
||||||
@@ -660,11 +657,11 @@ bool audio::orchestra::api::Jack::callbackEvent(uint64_t _nframes) {
|
|||||||
audio::Time streamTime = getStreamTime();
|
audio::Time streamTime = getStreamTime();
|
||||||
std::vector<enum audio::orchestra::status> status;
|
std::vector<enum audio::orchestra::status> status;
|
||||||
if (m_mode != audio::orchestra::mode_input && m_private->xrun[0] == true) {
|
if (m_mode != audio::orchestra::mode_input && m_private->xrun[0] == true) {
|
||||||
status.push_back(audio::orchestra::status_underflow);
|
status.push_back(audio::orchestra::status::underflow);
|
||||||
m_private->xrun[0] = false;
|
m_private->xrun[0] = false;
|
||||||
}
|
}
|
||||||
if (m_mode != audio::orchestra::mode_output && m_private->xrun[1] == true) {
|
if (m_mode != audio::orchestra::mode_output && m_private->xrun[1] == true) {
|
||||||
status.push_back(audio::orchestra::status_overflow);
|
status.push_back(audio::orchestra::status::overflow);
|
||||||
m_private->xrun[1] = false;
|
m_private->xrun[1] = false;
|
||||||
}
|
}
|
||||||
int32_t cbReturnValue = m_callback(&m_userBuffer[1][0],
|
int32_t cbReturnValue = m_callback(&m_userBuffer[1][0],
|
||||||
@@ -674,7 +671,7 @@ bool audio::orchestra::api::Jack::callbackEvent(uint64_t _nframes) {
|
|||||||
m_bufferSize,
|
m_bufferSize,
|
||||||
status);
|
status);
|
||||||
if (cbReturnValue == 2) {
|
if (cbReturnValue == 2) {
|
||||||
m_state = audio::orchestra::state_stopping;
|
m_state = audio::orchestra::state::stopping;
|
||||||
m_private->drainCounter = 2;
|
m_private->drainCounter = 2;
|
||||||
new std::thread(jackStopStream, this);
|
new std::thread(jackStopStream, this);
|
||||||
return true;
|
return true;
|
||||||
|
@@ -15,12 +15,12 @@ namespace audio {
|
|||||||
class JackPrivate;
|
class JackPrivate;
|
||||||
class Jack: public audio::orchestra::Api {
|
class Jack: public audio::orchestra::Api {
|
||||||
public:
|
public:
|
||||||
static std::shared_ptr<audio::orchestra::Api> create();
|
static ememory::SharedPtr<audio::orchestra::Api> create();
|
||||||
public:
|
public:
|
||||||
Jack();
|
Jack();
|
||||||
virtual ~Jack();
|
virtual ~Jack();
|
||||||
const std::string& getCurrentApi() {
|
const std::string& getCurrentApi() {
|
||||||
return audio::orchestra::type_jack;
|
return audio::orchestra::typeJack;
|
||||||
}
|
}
|
||||||
uint32_t getDeviceCount();
|
uint32_t getDeviceCount();
|
||||||
audio::orchestra::DeviceInfo getDeviceInfo(uint32_t _device);
|
audio::orchestra::DeviceInfo getDeviceInfo(uint32_t _device);
|
||||||
@@ -40,7 +40,7 @@ namespace audio {
|
|||||||
static void jackShutdown(void* _userData);
|
static void jackShutdown(void* _userData);
|
||||||
static int32_t jackCallbackHandler(jack_nframes_t _nframes, void* _userData);
|
static int32_t jackCallbackHandler(jack_nframes_t _nframes, void* _userData);
|
||||||
private:
|
private:
|
||||||
std::shared_ptr<JackPrivate> m_private;
|
ememory::SharedPtr<JackPrivate> m_private;
|
||||||
bool open(uint32_t _device,
|
bool open(uint32_t _device,
|
||||||
audio::orchestra::mode _mode,
|
audio::orchestra::mode _mode,
|
||||||
uint32_t _channels,
|
uint32_t _channels,
|
@@ -8,22 +8,19 @@
|
|||||||
|
|
||||||
#if defined(ORCHESTRA_BUILD_PULSE)
|
#if defined(ORCHESTRA_BUILD_PULSE)
|
||||||
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <limits.h>
|
#include <climits>
|
||||||
#include <audio/orchestra/Interface.h>
|
#include <audio/orchestra/Interface.hpp>
|
||||||
#include <audio/orchestra/debug.h>
|
#include <audio/orchestra/debug.hpp>
|
||||||
#include <pulse/error.h>
|
#include <pulse/error.h>
|
||||||
#include <pulse/simple.h>
|
#include <pulse/simple.h>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <ethread/tools.h>
|
#include <ethread/tools.hpp>
|
||||||
#include <audio/orchestra/api/PulseDeviceList.h>
|
#include <audio/orchestra/api/PulseDeviceList.hpp>
|
||||||
#include <audio/orchestra/api/Pulse.h>
|
#include <audio/orchestra/api/Pulse.hpp>
|
||||||
|
|
||||||
#undef __class__
|
ememory::SharedPtr<audio::orchestra::Api> audio::orchestra::api::Pulse::create() {
|
||||||
#define __class__ "api::Pulse"
|
return ememory::SharedPtr<audio::orchestra::api::Pulse>(new audio::orchestra::api::Pulse());
|
||||||
|
|
||||||
std::shared_ptr<audio::orchestra::Api> audio::orchestra::api::Pulse::create() {
|
|
||||||
return std::shared_ptr<audio::orchestra::Api>(new audio::orchestra::api::Pulse());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -56,7 +53,7 @@ namespace audio {
|
|||||||
class PulsePrivate {
|
class PulsePrivate {
|
||||||
public:
|
public:
|
||||||
pa_simple* handle;
|
pa_simple* handle;
|
||||||
std::shared_ptr<std::thread> thread;
|
ememory::SharedPtr<std::thread> thread;
|
||||||
bool threadRunning;
|
bool threadRunning;
|
||||||
std::condition_variable runnable_cv;
|
std::condition_variable runnable_cv;
|
||||||
bool runnable;
|
bool runnable;
|
||||||
@@ -76,7 +73,7 @@ audio::orchestra::api::Pulse::Pulse() :
|
|||||||
}
|
}
|
||||||
|
|
||||||
audio::orchestra::api::Pulse::~Pulse() {
|
audio::orchestra::api::Pulse::~Pulse() {
|
||||||
if (m_state != audio::orchestra::state_closed) {
|
if (m_state != audio::orchestra::state::closed) {
|
||||||
closeStream();
|
closeStream();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -114,7 +111,7 @@ void audio::orchestra::api::Pulse::callbackEvent() {
|
|||||||
enum audio::orchestra::error audio::orchestra::api::Pulse::closeStream() {
|
enum audio::orchestra::error audio::orchestra::api::Pulse::closeStream() {
|
||||||
m_private->threadRunning = false;
|
m_private->threadRunning = false;
|
||||||
m_mutex.lock();
|
m_mutex.lock();
|
||||||
if (m_state == audio::orchestra::state_stopped) {
|
if (m_state == audio::orchestra::state::stopped) {
|
||||||
m_private->runnable = true;
|
m_private->runnable = true;
|
||||||
m_private->runnable_cv.notify_one();;
|
m_private->runnable_cv.notify_one();;
|
||||||
}
|
}
|
||||||
@@ -127,23 +124,23 @@ enum audio::orchestra::error audio::orchestra::api::Pulse::closeStream() {
|
|||||||
m_private->handle = nullptr;
|
m_private->handle = nullptr;
|
||||||
m_userBuffer[0].clear();
|
m_userBuffer[0].clear();
|
||||||
m_userBuffer[1].clear();
|
m_userBuffer[1].clear();
|
||||||
m_state = audio::orchestra::state_closed;
|
m_state = audio::orchestra::state::closed;
|
||||||
m_mode = audio::orchestra::mode_unknow;
|
m_mode = audio::orchestra::mode_unknow;
|
||||||
return audio::orchestra::error_none;
|
return audio::orchestra::error_none;
|
||||||
}
|
}
|
||||||
|
|
||||||
void audio::orchestra::api::Pulse::callbackEventOneCycle() {
|
void audio::orchestra::api::Pulse::callbackEventOneCycle() {
|
||||||
if (m_state == audio::orchestra::state_stopped) {
|
if (m_state == audio::orchestra::state::stopped) {
|
||||||
std::unique_lock<std::mutex> lck(m_mutex);
|
std::unique_lock<std::mutex> lck(m_mutex);
|
||||||
while (!m_private->runnable) {
|
while (!m_private->runnable) {
|
||||||
m_private->runnable_cv.wait(lck);
|
m_private->runnable_cv.wait(lck);
|
||||||
}
|
}
|
||||||
if (m_state != audio::orchestra::state_running) {
|
if (m_state != audio::orchestra::state::running) {
|
||||||
m_mutex.unlock();
|
m_mutex.unlock();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (m_state == audio::orchestra::state_closed) {
|
if (m_state == audio::orchestra::state::closed) {
|
||||||
ATA_ERROR("the stream is closed ... this shouldn't happen!");
|
ATA_ERROR("the stream is closed ... this shouldn't happen!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -162,7 +159,7 @@ void audio::orchestra::api::Pulse::callbackEventOneCycle() {
|
|||||||
m_mutex.lock();
|
m_mutex.lock();
|
||||||
void *pulse_in = m_doConvertBuffer[audio::orchestra::modeToIdTable(audio::orchestra::mode_input)] ? m_deviceBuffer : &m_userBuffer[audio::orchestra::modeToIdTable(audio::orchestra::mode_input)][0];
|
void *pulse_in = m_doConvertBuffer[audio::orchestra::modeToIdTable(audio::orchestra::mode_input)] ? m_deviceBuffer : &m_userBuffer[audio::orchestra::modeToIdTable(audio::orchestra::mode_input)][0];
|
||||||
void *pulse_out = m_doConvertBuffer[audio::orchestra::modeToIdTable(audio::orchestra::mode_output)] ? m_deviceBuffer : &m_userBuffer[audio::orchestra::modeToIdTable(audio::orchestra::mode_output)][0];
|
void *pulse_out = m_doConvertBuffer[audio::orchestra::modeToIdTable(audio::orchestra::mode_output)] ? m_deviceBuffer : &m_userBuffer[audio::orchestra::modeToIdTable(audio::orchestra::mode_output)][0];
|
||||||
if (m_state != audio::orchestra::state_running) {
|
if (m_state != audio::orchestra::state::running) {
|
||||||
goto unlock;
|
goto unlock;
|
||||||
}
|
}
|
||||||
int32_t pa_error;
|
int32_t pa_error;
|
||||||
@@ -210,16 +207,16 @@ unlock:
|
|||||||
enum audio::orchestra::error audio::orchestra::api::Pulse::startStream() {
|
enum audio::orchestra::error audio::orchestra::api::Pulse::startStream() {
|
||||||
// TODO : Check return ...
|
// TODO : Check return ...
|
||||||
audio::orchestra::Api::startStream();
|
audio::orchestra::Api::startStream();
|
||||||
if (m_state == audio::orchestra::state_closed) {
|
if (m_state == audio::orchestra::state::closed) {
|
||||||
ATA_ERROR("the stream is not open!");
|
ATA_ERROR("the stream is not open!");
|
||||||
return audio::orchestra::error_invalidUse;
|
return audio::orchestra::error_invalidUse;
|
||||||
}
|
}
|
||||||
if (m_state == audio::orchestra::state_running) {
|
if (m_state == audio::orchestra::state::running) {
|
||||||
ATA_ERROR("the stream is already running!");
|
ATA_ERROR("the stream is already running!");
|
||||||
return audio::orchestra::error_warning;
|
return audio::orchestra::error_warning;
|
||||||
}
|
}
|
||||||
m_mutex.lock();
|
m_mutex.lock();
|
||||||
m_state = audio::orchestra::state_running;
|
m_state = audio::orchestra::state::running;
|
||||||
m_private->runnable = true;
|
m_private->runnable = true;
|
||||||
m_private->runnable_cv.notify_one();
|
m_private->runnable_cv.notify_one();
|
||||||
m_mutex.unlock();
|
m_mutex.unlock();
|
||||||
@@ -227,15 +224,15 @@ enum audio::orchestra::error audio::orchestra::api::Pulse::startStream() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
enum audio::orchestra::error audio::orchestra::api::Pulse::stopStream() {
|
enum audio::orchestra::error audio::orchestra::api::Pulse::stopStream() {
|
||||||
if (m_state == audio::orchestra::state_closed) {
|
if (m_state == audio::orchestra::state::closed) {
|
||||||
ATA_ERROR("the stream is not open!");
|
ATA_ERROR("the stream is not open!");
|
||||||
return audio::orchestra::error_invalidUse;
|
return audio::orchestra::error_invalidUse;
|
||||||
}
|
}
|
||||||
if (m_state == audio::orchestra::state_stopped) {
|
if (m_state == audio::orchestra::state::stopped) {
|
||||||
ATA_ERROR("the stream is already stopped!");
|
ATA_ERROR("the stream is already stopped!");
|
||||||
return audio::orchestra::error_warning;
|
return audio::orchestra::error_warning;
|
||||||
}
|
}
|
||||||
m_state = audio::orchestra::state_stopped;
|
m_state = audio::orchestra::state::stopped;
|
||||||
m_mutex.lock();
|
m_mutex.lock();
|
||||||
if ( m_private != nullptr
|
if ( m_private != nullptr
|
||||||
&& m_private->handle != nullptr
|
&& m_private->handle != nullptr
|
||||||
@@ -247,21 +244,21 @@ enum audio::orchestra::error audio::orchestra::api::Pulse::stopStream() {
|
|||||||
return audio::orchestra::error_systemError;
|
return audio::orchestra::error_systemError;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_state = audio::orchestra::state_stopped;
|
m_state = audio::orchestra::state::stopped;
|
||||||
m_mutex.unlock();
|
m_mutex.unlock();
|
||||||
return audio::orchestra::error_none;
|
return audio::orchestra::error_none;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum audio::orchestra::error audio::orchestra::api::Pulse::abortStream() {
|
enum audio::orchestra::error audio::orchestra::api::Pulse::abortStream() {
|
||||||
if (m_state == audio::orchestra::state_closed) {
|
if (m_state == audio::orchestra::state::closed) {
|
||||||
ATA_ERROR("the stream is not open!");
|
ATA_ERROR("the stream is not open!");
|
||||||
return audio::orchestra::error_invalidUse;
|
return audio::orchestra::error_invalidUse;
|
||||||
}
|
}
|
||||||
if (m_state == audio::orchestra::state_stopped) {
|
if (m_state == audio::orchestra::state::stopped) {
|
||||||
ATA_ERROR("the stream is already stopped!");
|
ATA_ERROR("the stream is already stopped!");
|
||||||
return audio::orchestra::error_warning;
|
return audio::orchestra::error_warning;
|
||||||
}
|
}
|
||||||
m_state = audio::orchestra::state_stopped;
|
m_state = audio::orchestra::state::stopped;
|
||||||
m_mutex.lock();
|
m_mutex.lock();
|
||||||
if ( m_private != nullptr
|
if ( m_private != nullptr
|
||||||
&& m_private->handle != nullptr
|
&& m_private->handle != nullptr
|
||||||
@@ -273,7 +270,7 @@ enum audio::orchestra::error audio::orchestra::api::Pulse::abortStream() {
|
|||||||
return audio::orchestra::error_systemError;
|
return audio::orchestra::error_systemError;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_state = audio::orchestra::state_stopped;
|
m_state = audio::orchestra::state::stopped;
|
||||||
m_mutex.unlock();
|
m_mutex.unlock();
|
||||||
return audio::orchestra::error_none;
|
return audio::orchestra::error_none;
|
||||||
}
|
}
|
||||||
@@ -396,13 +393,13 @@ bool audio::orchestra::api::Pulse::open(uint32_t _device,
|
|||||||
}
|
}
|
||||||
if (m_private->threadRunning == false) {
|
if (m_private->threadRunning == false) {
|
||||||
m_private->threadRunning = true;
|
m_private->threadRunning = true;
|
||||||
m_private->thread = std::make_shared<std::thread>(&pulseaudio_callback, this);
|
m_private->thread = ememory::makeShared<std::thread>(&pulseaudio_callback, this);
|
||||||
if (m_private->thread == nullptr) {
|
if (m_private->thread == nullptr) {
|
||||||
ATA_ERROR("error creating thread.");
|
ATA_ERROR("error creating thread.");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_state = audio::orchestra::state_stopped;
|
m_state = audio::orchestra::state::stopped;
|
||||||
return true;
|
return true;
|
||||||
error:
|
error:
|
||||||
for (int32_t iii=0; iii<2; ++iii) {
|
for (int32_t iii=0; iii<2; ++iii) {
|
||||||
|
@@ -13,12 +13,12 @@ namespace audio {
|
|||||||
class PulsePrivate;
|
class PulsePrivate;
|
||||||
class Pulse: public audio::orchestra::Api {
|
class Pulse: public audio::orchestra::Api {
|
||||||
public:
|
public:
|
||||||
static std::shared_ptr<audio::orchestra::Api> create();
|
static ememory::SharedPtr<audio::orchestra::Api> create();
|
||||||
public:
|
public:
|
||||||
Pulse();
|
Pulse();
|
||||||
virtual ~Pulse();
|
virtual ~Pulse();
|
||||||
const std::string& getCurrentApi() {
|
const std::string& getCurrentApi() {
|
||||||
return audio::orchestra::type_pulse;
|
return audio::orchestra::typePulse;
|
||||||
}
|
}
|
||||||
uint32_t getDeviceCount();
|
uint32_t getDeviceCount();
|
||||||
audio::orchestra::DeviceInfo getDeviceInfo(uint32_t _device);
|
audio::orchestra::DeviceInfo getDeviceInfo(uint32_t _device);
|
||||||
@@ -33,7 +33,7 @@ namespace audio {
|
|||||||
void callbackEventOneCycle();
|
void callbackEventOneCycle();
|
||||||
void callbackEvent();
|
void callbackEvent();
|
||||||
private:
|
private:
|
||||||
std::shared_ptr<PulsePrivate> m_private;
|
ememory::SharedPtr<PulsePrivate> m_private;
|
||||||
std::vector<audio::orchestra::DeviceInfo> m_devices;
|
std::vector<audio::orchestra::DeviceInfo> m_devices;
|
||||||
void saveDeviceInfo();
|
void saveDeviceInfo();
|
||||||
bool open(uint32_t _device,
|
bool open(uint32_t _device,
|
@@ -7,15 +7,15 @@
|
|||||||
|
|
||||||
#if defined(ORCHESTRA_BUILD_PULSE)
|
#if defined(ORCHESTRA_BUILD_PULSE)
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <cstdio>
|
||||||
#include <string.h>
|
#include <cstring>
|
||||||
#include <pulse/pulseaudio.h>
|
#include <pulse/pulseaudio.hpp>
|
||||||
#include <audio/orchestra/api/PulseDeviceList.h>
|
#include <audio/orchestra/api/PulseDeviceList.hpp>
|
||||||
#include <audio/orchestra/debug.h>
|
#include <audio/orchestra/debug.hpp>
|
||||||
#include <audio/Time.h>
|
#include <audio/Time.hpp>
|
||||||
#include <audio/Duration.h>
|
#include <audio/Duration.hpp>
|
||||||
#include <audio/format.h>
|
#include <audio/format.hpp>
|
||||||
#include <etk/stdTools.h>
|
#include <etk/stdTools.hpp>
|
||||||
|
|
||||||
// This callback gets called when our context changes state. We really only
|
// This callback gets called when our context changes state. We really only
|
||||||
// care about when it's ready or if it has failed
|
// care about when it's ready or if it has failed
|
||||||
|
@@ -7,8 +7,8 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#ifdef ORCHESTRA_BUILD_PULSE
|
#ifdef ORCHESTRA_BUILD_PULSE
|
||||||
|
|
||||||
#include <etk/types.h>
|
#include <etk/types.hpp>
|
||||||
#include <audio/orchestra/DeviceInfo.h>
|
#include <audio/orchestra/DeviceInfo.hpp>
|
||||||
|
|
||||||
namespace audio {
|
namespace audio {
|
||||||
namespace orchestra {
|
namespace orchestra {
|
@@ -1,25 +0,0 @@
|
|||||||
/** @file
|
|
||||||
* @author Edouard DUPIN
|
|
||||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
|
||||||
* @license APACHE v2.0 (see license file)
|
|
||||||
* @fork from RTAudio
|
|
||||||
*/
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <thread>
|
|
||||||
#include <condition_variable>
|
|
||||||
#include <mutex>
|
|
||||||
#include <chrono>
|
|
||||||
#include <functional>
|
|
||||||
#include <memory>
|
|
||||||
#include <audio/channel.h>
|
|
||||||
#include <audio/format.h>
|
|
||||||
#include <audio/orchestra/error.h>
|
|
||||||
#include <audio/orchestra/status.h>
|
|
||||||
#include <audio/orchestra/Flags.h>
|
|
||||||
|
|
||||||
#include <audio/orchestra/CallbackInfo.h>
|
|
||||||
#include <audio/orchestra/DeviceInfo.h>
|
|
||||||
#include <audio/orchestra/StreamOptions.h>
|
|
||||||
#include <audio/orchestra/StreamParameters.h>
|
|
||||||
|
|
25
audio/orchestra/base.hpp
Normal file
25
audio/orchestra/base.hpp
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
/** @file
|
||||||
|
* @author Edouard DUPIN
|
||||||
|
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||||
|
* @license APACHE v2.0 (see license file)
|
||||||
|
* @fork from RTAudio
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <thread>
|
||||||
|
#include <condition_variable>
|
||||||
|
#include <mutex>
|
||||||
|
#include <chrono>
|
||||||
|
#include <functional>
|
||||||
|
#include <ememory/memory.hpp>
|
||||||
|
#include <audio/channel.hpp>
|
||||||
|
#include <audio/format.hpp>
|
||||||
|
#include <audio/orchestra/error.hpp>
|
||||||
|
#include <audio/orchestra/status.hpp>
|
||||||
|
#include <audio/orchestra/Flags.hpp>
|
||||||
|
|
||||||
|
#include <audio/orchestra/CallbackInfo.hpp>
|
||||||
|
#include <audio/orchestra/DeviceInfo.hpp>
|
||||||
|
#include <audio/orchestra/StreamOptions.hpp>
|
||||||
|
#include <audio/orchestra/StreamParameters.hpp>
|
||||||
|
|
@@ -5,7 +5,7 @@
|
|||||||
* @fork from RTAudio
|
* @fork from RTAudio
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <audio/orchestra/debug.h>
|
#include <audio/orchestra/debug.hpp>
|
||||||
|
|
||||||
int32_t audio::orchestra::getLogId() {
|
int32_t audio::orchestra::getLogId() {
|
||||||
static int32_t g_val = elog::registerInstance("audio-orchestra");
|
static int32_t g_val = elog::registerInstance("audio-orchestra");
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <elog/log.h>
|
#include <elog/log.hpp>
|
||||||
|
|
||||||
namespace audio {
|
namespace audio {
|
||||||
namespace orchestra {
|
namespace orchestra {
|
@@ -5,5 +5,5 @@
|
|||||||
* @fork from RTAudio
|
* @fork from RTAudio
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <audio/orchestra/error.h>
|
#include <audio/orchestra/error.hpp>
|
||||||
#include <audio/orchestra/debug.h>
|
#include <audio/orchestra/debug.hpp>
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <etk/types.h>
|
#include <etk/types.hpp>
|
||||||
|
|
||||||
namespace audio {
|
namespace audio {
|
||||||
namespace orchestra {
|
namespace orchestra {
|
@@ -5,8 +5,8 @@
|
|||||||
* @fork from RTAudio
|
* @fork from RTAudio
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <audio/orchestra/mode.h>
|
#include <audio/orchestra/mode.hpp>
|
||||||
#include <audio/orchestra/debug.h>
|
#include <audio/orchestra/debug.hpp>
|
||||||
|
|
||||||
int32_t audio::orchestra::modeToIdTable(enum mode _mode) {
|
int32_t audio::orchestra::modeToIdTable(enum mode _mode) {
|
||||||
switch (_mode) {
|
switch (_mode) {
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <etk/types.h>
|
#include <etk/types.hpp>
|
||||||
|
|
||||||
namespace audio {
|
namespace audio {
|
||||||
namespace orchestra {
|
namespace orchestra {
|
@@ -6,15 +6,15 @@
|
|||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <etk/types.h>
|
#include <etk/types.hpp>
|
||||||
|
|
||||||
namespace audio {
|
namespace audio {
|
||||||
namespace orchestra {
|
namespace orchestra {
|
||||||
enum state {
|
enum class state {
|
||||||
state_closed,
|
closed,
|
||||||
state_stopped,
|
stopped,
|
||||||
state_stopping,
|
stopping,
|
||||||
state_running
|
running
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -5,8 +5,8 @@
|
|||||||
* @fork from RTAudio
|
* @fork from RTAudio
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <audio/orchestra/status.h>
|
#include <audio/orchestra/status.hpp>
|
||||||
#include <audio/orchestra/debug.h>
|
#include <audio/orchestra/debug.hpp>
|
||||||
static const char* listValue[] = {
|
static const char* listValue[] = {
|
||||||
"ok",
|
"ok",
|
||||||
"overflow",
|
"overflow",
|
||||||
@@ -14,7 +14,7 @@ static const char* listValue[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
std::ostream& audio::orchestra::operator <<(std::ostream& _os, enum audio::orchestra::status _obj) {
|
std::ostream& audio::orchestra::operator <<(std::ostream& _os, enum audio::orchestra::status _obj) {
|
||||||
_os << listValue[_obj];
|
_os << listValue[int32_t(_obj)];
|
||||||
return _os;
|
return _os;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -6,14 +6,14 @@
|
|||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <etk/types.h>
|
#include <etk/types.hpp>
|
||||||
|
|
||||||
namespace audio {
|
namespace audio {
|
||||||
namespace orchestra {
|
namespace orchestra {
|
||||||
enum status {
|
enum class status {
|
||||||
status_ok, //!< nothing...
|
ok, //!< nothing...
|
||||||
status_overflow, //!< Internal buffer has more data than they can accept
|
overflow, //!< Internal buffer has more data than they can accept
|
||||||
status_underflow //!< The internal buffer is empty
|
underflow //!< The internal buffer is empty
|
||||||
};
|
};
|
||||||
std::ostream& operator <<(std::ostream& _os, enum audio::orchestra::status _obj);
|
std::ostream& operator <<(std::ostream& _os, enum audio::orchestra::status _obj);
|
||||||
std::ostream& operator <<(std::ostream& _os, const std::vector<enum audio::orchestra::status>& _obj);
|
std::ostream& operator <<(std::ostream& _os, const std::vector<enum audio::orchestra::status>& _obj);
|
@@ -5,24 +5,21 @@
|
|||||||
* @fork from RTAudio
|
* @fork from RTAudio
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <audio/orchestra/type.h>
|
#include <audio/orchestra/type.hpp>
|
||||||
#include <audio/orchestra/debug.h>
|
#include <audio/orchestra/debug.hpp>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <climits>
|
#include <climits>
|
||||||
|
|
||||||
#undef __class__
|
const std::string audio::orchestra::typeUndefined = "undefined";
|
||||||
#define __class__ "type"
|
const std::string audio::orchestra::typeAlsa = "alsa";
|
||||||
|
const std::string audio::orchestra::typePulse = "pulse";
|
||||||
const std::string audio::orchestra::type_undefined = "undefined";
|
const std::string audio::orchestra::typeOss = "oss";
|
||||||
const std::string audio::orchestra::type_alsa = "alsa";
|
const std::string audio::orchestra::typeJack = "jack";
|
||||||
const std::string audio::orchestra::type_pulse = "pulse";
|
const std::string audio::orchestra::typeCoreOSX = "coreOSX";
|
||||||
const std::string audio::orchestra::type_oss = "oss";
|
const std::string audio::orchestra::typeCoreIOS = "coreIOS";
|
||||||
const std::string audio::orchestra::type_jack = "jack";
|
const std::string audio::orchestra::typeAsio = "asio";
|
||||||
const std::string audio::orchestra::type_coreOSX = "coreOSX";
|
const std::string audio::orchestra::typeDs = "ds";
|
||||||
const std::string audio::orchestra::type_coreIOS = "coreIOS";
|
const std::string audio::orchestra::typeJava = "java";
|
||||||
const std::string audio::orchestra::type_asio = "asio";
|
const std::string audio::orchestra::typeDummy = "dummy";
|
||||||
const std::string audio::orchestra::type_ds = "ds";
|
|
||||||
const std::string audio::orchestra::type_java = "java";
|
|
||||||
const std::string audio::orchestra::type_dummy = "dummy";
|
|
||||||
|
@@ -1,30 +0,0 @@
|
|||||||
/** @file
|
|
||||||
* @author Edouard DUPIN
|
|
||||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
|
||||||
* @license APACHE v2.0 (see license file)
|
|
||||||
* @fork from RTAudio
|
|
||||||
*/
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <etk/types.h>
|
|
||||||
#include <etk/stdTools.h>
|
|
||||||
|
|
||||||
namespace audio {
|
|
||||||
namespace orchestra {
|
|
||||||
/**
|
|
||||||
* @brief Audio API specifier arguments.
|
|
||||||
*/
|
|
||||||
extern const std::string type_undefined; //!< Error API.
|
|
||||||
extern const std::string type_alsa; //!< LINUX The Advanced Linux Sound Architecture.
|
|
||||||
extern const std::string type_pulse; //!< LINUX The Linux PulseAudio.
|
|
||||||
extern const std::string type_oss; //!< LINUX The Linux Open Sound System.
|
|
||||||
extern const std::string type_jack; //!< UNIX The Jack Low-Latency Audio Server.
|
|
||||||
extern const std::string type_coreOSX; //!< Macintosh OSX Core Audio.
|
|
||||||
extern const std::string type_coreIOS; //!< Macintosh iOS Core Audio.
|
|
||||||
extern const std::string type_asio; //!< WINDOWS The Steinberg Audio Stream I/O.
|
|
||||||
extern const std::string type_ds; //!< WINDOWS The Microsoft Direct Sound.
|
|
||||||
extern const std::string type_java; //!< ANDROID Interface.
|
|
||||||
extern const std::string type_dummy; //!< Empty wrapper (non-functional).
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
30
audio/orchestra/type.hpp
Normal file
30
audio/orchestra/type.hpp
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
/** @file
|
||||||
|
* @author Edouard DUPIN
|
||||||
|
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||||
|
* @license APACHE v2.0 (see license file)
|
||||||
|
* @fork from RTAudio
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <etk/types.hpp>
|
||||||
|
#include <etk/stdTools.hpp>
|
||||||
|
|
||||||
|
namespace audio {
|
||||||
|
namespace orchestra {
|
||||||
|
/**
|
||||||
|
* @brief Audio API specifier arguments.
|
||||||
|
*/
|
||||||
|
extern const std::string typeUndefined; //!< Error API.
|
||||||
|
extern const std::string typeAlsa; //!< LINUX The Advanced Linux Sound Architecture.
|
||||||
|
extern const std::string typePulse; //!< LINUX The Linux PulseAudio.
|
||||||
|
extern const std::string typeOss; //!< LINUX The Linux Open Sound System.
|
||||||
|
extern const std::string typeJack; //!< UNIX The Jack Low-Latency Audio Server.
|
||||||
|
extern const std::string typeCoreOSX; //!< Macintosh OSX Core Audio.
|
||||||
|
extern const std::string typeCoreIOS; //!< Macintosh iOS Core Audio.
|
||||||
|
extern const std::string typeAsio; //!< WINDOWS The Steinberg Audio Stream I/O.
|
||||||
|
extern const std::string typeDs; //!< WINDOWS The Microsoft Direct Sound.
|
||||||
|
extern const std::string typeJava; //!< ANDROID Interface.
|
||||||
|
extern const std::string typeDummy; //!< Empty wrapper (non-functional).
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
1
authors.txt
Normal file
1
authors.txt
Normal file
@@ -0,0 +1 @@
|
|||||||
|
MR Edouard DUPIN <yui.heero@gmail.com>
|
@@ -1,91 +0,0 @@
|
|||||||
cmake_minimum_required(VERSION 2.8.3)
|
|
||||||
project(audio_orchestra)
|
|
||||||
|
|
||||||
set(CMAKE_VERBOSE_MAKEFILE ON)
|
|
||||||
|
|
||||||
## Find catkin macros and libraries
|
|
||||||
## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
|
|
||||||
## is used, also find other catkin packages
|
|
||||||
find_package(catkin REQUIRED COMPONENTS
|
|
||||||
etk
|
|
||||||
audio
|
|
||||||
)
|
|
||||||
|
|
||||||
find_package(ALSA REQUIRED)
|
|
||||||
|
|
||||||
###################################
|
|
||||||
## catkin specific configuration ##
|
|
||||||
###################################
|
|
||||||
## The catkin_package macro generates cmake config files for your package
|
|
||||||
## Declare things to be passed to dependent projects
|
|
||||||
## INCLUDE_DIRS: uncomment this if you package contains header files
|
|
||||||
## LIBRARIES: libraries you create in this project that dependent projects also need
|
|
||||||
## CATKIN_DEPENDS: catkin_packages dependent projects also need
|
|
||||||
## DEPENDS: system dependencies of this project that dependent projects also need
|
|
||||||
catkin_package(
|
|
||||||
INCLUDE_DIRS ../
|
|
||||||
LIBRARIES ${PROJECT_NAME}
|
|
||||||
CATKIN_DEPENDS etk audio
|
|
||||||
DEPENDS system_lib
|
|
||||||
)
|
|
||||||
|
|
||||||
###########
|
|
||||||
## Build ##
|
|
||||||
###########
|
|
||||||
|
|
||||||
## Specify additional locations of header files
|
|
||||||
## Your package locations should be listed before other locations
|
|
||||||
include_directories(
|
|
||||||
..
|
|
||||||
${catkin_INCLUDE_DIRS}
|
|
||||||
)
|
|
||||||
|
|
||||||
## Declare a cpp library
|
|
||||||
add_library(${PROJECT_NAME}
|
|
||||||
../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
|
|
||||||
../audio/orchestra/api/Alsa.cpp
|
|
||||||
../audio/orchestra/api/Jack.cpp
|
|
||||||
../audio/orchestra/api/Pulse.cpp
|
|
||||||
../audio/orchestra/api/Oss.cpp
|
|
||||||
)
|
|
||||||
|
|
||||||
add_definitions(-D__LINUX_ALSA__)
|
|
||||||
add_definitions(-D__DUMMY__)
|
|
||||||
|
|
||||||
## Add cmake target dependencies of the executable/library
|
|
||||||
## as an example, message headers may need to be generated before nodes
|
|
||||||
#add_dependencies(${PROJECT_NAME} test_perfo_core_generate_messages_cpp)
|
|
||||||
|
|
||||||
## Specify libraries to link a library or executable target against
|
|
||||||
target_link_libraries(${PROJECT_NAME}
|
|
||||||
${ALSA_LIBRARIES}
|
|
||||||
${catkin_LIBRARIES}
|
|
||||||
)
|
|
||||||
|
|
||||||
#############
|
|
||||||
## Install ##
|
|
||||||
#############
|
|
||||||
|
|
||||||
## Mark executables and/or libraries for installation
|
|
||||||
install(TARGETS ${PROJECT_NAME}
|
|
||||||
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
|
|
||||||
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
|
|
||||||
)
|
|
||||||
|
|
||||||
## Mark cpp header files for installation
|
|
||||||
install(DIRECTORY ../audio/orchestra/
|
|
||||||
DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
|
|
||||||
FILES_MATCHING PATTERN "*.h"
|
|
||||||
)
|
|
@@ -1,13 +0,0 @@
|
|||||||
<?xml version="1.0"?>
|
|
||||||
<package>
|
|
||||||
<name>audio_orchestra</name>
|
|
||||||
<version>0.3.0</version>
|
|
||||||
<description>Ewol RTAudio fork</description>
|
|
||||||
<maintainer email="yui.heero@gmail.com">Edouard DUPIN</maintainer>
|
|
||||||
<license>Apache-2.0</license>
|
|
||||||
<build_depend>etk</build_depend>
|
|
||||||
<build_depend>audio</build_depend>
|
|
||||||
<buildtool_depend>catkin</buildtool_depend>
|
|
||||||
<run_depend>etk</run_depend>
|
|
||||||
<run_depend>audio</run_depend>
|
|
||||||
</package>
|
|
83
doc/build.md
Normal file
83
doc/build.md
Normal file
@@ -0,0 +1,83 @@
|
|||||||
|
Build lib & build sample {#audio_orchestra_build}
|
||||||
|
========================
|
||||||
|
|
||||||
|
@tableofcontents
|
||||||
|
|
||||||
|
Download: {#audio_orchestra_build_download}
|
||||||
|
=========
|
||||||
|
|
||||||
|
ege use some tools to manage source and build it:
|
||||||
|
|
||||||
|
need google repo: {#audio_orchestra_build_download_repo}
|
||||||
|
-----------------
|
||||||
|
|
||||||
|
see: http://source.android.com/source/downloading.html#installing-repo
|
||||||
|
|
||||||
|
On all platform:
|
||||||
|
```{.sh}
|
||||||
|
mkdir ~/.bin
|
||||||
|
PATH=~/.bin:$PATH
|
||||||
|
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/.bin/repo
|
||||||
|
chmod a+x ~/.bin/repo
|
||||||
|
```
|
||||||
|
|
||||||
|
On ubuntu
|
||||||
|
```{.sh}
|
||||||
|
sudo apt-get install repo
|
||||||
|
```
|
||||||
|
|
||||||
|
On archlinux
|
||||||
|
```{.sh}
|
||||||
|
sudo pacman -S repo
|
||||||
|
```
|
||||||
|
|
||||||
|
lutin (build-system): {#audio_orchestra_build_download_lutin}
|
||||||
|
---------------------
|
||||||
|
|
||||||
|
```{.sh}
|
||||||
|
pip install lutin --user
|
||||||
|
# optionnal dependency of lutin (manage image changing size for application release)
|
||||||
|
pip install pillow --user
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
dependency: {#audio_orchestra_build_download_dependency}
|
||||||
|
-----------
|
||||||
|
|
||||||
|
```{.sh}
|
||||||
|
mkdir -p WORKING_DIRECTORY/framework
|
||||||
|
cd WORKING_DIRECTORY/framework
|
||||||
|
repo init -u git://github.com/atria-soft/manifest.git
|
||||||
|
repo sync -j8
|
||||||
|
cd ../..
|
||||||
|
```
|
||||||
|
|
||||||
|
sources: {#audio_orchestra_build_download_sources}
|
||||||
|
--------
|
||||||
|
|
||||||
|
They are already download in the repo manifest in:
|
||||||
|
|
||||||
|
```{.sh}
|
||||||
|
cd WORKING_DIRECTORY/framework/atria-soft/audio_orchestra
|
||||||
|
```
|
||||||
|
|
||||||
|
Build: {#audio_orchestra_build_build}
|
||||||
|
======
|
||||||
|
|
||||||
|
you must stay in zour working directory...
|
||||||
|
```{.sh}
|
||||||
|
cd WORKING_DIRECTORY
|
||||||
|
```
|
||||||
|
|
||||||
|
library: {#audio_orchestra_build_build_library}
|
||||||
|
--------
|
||||||
|
|
||||||
|
```{.sh}
|
||||||
|
lutin -mdebug audio-orchestra
|
||||||
|
```
|
||||||
|
|
||||||
|
Sample: {#audio_orchestra_build_build_sample}
|
||||||
|
-------
|
||||||
|
|
||||||
|
No smaple availlable for now ...
|
||||||
|
|
50
doc/mainpage.md
Normal file
50
doc/mainpage.md
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
AUDIO-ORCHESTRA library {#mainpage}
|
||||||
|
=======================
|
||||||
|
|
||||||
|
@tableofcontents
|
||||||
|
|
||||||
|
What is AUDIO-ORCHESTRA: {#audio_orchestra_mainpage_what}
|
||||||
|
========================
|
||||||
|
|
||||||
|
AUDIO-ORCHESTRA, is a fork of RTAudio lib (with port for Android, and IOs).
|
||||||
|
|
||||||
|
This is a cross API of Audio wrapping the Hardware.
|
||||||
|
|
||||||
|
This library is not friendy usable, use audio-river to have a correct and simple multiple-flow API
|
||||||
|
|
||||||
|
What it does: {#audio_orchestra_mainpage_what_it_does}
|
||||||
|
-------------
|
||||||
|
|
||||||
|
- Open a strem audio in Input or output
|
||||||
|
- synchronise 2 flow
|
||||||
|
- open on some platform: Android, Linux, MacOs, Ios, Windows
|
||||||
|
|
||||||
|
AUDIO-ORCHESTRA is dependent of the STL (compatible with MacOs stl (CXX))
|
||||||
|
|
||||||
|
|
||||||
|
What languages are supported? {#audio_orchestra_mainpage_language}
|
||||||
|
=============================
|
||||||
|
|
||||||
|
AUDIO-ORCHESTRA is written in C++.
|
||||||
|
|
||||||
|
|
||||||
|
Are there any licensing restrictions? {#audio_orchestra_mainpage_license_restriction}
|
||||||
|
=====================================
|
||||||
|
|
||||||
|
AUDIO-ORCHESTRA is **FREE software** and _all sub-library are FREE and staticly linkable !!!_
|
||||||
|
|
||||||
|
|
||||||
|
License (MIT) {#audio_orchestra_mainpage_license}
|
||||||
|
=============
|
||||||
|
|
||||||
|
Copyright AUDIO-ORCHESTRA Edouard DUPIN
|
||||||
|
|
||||||
|
MIT ...
|
||||||
|
|
||||||
|
|
||||||
|
Other pages {#audio_orchestra_mainpage_sub_page}
|
||||||
|
===========
|
||||||
|
|
||||||
|
- @ref audio_orchestra_build
|
||||||
|
- [**ewol coding style**](http://atria-soft.github.io/ewol/ewol_coding_style.html)
|
||||||
|
|
32
doxy_audio-orchestra.py
Normal file
32
doxy_audio-orchestra.py
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
import os
|
||||||
|
import doxy.module as module
|
||||||
|
import doxy.debug as debug
|
||||||
|
import doxy.tools as tools
|
||||||
|
|
||||||
|
def create(target, module_name):
|
||||||
|
my_module = module.Module(__file__, module_name)
|
||||||
|
my_module.set_version("version.txt")
|
||||||
|
my_module.set_title("Orchestra: audio interface wrapper")
|
||||||
|
my_module.set_website("http://musicdsp.github.io/" + module_name)
|
||||||
|
my_module.set_website_sources("http://github.com/musicdsp/" + module_name)
|
||||||
|
my_module.add_path([
|
||||||
|
"audio",
|
||||||
|
"doc"
|
||||||
|
])
|
||||||
|
my_module.add_depend([
|
||||||
|
'etk',
|
||||||
|
'audio',
|
||||||
|
])
|
||||||
|
my_module.add_exclude_symbols([
|
||||||
|
'*operator<<*',
|
||||||
|
])
|
||||||
|
my_module.add_exclude_file([
|
||||||
|
'debug.h',
|
||||||
|
])
|
||||||
|
my_module.add_file_patterns([
|
||||||
|
'*.h',
|
||||||
|
'*.md',
|
||||||
|
])
|
||||||
|
|
||||||
|
return my_module
|
@@ -1,5 +1,4 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
import lutin.module as module
|
|
||||||
import lutin.tools as tools
|
import lutin.tools as tools
|
||||||
import lutin.debug as debug
|
import lutin.debug as debug
|
||||||
|
|
||||||
@@ -20,13 +19,12 @@ def get_compagny_name():
|
|||||||
return "atria-soft"
|
return "atria-soft"
|
||||||
|
|
||||||
def get_maintainer():
|
def get_maintainer():
|
||||||
return ["Mr DUPIN Edouard <yui.heero@gmail.com>"]
|
return "authors.txt"
|
||||||
|
|
||||||
def get_version():
|
def get_version():
|
||||||
return [0,0,0]
|
return "version.txt"
|
||||||
|
|
||||||
def create(target, module_name):
|
def configure(target, my_module):
|
||||||
my_module = module.Module(__file__, module_name, get_type())
|
|
||||||
my_module.add_src_file([
|
my_module.add_src_file([
|
||||||
'audio/orchestra/debug.cpp',
|
'audio/orchestra/debug.cpp',
|
||||||
'audio/orchestra/status.cpp',
|
'audio/orchestra/status.cpp',
|
||||||
@@ -43,67 +41,70 @@ def create(target, module_name):
|
|||||||
'audio/orchestra/api/Dummy.cpp'
|
'audio/orchestra/api/Dummy.cpp'
|
||||||
])
|
])
|
||||||
my_module.add_header_file([
|
my_module.add_header_file([
|
||||||
'audio/orchestra/debug.h',
|
'audio/orchestra/debug.hpp',
|
||||||
'audio/orchestra/status.h',
|
'audio/orchestra/status.hpp',
|
||||||
'audio/orchestra/type.h',
|
'audio/orchestra/type.hpp',
|
||||||
'audio/orchestra/mode.h',
|
'audio/orchestra/mode.hpp',
|
||||||
'audio/orchestra/state.h',
|
'audio/orchestra/state.hpp',
|
||||||
'audio/orchestra/error.h',
|
'audio/orchestra/error.hpp',
|
||||||
'audio/orchestra/base.h',
|
'audio/orchestra/base.hpp',
|
||||||
'audio/orchestra/Interface.h',
|
'audio/orchestra/Interface.hpp',
|
||||||
'audio/orchestra/Flags.h',
|
'audio/orchestra/Flags.hpp',
|
||||||
'audio/orchestra/Api.h',
|
'audio/orchestra/Api.hpp',
|
||||||
'audio/orchestra/DeviceInfo.h',
|
'audio/orchestra/DeviceInfo.hpp',
|
||||||
'audio/orchestra/StreamOptions.h',
|
'audio/orchestra/StreamOptions.hpp',
|
||||||
'audio/orchestra/CallbackInfo.h',
|
'audio/orchestra/CallbackInfo.hpp',
|
||||||
'audio/orchestra/StreamParameters.h'
|
'audio/orchestra/StreamParameters.hpp'
|
||||||
|
])
|
||||||
|
my_module.add_depend([
|
||||||
|
'audio',
|
||||||
|
'etk'
|
||||||
])
|
])
|
||||||
my_module.add_module_depend(['audio', 'etk'])
|
|
||||||
# add all the time the dummy interface
|
# add all the time the dummy interface
|
||||||
my_module.add_export_flag('c++', ['-DORCHESTRA_BUILD_DUMMY'])
|
my_module.add_flag('c++', ['-DORCHESTRA_BUILD_DUMMY'], export=True)
|
||||||
# TODO : Add a FILE interface:
|
# TODO : Add a FILE interface:
|
||||||
|
|
||||||
if target.name=="Windows":
|
if "Windows" in target.get_type():
|
||||||
my_module.add_src_file([
|
my_module.add_src_file([
|
||||||
'audio/orchestra/api/Asio.cpp',
|
'audio/orchestra/api/Asio.cpp',
|
||||||
'audio/orchestra/api/Ds.cpp',
|
'audio/orchestra/api/Ds.cpp',
|
||||||
])
|
])
|
||||||
# load optionnal API:
|
# load optionnal API:
|
||||||
my_module.add_optionnal_module_depend('asio', ["c++", "-DORCHESTRA_BUILD_ASIO"])
|
my_module.add_optionnal_depend('asio', ["c++", "-DORCHESTRA_BUILD_ASIO"])
|
||||||
my_module.add_optionnal_module_depend('ds', ["c++", "-DORCHESTRA_BUILD_DS"])
|
my_module.add_optionnal_depend('ds', ["c++", "-DORCHESTRA_BUILD_DS"])
|
||||||
my_module.add_optionnal_module_depend('wasapi', ["c++", "-DORCHESTRA_BUILD_WASAPI"])
|
my_module.add_optionnal_depend('wasapi', ["c++", "-DORCHESTRA_BUILD_WASAPI"])
|
||||||
elif target.name=="Linux":
|
elif "Linux" in target.get_type():
|
||||||
my_module.add_src_file([
|
my_module.add_src_file([
|
||||||
'audio/orchestra/api/Alsa.cpp',
|
'audio/orchestra/api/Alsa.cpp',
|
||||||
'audio/orchestra/api/Jack.cpp',
|
'audio/orchestra/api/Jack.cpp',
|
||||||
'audio/orchestra/api/Pulse.cpp',
|
'audio/orchestra/api/Pulse.cpp',
|
||||||
'audio/orchestra/api/PulseDeviceList.cpp'
|
'audio/orchestra/api/PulseDeviceList.cpp'
|
||||||
])
|
])
|
||||||
my_module.add_optionnal_module_depend('alsa', ["c++", "-DORCHESTRA_BUILD_ALSA"])
|
my_module.add_optionnal_depend('alsa', ["c++", "-DORCHESTRA_BUILD_ALSA"])
|
||||||
my_module.add_optionnal_module_depend('jack', ["c++", "-DORCHESTRA_BUILD_JACK"])
|
my_module.add_optionnal_depend('jack', ["c++", "-DORCHESTRA_BUILD_JACK"])
|
||||||
my_module.add_optionnal_module_depend('pulse', ["c++", "-DORCHESTRA_BUILD_PULSE"])
|
my_module.add_optionnal_depend('pulse', ["c++", "-DORCHESTRA_BUILD_PULSE"])
|
||||||
elif target.name=="MacOs":
|
elif "MacOs" in target.get_type():
|
||||||
my_module.add_src_file([
|
my_module.add_src_file([
|
||||||
'audio/orchestra/api/Core.cpp'
|
'audio/orchestra/api/Core.cpp'
|
||||||
])
|
])
|
||||||
# MacOsX core
|
# MacOsX core
|
||||||
my_module.add_optionnal_module_depend('CoreAudio', ["c++", "-DORCHESTRA_BUILD_MACOSX_CORE"])
|
my_module.add_optionnal_depend('CoreAudio', ["c++", "-DORCHESTRA_BUILD_MACOSX_CORE"])
|
||||||
elif target.name=="IOs":
|
elif "IOs" in target.get_type():
|
||||||
my_module.add_src_file('audio/orchestra/api/CoreIos.mm')
|
my_module.add_src_file('audio/orchestra/api/CoreIos.mm')
|
||||||
# IOsX core
|
# IOsX core
|
||||||
my_module.add_optionnal_module_depend('CoreAudio', ["c++", "-DORCHESTRA_BUILD_IOS_CORE"])
|
my_module.add_optionnal_depend('CoreAudio', ["c++", "-DORCHESTRA_BUILD_IOS_CORE"])
|
||||||
elif target.name=="Android":
|
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/OrchestraConstants.java')
|
||||||
my_module.add_src_file('android/org/musicdsp/orchestra/OrchestraManagerCallback.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/OrchestraNative.java')
|
||||||
my_module.add_src_file('android/org/musicdsp/orchestra/OrchestraInterfaceInput.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/OrchestraInterfaceOutput.java')
|
||||||
my_module.add_src_file('android/org/musicdsp/orchestra/OrchestraManager.java')
|
my_module.add_src_file('android/org/musicdsp/orchestra/OrchestraManager.java')
|
||||||
# create inter language interface
|
# create inter language interfacef
|
||||||
my_module.add_src_file('org.musicdsp.orchestra.OrchestraConstants.javah')
|
my_module.add_src_file('org.musicdsp.orchestra.OrchestraConstants.javah')
|
||||||
my_module.add_path(tools.get_current_path(__file__) + '/android/', type='java')
|
my_module.add_path('android', type='java')
|
||||||
my_module.add_module_depend(['SDK', 'jvm-basics', 'ejson'])
|
my_module.add_depend(['SDK', 'jvm-basics', 'ejson'])
|
||||||
my_module.add_export_flag('c++', ['-DORCHESTRA_BUILD_JAVA'])
|
my_module.add_flag('c++', ['-DORCHESTRA_BUILD_JAVA'], export=True)
|
||||||
|
|
||||||
my_module.add_src_file('audio/orchestra/api/Android.cpp')
|
my_module.add_src_file('audio/orchestra/api/Android.cpp')
|
||||||
my_module.add_src_file('audio/orchestra/api/AndroidNativeInterface.cpp')
|
my_module.add_src_file('audio/orchestra/api/AndroidNativeInterface.cpp')
|
||||||
@@ -112,9 +113,9 @@ def create(target, module_name):
|
|||||||
else:
|
else:
|
||||||
debug.warning("unknow target for audio_orchestra : " + target.name);
|
debug.warning("unknow target for audio_orchestra : " + target.name);
|
||||||
|
|
||||||
my_module.add_path(tools.get_current_path(__file__))
|
my_module.add_path(".")
|
||||||
|
|
||||||
return my_module
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -124,13 +125,13 @@ def create(target, module_name):
|
|||||||
##
|
##
|
||||||
##################################################################
|
##################################################################
|
||||||
def tool_generate_add_java_section_in_class(target, module, package_name):
|
def tool_generate_add_java_section_in_class(target, module, package_name):
|
||||||
module.pkg_add("GENERATE_SECTION__IMPORT", [
|
module.add_pkg("GENERATE_SECTION__IMPORT", [
|
||||||
"import org.musicdsp.orchestra.OrchestraManager;"
|
"import org.musicdsp.orchestra.OrchestraManager;"
|
||||||
])
|
])
|
||||||
module.pkg_add("GENERATE_SECTION__DECLARE", [
|
module.add_pkg("GENERATE_SECTION__DECLARE", [
|
||||||
"private OrchestraManager m_audioManagerHandle;"
|
"private OrchestraManager m_audioManagerHandle;"
|
||||||
])
|
])
|
||||||
module.pkg_add("GENERATE_SECTION__CONSTRUCTOR", [
|
module.add_pkg("GENERATE_SECTION__CONSTRUCTOR", [
|
||||||
"// load audio maneger if it does not work, it is not critical ...",
|
"// load audio maneger if it does not work, it is not critical ...",
|
||||||
"try {",
|
"try {",
|
||||||
" m_audioManagerHandle = new OrchestraManager();",
|
" m_audioManagerHandle = new OrchestraManager();",
|
||||||
@@ -138,37 +139,37 @@ def tool_generate_add_java_section_in_class(target, module, package_name):
|
|||||||
" Log.e(\"" + package_name + "\", \"Can not load Audio interface (maybe not really needed) :\" + e);",
|
" Log.e(\"" + package_name + "\", \"Can not load Audio interface (maybe not really needed) :\" + e);",
|
||||||
"}"
|
"}"
|
||||||
])
|
])
|
||||||
module.pkg_add("GENERATE_SECTION__ON_CREATE", [
|
module.add_pkg("GENERATE_SECTION__ON_CREATE", [
|
||||||
"if (m_audioManagerHandle != null) {",
|
"if (m_audioManagerHandle != null) {",
|
||||||
" m_audioManagerHandle.onCreate();",
|
" m_audioManagerHandle.onCreate();",
|
||||||
"}"
|
"}"
|
||||||
])
|
])
|
||||||
module.pkg_add("GENERATE_SECTION__ON_START", [
|
module.add_pkg("GENERATE_SECTION__ON_START", [
|
||||||
"if (m_audioManagerHandle != null) {",
|
"if (m_audioManagerHandle != null) {",
|
||||||
" m_audioManagerHandle.onStart();",
|
" m_audioManagerHandle.onStart();",
|
||||||
"}"
|
"}"
|
||||||
])
|
])
|
||||||
module.pkg_add("GENERATE_SECTION__ON_RESTART", [
|
module.add_pkg("GENERATE_SECTION__ON_RESTART", [
|
||||||
"if (m_audioManagerHandle != null) {",
|
"if (m_audioManagerHandle != null) {",
|
||||||
" m_audioManagerHandle.onRestart();",
|
" m_audioManagerHandle.onRestart();",
|
||||||
"}"
|
"}"
|
||||||
])
|
])
|
||||||
module.pkg_add("GENERATE_SECTION__ON_RESUME", [
|
module.add_pkg("GENERATE_SECTION__ON_RESUME", [
|
||||||
"if (m_audioManagerHandle != null) {",
|
"if (m_audioManagerHandle != null) {",
|
||||||
" m_audioManagerHandle.onResume();",
|
" m_audioManagerHandle.onResume();",
|
||||||
"}"
|
"}"
|
||||||
])
|
])
|
||||||
module.pkg_add("GENERATE_SECTION__ON_PAUSE", [
|
module.add_pkg("GENERATE_SECTION__ON_PAUSE", [
|
||||||
"if (m_audioManagerHandle != null) {",
|
"if (m_audioManagerHandle != null) {",
|
||||||
" m_audioManagerHandle.onPause();",
|
" m_audioManagerHandle.onPause();",
|
||||||
"}"
|
"}"
|
||||||
])
|
])
|
||||||
module.pkg_add("GENERATE_SECTION__ON_STOP", [
|
module.add_pkg("GENERATE_SECTION__ON_STOP", [
|
||||||
"if (m_audioManagerHandle != null) {",
|
"if (m_audioManagerHandle != null) {",
|
||||||
" m_audioManagerHandle.onStop();",
|
" m_audioManagerHandle.onStop();",
|
||||||
"}"
|
"}"
|
||||||
])
|
])
|
||||||
module.pkg_add("GENERATE_SECTION__ON_DESTROY", [
|
module.add_pkg("GENERATE_SECTION__ON_DESTROY", [
|
||||||
"// Destroy the AdView.",
|
"// Destroy the AdView.",
|
||||||
"if (m_audioManagerHandle != null) {",
|
"if (m_audioManagerHandle != null) {",
|
||||||
" m_audioManagerHandle.onDestroy();",
|
" m_audioManagerHandle.onDestroy();",
|
||||||
|
@@ -1,7 +1,6 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
import lutin.module as module
|
|
||||||
import lutin.tools as tools
|
|
||||||
import lutin.debug as debug
|
import lutin.debug as debug
|
||||||
|
import lutin.tools as tools
|
||||||
|
|
||||||
|
|
||||||
def get_type():
|
def get_type():
|
||||||
@@ -25,13 +24,14 @@ def get_compagny_name():
|
|||||||
def get_maintainer():
|
def get_maintainer():
|
||||||
return ["Mr DUPIN Edouard <yui.heero@gmail.com>"]
|
return ["Mr DUPIN Edouard <yui.heero@gmail.com>"]
|
||||||
|
|
||||||
def create(target, module_name):
|
def configure(target, my_module):
|
||||||
my_module = module.Module(__file__, module_name, get_type())
|
|
||||||
|
|
||||||
my_module.add_src_file([
|
my_module.add_src_file([
|
||||||
'orchestra-in.cpp'
|
'orchestra-in.cpp'
|
||||||
])
|
])
|
||||||
my_module.add_module_depend(['audio-orchestra', 'test-debug'])
|
my_module.add_depend([
|
||||||
return my_module
|
'audio-orchestra',
|
||||||
|
'test-debug'
|
||||||
|
])
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1,7 +1,6 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
import lutin.module as module
|
|
||||||
import lutin.tools as tools
|
|
||||||
import lutin.debug as debug
|
import lutin.debug as debug
|
||||||
|
import lutin.tools as tools
|
||||||
|
|
||||||
|
|
||||||
def get_type():
|
def get_type():
|
||||||
@@ -25,13 +24,14 @@ def get_compagny_name():
|
|||||||
def get_maintainer():
|
def get_maintainer():
|
||||||
return ["Mr DUPIN Edouard <yui.heero@gmail.com>"]
|
return ["Mr DUPIN Edouard <yui.heero@gmail.com>"]
|
||||||
|
|
||||||
def create(target, module_name):
|
def configure(target, my_module):
|
||||||
my_module = module.Module(__file__, module_name, get_type())
|
|
||||||
|
|
||||||
my_module.add_src_file([
|
my_module.add_src_file([
|
||||||
'orchestra-list.cpp'
|
'orchestra-list.cpp'
|
||||||
])
|
])
|
||||||
my_module.add_module_depend(['audio-orchestra', 'test-debug'])
|
my_module.add_depend([
|
||||||
return my_module
|
'audio-orchestra',
|
||||||
|
'test-debug'
|
||||||
|
])
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1,7 +1,6 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
import lutin.module as module
|
|
||||||
import lutin.tools as tools
|
|
||||||
import lutin.debug as debug
|
import lutin.debug as debug
|
||||||
|
import lutin.tools as tools
|
||||||
|
|
||||||
|
|
||||||
def get_type():
|
def get_type():
|
||||||
@@ -25,13 +24,14 @@ def get_compagny_name():
|
|||||||
def get_maintainer():
|
def get_maintainer():
|
||||||
return ["Mr DUPIN Edouard <yui.heero@gmail.com>"]
|
return ["Mr DUPIN Edouard <yui.heero@gmail.com>"]
|
||||||
|
|
||||||
def create(target, module_name):
|
def configure(target, my_module):
|
||||||
my_module = module.Module(__file__, module_name, get_type())
|
|
||||||
|
|
||||||
my_module.add_src_file([
|
my_module.add_src_file([
|
||||||
'orchestra-out.cpp'
|
'orchestra-out.cpp'
|
||||||
])
|
])
|
||||||
my_module.add_module_depend(['audio-orchestra', 'test-debug'])
|
my_module.add_depend([
|
||||||
return my_module
|
'audio-orchestra',
|
||||||
|
'test-debug'
|
||||||
|
])
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
@@ -4,10 +4,10 @@
|
|||||||
* @license APACHE v2.0 (see license file)
|
* @license APACHE v2.0 (see license file)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <etk/etk.h>
|
#include <etk/etk.hpp>
|
||||||
#include <test-debug/debug.h>
|
#include <test-debug/debug.hpp>
|
||||||
#include <unistd.h>
|
|
||||||
#include <audio/orchestra/Interface.h>
|
#include <audio/orchestra/Interface.hpp>
|
||||||
|
|
||||||
int main(int _argc, const char **_argv) {
|
int main(int _argc, const char **_argv) {
|
||||||
// the only one init for etk:
|
// the only one init for etk:
|
||||||
|
@@ -4,10 +4,10 @@
|
|||||||
* @license APACHE v2.0 (see license file)
|
* @license APACHE v2.0 (see license file)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <etk/etk.h>
|
#include <etk/etk.hpp>
|
||||||
#include <test-debug/debug.h>
|
#include <test-debug/debug.hpp>
|
||||||
#include <unistd.h>
|
|
||||||
#include <audio/orchestra/Interface.h>
|
#include <audio/orchestra/Interface.hpp>
|
||||||
|
|
||||||
int main(int _argc, const char **_argv) {
|
int main(int _argc, const char **_argv) {
|
||||||
// the only one init for etk:
|
// the only one init for etk:
|
||||||
|
@@ -4,10 +4,10 @@
|
|||||||
* @license APACHE v2.0 (see license file)
|
* @license APACHE v2.0 (see license file)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <etk/etk.h>
|
#include <etk/etk.hpp>
|
||||||
#include <test-debug/debug.h>
|
#include <test-debug/debug.hpp>
|
||||||
#include <unistd.h>
|
|
||||||
#include <audio/orchestra/Interface.h>
|
#include <audio/orchestra/Interface.hpp>
|
||||||
|
|
||||||
int main(int _argc, const char **_argv) {
|
int main(int _argc, const char **_argv) {
|
||||||
// the only one init for etk:
|
// the only one init for etk:
|
||||||
|
1
version.txt
Normal file
1
version.txt
Normal file
@@ -0,0 +1 @@
|
|||||||
|
0.4.0
|
Reference in New Issue
Block a user