Check presence and number of samples before triggering activity LED

This commit is contained in:
Peter Nelson 2013-02-15 22:44:08 +00:00
parent 190c9f3a36
commit 79f48b9eee

View File

@ -285,9 +285,11 @@ static gboolean unset_bg(gpointer data) {
} }
static void sample_triggered(DrMrUi *ui, int si) { static void sample_triggered(DrMrUi *ui, int si) {
if (ui->notify_leds && si < ui->samples) {
gtk_image_set_from_pixbuf(GTK_IMAGE(ui->notify_leds[si]),led_on_pixbuf); gtk_image_set_from_pixbuf(GTK_IMAGE(ui->notify_leds[si]),led_on_pixbuf);
g_timeout_add(200,unset_bg,ui->notify_leds[si]); g_timeout_add(200,unset_bg,ui->notify_leds[si]);
} }
}
static const char* nstrs = "C C#D D#E F F#G G#A A#B "; static const char* nstrs = "C C#D D#E F F#G G#A A#B ";
static char baseLabelBuf[32]; static char baseLabelBuf[32];
@ -337,6 +339,7 @@ static gboolean kit_callback(gpointer data) {
notify_leds = ui->notify_leds; notify_leds = ui->notify_leds;
gain_sliders = ui->gain_sliders; gain_sliders = ui->gain_sliders;
pan_sliders = ui->pan_sliders; pan_sliders = ui->pan_sliders;
ui->samples = 0;
ui->notify_leds = NULL; ui->notify_leds = NULL;
ui->gain_sliders = NULL; ui->gain_sliders = NULL;
ui->pan_sliders = NULL; ui->pan_sliders = NULL;