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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
HDSPMixerCard::HDSPMixerCard(int cardtype, int id)
|
HDSPMixerCard::HDSPMixerCard(int cardtype, int id, char *shortname)
|
||||||
{
|
{
|
||||||
type = cardtype;
|
type = cardtype;
|
||||||
card_id = id;
|
card_id = id;
|
||||||
snprintf(name, 6, "hw:%i", card_id);
|
snprintf(name, 6, "hw:%i", card_id);
|
||||||
|
cardname = shortname;
|
||||||
h9632_aeb.aebi = 0;
|
h9632_aeb.aebi = 0;
|
||||||
h9632_aeb.aebo = 0;
|
h9632_aeb.aebo = 0;
|
||||||
if (type == H9632) {
|
if (type == H9632) {
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <string>
|
||||||
#include <alsa/asoundlib.h>
|
#include <alsa/asoundlib.h>
|
||||||
#include <alsa/sound/hdsp.h>
|
#include <alsa/sound/hdsp.h>
|
||||||
#include <alsa/sound/hdspm.h>
|
#include <alsa/sound/hdspm.h>
|
||||||
|
|
@ -42,7 +43,8 @@ private:
|
||||||
public:
|
public:
|
||||||
HDSPMixerWindow *basew;
|
HDSPMixerWindow *basew;
|
||||||
char name[6];
|
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_input, channels_playback, window_width, window_height, card_id;
|
||||||
int channels_output;
|
int channels_output;
|
||||||
int type;
|
int type;
|
||||||
|
|
|
||||||
|
|
@ -50,6 +50,7 @@ void HDSPMixerCardSelector::ActivateCard (int i)
|
||||||
card = i + 1;
|
card = i + 1;
|
||||||
basew->current_card = i;
|
basew->current_card = i;
|
||||||
basew->cards[i]->setMode (basew->cards[i]->getSpeed ());
|
basew->cards[i]->setMode (basew->cards[i]->getSpeed ());
|
||||||
|
basew->setTitleWithFilename();
|
||||||
redraw ();
|
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;
|
if (!(w->file_name = fl_file_chooser("Choose a file to save presets to :", "HDSPMixer preset file (*.mix)", NULL, 0))) return;
|
||||||
}
|
}
|
||||||
w->save();
|
w->save();
|
||||||
snprintf(w->window_title, FL_PATH_MAX, "HDSPMixer - %s", fl_filename_name(w->file_name));
|
w->setTitleWithFilename();
|
||||||
w->label(w->window_title);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void make_default_cb(Fl_Widget *widget, void *arg)
|
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->deleteEntry("default_file");
|
||||||
w->prefs->flush();
|
w->prefs->flush();
|
||||||
w->file_name = NULL;
|
w->file_name = NULL;
|
||||||
snprintf(w->window_title, FL_PATH_MAX, "HDSPMixer");
|
w->setTitleWithFilename();
|
||||||
w->label(w->window_title);
|
|
||||||
w->resetMixer();
|
w->resetMixer();
|
||||||
while (i < MAX_CARDS && w->cards[i] != NULL) {
|
while (i < MAX_CARDS && w->cards[i] != NULL) {
|
||||||
w->restoreDefaults(i++);
|
w->restoreDefaults(i++);
|
||||||
|
|
@ -516,8 +514,7 @@ void HDSPMixerWindow::load()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fclose(file);
|
fclose(file);
|
||||||
snprintf(window_title, FL_PATH_MAX, "HDSPMixer - %s", fl_filename_name(file_name));
|
setTitleWithFilename();
|
||||||
label(window_title);
|
|
||||||
resetMixer();
|
resetMixer();
|
||||||
inputs->buttons->presets->preset_change(1);
|
inputs->buttons->presets->preset_change(1);
|
||||||
return;
|
return;
|
||||||
|
|
@ -527,6 +524,29 @@ load_error:
|
||||||
return;
|
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)
|
void HDSPMixerWindow::restoreDefaults(int card)
|
||||||
{
|
{
|
||||||
int chnls[3];
|
int chnls[3];
|
||||||
|
|
@ -883,16 +903,14 @@ void HDSPMixerWindow::checkState()
|
||||||
corrupt++;
|
corrupt++;
|
||||||
|
|
||||||
if (corrupt) {
|
if (corrupt) {
|
||||||
if (!dirty) {
|
if (!dirty) {
|
||||||
dirty = 1;
|
dirty = 1;
|
||||||
snprintf(window_title, FL_PATH_MAX, "HDSPMixer - %s *", fl_filename_name(file_name));
|
setTitleWithFilename();
|
||||||
label(window_title);
|
Fl::add_timeout(0.3, dirty_cb, (void *)this);
|
||||||
Fl::add_timeout(0.3, dirty_cb, (void *)this);
|
}
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
snprintf(window_title, FL_PATH_MAX, "HDSPMixer - %s", fl_filename_name(file_name));
|
setTitleWithFilename();
|
||||||
label(window_title);
|
dirty = 0;
|
||||||
dirty = 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -93,6 +93,8 @@ public:
|
||||||
void refreshMixerStrip(int idx, int src);
|
void refreshMixerStrip(int idx, int src);
|
||||||
void save();
|
void save();
|
||||||
void load();
|
void load();
|
||||||
|
void setTitle(std::string suffix);
|
||||||
|
void setTitleWithFilename();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
HDSPMixerWindow *window;
|
HDSPMixerWindow *window;
|
||||||
HDSPMixerCard *hdsp_cards[3];
|
HDSPMixerCard *hdsp_cards[3];
|
||||||
char *name;
|
char *name, *shortname;
|
||||||
int card;
|
int card;
|
||||||
int cards = 0;
|
int cards = 0;
|
||||||
|
|
||||||
|
|
@ -55,42 +55,43 @@ int main(int argc, char **argv)
|
||||||
}
|
}
|
||||||
|
|
||||||
snd_card_get_longname(card, &name);
|
snd_card_get_longname(card, &name);
|
||||||
|
snd_card_get_name(card, &shortname);
|
||||||
printf("Card %d: %s\n", card, name);
|
printf("Card %d: %s\n", card, name);
|
||||||
if (!strncmp(name, "RME Hammerfall DSP + Multiface", 30)) {
|
if (!strncmp(name, "RME Hammerfall DSP + Multiface", 30)) {
|
||||||
printf("Multiface found!\n");
|
printf("Multiface found!\n");
|
||||||
hdsp_cards[cards] = new HDSPMixerCard(Multiface, card);
|
hdsp_cards[cards] = new HDSPMixerCard(Multiface, card, shortname);
|
||||||
cards++;
|
cards++;
|
||||||
} else if (!strncmp(name, "RME Hammerfall DSP + Digiface", 29)) {
|
} else if (!strncmp(name, "RME Hammerfall DSP + Digiface", 29)) {
|
||||||
printf("Digiface found!\n");
|
printf("Digiface found!\n");
|
||||||
hdsp_cards[cards] = new HDSPMixerCard(Digiface, card);
|
hdsp_cards[cards] = new HDSPMixerCard(Digiface, card, shortname);
|
||||||
cards++;
|
cards++;
|
||||||
} else if (!strncmp(name, "RME Hammerfall HDSP 9652", 24)) {
|
} else if (!strncmp(name, "RME Hammerfall HDSP 9652", 24)) {
|
||||||
printf("HDSP 9652 found!\n");
|
printf("HDSP 9652 found!\n");
|
||||||
hdsp_cards[cards] = new HDSPMixerCard(H9652, card);
|
hdsp_cards[cards] = new HDSPMixerCard(H9652, card, shortname);
|
||||||
cards++;
|
cards++;
|
||||||
} else if (!strncmp(name, "RME Hammerfall HDSP 9632", 24)) {
|
} else if (!strncmp(name, "RME Hammerfall HDSP 9632", 24)) {
|
||||||
printf("HDSP 9632 found!\n");
|
printf("HDSP 9632 found!\n");
|
||||||
hdsp_cards[cards] = new HDSPMixerCard(H9632, card);
|
hdsp_cards[cards] = new HDSPMixerCard(H9632, card, shortname);
|
||||||
cards++;
|
cards++;
|
||||||
} else if (!strncmp(name, "RME MADIface", 12)) {
|
} else if (!strncmp(name, "RME MADIface", 12)) {
|
||||||
printf("RME MADIface found!\n");
|
printf("RME MADIface found!\n");
|
||||||
hdsp_cards[cards] = new HDSPMixerCard(HDSPeMADI, card);
|
hdsp_cards[cards] = new HDSPMixerCard(HDSPeMADI, card, shortname);
|
||||||
cards++;
|
cards++;
|
||||||
} else if (!strncmp(name, "RME MADI", 8)) {
|
} else if (!strncmp(name, "RME MADI", 8)) {
|
||||||
printf("RME MADI found!\n");
|
printf("RME MADI found!\n");
|
||||||
hdsp_cards[cards] = new HDSPMixerCard(HDSPeMADI, card);
|
hdsp_cards[cards] = new HDSPMixerCard(HDSPeMADI, card, shortname);
|
||||||
cards++;
|
cards++;
|
||||||
} else if (!strncmp(name, "RME AES32", 8)) {
|
} else if (!strncmp(name, "RME AES32", 8)) {
|
||||||
printf("RME AES32 or HDSPe AES found!\n");
|
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++;
|
cards++;
|
||||||
} else if (!strncmp(name, "RME RayDAT", 10)) {
|
} else if (!strncmp(name, "RME RayDAT", 10)) {
|
||||||
printf("RME RayDAT found!\n");
|
printf("RME RayDAT found!\n");
|
||||||
hdsp_cards[cards] = new HDSPMixerCard(HDSPeRayDAT, card);
|
hdsp_cards[cards] = new HDSPMixerCard(HDSPeRayDAT, card, shortname);
|
||||||
cards++;
|
cards++;
|
||||||
} else if (!strncmp(name, "RME AIO", 7)) {
|
} else if (!strncmp(name, "RME AIO", 7)) {
|
||||||
printf("RME AIO found!\n");
|
printf("RME AIO found!\n");
|
||||||
hdsp_cards[cards] = new HDSPMixerCard(HDSPeAIO, card);
|
hdsp_cards[cards] = new HDSPMixerCard(HDSPeAIO, card, shortname);
|
||||||
cards++;
|
cards++;
|
||||||
} else if (!strncmp(name, "RME Hammerfall DSP", 18)) {
|
} else if (!strncmp(name, "RME Hammerfall DSP", 18)) {
|
||||||
printf("Uninitialized HDSP card found.\nUse hdsploader to upload configuration data to the card.\n");
|
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