mirror of
https://github.com/alsa-project/alsa-tools.git
synced 2025-10-29 05:40:25 -04:00
hdspmixer: Show cardname in window title
When running with more than one card, it isn't obvious which card is shown. Store the ALSA cardname in the corresponding class and show it in the window title upon switching cards. Also, don't show "(null)" but "(unsaved)" in case the user hasn't selected a preset file. Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
1669acbe34
commit
7416c3a83c
6 changed files with 52 additions and 27 deletions
|
|
@ -163,11 +163,12 @@ int HDSPMixerCard::getSpeed()
|
|||
return 0;
|
||||
}
|
||||
|
||||
HDSPMixerCard::HDSPMixerCard(int cardtype, int id)
|
||||
HDSPMixerCard::HDSPMixerCard(int cardtype, int id, char *shortname)
|
||||
{
|
||||
type = cardtype;
|
||||
card_id = id;
|
||||
snprintf(name, 6, "hw:%i", card_id);
|
||||
cardname = shortname;
|
||||
h9632_aeb.aebi = 0;
|
||||
h9632_aeb.aebo = 0;
|
||||
if (type == H9632) {
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@
|
|||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string>
|
||||
#include <alsa/asoundlib.h>
|
||||
#include <alsa/sound/hdsp.h>
|
||||
#include <alsa/sound/hdspm.h>
|
||||
|
|
@ -42,7 +43,8 @@ private:
|
|||
public:
|
||||
HDSPMixerWindow *basew;
|
||||
char name[6];
|
||||
HDSPMixerCard(int cardtype, int id);
|
||||
std::string cardname;
|
||||
HDSPMixerCard(int cardtype, int id, char *shortname);
|
||||
int channels_input, channels_playback, window_width, window_height, card_id;
|
||||
int channels_output;
|
||||
int type;
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@ void HDSPMixerCardSelector::ActivateCard (int i)
|
|||
card = i + 1;
|
||||
basew->current_card = i;
|
||||
basew->cards[i]->setMode (basew->cards[i]->getSpeed ());
|
||||
basew->setTitleWithFilename();
|
||||
redraw ();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -216,8 +216,7 @@ static void save_cb(Fl_Widget *widget, void *arg)
|
|||
if (!(w->file_name = fl_file_chooser("Choose a file to save presets to :", "HDSPMixer preset file (*.mix)", NULL, 0))) return;
|
||||
}
|
||||
w->save();
|
||||
snprintf(w->window_title, FL_PATH_MAX, "HDSPMixer - %s", fl_filename_name(w->file_name));
|
||||
w->label(w->window_title);
|
||||
w->setTitleWithFilename();
|
||||
}
|
||||
|
||||
static void make_default_cb(Fl_Widget *widget, void *arg)
|
||||
|
|
@ -241,8 +240,7 @@ static void restore_defaults_cb(Fl_Widget *widget, void *arg)
|
|||
w->prefs->deleteEntry("default_file");
|
||||
w->prefs->flush();
|
||||
w->file_name = NULL;
|
||||
snprintf(w->window_title, FL_PATH_MAX, "HDSPMixer");
|
||||
w->label(w->window_title);
|
||||
w->setTitleWithFilename();
|
||||
w->resetMixer();
|
||||
while (i < MAX_CARDS && w->cards[i] != NULL) {
|
||||
w->restoreDefaults(i++);
|
||||
|
|
@ -516,8 +514,7 @@ void HDSPMixerWindow::load()
|
|||
}
|
||||
}
|
||||
fclose(file);
|
||||
snprintf(window_title, FL_PATH_MAX, "HDSPMixer - %s", fl_filename_name(file_name));
|
||||
label(window_title);
|
||||
setTitleWithFilename();
|
||||
resetMixer();
|
||||
inputs->buttons->presets->preset_change(1);
|
||||
return;
|
||||
|
|
@ -527,6 +524,29 @@ load_error:
|
|||
return;
|
||||
}
|
||||
|
||||
void HDSPMixerWindow::setTitle(std::string suffix)
|
||||
{
|
||||
std::string title = "HDSPMixer (";
|
||||
|
||||
title = title + cards[current_card]->cardname + ") "; /*cardname */
|
||||
title = title + suffix;
|
||||
snprintf(window_title, FL_PATH_MAX, "%s", title.c_str());
|
||||
label(window_title);
|
||||
}
|
||||
|
||||
void HDSPMixerWindow::setTitleWithFilename(void)
|
||||
{
|
||||
const char *filename = fl_filename_name(file_name);
|
||||
|
||||
if (NULL == file_name) {
|
||||
filename = "(unsaved)";
|
||||
}
|
||||
|
||||
setTitle(filename);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void HDSPMixerWindow::restoreDefaults(int card)
|
||||
{
|
||||
int chnls[3];
|
||||
|
|
@ -885,13 +905,11 @@ void HDSPMixerWindow::checkState()
|
|||
if (corrupt) {
|
||||
if (!dirty) {
|
||||
dirty = 1;
|
||||
snprintf(window_title, FL_PATH_MAX, "HDSPMixer - %s *", fl_filename_name(file_name));
|
||||
label(window_title);
|
||||
setTitleWithFilename();
|
||||
Fl::add_timeout(0.3, dirty_cb, (void *)this);
|
||||
}
|
||||
} else {
|
||||
snprintf(window_title, FL_PATH_MAX, "HDSPMixer - %s", fl_filename_name(file_name));
|
||||
label(window_title);
|
||||
setTitleWithFilename();
|
||||
dirty = 0;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -93,6 +93,8 @@ public:
|
|||
void refreshMixerStrip(int idx, int src);
|
||||
void save();
|
||||
void load();
|
||||
void setTitle(std::string suffix);
|
||||
void setTitleWithFilename();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ int main(int argc, char **argv)
|
|||
{
|
||||
HDSPMixerWindow *window;
|
||||
HDSPMixerCard *hdsp_cards[3];
|
||||
char *name;
|
||||
char *name, *shortname;
|
||||
int card;
|
||||
int cards = 0;
|
||||
|
||||
|
|
@ -55,42 +55,43 @@ int main(int argc, char **argv)
|
|||
}
|
||||
|
||||
snd_card_get_longname(card, &name);
|
||||
snd_card_get_name(card, &shortname);
|
||||
printf("Card %d: %s\n", card, name);
|
||||
if (!strncmp(name, "RME Hammerfall DSP + Multiface", 30)) {
|
||||
printf("Multiface found!\n");
|
||||
hdsp_cards[cards] = new HDSPMixerCard(Multiface, card);
|
||||
hdsp_cards[cards] = new HDSPMixerCard(Multiface, card, shortname);
|
||||
cards++;
|
||||
} else if (!strncmp(name, "RME Hammerfall DSP + Digiface", 29)) {
|
||||
printf("Digiface found!\n");
|
||||
hdsp_cards[cards] = new HDSPMixerCard(Digiface, card);
|
||||
hdsp_cards[cards] = new HDSPMixerCard(Digiface, card, shortname);
|
||||
cards++;
|
||||
} else if (!strncmp(name, "RME Hammerfall HDSP 9652", 24)) {
|
||||
printf("HDSP 9652 found!\n");
|
||||
hdsp_cards[cards] = new HDSPMixerCard(H9652, card);
|
||||
hdsp_cards[cards] = new HDSPMixerCard(H9652, card, shortname);
|
||||
cards++;
|
||||
} else if (!strncmp(name, "RME Hammerfall HDSP 9632", 24)) {
|
||||
printf("HDSP 9632 found!\n");
|
||||
hdsp_cards[cards] = new HDSPMixerCard(H9632, card);
|
||||
hdsp_cards[cards] = new HDSPMixerCard(H9632, card, shortname);
|
||||
cards++;
|
||||
} else if (!strncmp(name, "RME MADIface", 12)) {
|
||||
printf("RME MADIface found!\n");
|
||||
hdsp_cards[cards] = new HDSPMixerCard(HDSPeMADI, card);
|
||||
hdsp_cards[cards] = new HDSPMixerCard(HDSPeMADI, card, shortname);
|
||||
cards++;
|
||||
} else if (!strncmp(name, "RME MADI", 8)) {
|
||||
printf("RME MADI found!\n");
|
||||
hdsp_cards[cards] = new HDSPMixerCard(HDSPeMADI, card);
|
||||
hdsp_cards[cards] = new HDSPMixerCard(HDSPeMADI, card, shortname);
|
||||
cards++;
|
||||
} else if (!strncmp(name, "RME AES32", 8)) {
|
||||
printf("RME AES32 or HDSPe AES found!\n");
|
||||
hdsp_cards[cards] = new HDSPMixerCard(HDSP_AES, card);
|
||||
hdsp_cards[cards] = new HDSPMixerCard(HDSP_AES, card, shortname);
|
||||
cards++;
|
||||
} else if (!strncmp(name, "RME RayDAT", 10)) {
|
||||
printf("RME RayDAT found!\n");
|
||||
hdsp_cards[cards] = new HDSPMixerCard(HDSPeRayDAT, card);
|
||||
hdsp_cards[cards] = new HDSPMixerCard(HDSPeRayDAT, card, shortname);
|
||||
cards++;
|
||||
} else if (!strncmp(name, "RME AIO", 7)) {
|
||||
printf("RME AIO found!\n");
|
||||
hdsp_cards[cards] = new HDSPMixerCard(HDSPeAIO, card);
|
||||
hdsp_cards[cards] = new HDSPMixerCard(HDSPeAIO, card, shortname);
|
||||
cards++;
|
||||
} else if (!strncmp(name, "RME Hammerfall DSP", 18)) {
|
||||
printf("Uninitialized HDSP card found.\nUse hdsploader to upload configuration data to the card.\n");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue