2009-03-12 12:02:18     Problem changing mixer to line input

Document created by Aaronwu Employee on Aug 14, 2013
Version 1Show Document
  • View in full screen mode

2009-03-12 12:02:18     Problem changing mixer to line input

Alvin Davison (UNITED KINGDOM)

Message: 70873   

 

Hi,

 

  I'm currently developing an application on the Blackfin537 using the ad1981b driver that requires audio to come in via the line input and not the microphone.  The mixer for the embedded linux 2.6 currently defaults to microphone.  I have a routine that opens the mixer, reads in the current recording source, changes that value to the line input, and as confirmation reads in that value again.

 

void InitMixer(void)

{

int recsrc;

 

/* Try to open mixer device */

MixerHandle = open(MIXERDEVICE, O_RDWR, 0)

 

/* Read in current source */

ioctl(MixerHandle, SOUND_MIXER_READ_RECSRC, &recsrc);

printf("Current mixer %d\n", recsrc);

 

/* Change source to line input */

recsrc = SOUND_MASK_LINE;

ioctl(MixerHandle, SOUND_MIXER_WRITE_RECSRC, &recsrc)

printf("New mixer %d\n", recsrc);

 

/* Check new source */

ioctl(MixerHandle, SOUND_MIXER_READ_RECSRC, &recsrc);

printf("Mixer check %d\n", recsrc);

 

/* Close mixer */

close(MixerHandle);

}

 

When I run the application I see as output:

 

Current mixer 128

 

New mixer 64

 

Mixer check 128

 

As you can see, for some reason, the mixer is not setting itself to line input.  Does anyone know what I am doing wrong?

 

 

 

Thanks,

 

 

 

Alvin

QuoteReplyEditDelete

 

 

2009-03-13 02:44:36     Re: Problem changing mixer to line input

Mike Frysinger (UNITED STATES)

Message: 70919   

 

are you using OSS or ALSA ?

QuoteReplyEditDelete

 

 

2009-03-13 03:00:18     Re: Problem changing mixer to line input

Pavel Frolov (BELARUS)

Message: 70923    What does the runing mixer without parameters say? It seems, value(64) you are writing to /dev/mixer is correct. May be linein not allowed as input device.

QuoteReplyEditDelete

 

 

2009-03-13 04:09:39     Re: Problem changing mixer to line input

Cliff Cai (CHINA)

Message: 70929   

 

Try or'ed the former recsrc with new MASK .

 

recsrc |=  SOUND_MASK_LINE;

 

and run you application again,it's the mixer's way,see user/vplay/mixer.c

 

and works for me.

 

 

 

Cliff

 

 

QuoteReplyEditDelete

 

 

2009-03-13 07:44:40     Re: Problem changing mixer to line input

Alvin Davison (UNITED KINGDOM)

Message: 70950   

 

Hi,

 

  The sound driver I'm currently using is snd-ad1981b.ko.  When installed, it reports "AD1981B AC97 OSS driver succesfully loaded".

 

I've checked and the mixer does support line input (or at least it reports that it doesn't when queried). 

 

I've tried your suggestion Cliff, but it still makes no difference. 

 

However, I have made a discovery when browsing the source code for the device driver: even though I'm still relatively new to C, it looks like the fault may be in the SOUND_MIXER_READ_RECSRC routine.  To me, it looks like it will always report back the input is microphone irrespective of which input is currently selected

 

If it is indeed a fault with the driver, is there an updated driver I can get specific to the Blackfin537. I must admit that I'm still out of my depth when it comes to making changes to this driver myself.

 

With this in mind, I'm going to continue development of my application and hope that the fault is in SOUND_MIXER_READ_RECSRC and not SOUND_MIXER_WRITE_RECSRC.

 

Thanks for your suggestions. Its been appreciated.

 

 

 

Alvin

 

 

QuoteReplyEditDelete

 

 

2009-03-15 23:25:21     Re: Problem changing mixer to line input

Sonic Zhang (CHINA)

Message: 71003   

 

Which release of uClinux-dist do you use?

 

 

QuoteReplyEditDelete

 

 

2009-03-16 04:15:45     Re: Problem changing mixer to line input

Alvin Davison (UNITED KINGDOM)

Message: 71006   

 

I'm using the distribution that was released with the SSV DNP5370 starter kit.  It is uClinux-dist-R06R2-R2.

 

I know that there is a later release, but after being in contact with SSV, they recommended that I use the release version they supplied me.

 

 

 

Alvin

QuoteReplyEditDelete

 

 

2009-03-16 04:15:47     Re: Problem changing mixer to line input

Cliff Cai (CHINA)

Message: 71007   

 

Alvin,

 

It seems a problem of oss emulation in alsa.I've tried to set capture source to line using amixer(user/blkfin-apps/alsa-utils/amixer):

 

amixer -c 0 sset Line, 0 100%,100% unmute cap

 

and "vrec|vplay" runs just fine.

 

 

 

Cliff

QuoteReplyEditDelete

 

 

2009-03-16 04:22:12     Re: Problem changing mixer to line input

Sonic Zhang (CHINA)

Message: 71019   

 

This old release is never supported on this forum. Either upgrade your release, or ask SSV for help.

Attachments

    Outcomes