Allow to use PCM devices which does not have a hint section

This commit is contained in:
Jörg Krause 2017-03-30 12:42:42 +02:00 committed by badaix
parent 0dd803007a
commit 5da4fe8830
2 changed files with 5 additions and 33 deletions

View file

@ -41,30 +41,6 @@ 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)
{
@ -198,14 +174,10 @@ int main (int argc, char **argv)
}
#endif
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.isSet())
pcmDevice.name = soundcard;
if (host.empty())
{