hdspmixer: Handle channel count in old (v1.0.23) preset file format

When reading a preset file, v1.0.23 only used 26 channels instead of 64.
Reading 64 channels from a 26 channel file won't work, hence set it
depending on the file format version.

Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
Adrian Knoth 2011-04-08 19:58:36 +02:00 committed by Takashi Iwai
parent 25bd81562a
commit 7c6912449a

View file

@ -488,6 +488,7 @@ void HDSPMixerWindow::load()
char buffer[sizeof(header)];
bool ondisk_v1 = false;
int pan_array_size = 14; /* old (pre 1.0.24) HDSP_MAX_DEST */
int channels_per_card = 26; /* old (pre 1.0.24) HDSP_MAX_CHANNELS */
if (fread(&buffer, sizeof(char), sizeof(buffer), file) != sizeof(buffer)) {
goto load_error;
@ -496,6 +497,7 @@ void HDSPMixerWindow::load()
/* new ondisk format found */
ondisk_v1 = true;
pan_array_size = HDSP_MAX_DEST;
channels_per_card = HDSP_MAX_CHANNELS;
} else {
/* old format, rewind to the start and simply read all data */
rewind(file);
@ -504,7 +506,7 @@ void HDSPMixerWindow::load()
for (int speed = 0; speed < 3; ++speed) {
for (int card = 0; card < MAX_CARDS; ++card) {
for (int preset = 0; preset < 8; ++preset) {
for (int channel = 0; channel < HDSP_MAX_CHANNELS; ++channel) {
for (int channel = 0; channel < channels_per_card; ++channel) {
/* inputs pans and volumes */
if (fread((void *)&(inputs->strips[channel]->data[card][speed][preset]->pan_pos[0]), sizeof(int), pan_array_size, file) != pan_array_size) {
goto load_error;