io-audio bug

Hi !

New problem, possibly chain bug in io-audio and photon mixer. I’ve mic mute
control, for it I’m using the sw1 element with 1 channel for operate.
Creation of sw1 element looks like:

cmpci->mic_mute=ado_mixer_element_sw1(mixer, “Mic Mute”, 1,
snd_cmipci_mic_mute, cmpci, NULL);

Callback function looks like:

static int32_t snd_cmipci_mic_mute(MIXER_CONTEXT_T* context,
ado_mixer_delement_t* element,
uint8_t w_flag,
uint32_t* bitmap,
void* instance);

Problem 1: When the first call of mic mute callback is occurred, (*bitmap)
contains a trash 0x2DF…UL. Is that normal ?
Problem 2: I’m setted in first call bit 0 to 1, when the second call of mic
mute callback is occured, (*bitmap) contains 0x00000003UL, Why I’m using
only 1 channel ? May be in swX callbacks I’m need to manually reset the
bitmap, but in audio DDK docs no words about that ! BTW: ALSA architecture
does not needed to reset bitmap manually.
Problem 3: In connetion with problem 2 photon mixer doesn’t show correctly
mic mute status, when mute is on, mixer shows off, but when I move the
volume slider, mic mute check box suddenly appears is on. What that ?

Thanks !

Hi Mike,

I am checking with the audio developer about this and I will see what
I can find out.

Regards,

Erick.


Mike Gorchak <mike@malva.com.ua> wrote:

Hi !

New problem, possibly chain bug in io-audio and photon mixer. I’ve mic mute
control, for it I’m using the sw1 element with 1 channel for operate.
Creation of sw1 element looks like:

cmpci->mic_mute=ado_mixer_element_sw1(mixer, “Mic Mute”, 1,
snd_cmipci_mic_mute, cmpci, NULL);

Callback function looks like:

static int32_t snd_cmipci_mic_mute(MIXER_CONTEXT_T* context,
ado_mixer_delement_t* element,
uint8_t w_flag,
uint32_t* bitmap,
void* instance);

Problem 1: When the first call of mic mute callback is occurred, (*bitmap)
contains a trash 0x2DF…UL. Is that normal ?
Problem 2: I’m setted in first call bit 0 to 1, when the second call of mic
mute callback is occured, (*bitmap) contains 0x00000003UL, Why I’m using
only 1 channel ? May be in swX callbacks I’m need to manually reset the
bitmap, but in audio DDK docs no words about that ! BTW: ALSA architecture
does not needed to reset bitmap manually.
Problem 3: In connetion with problem 2 photon mixer doesn’t show correctly
mic mute status, when mute is on, mixer shows off, but when I move the
volume slider, mic mute check box suddenly appears is on. What that ?

Thanks !

Hi Mike,


Hardware Support Account <hw@qnx.com> wrote:

Hi Mike,

I am checking with the audio developer about this and I will see what
I can find out.

Regards,

Erick.



Mike Gorchak <> mike@malva.com.ua> > wrote:
Hi !

New problem, possibly chain bug in io-audio and photon mixer. I’ve mic mute
control, for it I’m using the sw1 element with 1 channel for operate.
Creation of sw1 element looks like:

cmpci->mic_mute=ado_mixer_element_sw1(mixer, “Mic Mute”, 1,
snd_cmipci_mic_mute, cmpci, NULL);

Callback function looks like:

static int32_t snd_cmipci_mic_mute(MIXER_CONTEXT_T* context,
ado_mixer_delement_t* element,
uint8_t w_flag,
uint32_t* bitmap,
void* instance);

Problem 1: When the first call of mic mute callback is occurred, (*bitmap)
contains a trash 0x2DF…UL. Is that normal ?

Check the w_flag in this case I’ll bet it’s 0 meaning
the upper layer wants to read the state of the switch, the
bitmap is full of whatever was on the stack just set bitmap
to the correct value 0|1 and return.



Problem 2: I’m setted in first call bit 0 to 1, when the second call of mic
mute callback is occured, (*bitmap) contains 0x00000003UL, Why I’m using
only 1 channel ? May be in swX callbacks I’m need to manually reset the
bitmap, but in audio DDK docs no words about that ! BTW: ALSA architecture
does not needed to reset bitmap manually.

Is the playback group that contains this sw1 element a
stereo (2 channel) group? If so the photon mixer sets the
mute bit on both channels and this is sent to the element,
but just look at bit 0 since it’s a 1 switch element and
behave accordingly. Just ignore bit 1 as the element does
have a switch for that anyway.


Problem 3: In connetion with problem 2 photon mixer doesn’t show correctly
mic mute status, when mute is on, mixer shows off, but when I move the
volume slider, mic mute check box suddenly appears is on. What that ?

After you fix the above two issue this one should disapear as well.

Regards…


Thanks !

Problem 1: When the first call of mic mute callback is occurred,
(*bitmap)
contains a trash 0x2DF…UL. Is that normal ?
Check the w_flag in this case I’ll bet it’s 0 meaning
the upper layer wants to read the state of the switch, the
bitmap is full of whatever was on the stack just set bitmap
to the correct value 0|1 and return.

But why ? Is so hard to clean variables on stack ? It is not a good policy.
Example, when trash passed as bitmap (I’m using mono channel) I’m setted up
the only bit 0 to ‘one’, but bit 1 and other bits still contain trash.

Problem 2: I’m setted in first call bit 0 to 1, when the second call of
mic
mute callback is occured, (*bitmap) contains 0x00000003UL, Why I’m
using
only 1 channel ? May be in swX callbacks I’m need to manually reset the
bitmap, but in audio DDK docs no words about that ! BTW: ALSA
architecture
does not needed to reset bitmap manually.
Is the playback group that contains this sw1 element a
stereo (2 channel) group? If so the photon mixer sets the
mute bit on both channels and this is sent to the element,
but just look at bit 0 since it’s a 1 switch element and
behave accordingly. Just ignore bit 1 as the element does
have a switch for that anyway.

No it has one channel (mono), see example in my first letter, ignoring bit 1
we have photon mixer bug, when I add clearing code of unused bits, bug in
photon mixer is out. But it is not normal !

Problem 3: In connetion with problem 2 photon mixer doesn’t show
correctly
mic mute status, when mute is on, mixer shows off, but when I move the
volume slider, mic mute check box suddenly appears is on. What that ?
After you fix the above two issue this one should disapear as well.

Looks like io-audio and photon mixer doesn’t correctly handle mono channels.
I’m may imagine code of photon mixer, it has code like this:

if (bitmap & BLAH_SWITCH_MASK)
{
// switch is set
}
else
{
// switch is not set
}

So if we have trash in bit 1 and mask always uses stereo channel we have
this bug, it is my supposition only. I’m repeat myself looks like a bug with
handling mono channels.