[alsa-devel] hdspmixer broken for 96khz

Adrian Knoth adi at drcomp.erfurt.thur.de
Mon Apr 4 12:01:32 CEST 2011


On Mon, Apr 04, 2011 at 10:05:58AM +0200, Tim Blechmann wrote:

> > Any chance to recover the old broken configuration?
> > Then we can track down the bug.
> attached

This isn't the old configuration, it's the new one. (it has my new magic
code "HDSPMixer v1" right at the beginning)

The foremost question is: when did you wrote your old configuration
file?

What I tried so far: checked out tag 1.0.24, created a conf file, then
checked out HEAD. As expected, hdspmixer correctly loads the file,
switching samplerates works.

Since I only have a RayDAT at hand right now, I cannot test with
anything older than 1.0.24 (to be precise, older than commit
e24e56795ea57e3dd7da45063ab71f04e231192d)

But what I can say for sure is: if you used hdspmixer before 1.0.24 on a
non-MADI card like Multiface/Digiface, loading this preset file in
1.0.24 would break the configuration. Is this what we're talking about?

Reason: defines.h contains HDSP_MAX_CHANNELS, it was 26 until adding
support for MADI cards, bumping this value to 64. And now let's have a
look at the preset load/restore code:

    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) {
		    /* inputs pans and volumes */
		    if (fread((void
*)&(inputs->strips[channel]->data[card][speed][preset]->pan_pos[0]),
sizeof(int), 14, file) != 14) {
			goto load_error;
		    }
		    if (fread((void
*)&(inputs->strips[channel]->data[card][speed][preset]->fader_pos[0]),
sizeof(int), 14, file) != 14) {
			goto load_error;
		    }

As I said earlier, the ondisk format is a pure 1:1 memory dump without
any meta information, just an array of integers.

Now that HDSP_MAX_CHANNELS has changed, the size of the final memory
dump differs and different values end up in different places.

The only possible way to circumvent this is to check the file size.
3*3*8*26*some_constant is different than 3*3*8*64*some_constant, and we
would be able to guess if it's a pre-1.0.24 preset file or a newer one.


Cheers

-- 
mail: adi at thur.de  	http://adi.thur.de	PGP/GPG: key via keyserver


More information about the Alsa-devel mailing list