summaryrefslogtreecommitdiff
path: root/radio.c
diff options
context:
space:
mode:
Diffstat (limited to 'radio.c')
-rw-r--r--radio.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/radio.c b/radio.c
index 7b53fba..07c6ff8 100644
--- a/radio.c
+++ b/radio.c
@@ -34,13 +34,33 @@ void radio_start()
g_return_if_fail(!active);
g_debug("Starting radio");
- configure_bt_muxer(true);
+ bool ok;
+
+ ok = configure_bt_muxer(true);
+ if (!ok) goto fail_start;
+
configure_mixer(true);
+ if (!ok) goto fail_start;
+
configure_tuner(true);
+ if (!ok) goto fail_start;
+
configure_capture(true);
+ if (!ok) goto fail_start;
+
+ // Not essential.
+ configure_signal(true);
configure_rds(true);
active = true;
+ return; // Success
+
+fail_start:
+ g_critical("Radio failed to start!");
+
+ // Try to force a stop
+ active = true;
+ radio_stop();
}
void radio_stop()
@@ -49,6 +69,7 @@ void radio_stop()
g_debug("Stopping radio");
configure_rds(false);
+ configure_signal(false);
configure_capture(false);
configure_tuner(false);
configure_mixer(false);