merge with develop

This commit is contained in:
badaix 2018-02-04 17:43:38 +01:00
parent fc075555ea
commit 113e71b67b
4 changed files with 54 additions and 28 deletions

View file

@ -41,6 +41,30 @@ using namespace popl;
volatile sig_atomic_t g_terminated = false;
PcmDevice getPcmDevice(const std::string& soundcard)
{
#ifdef HAS_ALSA
vector<PcmDevice> pcmDevices = AlsaPlayer::pcm_list();
try
{
int soundcardIdx = cpt::stoi(soundcard);
for (auto dev: pcmDevices)
if (dev.idx == soundcardIdx)
return dev;
}
catch(...)
{
}
for (auto dev: pcmDevices)
if (dev.name.find(soundcard) != string::npos)
return dev;
#endif
PcmDevice pcmDevice;
return pcmDevice;
}
int main (int argc, char **argv)
{
@ -174,6 +198,17 @@ int main (int argc, char **argv)
}
#endif
/* TODO: Merge
PcmDevice pcmDevice = getPcmDevice(soundcard);
#if defined(HAS_ALSA)
if (pcmDevice.idx == -1)
{
cout << "soundcard \"" << soundcard << "\" not found\n";
// exit(EXIT_FAILURE);
}
#endif
*/
PcmDevice pcmDevice;
pcmDevice.idx = 1;
if (soundcardValue->is_set())