From: Takashi Iwai Date: Wed, 14 Nov 2007 12:04:34 +0000 (+0100) Subject: hdspmixer - Automatic initialization of secondary cards X-Git-Tag: v1.0.16rc1~2 X-Git-Url: https://git.alsa-project.org/?a=commitdiff_plain;h=d6d0775e8c259a264ffaa60392e307c2ba071e99;p=alsa-tools.git hdspmixer - Automatic initialization of secondary cards From debian bug#450805: We are using Hammerfall DSP cards. After booting, their audio output remains silent until hdspmixer is started. No interaction in the GUI of hdspmixer is necessary to unmute the first HDSP card; however, further cards are only unmuted when activating the respective GUI page ("2", "3"). Apparently, hdspmixer does some automatic initialization of the card when activating the page. Since we'd like to have a fully automatic startup, the following patch activates the page for each existing card on startup, thereby initializing them. There are surely more elegant solutions, but this patch is tested and solves the problem for us. --- diff --git a/hdspmixer/src/HDSPMixerCardSelector.cxx b/hdspmixer/src/HDSPMixerCardSelector.cxx index 083f817..0e31847 100644 --- a/hdspmixer/src/HDSPMixerCardSelector.cxx +++ b/hdspmixer/src/HDSPMixerCardSelector.cxx @@ -45,27 +45,25 @@ void HDSPMixerCardSelector::draw() } } +void HDSPMixerCardSelector::ActivateCard (int i) +{ + card = i + 1; + basew->current_card = i; + basew->cards[i]->setMode (basew->cards[i]->getSpeed ()); + redraw (); +} + int HDSPMixerCardSelector::handle(int e) { int xpos = Fl::event_x()-x(); switch (e) { case FL_PUSH: - if (xpos < 13 && card != 1) { - card = 1; - basew->current_card = 0; - basew->cards[0]->setMode(basew->cards[0]->getSpeed()); - redraw(); - } else if (xpos >= 24 && xpos < 37 && card != 2 && basew->cards[1] != NULL) { - card = 2; - basew->current_card = 1; - basew->cards[1]->setMode(basew->cards[1]->getSpeed()); - redraw(); - } else if (xpos >= 48 && card != 3 && basew->cards[2] != NULL) { - card = 3; - basew->current_card = 2; - basew->cards[2]->setMode(basew->cards[2]->getSpeed()); - redraw(); - } + if (xpos < 13 && card != 1) + ActivateCard (0); + else if (xpos >= 24 && xpos < 37 && card != 2 && basew->cards[1] != NULL) + ActivateCard (1); + else if (xpos >= 48 && card != 3 && basew->cards[2] != NULL) + ActivateCard (2); return 1; default: return Fl_Widget::handle(e); diff --git a/hdspmixer/src/HDSPMixerCardSelector.h b/hdspmixer/src/HDSPMixerCardSelector.h index 9a5676e..7d2912d 100644 --- a/hdspmixer/src/HDSPMixerCardSelector.h +++ b/hdspmixer/src/HDSPMixerCardSelector.h @@ -37,6 +37,7 @@ public: int card; HDSPMixerWindow *basew; HDSPMixerCardSelector(int x, int y, int w, int h, int card); + void ActivateCard (int i); void draw(); int handle(int e); }; diff --git a/hdspmixer/src/HDSPMixerWindow.cxx b/hdspmixer/src/HDSPMixerWindow.cxx index cab0d5e..fb90130 100644 --- a/hdspmixer/src/HDSPMixerWindow.cxx +++ b/hdspmixer/src/HDSPMixerWindow.cxx @@ -700,6 +700,9 @@ HDSPMixerWindow::HDSPMixerWindow(int x, int y, int w, int h, const char *label, Fl::atclose = atclose_cb; Fl::add_handler(handler_cb); Fl::add_timeout(0.030, readregisters_cb, this); + i = 0; + while (cards[i] != NULL) + inputs->buttons->cardselector->ActivateCard (i++); } int HDSPMixerWindow::handle(int e)