File tree Expand file tree Collapse file tree 1 file changed +17
-9
lines changed
Expand file tree Collapse file tree 1 file changed +17
-9
lines changed Original file line number Diff line number Diff line change @@ -84,17 +84,25 @@ void initPcmDevice() {
8484
8585 gtk_combo_box_set_active (GTK_COMBO_BOX (cardcombo ), 0 );
8686
87- if (cardnum == 0 ) {
88- sprintf (pcm_name ,"default" );
89- } else {
90- sprintf (pcm_name ,"hw:%d" ,cardnum - 1 );
91- }
92-
9387 snd_pcm_hw_params_alloca (& hwparams );
9488
95- if (snd_pcm_open (& pcm_handle , pcm_name , PcmInStream , 0 ) < 0 ) {
96- fprintf (stderr , "ALSA: Error opening PCM device %s\n" , pcm_name );
97- exit (EXIT_FAILURE );
89+ while (true) {
90+ if (cardnum == 0 ) {
91+ sprintf (pcm_name ,"default" );
92+ } else {
93+ sprintf (pcm_name ,"hw:%d" ,cardnum - 1 );
94+ }
95+
96+ if (snd_pcm_open (& pcm_handle , pcm_name , PcmInStream , 0 ) < 0 ) {
97+ fprintf (stderr , "ALSA: Error opening PCM device %s\n" , pcm_name );
98+ if (cardnum == 0 ) {
99+ exit (EXIT_FAILURE );
100+ } else {
101+ cardnum -- ;
102+ }
103+ } else {
104+ break ;
105+ }
98106 }
99107
100108 /* Init hwparams with full configuration space */
You can’t perform that action at this time.
0 commit comments