From e53508227075f907f11af4c5a8bc63d1f234caf9 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Mon, 24 Nov 2003 18:17:05 +0000 Subject: [PATCH] - updated to version 1.6 - fixed compile warnings - corrects preset 7 for H9632 cards --- hdspmixer/NEWS | 5 ++ hdspmixer/configure.in | 2 +- hdspmixer/src/HDSPMixerCard.cxx | 94 +++++++++++++++++++++++------ hdspmixer/src/HDSPMixerCard.h | 3 - hdspmixer/src/HDSPMixerFader.cxx | 1 - hdspmixer/src/HDSPMixerMaster.cxx | 1 - hdspmixer/src/HDSPMixerMeter.cxx | 1 - hdspmixer/src/HDSPMixerOutput.cxx | 41 ++++++++++++- hdspmixer/src/HDSPMixerOutput.h | 41 ------------- hdspmixer/src/HDSPMixerPan.cxx | 1 - hdspmixer/src/HDSPMixerSelector.cxx | 50 ++++++++++++++- hdspmixer/src/HDSPMixerSelector.h | 55 ----------------- hdspmixer/src/HDSPMixerView.cxx | 1 - hdspmixer/src/HDSPMixerWindow.cxx | 11 +++- hdspmixer/src/Makefile.am | 1 - 15 files changed, 178 insertions(+), 130 deletions(-) diff --git a/hdspmixer/NEWS b/hdspmixer/NEWS index 7c7197f..cbe95d8 100644 --- a/hdspmixer/NEWS +++ b/hdspmixer/NEWS @@ -1,3 +1,8 @@ +Version 1.6 (24/11/2003): + * Fixes compilation warnings + * AutoSync sample rate detection scheme changed + * Fixes default preset 7 for H9632 cards + Version 1.5 (21/11/2003): * Added a .desktop file * H9632 bug fixes (thanks to Pentti Ala-Vannesluoma) diff --git a/hdspmixer/configure.in b/hdspmixer/configure.in index 243dc04..5393a05 100644 --- a/hdspmixer/configure.in +++ b/hdspmixer/configure.in @@ -1,5 +1,5 @@ AC_INIT(src/hdspmixer.cxx) -AM_INIT_AUTOMAKE(hdspmixer, 1.5) +AM_INIT_AUTOMAKE(hdspmixer, 1.6) AC_PROG_CXX AC_PROG_MAKE_SET diff --git a/hdspmixer/src/HDSPMixerCard.cxx b/hdspmixer/src/HDSPMixerCard.cxx index 0e7e8b5..ea8573d 100644 --- a/hdspmixer/src/HDSPMixerCard.cxx +++ b/hdspmixer/src/HDSPMixerCard.cxx @@ -19,9 +19,76 @@ */ #pragma implementation -#define HDSPMIXER_DEFINE_MAPPINGS #include "HDSPMixerCard.h" +static char channel_map_df_ss[26] = { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, + 18, 19, 20, 21, 22, 23, 24, 25 +}; + +static char channel_map_mf_ss[26] = { + 0, 1, 2, 3, 4, 5, 6, 7, + 16, 17, 18, 19, 20, 21, 22, 23, + 24, 25, + -1, -1, -1, -1, -1, -1, -1, -1 +}; + +static char meter_map_ds[26] = { + 0, 1, 2, 3, 8, 9, 10, 11, 16, 17, 18, 19, + 24, 25, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 +}; + +static char channel_map_ds[26] = { + 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, + 24, 25, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 +}; + +static char dest_map_mf_ss[10] = { + 0, 2, 4, 6, 16, 18, 20, 22, 24, 26 +}; + +static char dest_map_ds[8] = { + 0, 2, 8, 10, 16, 18, 24, 26 +}; + +static char dest_map_df_ss[14] = { + 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26 +}; + +static char dest_map_h9652_ss[13] = { + 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24 +}; + +static char dest_map_h9652_ds[7] = { + 0, 2, 8, 10, 16, 18, 24 +}; + +static char dest_map_h9632_ss[8] = { + 0, 2, 4, 6, 8, 10, 12, 14 +}; + +static char dest_map_h9632_ds[6] = { + 0, 2, 8, 10, 12, 14 +}; + +static char dest_map_h9632_qs[4] = { + 8, 10, 12, 14 +}; + +static char channel_map_h9632_ss[16] = { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 +}; + +static char channel_map_h9632_ds[12] = { + 0, 1, 2, 3, 8, 9, 10, 11, 12, 13, 14, 15 +}; + +static char channel_map_h9632_qs[8] = { + 8, 9, 10, 11, 12, 13, 14, 15 +}; + static void alsactl_cb(snd_async_handler_t *handler) { int err, clock_value; @@ -76,12 +143,7 @@ static void alsactl_cb(snd_async_handler_t *handler) int HDSPMixerCard::getAutosyncSpeed() { - /* FIXME : this is over simplistic, there are lots of crooked cases - It should always be possible to do what one wants executing the - proper sequence of actions, though. - */ - - int err, external_rate; + int err, rate; snd_ctl_elem_value_t *elemval; snd_ctl_elem_id_t * elemid; snd_ctl_t *handle; @@ -92,24 +154,22 @@ int HDSPMixerCard::getAutosyncSpeed() return -1; } - snd_ctl_elem_id_set_name(elemid, "External Rate"); - snd_ctl_elem_id_set_numid(elemid, 17); - snd_ctl_elem_id_set_interface(elemid, SND_CTL_ELEM_IFACE_PCM); + snd_ctl_elem_id_set_name(elemid, "System Sample Rate"); + snd_ctl_elem_id_set_numid(elemid, 16); + snd_ctl_elem_id_set_interface(elemid, SND_CTL_ELEM_IFACE_HWDEP); snd_ctl_elem_id_set_device(elemid, 0); snd_ctl_elem_id_set_subdevice(elemid, 0); snd_ctl_elem_id_set_index(elemid, 0); snd_ctl_elem_value_set_id(elemval, elemid); snd_ctl_elem_read(handle, elemval); - external_rate = snd_ctl_elem_value_get_enumerated(elemval, 0); + rate = snd_ctl_elem_value_get_integer(elemval, 0); snd_ctl_close(handle); - if (external_rate > 2 && external_rate < 6) { - return 1; - } else if (external_rate > 6) { + if (rate > 96000) { return 2; - } else if (external_rate <= 2) { - return 0; + } else if (rate > 48000) { + return 1; } return 0; } @@ -189,7 +249,7 @@ HDSPMixerCard::HDSPMixerCard(HDSP_IO_Type cardtype, int id) } void HDSPMixerCard::getAeb() { - int err, i; + int err; snd_hwdep_t *hw; snd_hwdep_info_t *info; snd_hwdep_info_alloca(&info); diff --git a/hdspmixer/src/HDSPMixerCard.h b/hdspmixer/src/HDSPMixerCard.h index 4e7df46..e8c4123 100644 --- a/hdspmixer/src/HDSPMixerCard.h +++ b/hdspmixer/src/HDSPMixerCard.h @@ -26,9 +26,6 @@ #include #include #include -#ifdef HDSPMIXER_DEFINE_MAPPINGS -#include "mappings.h" -#endif #include "defines.h" #include "HDSPMixerWindow.h" diff --git a/hdspmixer/src/HDSPMixerFader.cxx b/hdspmixer/src/HDSPMixerFader.cxx index fb3db2e..0441c51 100644 --- a/hdspmixer/src/HDSPMixerFader.cxx +++ b/hdspmixer/src/HDSPMixerFader.cxx @@ -46,7 +46,6 @@ int HDSPMixerFader::handle(int e) int button3 = Fl::event_button3(); int shift = Fl::event_shift(); int ctrl = Fl::event_ctrl(); - int xpos = Fl::event_x()-x(); int ypos = Fl::event_y()-y(); switch (e) { case FL_PUSH: diff --git a/hdspmixer/src/HDSPMixerMaster.cxx b/hdspmixer/src/HDSPMixerMaster.cxx index d926fc9..9018856 100644 --- a/hdspmixer/src/HDSPMixerMaster.cxx +++ b/hdspmixer/src/HDSPMixerMaster.cxx @@ -53,7 +53,6 @@ void HDSPMixerMaster::draw() int HDSPMixerMaster::handle(int e) { int xpos = Fl::event_x()-x(); - int ypos = Fl::event_y()-y(); switch (e) { case FL_PUSH: if (xpos >= 0 && xpos <= 29) { diff --git a/hdspmixer/src/HDSPMixerMeter.cxx b/hdspmixer/src/HDSPMixerMeter.cxx index a51ee22..50aa0e2 100644 --- a/hdspmixer/src/HDSPMixerMeter.cxx +++ b/hdspmixer/src/HDSPMixerMeter.cxx @@ -117,7 +117,6 @@ int HDSPMixerMeter::logToHeight(double db) void HDSPMixerMeter::update(int peak, int overs, int64 rms) { - int p; double fp, fr, db; int over = 0; diff --git a/hdspmixer/src/HDSPMixerOutput.cxx b/hdspmixer/src/HDSPMixerOutput.cxx index 5a79201..0f70eca 100644 --- a/hdspmixer/src/HDSPMixerOutput.cxx +++ b/hdspmixer/src/HDSPMixerOutput.cxx @@ -19,9 +19,48 @@ */ #pragma implementation -#define HDSPMIXER_DEFINE_OUTPUT_LABELS #include "HDSPMixerOutput.h" +static char *labels_mf_ss[20] = { + "AN 1", "AN 2", "AN 3", "AN 4", "AN 5", "AN 6", "AN 7", "AN 8", + "A 1", "A 2", "A 3", "A 4", "A 5", "A 6", "A 7", "A 8", + "SP.L", "SP.R", "AN.L", "AN.R" +}; + +static char *labels_mf_ds[16] = { + "AN 1", "AN 2", "AN 3", "AN 4", "AN 5", "AN 6", "AN 7", "AN 8", + "A 1", "A 2", "A 3", "A 4", + "SP.L", "SP.R", "AN.L", "AN.R" +}; + +static char *labels_df_ss[28] = { + "A1 1", "A1 2", "A1 3", "A1 4", "A1 5", "A1 6", "A1 7", "A1 8", + "A2 1", "A2 2", "A2 3", "A2 4", "A2 5", "A2 6", "A2 7", "A2 8", + "A3 1", "A3 2", "A3 3", "A3 4", "A3 5", "A3 6", "A3 7", "A3 8", + "SP.L", "SP.R", "AN.L", "AN.R" +}; + +static char *labels_df_ds[16] = { + "A1 1", "A1 2", "A1 3", "A1 4", + "A2 1", "A2 2", "A2 3", "A2 4", + "A3 1", "A3 2", "A3 3", "A3 4", + "SP.L", "SP.R", "AN.L", "AN.R" +}; + +static char *labels_9632_ss[16] = { + "A 1", "A 2", "A 3", "A 4", "A 5", "A 6", "A 7", "A 8", + "SP.L", "SP.R", "AN 1", "AN 2", "AN 3", "AN 4", "AN 5", "AN 6" +}; + +static char *labels_9632_ds[12] = { + "A 1", "A 2", "A 3", "A 4", + "SP.L", "SP.R", "AN 1", "AN 2", "AN 3", "AN 4", "AN 5", "AN 6" +}; + +static char *labels_9632_qs[8] = { + "SP.L", "SP.R", "AN 1", "AN 2", "AN 3", "AN 4", "AN 5", "AN 6" +}; + HDSPMixerOutput::HDSPMixerOutput(int x, int y, int w, int h, int num):Fl_Group(x, y, w, h) { diff --git a/hdspmixer/src/HDSPMixerOutput.h b/hdspmixer/src/HDSPMixerOutput.h index 2767e06..e440eb0 100644 --- a/hdspmixer/src/HDSPMixerOutput.h +++ b/hdspmixer/src/HDSPMixerOutput.h @@ -41,47 +41,6 @@ class HDSPMixerMeter; class HDSPMixerOutputData; class HDSPMixerWindow; -#ifdef HDSPMIXER_DEFINE_OUTPUT_LABELS -static char *labels_mf_ss[20] = { - "AN 1", "AN 2", "AN 3", "AN 4", "AN 5", "AN 6", "AN 7", "AN 8", - "A 1", "A 2", "A 3", "A 4", "A 5", "A 6", "A 7", "A 8", - "SP.L", "SP.R", "AN.L", "AN.R" -}; - -static char *labels_mf_ds[16] = { - "AN 1", "AN 2", "AN 3", "AN 4", "AN 5", "AN 6", "AN 7", "AN 8", - "A 1", "A 2", "A 3", "A 4", - "SP.L", "SP.R", "AN.L", "AN.R" -}; - -static char *labels_df_ss[28] = { - "A1 1", "A1 2", "A1 3", "A1 4", "A1 5", "A1 6", "A1 7", "A1 8", - "A2 1", "A2 2", "A2 3", "A2 4", "A2 5", "A2 6", "A2 7", "A2 8", - "A3 1", "A3 2", "A3 3", "A3 4", "A3 5", "A3 6", "A3 7", "A3 8", - "SP.L", "SP.R", "AN.L", "AN.R" -}; - -static char *labels_df_ds[16] = { - "A1 1", "A1 2", "A1 3", "A1 4", - "A2 1", "A2 2", "A2 3", "A2 4", - "A3 1", "A3 2", "A3 3", "A3 4", - "SP.L", "SP.R", "AN.L", "AN.R" -}; - -static char *labels_9632_ss[16] = { - "A 1", "A 2", "A 3", "A 4", "A 5", "A 6", "A 7", "A 8", - "SP.L", "SP.R", "AN 1", "AN 2", "AN 3", "AN 4", "AN 5", "AN 6" -}; - -static char *labels_9632_ds[12] = { - "A 1", "A 2", "A 3", "A 4", - "SP.L", "SP.R", "AN 1", "AN 2", "AN 3", "AN 4", "AN 5", "AN 6" -}; - -static char *labels_9632_qs[8] = { - "SP.L", "SP.R", "AN 1", "AN 2", "AN 3", "AN 4", "AN 5", "AN 6" -}; -#endif class HDSPMixerOutput:public Fl_Group { diff --git a/hdspmixer/src/HDSPMixerPan.cxx b/hdspmixer/src/HDSPMixerPan.cxx index edbd488..5396614 100644 --- a/hdspmixer/src/HDSPMixerPan.cxx +++ b/hdspmixer/src/HDSPMixerPan.cxx @@ -43,7 +43,6 @@ int HDSPMixerPan::handle(int e) int shift = Fl::event_shift(); int ctrl = Fl::event_ctrl(); int xpos = Fl::event_x()-x(); - int ypos = Fl::event_y()-y(); switch (e) { case FL_PUSH: if (xpos > 0 && xpos < 30) { diff --git a/hdspmixer/src/HDSPMixerSelector.cxx b/hdspmixer/src/HDSPMixerSelector.cxx index 166c557..bf11db0 100644 --- a/hdspmixer/src/HDSPMixerSelector.cxx +++ b/hdspmixer/src/HDSPMixerSelector.cxx @@ -19,9 +19,55 @@ */ #pragma implementation -#define HDSPMIXER_DEFINE_SELECTOR_LABELS #include "HDSPMixerSelector.h" + static char *destinations_mf_ss[10] = { + "AN 1+2", "AN 3+4", "AN 5+6", "AN 7+8", + "A 1+2", "A 3+4", "A 5+6", "A 7+8", + "SPDIF", "Analog" + }; + static char *destinations_mf_ds[8] = { + "AN 1+2", "AN 3+4", "AN 5+6", "AN 7+8", + "A 1+2", "A 3+4", + "SPDIF", "Analog" + }; + static char *destinations_df_ss[14] = { + "A1 1+2", "A1 3+4", "A1 5+6", "A1 7+8", + "A2 1+2", "A2 3+4", "A2 5+6", "A2 7+8", + "A3 1+2", "A3 3+4", "A3 5+6", "A3 7+8", + "SPDIF", "Analog" + }; + static char *destinations_df_ds[8] = { + "A1 1+2", "A1 3+4", + "A2 1+2", "A2 3+4", + "A3 1+2", "A3 3+4", + "SPDIF", "Analog" + }; + static char *destinations_h9652_ss[13] = { + "A1 1+2", "A1 3+4", "A1 5+6", "A1 7+8", + "A2 1+2", "A2 3+4", "A2 5+6", "A2 7+8", + "A3 1+2", "A3 3+4", "A3 5+6", "A3 7+8", + "SPDIF" + }; + + static char *destinations_h9652_ds[7] = { + "A1 1+2", "A1 3+4", + "A2 1+2", "A2 3+4", + "A3 1+2", "A3 3+4", + "SPDIF" + }; + static char *destinations_h9632_ss[8] = { + "A 1+2", "A 3+4", "A 5+6", "A 7+8", + "SPDIF", "AN 1+2", "AN 3+4", "AN 5+6" + }; + static char *destinations_h9632_ds[6] = { + "A 1+2", "A 3+4", + "SPDIF", "AN 1+2", "AN 3+4", "AN 5+6" + }; + static char *destinations_h9632_qs[4] = { + "SPDIF", "AN 1+2", "AN 3+4", "AN 5+6" + }; + HDSPMixerSelector::HDSPMixerSelector(int x, int y, int w, int h):Fl_Menu_(x, y, w, h) { max_dest = 0; @@ -41,8 +87,6 @@ void HDSPMixerSelector::draw() { int HDSPMixerSelector::handle(int e) { const Fl_Menu_Item *item; - int xpos = Fl::event_x()-x(); - int ypos = Fl::event_y()-y(); switch(e) { case FL_PUSH: for (int i = 0; i < max_dest; i++) { diff --git a/hdspmixer/src/HDSPMixerSelector.h b/hdspmixer/src/HDSPMixerSelector.h index 2a81b0d..634b3b0 100644 --- a/hdspmixer/src/HDSPMixerSelector.h +++ b/hdspmixer/src/HDSPMixerSelector.h @@ -35,61 +35,6 @@ class HDSPMixerWindow; class HDSPMixerIOMixer; -#ifdef HDSPMIXER_DEFINE_SELECTOR_LABELS -static char *destinations_mf_ss[10] = { - "AN 1+2", "AN 3+4", "AN 5+6", "AN 7+8", - "A 1+2", "A 3+4", "A 5+6", "A 7+8", - "SPDIF", "Analog" -}; - -static char *destinations_mf_ds[8] = { - "AN 1+2", "AN 3+4", "AN 5+6", "AN 7+8", - "A 1+2", "A 3+4", - "SPDIF", "Analog" -}; - -static char *destinations_df_ss[14] = { - "A1 1+2", "A1 3+4", "A1 5+6", "A1 7+8", - "A2 1+2", "A2 3+4", "A2 5+6", "A2 7+8", - "A3 1+2", "A3 3+4", "A3 5+6", "A3 7+8", - "SPDIF", "Analog" -}; - -static char *destinations_df_ds[8] = { - "A1 1+2", "A1 3+4", - "A2 1+2", "A2 3+4", - "A3 1+2", "A3 3+4", - "SPDIF", "Analog" -}; - -static char *destinations_h9652_ss[13] = { - "A1 1+2", "A1 3+4", "A1 5+6", "A1 7+8", - "A2 1+2", "A2 3+4", "A2 5+6", "A2 7+8", - "A3 1+2", "A3 3+4", "A3 5+6", "A3 7+8", - "SPDIF" -}; - -static char *destinations_h9652_ds[7] = { - "A1 1+2", "A1 3+4", - "A2 1+2", "A2 3+4", - "A3 1+2", "A3 3+4", - "SPDIF" -}; - -static char *destinations_h9632_ss[8] = { - "A 1+2", "A 3+4", "A 5+6", "A 7+8", - "SPDIF", "AN 1+2", "AN 3+4", "AN 5+6" -}; - -static char *destinations_h9632_ds[6] = { - "A 1+2", "A 3+4", - "SPDIF", "AN 1+2", "AN 3+4", "AN 5+6" -}; - -static char *destinations_h9632_qs[4] = { - "SPDIF", "AN 1+2", "AN 3+4", "AN 5+6" -}; -#endif class HDSPMixerSelector:public Fl_Menu_ { diff --git a/hdspmixer/src/HDSPMixerView.cxx b/hdspmixer/src/HDSPMixerView.cxx index 7c6bb29..8463e48 100644 --- a/hdspmixer/src/HDSPMixerView.cxx +++ b/hdspmixer/src/HDSPMixerView.cxx @@ -47,7 +47,6 @@ void HDSPMixerView::draw() int HDSPMixerView::handle(int e) { - int xpos = Fl::event_x()-x(); int ypos = Fl::event_y()-y(); switch (e) { case FL_PUSH: diff --git a/hdspmixer/src/HDSPMixerWindow.cxx b/hdspmixer/src/HDSPMixerWindow.cxx index 52a4cc6..5031266 100644 --- a/hdspmixer/src/HDSPMixerWindow.cxx +++ b/hdspmixer/src/HDSPMixerWindow.cxx @@ -533,6 +533,9 @@ void HDSPMixerWindow::restoreDefaults(int card) h9632_an12_submix[2] = 1; num_modes = 3; phones = 0; + default: + /* should never happen */ + return; } for (int preset = 0; preset < 8; ++preset) { for (int speed = 0; speed < num_modes; ++speed) { @@ -595,8 +598,10 @@ void HDSPMixerWindow::restoreDefaults(int card) } } else if (preset > 4 && preset < 7) { data[card][speed][preset]->submix_value = maxdest[speed]-phones-1; - outputs->strips[chnls[speed]-2]->data[card][speed][preset]->fader_pos = ndb; - outputs->strips[chnls[speed]-1]->data[card][speed][preset]->fader_pos = ndb; + if (preset == 5) { + outputs->strips[chnls[speed]-2]->data[card][speed][preset]->fader_pos = ndb; + outputs->strips[chnls[speed]-1]->data[card][speed][preset]->fader_pos = ndb; + } } else { data[card][speed][preset]->submix = 0; } @@ -613,7 +618,7 @@ void HDSPMixerWindow::restoreDefaults(int card) HDSPMixerWindow::HDSPMixerWindow(int x, int y, int w, int h, const char *label, HDSPMixerCard *hdsp_card1, HDSPMixerCard *hdsp_card2, HDSPMixerCard *hdsp_card3):Fl_Double_Window(x, y, w, h, label) { - int def, i; + int i; cards[0] = hdsp_card1; cards[1] = hdsp_card2; cards[2] = hdsp_card3; diff --git a/hdspmixer/src/Makefile.am b/hdspmixer/src/Makefile.am index 6aa4a2a..9bb83af 100644 --- a/hdspmixer/src/Makefile.am +++ b/hdspmixer/src/Makefile.am @@ -55,5 +55,4 @@ hdspmixer_SOURCES = \ HDSPMixerMeter.h \ pixmaps.cxx \ pixmaps.h \ - mappings.h \ defines.h -- 2.47.1