[DEV] continue removing stl

This commit is contained in:
2017-08-28 00:08:41 +02:00
parent bcff6508ab
commit a4ba319ffc
37 changed files with 288 additions and 288 deletions

View File

@@ -45,7 +45,7 @@ namespace audio {
bool threadRunning;
bool mmapInterface; //!< enable or disable mmap mode...
enum timestampMode timeMode; //!< the timestamp of the flow came from the harware.
std::vector<snd_pcm_channel_area_t> areas;
etk::Vector<snd_pcm_channel_area_t> areas;
AlsaPrivate() :
handle(nullptr),
runnable(false),
@@ -112,7 +112,7 @@ nextcard:
return nDevices;
}
bool audio::orchestra::api::Alsa::getNamedDeviceInfoLocal(const std::string& _deviceName, audio::orchestra::DeviceInfo& _info, int32_t _cardId, int32_t _subdevice, int32_t _localDeviceId, bool _input) {
bool audio::orchestra::api::Alsa::getNamedDeviceInfoLocal(const etk::String& _deviceName, audio::orchestra::DeviceInfo& _info, int32_t _cardId, int32_t _subdevice, int32_t _localDeviceId, bool _input) {
int32_t result;
snd_ctl_t *chandle;
int32_t openMode = SND_PCM_ASYNC;
@@ -130,7 +130,7 @@ bool audio::orchestra::api::Alsa::getNamedDeviceInfoLocal(const std::string& _de
stream = SND_PCM_STREAM_PLAYBACK;
}
snd_pcm_info_set_stream(pcminfo, stream);
std::vector<std::string> listElement = etk::split(_deviceName, ',');
etk::Vector<etk::String> listElement = etk::split(_deviceName, ',');
if (listElement.size() == 0) {
ATA_ERROR("can not get control interface = '" << _deviceName << "' Can not plit at ',' ...");
return false;
@@ -190,15 +190,15 @@ bool audio::orchestra::api::Alsa::getNamedDeviceInfoLocal(const std::string& _de
}
ATA_DEBUG("Input channel = " << value);
for (int32_t iii=0; iii<value; ++iii) {
_info.channels.push_back(audio::channel_unknow);
_info.channels.pushBack(audio::channel_unknow);
}
// Test our discrete set of sample rate values.
_info.sampleRates.clear();
for (std::vector<uint32_t>::const_iterator it(audio::orchestra::genericSampleRate().begin());
for (etk::Vector<uint32_t>::const_iterator it(audio::orchestra::genericSampleRate().begin());
it != audio::orchestra::genericSampleRate().end();
++it ) {
if (snd_pcm_hw_params_test_rate(phandle, params, *it, 0) == 0) {
_info.sampleRates.push_back(*it);
_info.sampleRates.pushBack(*it);
}
}
if (_info.sampleRates.size() == 0) {
@@ -211,27 +211,27 @@ bool audio::orchestra::api::Alsa::getNamedDeviceInfoLocal(const std::string& _de
_info.nativeFormats.clear();
format = SND_PCM_FORMAT_S8;
if (snd_pcm_hw_params_test_format(phandle, params, format) == 0) {
_info.nativeFormats.push_back(audio::format_int8);
_info.nativeFormats.pushBack(audio::format_int8);
}
format = SND_PCM_FORMAT_S16;
if (snd_pcm_hw_params_test_format(phandle, params, format) == 0) {
_info.nativeFormats.push_back(audio::format_int16);
_info.nativeFormats.pushBack(audio::format_int16);
}
format = SND_PCM_FORMAT_S24;
if (snd_pcm_hw_params_test_format(phandle, params, format) == 0) {
_info.nativeFormats.push_back(audio::format_int24);
_info.nativeFormats.pushBack(audio::format_int24);
}
format = SND_PCM_FORMAT_S32;
if (snd_pcm_hw_params_test_format(phandle, params, format) == 0) {
_info.nativeFormats.push_back(audio::format_int32);
_info.nativeFormats.pushBack(audio::format_int32);
}
format = SND_PCM_FORMAT_FLOAT;
if (snd_pcm_hw_params_test_format(phandle, params, format) == 0) {
_info.nativeFormats.push_back(audio::format_float);
_info.nativeFormats.pushBack(audio::format_float);
}
format = SND_PCM_FORMAT_FLOAT64;
if (snd_pcm_hw_params_test_format(phandle, params, format) == 0) {
_info.nativeFormats.push_back(audio::format_double);
_info.nativeFormats.pushBack(audio::format_double);
}
// Check that we have at least one supported format
if (_info.nativeFormats.size() == 0) {
@@ -406,7 +406,7 @@ foundDevice:
return openName(name, _mode, _channels, _firstChannel, _sampleRate, _format, _bufferSize, _options);
}
bool audio::orchestra::api::Alsa::openName(const std::string& _deviceName,
bool audio::orchestra::api::Alsa::openName(const etk::String& _deviceName,
audio::orchestra::mode _mode,
uint32_t _channels,
uint32_t _firstChannel,
@@ -989,7 +989,7 @@ void audio::orchestra::api::Alsa::callbackEvent() {
}
ethread::setName("Alsa IO-" + m_name);
//Wait data with poll
std::vector<struct pollfd> ufds;
etk::Vector<struct pollfd> ufds;
signed short *ptr;
int32_t err, count, cptr, init;
count = snd_pcm_poll_descriptors_count(m_private->handle);
@@ -1106,9 +1106,9 @@ void audio::orchestra::api::Alsa::callbackEventOneCycleRead() {
}
int32_t doStopStream = 0;
audio::Time streamTime;
std::vector<enum audio::orchestra::status> status;
etk::Vector<enum audio::orchestra::status> status;
if (m_private->xrun[0] == true) {
status.push_back(audio::orchestra::status::underflow);
status.pushBack(audio::orchestra::status::underflow);
m_private->xrun[0] = false;
}
int32_t result;
@@ -1223,9 +1223,9 @@ void audio::orchestra::api::Alsa::callbackEventOneCycleWrite() {
}
int32_t doStopStream = 0;
audio::Time streamTime;
std::vector<enum audio::orchestra::status> status;
etk::Vector<enum audio::orchestra::status> status;
if (m_private->xrun[1] == true) {
status.push_back(audio::orchestra::status::overflow);
status.pushBack(audio::orchestra::status::overflow);
m_private->xrun[1] = false;
}
int32_t result;
@@ -1325,9 +1325,9 @@ void audio::orchestra::api::Alsa::callbackEventOneCycleMMAPWrite() {
}
int32_t doStopStream = 0;
audio::Time streamTime;
std::vector<enum audio::orchestra::status> status;
etk::Vector<enum audio::orchestra::status> status;
if (m_private->xrun[1] == true) {
status.push_back(audio::orchestra::status::overflow);
status.pushBack(audio::orchestra::status::overflow);
m_private->xrun[1] = false;
}
int32_t result;
@@ -1459,9 +1459,9 @@ void audio::orchestra::api::Alsa::callbackEventOneCycleMMAPRead() {
}
int32_t doStopStream = 0;
audio::Time streamTime;
std::vector<enum audio::orchestra::status> status;
etk::Vector<enum audio::orchestra::status> status;
if (m_private->xrun[0] == true) {
status.push_back(audio::orchestra::status::underflow);
status.pushBack(audio::orchestra::status::underflow);
m_private->xrun[0] = false;
}
int32_t result;

View File

@@ -18,19 +18,19 @@ namespace audio {
public:
Alsa();
virtual ~Alsa();
const std::string& getCurrentApi() {
const etk::String& getCurrentApi() {
return audio::orchestra::typeAlsa;
}
uint32_t getDeviceCount();
private:
bool getNamedDeviceInfoLocal(const std::string& _deviceName,
bool getNamedDeviceInfoLocal(const etk::String& _deviceName,
audio::orchestra::DeviceInfo& _info,
int32_t _cardId=-1, // Alsa card ID
int32_t _subdevice=-1, // alsa subdevice ID
int32_t _localDeviceId=-1,// local ID of device find
bool _input=false);
public:
bool getNamedDeviceInfo(const std::string& _deviceName, audio::orchestra::DeviceInfo& _info) {
bool getNamedDeviceInfo(const etk::String& _deviceName, audio::orchestra::DeviceInfo& _info) {
return getNamedDeviceInfoLocal(_deviceName, _info);
}
audio::orchestra::DeviceInfo getDeviceInfo(uint32_t _device);
@@ -51,7 +51,7 @@ namespace audio {
static void alsaCallbackEvent(void* _userData);
private:
ememory::SharedPtr<AlsaPrivate> m_private;
std::vector<audio::orchestra::DeviceInfo> m_devices;
etk::Vector<audio::orchestra::DeviceInfo> m_devices;
void saveDeviceInfo();
bool open(uint32_t _device,
enum audio::orchestra::mode _mode,
@@ -62,7 +62,7 @@ namespace audio {
uint32_t *_bufferSize,
const audio::orchestra::StreamOptions& _options);
bool openName(const std::string& _deviceName,
bool openName(const etk::String& _deviceName,
audio::orchestra::mode _mode,
uint32_t _channels,
uint32_t _firstChannel,

View File

@@ -74,7 +74,7 @@ void audio::orchestra::api::Android::playback(int16_t* _dst, int32_t _nbChunk) {
}
int32_t doStopStream = 0;
audio::Time streamTime = getStreamTime();
std::vector<enum audio::orchestra::status> status;
etk::Vector<enum audio::orchestra::status> status;
if (m_doConvertBuffer[modeToIdTable(m_mode)] == true) {
ATA_VERBOSE("Need playback data " << int32_t(_nbChunk) << " userbuffer size = " << m_userBuffer[audio::orchestra::mode_output].size() << "pointer=" << int64_t(&m_userBuffer[audio::orchestra::mode_output][0]));
doStopStream = m_callback(nullptr,
@@ -104,7 +104,7 @@ void audio::orchestra::api::Android::playback(int16_t* _dst, int32_t _nbChunk) {
void audio::orchestra::api::Android::record(int16_t* _dst, int32_t _nbChunk) {
int32_t doStopStream = 0;
audio::Time streamTime = getStreamTime();
std::vector<enum audio::orchestra::status> status;
etk::Vector<enum audio::orchestra::status> status;
if (m_doConvertBuffer[modeToIdTable(m_mode)] == true) {
ATA_VERBOSE("Need playback data " << int32_t(_nbChunk) << " userbuffer size = " << m_userBuffer[audio::orchestra::mode_output].size() << "pointer=" << int64_t(&m_userBuffer[audio::orchestra::mode_output][0]));
convertBuffer((char*)&m_userBuffer[audio::orchestra::mode_input][0], (char*)_dst, m_convertInfo[audio::orchestra::mode_input]);

View File

@@ -18,7 +18,7 @@ namespace audio {
public:
Android();
virtual ~Android();
const std::string& getCurrentApi() {
const etk::String& getCurrentApi() {
return audio::orchestra::typeJava;
}
uint32_t getDeviceCount();
@@ -39,7 +39,7 @@ namespace audio {
return m_uid;
}
private:
std::vector<audio::orchestra::DeviceInfo> m_devices;
etk::Vector<audio::orchestra::DeviceInfo> m_devices;
void saveDeviceInfo();
bool open(uint32_t _device,
audio::orchestra::mode _mode,

View File

@@ -235,7 +235,7 @@ class AndroidOrchestraContext {
//Call java ...
jstring returnString = (jstring) m_JavaVirtualMachinePointer->CallObjectMethod(m_javaObjectOrchestraCallback, m_javaMethodOrchestraActivityAudioGetDeviceProperty, _idDevice);
const char *js = m_JavaVirtualMachinePointer->GetStringUTFChars(returnString, nullptr);
std::string retString(js);
etk::String retString(js);
m_JavaVirtualMachinePointer->ReleaseStringUTFChars(returnString, js);
//m_JavaVirtualMachinePointer->DeleteLocalRef(returnString);
// manage execption :
@@ -256,19 +256,19 @@ class AndroidOrchestraContext {
ejson::Array list = doc["sample-rate"].toArray();
if (list.exist() == true) {
for (auto it : list) {
info.sampleRates.push_back(int32_t(it.toNumber().get(48000)));
info.sampleRates.pushBack(int32_t(it.toNumber().get(48000)));
}
}
list = doc["channels"].toArray();
if (list.exist() == true) {
for (auto it : list) {
info.channels.push_back(audio::getChannelFromString(it.toString().get("???")));
info.channels.pushBack(audio::getChannelFromString(it.toString().get("???")));
}
}
list = doc["format"].toArray();
if (list.exist() == true) {
for (auto it : list) {
info.nativeFormats.push_back(audio::getFormatFromString(it.toString().get("???")));
info.nativeFormats.pushBack(audio::getFormatFromString(it.toString().get("???")));
}
}
info.isDefault = doc["default"].toBoolean().get(false);
@@ -276,7 +276,7 @@ class AndroidOrchestraContext {
return info;
}
private:
std::vector<ememory::WeakPtr<audio::orchestra::api::Android> > m_instanceList; // list of connected handle ...
etk::Vector<ememory::WeakPtr<audio::orchestra::api::Android> > m_instanceList; // list of connected handle ...
//AndroidAudioCallback m_audioCallBack;
//void* m_audioCallBackUserData;
public:
@@ -305,7 +305,7 @@ class AndroidOrchestraContext {
jvm_basics::checkExceptionJavaVM(m_JavaVirtualMachinePointer);
java_detach_current_thread(status);
if (int32_t(ret) >= 0) {
m_instanceList.push_back(_instance);
m_instanceList.pushBack(_instance);
return int32_t(ret);
}
return -1;

View File

@@ -154,7 +154,7 @@ rtaudio::DeviceInfo audio::orchestra::api::Asio::getDeviceInfo(uint32_t _device)
for (uint32_t i=0; i<MAX_SAMPLE_RATES; i++) {
result = ASIOCanSampleRate((ASIOSampleRate) SAMPLE_RATES[i]);
if (result == ASE_OK) {
info.sampleRates.push_back(SAMPLE_RATES[i]);
info.sampleRates.pushBack(SAMPLE_RATES[i]);
}
}
// Determine supported data types ... just check first channel and assume rest are the same.
@@ -173,19 +173,19 @@ rtaudio::DeviceInfo audio::orchestra::api::Asio::getDeviceInfo(uint32_t _device)
info.nativeFormats.clear();
if ( channelInfo.type == ASIOSTInt16MSB
|| channelInfo.type == ASIOSTInt16LSB) {
info.nativeFormats.push_back(audio::format_int16);
info.nativeFormats.pushBack(audio::format_int16);
} else if ( channelInfo.type == ASIOSTInt32MSB
|| channelInfo.type == ASIOSTInt32LSB) {
info.nativeFormats.push_back(audio::format_int32);
info.nativeFormats.pushBack(audio::format_int32);
} else if ( channelInfo.type == ASIOSTFloat32MSB
|| channelInfo.type == ASIOSTFloat32LSB) {
info.nativeFormats.push_back(audio::format_float);
info.nativeFormats.pushBack(audio::format_float);
} else if ( channelInfo.type == ASIOSTFloat64MSB
|| channelInfo.type == ASIOSTFloat64LSB) {
info.nativeFormats.push_back(audio::format_double);
info.nativeFormats.pushBack(audio::format_double);
} else if ( channelInfo.type == ASIOSTInt24MSB
|| channelInfo.type == ASIOSTInt24LSB) {
info.nativeFormats.push_back(audio::format_int24);
info.nativeFormats.pushBack(audio::format_int24);
}
if (info.outputChannels > 0){
if (getDefaultOutputDevice() == _device) {
@@ -692,13 +692,13 @@ bool audio::orchestra::api::Asio::callbackEvent(long bufferIndex) {
// draining stream.
if (m_private->drainCounter == 0) {
audio::Time streamTime = getStreamTime();
std::vector<enum audio::orchestra::status status;
etk::Vector<enum audio::orchestra::status status;
if (m_mode != audio::orchestra::mode_input && asioXRun == true) {
status.push_back(audio::orchestra::status::underflow);
status.pushBack(audio::orchestra::status::underflow);
asioXRun = false;
}
if (m_mode != audio::orchestra::mode_output && asioXRun == true) {
status.push_back(audio::orchestra::status::underflow;
status.pushBack(audio::orchestra::status::underflow;
asioXRun = false;
}
int32_t cbReturnValue = info->callback(m_userBuffer[1],

View File

@@ -17,7 +17,7 @@ namespace audio {
public:
Asio();
virtual ~Asio();
const std::string& getCurrentApi() {
const etk::String& getCurrentApi() {
return audio::orchestra::typeAsio;
}
uint32_t getDeviceCount();
@@ -34,7 +34,7 @@ namespace audio {
bool callbackEvent(long _bufferIndex);
private:
ememory::SharedPtr<AsioPrivate> m_private;
std::vector<audio::orchestra::DeviceInfo> m_devices;
etk::Vector<audio::orchestra::DeviceInfo> m_devices;
void saveDeviceInfo();
bool m_coInitialized;
bool open(uint32_t _device,

View File

@@ -247,7 +247,7 @@ audio::orchestra::DeviceInfo audio::orchestra::api::Core::getDeviceInfo(uint32_t
}
//const char *mname = CFStringGetCStringPtr(cfname, CFStringGetSystemEncoding());
int32_t length = CFStringGetLength(cfname);
std::vector<char> name;
etk::Vector<char> name;
name.resize(length * 3 + 1, '\0');
CFStringGetCString(cfname, &name[0], length * 3 + 1, CFStringGetSystemEncoding());
info.name.append(&name[0], strlen(&name[0]));
@@ -302,7 +302,7 @@ audio::orchestra::DeviceInfo audio::orchestra::api::Core::getDeviceInfo(uint32_t
// Get channel information.
for (size_t iii=0; iii<bufferList->mNumberBuffers; ++iii) {
for (size_t jjj=0; jjj<bufferList->mBuffers[iii].mNumberChannels; ++jjj) {
info.channels.push_back(audio::channel_unknow);
info.channels.pushBack(audio::channel_unknow);
}
}
free(bufferList);
@@ -344,7 +344,7 @@ audio::orchestra::DeviceInfo audio::orchestra::api::Core::getDeviceInfo(uint32_t
for (auto &it : audio::orchestra::genericSampleRate()) {
if ( it >= minimumRate
&& it <= maximumRate) {
info.sampleRates.push_back(it);
info.sampleRates.pushBack(it);
}
}
if (info.sampleRates.size() == 0) {
@@ -358,7 +358,7 @@ audio::orchestra::DeviceInfo audio::orchestra::api::Core::getDeviceInfo(uint32_t
// CoreAudio always uses 32-bit floating point data for PCM streams.
// Thus, any other "physical" formats supported by the device are of
// no interest to the client.
info.nativeFormats.push_back(audio::format_float);
info.nativeFormats.pushBack(audio::format_float);
// ------------------------------------------------
// Determine the default channel.
// ------------------------------------------------
@@ -692,19 +692,19 @@ bool audio::orchestra::api::Core::open(uint32_t _device,
AudioStreamBasicDescription testDescription = description;
uint32_t formatFlags;
// We'll try higher bit rates first and then work our way down.
std::vector< std::pair<uint32_t, uint32_t> > physicalFormats;
etk::Vector< etk::Pair<uint32_t, uint32_t> > physicalFormats;
formatFlags = (description.mFormatFlags | kLinearPCMFormatFlagIsFloat) & ~kLinearPCMFormatFlagIsSignedInteger;
physicalFormats.push_back(std::pair<float, uint32_t>(32, formatFlags));
physicalFormats.pushBack(etk::Pair<float, uint32_t>(32, formatFlags));
formatFlags = (description.mFormatFlags | kLinearPCMFormatFlagIsSignedInteger | kAudioFormatFlagIsPacked) & ~kLinearPCMFormatFlagIsFloat;
physicalFormats.push_back(std::pair<float, uint32_t>(32, formatFlags));
physicalFormats.push_back(std::pair<float, uint32_t>(24, formatFlags)); // 24-bit packed
physicalFormats.pushBack(etk::Pair<float, uint32_t>(32, formatFlags));
physicalFormats.pushBack(etk::Pair<float, uint32_t>(24, formatFlags)); // 24-bit packed
formatFlags &= ~(kAudioFormatFlagIsPacked | kAudioFormatFlagIsAlignedHigh);
physicalFormats.push_back(std::pair<float, uint32_t>(24.2, formatFlags)); // 24-bit in 4 bytes, aligned low
physicalFormats.pushBack(etk::Pair<float, uint32_t>(24.2, formatFlags)); // 24-bit in 4 bytes, aligned low
formatFlags |= kAudioFormatFlagIsAlignedHigh;
physicalFormats.push_back(std::pair<float, uint32_t>(24.4, formatFlags)); // 24-bit in 4 bytes, aligned high
physicalFormats.pushBack(etk::Pair<float, uint32_t>(24.4, formatFlags)); // 24-bit in 4 bytes, aligned high
formatFlags = (description.mFormatFlags | kLinearPCMFormatFlagIsSignedInteger | kAudioFormatFlagIsPacked) & ~kLinearPCMFormatFlagIsFloat;
physicalFormats.push_back(std::pair<float, uint32_t>(16, formatFlags));
physicalFormats.push_back(std::pair<float, uint32_t>(8, formatFlags));
physicalFormats.pushBack(etk::Pair<float, uint32_t>(16, formatFlags));
physicalFormats.pushBack(etk::Pair<float, uint32_t>(8, formatFlags));
bool setPhysicalFormat = false;
for(uint32_t i=0; i<physicalFormats.size(); i++) {
testDescription = description;
@@ -1048,15 +1048,15 @@ bool audio::orchestra::api::Core::callbackEvent(AudioDeviceID _deviceId,
// draining stream or duplex mode AND the input/output devices are
// different AND this function is called for the input device.
if (m_private->drainCounter == 0 && (m_mode != audio::orchestra::mode_duplex || _deviceId == outputDevice)) {
std::vector<enum audio::orchestra::status> status;
etk::Vector<enum audio::orchestra::status> status;
if ( m_mode != audio::orchestra::mode_input
&& m_private->xrun[0] == true) {
status.push_back(audio::orchestra::status::underflow);
status.pushBack(audio::orchestra::status::underflow);
m_private->xrun[0] = false;
}
if ( m_mode != audio::orchestra::mode_output
&& m_private->xrun[1] == true) {
status.push_back(audio::orchestra::status::overflow);
status.pushBack(audio::orchestra::status::overflow);
m_private->xrun[1] = false;
}
int32_t cbReturnValue = m_callback(&m_userBuffer[1][0],

View File

@@ -20,7 +20,7 @@ namespace audio {
public:
Core();
virtual ~Core();
const std::string& getCurrentApi() {
const etk::String& getCurrentApi() {
return audio::orchestra::typeCoreOSX;
}
uint32_t getDeviceCount();

View File

@@ -17,7 +17,7 @@ namespace audio {
public:
CoreIos();
virtual ~CoreIos();
const std::string& getCurrentApi() {
const etk::String& getCurrentApi() {
return audio::orchestra::typeCoreIOS;
}
uint32_t getDeviceCount();
@@ -32,7 +32,7 @@ namespace audio {
// will most likely produce highly undesireable results!
void callbackEvent();
private:
std::vector<audio::orchestra::DeviceInfo> m_devices;
etk::Vector<audio::orchestra::DeviceInfo> m_devices;
void saveDeviceInfo();
bool open(uint32_t _device,
audio::orchestra::mode _mode,

View File

@@ -59,7 +59,7 @@ class DsDevice {
public:
LPGUID id;
bool input;
std::string name;
etk::String name;
DsDevice() :
id(0),
input(false) {
@@ -83,7 +83,7 @@ namespace audio {
DWORD dsBufferSize[2];
DWORD dsPointerLeadTime[2]; // the number of bytes ahead of the safe pointer to lead by.
HANDLE condition;
std::vector<DsDevice> dsDevices;
etk::Vector<DsDevice> dsDevices;
DsPrivate() :
threadRunning(false),
drainCounter(0),
@@ -107,7 +107,7 @@ static const char* getErrorString(int32_t _code);
struct DsProbeData {
bool isInput;
std::vector<DsDevice>* dsDevices;
etk::Vector<DsDevice>* dsDevices;
};
audio::orchestra::api::Ds::Ds() :
@@ -132,13 +132,13 @@ audio::orchestra::api::Ds::~Ds() {
#include "tchar.h"
static std::string convertTChar(LPCTSTR _name) {
static etk::String convertTChar(LPCTSTR _name) {
#if defined(UNICODE) || defined(_UNICODE)
int32_t length = WideCharToMultiByte(CP_UTF8, 0, _name, -1, nullptr, 0, nullptr, nullptr);
std::string s(length-1, '\0');
etk::String s(length-1, '\0');
WideCharToMultiByte(CP_UTF8, 0, _name, -1, &s[0], length, nullptr, nullptr);
#else
std::string s(_name);
etk::String s(_name);
#endif
return s;
}
@@ -148,7 +148,7 @@ static BOOL CALLBACK deviceQueryCallback(LPGUID _lpguid,
LPCTSTR _module,
LPVOID _lpContext) {
struct DsProbeData& probeInfo = *(struct DsProbeData*) _lpContext;
std::vector<DsDevice>& dsDevices = *probeInfo.dsDevices;
etk::Vector<DsDevice>& dsDevices = *probeInfo.dsDevices;
HRESULT hr;
bool validDevice = false;
if (probeInfo.isInput == true) {
@@ -187,7 +187,7 @@ static BOOL CALLBACK deviceQueryCallback(LPGUID _lpguid,
return TRUE;
}
// If good device, then save its name and guid.
std::string name = convertTChar(_description);
etk::String name = convertTChar(_description);
//if (name == "Primary Sound Driver" || name == "Primary Sound Capture Driver")
if (_lpguid == nullptr) {
name = "Default Device";
@@ -196,7 +196,7 @@ static BOOL CALLBACK deviceQueryCallback(LPGUID _lpguid,
device.name = name;
device.input = probeInfo.isInput;
device.id = _lpguid;
dsDevices.push_back(device);
dsDevices.pushBack(device);
return TRUE;
}
@@ -250,24 +250,24 @@ audio::orchestra::DeviceInfo audio::orchestra::api::Ds::getDeviceInfo(uint32_t _
}
// Get output channel information.
if (outCaps.dwFlags & DSCAPS_PRIMARYSTEREO) {
info.channels.push_back(audio::channel_unknow);
info.channels.push_back(audio::channel_unknow);
info.channels.pushBack(audio::channel_unknow);
info.channels.pushBack(audio::channel_unknow);
} else {
info.channels.push_back(audio::channel_unknow);
info.channels.pushBack(audio::channel_unknow);
}
// Get sample rate information.
for (auto &it : audio::orchestra::genericSampleRate()) {
if ( it >= outCaps.dwMinSecondarySampleRate
&& it <= outCaps.dwMaxSecondarySampleRate) {
info.sampleRates.push_back(it);
info.sampleRates.pushBack(it);
}
}
// Get format information.
if (outCaps.dwFlags & DSCAPS_PRIMARY16BIT) {
info.nativeFormats.push_back(audio::format_int16);
info.nativeFormats.pushBack(audio::format_int16);
}
if (outCaps.dwFlags & DSCAPS_PRIMARY8BIT) {
info.nativeFormats.push_back(audio::format_int8);
info.nativeFormats.pushBack(audio::format_int8);
}
output->Release();
info.name = m_private->dsDevices[_device].name;
@@ -292,67 +292,67 @@ audio::orchestra::DeviceInfo audio::orchestra::api::Ds::getDeviceInfo(uint32_t _
}
// Get input channel information.
for (int32_t iii=0; iii<inCaps.dwChannels; ++iii) {
info.channels.push_back(audio::channel_unknow);
info.channels.pushBack(audio::channel_unknow);
}
// Get sample rate and format information.
std::vector<uint32_t> rates;
etk::Vector<uint32_t> rates;
if (inCaps.dwChannels >= 2) {
if ( (inCaps.dwFormats & WAVE_FORMAT_1S16)
|| (inCaps.dwFormats & WAVE_FORMAT_2S16)
|| (inCaps.dwFormats & WAVE_FORMAT_4S16)
|| (inCaps.dwFormats & WAVE_FORMAT_96S16) ) {
info.nativeFormats.push_back(audio::format_int16);
info.nativeFormats.pushBack(audio::format_int16);
}
if ( (inCaps.dwFormats & WAVE_FORMAT_1S08)
|| (inCaps.dwFormats & WAVE_FORMAT_2S08)
|| (inCaps.dwFormats & WAVE_FORMAT_4S08)
|| (inCaps.dwFormats & WAVE_FORMAT_96S08) ) {
info.nativeFormats.push_back(audio::format_int8);
info.nativeFormats.pushBack(audio::format_int8);
}
if ( (inCaps.dwFormats & WAVE_FORMAT_1S16)
|| (inCaps.dwFormats & WAVE_FORMAT_1S08) ){
rates.push_back(11025);
rates.pushBack(11025);
}
if ( (inCaps.dwFormats & WAVE_FORMAT_2S16)
|| (inCaps.dwFormats & WAVE_FORMAT_2S08) ){
rates.push_back(22050);
rates.pushBack(22050);
}
if ( (inCaps.dwFormats & WAVE_FORMAT_4S16)
|| (inCaps.dwFormats & WAVE_FORMAT_4S08) ){
rates.push_back(44100);
rates.pushBack(44100);
}
if ( (inCaps.dwFormats & WAVE_FORMAT_96S16)
|| (inCaps.dwFormats & WAVE_FORMAT_96S08) ){
rates.push_back(96000);
rates.pushBack(96000);
}
} else if (inCaps.dwChannels == 1) {
if ( (inCaps.dwFormats & WAVE_FORMAT_1M16)
|| (inCaps.dwFormats & WAVE_FORMAT_2M16)
|| (inCaps.dwFormats & WAVE_FORMAT_4M16)
|| (inCaps.dwFormats & WAVE_FORMAT_96M16) ) {
info.nativeFormats.push_back(audio::format_int16);
info.nativeFormats.pushBack(audio::format_int16);
}
if ( (inCaps.dwFormats & WAVE_FORMAT_1M08)
|| (inCaps.dwFormats & WAVE_FORMAT_2M08)
|| (inCaps.dwFormats & WAVE_FORMAT_4M08)
|| (inCaps.dwFormats & WAVE_FORMAT_96M08) ) {
info.nativeFormats.push_back(audio::format_int8);
info.nativeFormats.pushBack(audio::format_int8);
}
if ( (inCaps.dwFormats & WAVE_FORMAT_1M16)
|| (inCaps.dwFormats & WAVE_FORMAT_1M08) ){
rates.push_back(11025);
rates.pushBack(11025);
}
if ( (inCaps.dwFormats & WAVE_FORMAT_2M16)
|| (inCaps.dwFormats & WAVE_FORMAT_2M08) ){
rates.push_back(22050);
rates.pushBack(22050);
}
if ( (inCaps.dwFormats & WAVE_FORMAT_4M16)
|| (inCaps.dwFormats & WAVE_FORMAT_4M08) ){
rates.push_back(44100);
rates.pushBack(44100);
}
if ( (inCaps.dwFormats & WAVE_FORMAT_96M16)
|| (inCaps.dwFormats & WAVE_FORMAT_96M08) ){
rates.push_back(96000);
rates.pushBack(96000);
}
} else {
// technically, this would be an error
@@ -374,7 +374,7 @@ audio::orchestra::DeviceInfo audio::orchestra::api::Ds::getDeviceInfo(uint32_t _
}
}
if (found == false) {
info.sampleRates.push_back(rates[i]);
info.sampleRates.pushBack(rates[i]);
}
}
std::sort(info.sampleRates.begin(), info.sampleRates.end());
@@ -763,7 +763,7 @@ bool audio::orchestra::api::Ds::open(uint32_t _device,
if (m_private->threadRunning == false) {
m_private->threadRunning = true;
ememory::SharedPtr<std::thread> tmpThread(new std::thread(&audio::orchestra::api::Ds::dsCallbackEvent, this));
m_private->thread = std::move(tmpThread);
m_private->thread = etk::move(tmpThread);
if (m_private->thread == nullptr) {
ATA_ERROR("error creating callback thread!");
goto error;
@@ -1009,15 +1009,15 @@ void audio::orchestra::api::Ds::callbackEvent() {
// draining stream.
if (m_private->drainCounter == 0) {
audio::Time streamTime = getStreamTime();
std::vector<audio::orchestra::status> status;
etk::Vector<audio::orchestra::status> status;
if ( m_mode != audio::orchestra::mode_input
&& m_private->xrun[0] == true) {
status.push_back(audio::orchestra::status::underflow);
status.pushBack(audio::orchestra::status::underflow);
m_private->xrun[0] = false;
}
if ( m_mode != audio::orchestra::mode_output
&& m_private->xrun[1] == true) {
status.push_back(audio::orchestra::status::overflow);
status.pushBack(audio::orchestra::status::overflow);
m_private->xrun[1] = false;
}
int32_t cbReturnValue = m_callback(&m_userBuffer[1][0],

View File

@@ -17,7 +17,7 @@ namespace audio {
public:
Ds();
virtual ~Ds();
const std::string& getCurrentApi() {
const etk::String& getCurrentApi() {
return audio::orchestra::typeDs;
}
uint32_t getDeviceCount();

View File

@@ -18,7 +18,7 @@ namespace audio {
static ememory::SharedPtr<audio::orchestra::Api> create();
public:
Dummy();
const std::string& getCurrentApi() {
const etk::String& getCurrentApi() {
return audio::orchestra::typeDummy;
}
uint32_t getDeviceCount();

View File

@@ -63,7 +63,7 @@ namespace audio {
public:
jack_client_t *client;
jack_port_t **ports[2];
std::string deviceName[2];
etk::String deviceName[2];
bool xrun[2];
std::condition_variable condition;
int32_t drainCounter; // Tracks callback counts when draining
@@ -103,7 +103,7 @@ uint32_t audio::orchestra::api::Jack::getDeviceCount() {
return 0;
}
const char **ports;
std::string port, previousPort;
etk::String port, previousPort;
uint32_t nChannels = 0, nDevices = 0;
ports = jack_get_ports(client, nullptr, nullptr, 0);
if (ports) {
@@ -112,7 +112,7 @@ uint32_t audio::orchestra::api::Jack::getDeviceCount() {
do {
port = (char *) ports[ nChannels ];
iColon = port.find(":");
if (iColon != std::string::npos) {
if (iColon != etk::String::npos) {
port = port.substr(0, iColon + 1);
if (port != previousPort) {
nDevices++;
@@ -138,7 +138,7 @@ audio::orchestra::DeviceInfo audio::orchestra::api::Jack::getDeviceInfo(uint32_t
return info;
}
const char **ports;
std::string port, previousPort;
etk::String port, previousPort;
uint32_t nPorts = 0, nDevices = 0;
ports = jack_get_ports(client, nullptr, nullptr, 0);
int32_t deviceID = _device/2;
@@ -149,7 +149,7 @@ audio::orchestra::DeviceInfo audio::orchestra::api::Jack::getDeviceInfo(uint32_t
do {
port = (char *) ports[nPorts];
iColon = port.find(":");
if (iColon != std::string::npos) {
if (iColon != etk::String::npos) {
port = port.substr(0, iColon);
if (port != previousPort) {
if (nDevices == deviceID) {
@@ -170,14 +170,14 @@ audio::orchestra::DeviceInfo audio::orchestra::api::Jack::getDeviceInfo(uint32_t
}
// Get the current jack server sample rate.
info.sampleRates.clear();
info.sampleRates.push_back(jack_get_sample_rate(client));
info.sampleRates.pushBack(jack_get_sample_rate(client));
if (info.input == true) {
ports = jack_get_ports(client, info.name.c_str(), nullptr, JackPortIsOutput);
if (ports) {
int32_t iii=0;
while (ports[iii]) {
ATA_ERROR(" ploppp='" << ports[iii] << "'");
info.channels.push_back(audio::channel_unknow);
info.channels.pushBack(audio::channel_unknow);
iii++;
}
free(ports);
@@ -188,7 +188,7 @@ audio::orchestra::DeviceInfo audio::orchestra::api::Jack::getDeviceInfo(uint32_t
int32_t iii=0;
while (ports[iii]) {
ATA_ERROR(" ploppp='" << ports[iii] << "'");
info.channels.push_back(audio::channel_unknow);
info.channels.pushBack(audio::channel_unknow);
iii++;
}
free(ports);
@@ -202,7 +202,7 @@ audio::orchestra::DeviceInfo audio::orchestra::api::Jack::getDeviceInfo(uint32_t
return info;
}
// Jack always uses 32-bit floats.
info.nativeFormats.push_back(audio::format_float);
info.nativeFormats.pushBack(audio::format_float);
// Jack doesn't provide default devices so we'll use the first available one.
if (deviceID == 0) {
info.isDefault = true;
@@ -287,7 +287,7 @@ bool audio::orchestra::api::Jack::open(uint32_t _device,
client = m_private->client;
}
const char **ports;
std::string port, previousPort, deviceName;
etk::String port, previousPort, deviceName;
uint32_t nPorts = 0, nDevices = 0;
int32_t deviceID = _device/2;
bool isInput = _device%2==0?true:false;
@@ -298,7 +298,7 @@ bool audio::orchestra::api::Jack::open(uint32_t _device,
do {
port = (char *) ports[ nPorts ];
iColon = port.find(":");
if (iColon != std::string::npos) {
if (iColon != etk::String::npos) {
port = port.substr(0, iColon);
if (port != previousPort) {
if (nDevices == deviceID) {
@@ -655,13 +655,13 @@ bool audio::orchestra::api::Jack::callbackEvent(uint64_t _nframes) {
// Invoke user callback first, to get fresh output data.
if (m_private->drainCounter == 0) {
audio::Time streamTime = getStreamTime();
std::vector<enum audio::orchestra::status> status;
etk::Vector<enum audio::orchestra::status> status;
if (m_mode != audio::orchestra::mode_input && m_private->xrun[0] == true) {
status.push_back(audio::orchestra::status::underflow);
status.pushBack(audio::orchestra::status::underflow);
m_private->xrun[0] = false;
}
if (m_mode != audio::orchestra::mode_output && m_private->xrun[1] == true) {
status.push_back(audio::orchestra::status::overflow);
status.pushBack(audio::orchestra::status::overflow);
m_private->xrun[1] = false;
}
int32_t cbReturnValue = m_callback(&m_userBuffer[1][0],

View File

@@ -19,7 +19,7 @@ namespace audio {
public:
Jack();
virtual ~Jack();
const std::string& getCurrentApi() {
const etk::String& getCurrentApi() {
return audio::orchestra::typeJack;
}
uint32_t getDeviceCount();

View File

@@ -80,7 +80,7 @@ audio::orchestra::api::Pulse::~Pulse() {
uint32_t audio::orchestra::api::Pulse::getDeviceCount() {
#if 1
std::vector<audio::orchestra::DeviceInfo> list = audio::orchestra::api::pulse::getDeviceList();
etk::Vector<audio::orchestra::DeviceInfo> list = audio::orchestra::api::pulse::getDeviceList();
return list.size();
#else
return 1;
@@ -88,7 +88,7 @@ uint32_t audio::orchestra::api::Pulse::getDeviceCount() {
}
audio::orchestra::DeviceInfo audio::orchestra::api::Pulse::getDeviceInfo(uint32_t _device) {
std::vector<audio::orchestra::DeviceInfo> list = audio::orchestra::api::pulse::getDeviceList();
etk::Vector<audio::orchestra::DeviceInfo> list = audio::orchestra::api::pulse::getDeviceList();
if (_device >= list.size()) {
ATA_ERROR("Request device out of IDs:" << _device << " >= " << list.size());
return audio::orchestra::DeviceInfo();
@@ -145,7 +145,7 @@ void audio::orchestra::api::Pulse::callbackEventOneCycle() {
return;
}
audio::Time streamTime = getStreamTime();
std::vector<enum audio::orchestra::status> status;
etk::Vector<enum audio::orchestra::status> status;
int32_t doStopStream = m_callback(&m_userBuffer[audio::orchestra::modeToIdTable(audio::orchestra::mode_input)][0],
streamTime,
&m_userBuffer[audio::orchestra::modeToIdTable(audio::orchestra::mode_output)][0],

View File

@@ -17,7 +17,7 @@ namespace audio {
public:
Pulse();
virtual ~Pulse();
const std::string& getCurrentApi() {
const etk::String& getCurrentApi() {
return audio::orchestra::typePulse;
}
uint32_t getDeviceCount();
@@ -34,7 +34,7 @@ namespace audio {
void callbackEvent();
private:
ememory::SharedPtr<PulsePrivate> m_private;
std::vector<audio::orchestra::DeviceInfo> m_devices;
etk::Vector<audio::orchestra::DeviceInfo> m_devices;
void saveDeviceInfo();
bool open(uint32_t _device,
audio::orchestra::mode _mode,

View File

@@ -105,101 +105,101 @@ static audio::format getFormatFromPulseFormat(enum pa_sample_format _format) {
return audio::format_unknow;
}
static std::vector<audio::channel> getChannelOrderFromPulseChannel(const struct pa_channel_map& _map) {
std::vector<audio::channel> out;
static etk::Vector<audio::channel> getChannelOrderFromPulseChannel(const struct pa_channel_map& _map) {
etk::Vector<audio::channel> out;
for (int32_t iii=0; iii<_map.channels; ++iii) {
switch(_map.map[iii]) {
default:
case PA_CHANNEL_POSITION_MAX:
case PA_CHANNEL_POSITION_INVALID:
out.push_back(audio::channel_unknow);
out.pushBack(audio::channel_unknow);
break;
case PA_CHANNEL_POSITION_MONO:
case PA_CHANNEL_POSITION_FRONT_CENTER:
out.push_back(audio::channel_frontCenter);
out.pushBack(audio::channel_frontCenter);
break;
case PA_CHANNEL_POSITION_FRONT_LEFT:
out.push_back(audio::channel_frontLeft);
out.pushBack(audio::channel_frontLeft);
break;
case PA_CHANNEL_POSITION_FRONT_RIGHT:
out.push_back(audio::channel_frontRight);
out.pushBack(audio::channel_frontRight);
break;
case PA_CHANNEL_POSITION_REAR_CENTER:
out.push_back(audio::channel_rearCenter);
out.pushBack(audio::channel_rearCenter);
break;
case PA_CHANNEL_POSITION_REAR_LEFT:
out.push_back(audio::channel_rearLeft);
out.pushBack(audio::channel_rearLeft);
break;
case PA_CHANNEL_POSITION_REAR_RIGHT:
out.push_back(audio::channel_rearRight);
out.pushBack(audio::channel_rearRight);
break;
case PA_CHANNEL_POSITION_LFE:
out.push_back(audio::channel_lfe);
out.pushBack(audio::channel_lfe);
break;
case PA_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER:
out.push_back(audio::channel_centerLeft);
out.pushBack(audio::channel_centerLeft);
break;
case PA_CHANNEL_POSITION_FRONT_RIGHT_OF_CENTER:
out.push_back(audio::channel_centerRight);
out.pushBack(audio::channel_centerRight);
break;
case PA_CHANNEL_POSITION_SIDE_LEFT:
out.push_back(audio::channel_topCenterLeft);
out.pushBack(audio::channel_topCenterLeft);
break;
case PA_CHANNEL_POSITION_SIDE_RIGHT:
out.push_back(audio::channel_topCenterRight);
out.pushBack(audio::channel_topCenterRight);
break;
case PA_CHANNEL_POSITION_TOP_CENTER:
case PA_CHANNEL_POSITION_TOP_FRONT_CENTER:
out.push_back(audio::channel_topFrontCenter);
out.pushBack(audio::channel_topFrontCenter);
break;
case PA_CHANNEL_POSITION_TOP_FRONT_LEFT:
out.push_back(audio::channel_topFrontLeft);
out.pushBack(audio::channel_topFrontLeft);
break;
case PA_CHANNEL_POSITION_TOP_FRONT_RIGHT:
out.push_back(audio::channel_topFrontRight);
out.pushBack(audio::channel_topFrontRight);
break;
case PA_CHANNEL_POSITION_TOP_REAR_LEFT:
out.push_back(audio::channel_topRearLeft);
out.pushBack(audio::channel_topRearLeft);
break;
case PA_CHANNEL_POSITION_TOP_REAR_RIGHT:
out.push_back(audio::channel_topRearRight);
out.pushBack(audio::channel_topRearRight);
break;
case PA_CHANNEL_POSITION_TOP_REAR_CENTER:
out.push_back(audio::channel_topRearCenter);
out.pushBack(audio::channel_topRearCenter);
break;
case PA_CHANNEL_POSITION_AUX0: out.push_back(audio::channel_aux0); break;
case PA_CHANNEL_POSITION_AUX1: out.push_back(audio::channel_aux1); break;
case PA_CHANNEL_POSITION_AUX2: out.push_back(audio::channel_aux2); break;
case PA_CHANNEL_POSITION_AUX3: out.push_back(audio::channel_aux3); break;
case PA_CHANNEL_POSITION_AUX4: out.push_back(audio::channel_aux4); break;
case PA_CHANNEL_POSITION_AUX5: out.push_back(audio::channel_aux5); break;
case PA_CHANNEL_POSITION_AUX6: out.push_back(audio::channel_aux6); break;
case PA_CHANNEL_POSITION_AUX7: out.push_back(audio::channel_aux7); break;
case PA_CHANNEL_POSITION_AUX8: out.push_back(audio::channel_aux8); break;
case PA_CHANNEL_POSITION_AUX9: out.push_back(audio::channel_aux9); break;
case PA_CHANNEL_POSITION_AUX10: out.push_back(audio::channel_aux10); break;
case PA_CHANNEL_POSITION_AUX11: out.push_back(audio::channel_aux11); break;
case PA_CHANNEL_POSITION_AUX12: out.push_back(audio::channel_aux12); break;
case PA_CHANNEL_POSITION_AUX13: out.push_back(audio::channel_aux13); break;
case PA_CHANNEL_POSITION_AUX14: out.push_back(audio::channel_aux14); break;
case PA_CHANNEL_POSITION_AUX15: out.push_back(audio::channel_aux15); break;
case PA_CHANNEL_POSITION_AUX16: out.push_back(audio::channel_aux16); break;
case PA_CHANNEL_POSITION_AUX17: out.push_back(audio::channel_aux17); break;
case PA_CHANNEL_POSITION_AUX18: out.push_back(audio::channel_aux18); break;
case PA_CHANNEL_POSITION_AUX19: out.push_back(audio::channel_aux19); break;
case PA_CHANNEL_POSITION_AUX20: out.push_back(audio::channel_aux20); break;
case PA_CHANNEL_POSITION_AUX21: out.push_back(audio::channel_aux21); break;
case PA_CHANNEL_POSITION_AUX22: out.push_back(audio::channel_aux22); break;
case PA_CHANNEL_POSITION_AUX23: out.push_back(audio::channel_aux23); break;
case PA_CHANNEL_POSITION_AUX24: out.push_back(audio::channel_aux24); break;
case PA_CHANNEL_POSITION_AUX25: out.push_back(audio::channel_aux25); break;
case PA_CHANNEL_POSITION_AUX26: out.push_back(audio::channel_aux26); break;
case PA_CHANNEL_POSITION_AUX27: out.push_back(audio::channel_aux27); break;
case PA_CHANNEL_POSITION_AUX28: out.push_back(audio::channel_aux28); break;
case PA_CHANNEL_POSITION_AUX29: out.push_back(audio::channel_aux29); break;
case PA_CHANNEL_POSITION_AUX30: out.push_back(audio::channel_aux30); break;
case PA_CHANNEL_POSITION_AUX31: out.push_back(audio::channel_aux31); break;
case PA_CHANNEL_POSITION_AUX0: out.pushBack(audio::channel_aux0); break;
case PA_CHANNEL_POSITION_AUX1: out.pushBack(audio::channel_aux1); break;
case PA_CHANNEL_POSITION_AUX2: out.pushBack(audio::channel_aux2); break;
case PA_CHANNEL_POSITION_AUX3: out.pushBack(audio::channel_aux3); break;
case PA_CHANNEL_POSITION_AUX4: out.pushBack(audio::channel_aux4); break;
case PA_CHANNEL_POSITION_AUX5: out.pushBack(audio::channel_aux5); break;
case PA_CHANNEL_POSITION_AUX6: out.pushBack(audio::channel_aux6); break;
case PA_CHANNEL_POSITION_AUX7: out.pushBack(audio::channel_aux7); break;
case PA_CHANNEL_POSITION_AUX8: out.pushBack(audio::channel_aux8); break;
case PA_CHANNEL_POSITION_AUX9: out.pushBack(audio::channel_aux9); break;
case PA_CHANNEL_POSITION_AUX10: out.pushBack(audio::channel_aux10); break;
case PA_CHANNEL_POSITION_AUX11: out.pushBack(audio::channel_aux11); break;
case PA_CHANNEL_POSITION_AUX12: out.pushBack(audio::channel_aux12); break;
case PA_CHANNEL_POSITION_AUX13: out.pushBack(audio::channel_aux13); break;
case PA_CHANNEL_POSITION_AUX14: out.pushBack(audio::channel_aux14); break;
case PA_CHANNEL_POSITION_AUX15: out.pushBack(audio::channel_aux15); break;
case PA_CHANNEL_POSITION_AUX16: out.pushBack(audio::channel_aux16); break;
case PA_CHANNEL_POSITION_AUX17: out.pushBack(audio::channel_aux17); break;
case PA_CHANNEL_POSITION_AUX18: out.pushBack(audio::channel_aux18); break;
case PA_CHANNEL_POSITION_AUX19: out.pushBack(audio::channel_aux19); break;
case PA_CHANNEL_POSITION_AUX20: out.pushBack(audio::channel_aux20); break;
case PA_CHANNEL_POSITION_AUX21: out.pushBack(audio::channel_aux21); break;
case PA_CHANNEL_POSITION_AUX22: out.pushBack(audio::channel_aux22); break;
case PA_CHANNEL_POSITION_AUX23: out.pushBack(audio::channel_aux23); break;
case PA_CHANNEL_POSITION_AUX24: out.pushBack(audio::channel_aux24); break;
case PA_CHANNEL_POSITION_AUX25: out.pushBack(audio::channel_aux25); break;
case PA_CHANNEL_POSITION_AUX26: out.pushBack(audio::channel_aux26); break;
case PA_CHANNEL_POSITION_AUX27: out.pushBack(audio::channel_aux27); break;
case PA_CHANNEL_POSITION_AUX28: out.pushBack(audio::channel_aux28); break;
case PA_CHANNEL_POSITION_AUX29: out.pushBack(audio::channel_aux29); break;
case PA_CHANNEL_POSITION_AUX30: out.pushBack(audio::channel_aux30); break;
case PA_CHANNEL_POSITION_AUX31: out.pushBack(audio::channel_aux31); break;
}
}
@@ -207,7 +207,7 @@ static std::vector<audio::channel> getChannelOrderFromPulseChannel(const struct
}
// Callback on getting data from pulseaudio:
static void callbackGetSinkList(pa_context* _contex, const pa_sink_info* _info, int _eol, void* _userdata) {
std::vector<audio::orchestra::DeviceInfo>* list = static_cast<std::vector<audio::orchestra::DeviceInfo>*>(_userdata);
etk::Vector<audio::orchestra::DeviceInfo>* list = static_cast<etk::Vector<audio::orchestra::DeviceInfo>*>(_userdata);
// If eol is set to a positive number, you're at the end of the list
if (_eol > 0) {
return;
@@ -217,17 +217,17 @@ static void callbackGetSinkList(pa_context* _contex, const pa_sink_info* _info,
info.input = false;
info.name = _info->name;
info.desc = _info->description;
info.sampleRates.push_back(_info->sample_spec.rate);
info.nativeFormats.push_back(getFormatFromPulseFormat(_info->sample_spec.format));
info.sampleRates.pushBack(_info->sample_spec.rate);
info.nativeFormats.pushBack(getFormatFromPulseFormat(_info->sample_spec.format));
info.channels = getChannelOrderFromPulseChannel(_info->channel_map);
ATA_VERBOSE("plop=" << _info->index << " " << _info->name);
//ATA_DEBUG(" ports=" << _info->n_ports);
list->push_back(info);
list->pushBack(info);
}
// allback to get data from pulseaudio:
static void callbackGetSourceList(pa_context* _contex, const pa_source_info* _info, int _eol, void* _userdata) {
std::vector<audio::orchestra::DeviceInfo>* list = static_cast<std::vector<audio::orchestra::DeviceInfo>*>(_userdata);
etk::Vector<audio::orchestra::DeviceInfo>* list = static_cast<etk::Vector<audio::orchestra::DeviceInfo>*>(_userdata);
if (_eol > 0) {
return;
}
@@ -236,18 +236,18 @@ static void callbackGetSourceList(pa_context* _contex, const pa_source_info* _in
info.input = true;
info.name = _info->name;
info.desc = _info->description;
info.sampleRates.push_back(_info->sample_spec.rate);
info.nativeFormats.push_back(getFormatFromPulseFormat(_info->sample_spec.format));
info.sampleRates.pushBack(_info->sample_spec.rate);
info.nativeFormats.pushBack(getFormatFromPulseFormat(_info->sample_spec.format));
info.channels = getChannelOrderFromPulseChannel(_info->channel_map);
ATA_VERBOSE("plop=" << _info->index << " " << _info->name);
list->push_back(info);
list->pushBack(info);
}
// to not update all the time ...
static std::vector<audio::orchestra::DeviceInfo> pulseAudioListOfDevice;
static etk::Vector<audio::orchestra::DeviceInfo> pulseAudioListOfDevice;
static audio::Time pulseAudioListOfDeviceTime;
std::vector<audio::orchestra::DeviceInfo> audio::orchestra::api::pulse::getDeviceList() {
etk::Vector<audio::orchestra::DeviceInfo> audio::orchestra::api::pulse::getDeviceList() {
audio::Duration delta = audio::Time::now() - pulseAudioListOfDeviceTime;
if (delta < audio::Duration(30,0)) {
return pulseAudioListOfDevice;
@@ -258,7 +258,7 @@ std::vector<audio::orchestra::DeviceInfo> audio::orchestra::api::pulse::getDevic
pa_operation* pulseAudioOperation;
pa_context* pulseAudioContex;
pa_context_flags_t pulseAudioFlags = PA_CONTEXT_NOAUTOSPAWN;
std::vector<audio::orchestra::DeviceInfo>& out = pulseAudioListOfDevice;
etk::Vector<audio::orchestra::DeviceInfo>& out = pulseAudioListOfDevice;
out.clear();
// We'll need these state variables to keep track of our requests
int state = 0;

View File

@@ -14,7 +14,7 @@ namespace audio {
namespace orchestra {
namespace api {
namespace pulse {
std::vector<audio::orchestra::DeviceInfo> getDeviceList();
etk::Vector<audio::orchestra::DeviceInfo> getDeviceList();
}
}
}