mirror of
https://github.com/alsa-project/alsa-tools.git
synced 2025-10-29 05:40:25 -04:00
hdspmixer: Handle preset files used in 1.0.24 and 1.0.24.1
As an addition to the previous commit, let's also cover the 3rd case when a preset file was written with hdspmixer v1.0.24 or v1.0.24.1. In this case, no magic header will be present, but the file size would differ from the pre 1.0.24 format. Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
7c6912449a
commit
cb40769c93
1 changed files with 18 additions and 1 deletions
|
|
@ -499,7 +499,24 @@ void HDSPMixerWindow::load()
|
|||
pan_array_size = HDSP_MAX_DEST;
|
||||
channels_per_card = HDSP_MAX_CHANNELS;
|
||||
} else {
|
||||
/* old format, rewind to the start and simply read all data */
|
||||
/* There are two different kinds of old format: pre 1.0.24 and
|
||||
* the one used for 1.0.24/1.0.24.1. We can distinguish between
|
||||
* these two by checking the file size, becase HDSP_MAX_CHANNELS
|
||||
* was bumped right before the 1.0.24 release.
|
||||
*/
|
||||
fseek (file, 0, SEEK_END);
|
||||
long filesize = ftell (file);
|
||||
|
||||
if (1163808 == filesize) {
|
||||
/* file written by hdspmixer v1.0.24 or v1.0.24.1 with
|
||||
* HDSP_MAX_CHANNELS set to 64, but pan_array_size still at
|
||||
* 14, so setting channels_per_card should get the correct
|
||||
* mapping.
|
||||
*/
|
||||
channels_per_card = 64; /* HDSP_MAX_CHANNELS */
|
||||
}
|
||||
|
||||
/* rewind to the start and simply read all data */
|
||||
rewind(file);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue