aboutsummaryrefslogtreecommitdiff
path: root/audio/audio.c
diff options
context:
space:
mode:
Diffstat (limited to 'audio/audio.c')
-rw-r--r--audio/audio.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/audio/audio.c b/audio/audio.c
index 17ef4f498f..c99e4ddea4 100644
--- a/audio/audio.c
+++ b/audio/audio.c
@@ -101,6 +101,8 @@ const struct mixeng_volume nominal_volume = {
#endif
};
+static bool legacy_config = true;
+
#ifdef AUDIO_IS_FLAWLESS_AND_NO_CHECKS_ARE_REQURIED
#error No its not
#else
@@ -1394,7 +1396,7 @@ static AudiodevListEntry *audiodev_find(
* if dev == NULL => legacy implicit initialization, return the already created
* state or create a new one
*/
-static AudioState *audio_init(Audiodev *dev)
+static AudioState *audio_init(Audiodev *dev, const char *name)
{
static bool atexit_registered;
size_t i;
@@ -1408,12 +1410,13 @@ static AudioState *audio_init(Audiodev *dev)
if (dev) {
/* -audiodev option */
+ legacy_config = false;
drvname = AudiodevDriver_str(dev->driver);
} else if (!QTAILQ_EMPTY(&audio_states)) {
- /*
- * todo: check for -audiodev once we have normal audiodev selection
- * support
- */
+ if (!legacy_config) {
+ dolog("You must specify an audiodev= for the device %s\n", name);
+ exit(1);
+ }
return QTAILQ_FIRST(&audio_states);
} else {
/* legacy implicit initialization */
@@ -1520,7 +1523,7 @@ void audio_free_audiodev_list(AudiodevListHead *head)
void AUD_register_card (const char *name, QEMUSoundCard *card)
{
if (!card->state) {
- card->state = audio_init(NULL);
+ card->state = audio_init(NULL, name);
}
card->name = g_strdup (name);
@@ -1546,8 +1549,11 @@ CaptureVoiceOut *AUD_add_capture(
struct capture_callback *cb;
if (!s) {
- /* todo: remove when we have normal audiodev selection support */
- s = audio_init(NULL);
+ if (!legacy_config) {
+ dolog("You must specify audiodev when trying to capture\n");
+ return NULL;
+ }
+ s = audio_init(NULL, NULL);
}
if (audio_validate_settings (as)) {
@@ -1778,7 +1784,7 @@ void audio_init_audiodevs(void)
AudiodevListEntry *e;
QSIMPLEQ_FOREACH(e, &audiodevs, next) {
- audio_init(e->dev);
+ audio_init(e->dev, NULL);
}
}