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)
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++);
}
}
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;
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];
corrupt++;
if (corrupt) {
- if (!dirty) {
- dirty = 1;
- snprintf(window_title, FL_PATH_MAX, "HDSPMixer - %s *", fl_filename_name(file_name));
- label(window_title);
- Fl::add_timeout(0.3, dirty_cb, (void *)this);
- }
+ if (!dirty) {
+ dirty = 1;
+ 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);
- dirty = 0;
+ setTitleWithFilename();
+ dirty = 0;
}
}
{
HDSPMixerWindow *window;
HDSPMixerCard *hdsp_cards[3];
- char *name;
+ char *name, *shortname;
int card;
int cards = 0;
}
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");