mirror of
https://github.com/badaix/snapcast.git
synced 2025-06-06 21:01:42 +02:00
Allow to use PCM devices which does not have a hint section
This commit is contained in:
parent
0dd803007a
commit
5da4fe8830
2 changed files with 5 additions and 33 deletions
|
@ -25,7 +25,7 @@
|
||||||
struct PcmDevice
|
struct PcmDevice
|
||||||
{
|
{
|
||||||
PcmDevice() :
|
PcmDevice() :
|
||||||
idx(-1)
|
idx(-1), name("default")
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -41,30 +41,6 @@ using namespace popl;
|
||||||
|
|
||||||
volatile sig_atomic_t g_terminated = false;
|
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)
|
int main (int argc, char **argv)
|
||||||
{
|
{
|
||||||
|
@ -198,14 +174,10 @@ int main (int argc, char **argv)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
PcmDevice pcmDevice = getPcmDevice(soundcard);
|
PcmDevice pcmDevice;
|
||||||
#if defined(HAS_ALSA)
|
pcmDevice.idx = 1;
|
||||||
if (pcmDevice.idx == -1)
|
if (soundcardValue.isSet())
|
||||||
{
|
pcmDevice.name = soundcard;
|
||||||
cout << "soundcard \"" << soundcard << "\" not found\n";
|
|
||||||
// exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (host.empty())
|
if (host.empty())
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue