Fixed one-card operations...

This commit is contained in:
Jaroslav Kysela 1998-11-11 20:26:51 +00:00
parent 6c9844d3dc
commit 4809266783

View file

@ -63,6 +63,28 @@ static void help( void )
printf( " from configuration file\n" ); printf( " from configuration file\n" );
} }
static int collect_all( void )
{
int idx, err;
unsigned int card_mask;
card_mask = snd_cards_mask();
if ( !card_mask ) {
error( "No soundcards found..." );
return 1;
}
soundcard_setup_init();
for ( idx = 0; idx < 32; idx++ ) {
if ( card_mask & (1 << idx) ) { /* find each installed soundcards */
if ( (err = soundcard_setup_collect( idx )) ) {
soundcard_setup_done();
return err;
}
}
}
return 0;
}
static int store_setup( const char *cardname ) static int store_setup( const char *cardname )
{ {
int err; int err;
@ -92,7 +114,8 @@ static int store_setup( const char *cardname )
error( "Cannot find soundcard '%s'...", cardname ); error( "Cannot find soundcard '%s'...", cardname );
return 1; return 1;
} }
soundcard_setup_init(); if ( (err = collect_all()) )
return err;
if ( (err = soundcard_setup_load( cfgfile )) ) if ( (err = soundcard_setup_load( cfgfile )) )
return err; return err;
if ( (err = soundcard_setup_collect( cardno )) ) { if ( (err = soundcard_setup_collect( cardno )) ) {
@ -107,8 +130,7 @@ static int store_setup( const char *cardname )
static int restore_setup( const char *cardname ) static int restore_setup( const char *cardname )
{ {
int err, idx, cardno = -1; int err, cardno = -1;
unsigned int card_mask;
if ( cardname ) { if ( cardname ) {
cardno = snd_card_name( cardname ); cardno = snd_card_name( cardname );
@ -117,20 +139,8 @@ static int restore_setup( const char *cardname )
return 1; return 1;
} }
} }
card_mask = snd_cards_mask(); if ( (err = collect_all()) )
if ( !card_mask ) { return err;
error( "No soundcards found..." );
return 1;
}
soundcard_setup_init();
for ( idx = 0; idx < 32; idx++ ) {
if ( card_mask & (1 << idx) ) { /* find each installed soundcards */
if ( (err = soundcard_setup_collect( idx )) ) {
soundcard_setup_done();
return err;
}
}
}
if ( (err = soundcard_setup_load( cfgfile )) ) if ( (err = soundcard_setup_load( cfgfile )) )
return err; return err;
err = soundcard_setup_process( cardno ); err = soundcard_setup_process( cardno );