diff --git a/src/common.h b/src/common.h index 2966283..1d59b87 100644 --- a/src/common.h +++ b/src/common.h @@ -16,7 +16,7 @@ struct options { int silent; /* silent output */ int info; /* display information and exit */ int probeonly; /* probe sound driver and exit */ - char *drv_id; /* sound driver ID */ + char *driver_id; /* sound driver ID */ char *out_file; /* output file name */ char *ins_path; /* instrument path */ char *driver_parm[MAX_DRV_PARM]; /* driver parameters */ diff --git a/src/main.c b/src/main.c index 0bfbd5f..3f993d5 100644 --- a/src/main.c +++ b/src/main.c @@ -16,10 +16,8 @@ #endif extern int optind; -extern struct sound_driver sound_null; - -struct sound_driver *sound; +static struct sound_driver *sound; static int background = 0; static int refresh_status; @@ -152,7 +150,7 @@ int main(int argc, char **argv) memset(&control, 0, sizeof (struct control)); options.verbose = 1; options.rate = 44100; - options.drv_id = NULL; + options.driver_id = NULL; get_options(argc, argv, &options); @@ -164,11 +162,11 @@ int main(int argc, char **argv) } if (options.silent) { - sound = &sound_null; - } else { - sound = select_sound_driver(&options); + options.driver_id = "null"; } + sound = select_sound_driver(&options); + if (sound == NULL) { fprintf(stderr, "%s: can't initialize sound\n", argv[0]); if (f != NULL) { diff --git a/src/options.c b/src/options.c index ef0291a..563a4a8 100644 --- a/src/options.c +++ b/src/options.c @@ -151,7 +151,7 @@ void get_options(int argc, char **argv, struct options *options) options->driver_parm[dparm++] = optarg; break; case 'd': - options->drv_id = optarg; + options->driver_id = optarg; break; #if 0 case OPT_FX9BUG: @@ -190,7 +190,9 @@ void get_options(int argc, char **argv, struct options *options) options->out_file = optarg; if (strlen(optarg) >= 4 && !strcasecmp(optarg + strlen(optarg) - 4, ".wav")) { - //options->drv_id = "wav"; + options->driver_id = "wav"; + } else { + options->driver_id = "file"; } break; case 'P': diff --git a/src/sound.c b/src/sound.c index fa15f9e..a69f7d2 100644 --- a/src/sound.c +++ b/src/sound.c @@ -2,6 +2,7 @@ #include #include "sound.h" +extern struct sound_driver sound_null; extern struct sound_driver sound_wav; extern struct sound_driver sound_file; extern struct sound_driver sound_oss; @@ -72,13 +73,14 @@ void init_sound_drivers() #endif register_sound_driver(&sound_wav); register_sound_driver(&sound_file); + register_sound_driver(&sound_null); } struct sound_driver *select_sound_driver(struct options *options) { struct list_head *head; struct sound_driver *sd; - char *pref = options->drv_id; + char *pref = options->driver_id; if (pref) { list_for_each(head, &sound_driver_list) { diff --git a/src/sound_null.c b/src/sound_null.c index 1164ade..491d560 100644 --- a/src/sound_null.c +++ b/src/sound_null.c @@ -29,7 +29,7 @@ static void onresume() struct sound_driver sound_null = { "null", - "No output", + "null output", NULL, init, deinit,