mirror of
https://github.com/alsa-project/alsa-tools.git
synced 2026-03-03 01:40:12 -05:00
Thomas Charbonnel <thomas@undata.org>:
- fix some problems with default presets file handling.
This commit is contained in:
parent
ffddfbf748
commit
8cf8f953a2
2 changed files with 22 additions and 2 deletions
|
|
@ -397,7 +397,13 @@ void HDSPMixerWindow::load()
|
||||||
{
|
{
|
||||||
FILE *file;
|
FILE *file;
|
||||||
if ((file = fopen(file_name, "r")) == NULL) {
|
if ((file = fopen(file_name, "r")) == NULL) {
|
||||||
|
int i = 0;
|
||||||
fl_alert("Error opening file %s for reading", file_name);
|
fl_alert("Error opening file %s for reading", file_name);
|
||||||
|
while (cards[i] != NULL) {
|
||||||
|
restoreDefaults(i++);
|
||||||
|
}
|
||||||
|
inputs->buttons->presets->preset_change(1);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
for (int speed = 0; speed < 3; ++speed) {
|
for (int speed = 0; speed < 3; ++speed) {
|
||||||
for (int card = 0; card < 3; ++card) {
|
for (int card = 0; card < 3; ++card) {
|
||||||
|
|
@ -533,6 +539,7 @@ void HDSPMixerWindow::restoreDefaults(int card)
|
||||||
h9632_an12_submix[2] = 1;
|
h9632_an12_submix[2] = 1;
|
||||||
num_modes = 3;
|
num_modes = 3;
|
||||||
phones = 0;
|
phones = 0;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
/* should never happen */
|
/* should never happen */
|
||||||
return;
|
return;
|
||||||
|
|
@ -624,8 +631,18 @@ HDSPMixerWindow::HDSPMixerWindow(int x, int y, int w, int h, const char *label,
|
||||||
cards[2] = hdsp_card3;
|
cards[2] = hdsp_card3;
|
||||||
current_card = current_preset = 0;
|
current_card = current_preset = 0;
|
||||||
prefs = new Fl_Preferences(Fl_Preferences::USER, "thomasATundata.org", "HDSPMixer");
|
prefs = new Fl_Preferences(Fl_Preferences::USER, "thomasATundata.org", "HDSPMixer");
|
||||||
if (!prefs->get("default_file", file_name_buffer, NULL, FL_PATH_MAX-1)) file_name = NULL;
|
if (!prefs->get("default_file", file_name_buffer, NULL, FL_PATH_MAX-1)) {
|
||||||
else file_name = file_name_buffer;
|
file_name = NULL;
|
||||||
|
} else {
|
||||||
|
struct stat buf;
|
||||||
|
if (!stat(file_name_buffer, &buf)) {
|
||||||
|
file_name = file_name_buffer;
|
||||||
|
} else {
|
||||||
|
file_name = NULL;
|
||||||
|
prefs->deleteEntry("default_file");
|
||||||
|
prefs->flush();
|
||||||
|
}
|
||||||
|
}
|
||||||
for (int j = 0; j < 3; ++j) {
|
for (int j = 0; j < 3; ++j) {
|
||||||
for (int i = 0; i < 8; ++i) {
|
for (int i = 0; i < 8; ++i) {
|
||||||
data[j][0][i] = new HDSPMixerPresetData();
|
data[j][0][i] = new HDSPMixerPresetData();
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,9 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <unistd.h>
|
||||||
#include <alsa/asoundlib.h>
|
#include <alsa/asoundlib.h>
|
||||||
#include <sound/hdsp.h>
|
#include <sound/hdsp.h>
|
||||||
#include "HDSPMixerCard.h"
|
#include "HDSPMixerCard.h"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue