29 #include "dsHALConfig.h"
30 #include "audioOutputPortConfig.hpp"
31 #include "dsAudioSettings.h"
32 #include "illegalArgumentException.hpp"
42 AudioOutputPortConfig::AudioOutputPortConfig()=
default;
44 AudioOutputPortConfig::~AudioOutputPortConfig()=
default;
47 AudioOutputPortConfig & AudioOutputPortConfig::getInstance()
49 static AudioOutputPortConfig _singleton;
53 const AudioEncoding &AudioOutputPortConfig::getEncoding(
int id)
const
55 return _aEncodings.at(
id);
57 const AudioCompression &AudioOutputPortConfig::getCompression(
int id)
const
59 return _aCompressions.at(
id);
62 const AudioStereoMode &AudioOutputPortConfig::getStereoMode(
int id)
const
64 return _aStereoModes.at(
id);
67 AudioOutputPortType & AudioOutputPortConfig::getPortType(
int id)
69 return _aPortTypes.at(
id);
72 AudioOutputPort &AudioOutputPortConfig::getPort(
int id)
74 return _aPorts.at(
id);
77 AudioOutputPort &AudioOutputPortConfig::getPort(
const std::string & name)
79 for (
size_t i = 0; i < _aPorts.size(); i++) {
80 if (name.compare(_aPorts.at(i).getName()) == 0) {
85 throw IllegalArgumentException();
88 List<AudioOutputPort> AudioOutputPortConfig::getPorts()
90 List <AudioOutputPort> rPorts;
92 for (
size_t i = 0; i < _aPorts.size(); i++) {
93 rPorts.push_back(_aPorts.at(i));
99 List<AudioOutputPortType> AudioOutputPortConfig::getSupportedTypes()
101 List<AudioOutputPortType> supportedTypes;
102 for (std::vector<AudioOutputPortType>::const_iterator it = _aPortTypes.begin(); it != _aPortTypes.end(); it++) {
103 if (it->isEnabled()) {
104 supportedTypes.push_back(*it);
108 return supportedTypes;
111 void AudioOutputPortConfig::load()
118 _aEncodings.push_back(AudioEncoding(i));
122 _aCompressions.push_back(AudioCompression(i));
127 _aStereoModes.push_back(AudioStereoMode(i));
132 _aPortTypes.push_back(AudioOutputPortType(i));
140 for (
size_t i = 0; i <
dsUTL_DIM(kConfigs); i++) {
146 _aEncodings.at(typeCfg->
encodings[j]).enable();
155 _aStereoModes.at(typeCfg->
stereoModes[j]).enable();
163 for (
size_t i = 0; i <
dsUTL_DIM(kPorts); i++) {
165 _aPorts.push_back(AudioOutputPort((port->
id.
type), port->
id.
index, i));
166 _aPortTypes.at(port->
id.
type).addPort(_aPorts.at(i));
175 void AudioOutputPortConfig::release()
179 _aCompressions.clear();
180 _aStereoModes.clear();