Alsa Mixer api documentation.
Hello,
I am trying to find a clear example, tutorial or guide to the
alsa mixer api. The documentation generated in the doxygen subdirectory of the doc subdirectory of the alsa-lib package is not very clear. The index page of the library api documentation does contain a link to some mixer info:
API Links
........
Page Mixer interface explains the mixer controls API.
........But that link contains:
Mixer interface
Mixer interface is designed to access the abstracted
mixer controls. This is an abstraction layer over the
hcontrol layer.
General overview
And that's it, there is nothing under the heading General Overview. I have found some of the method prototypes are documented but they are a bit ambiguous in regards to the actual functions they perform. (snd_mixer_first_elem) Michal Kochanowicz previously sent an email about this with subject
'Mixer programming - is there any documentation available?' So...is there? If anyone can even give me a simple "open mixer, set pcm to 50%, close mixer" example that'd be great.
Thanks for any and all help,
Cathal
-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies from IBM. Find simple to follow Roadmaps, straightforward articles, informative Webcasts and more! Get everything you need to get up to speed, fast. http://ads.osdn.com/?ad_idt77&alloc_id492&op=click
Quoted 2 lines · Chuckles
So...is there? If anyone can even give me a simple "open mixer, set pcm to 50%, close mixer" example that'd be great.
Why don't you look at the source to xmms or mplayer?
Lee
-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies from IBM. Find simple to follow Roadmaps, straightforward articles, informative Webcasts and more! Get everything you need to get up to speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
So that's a no then. I had been looking at the source for amixer.c but what can I tell ya? Pouring over 1500 lines of uncommented, (mostly) static methods written in C is hardly the best way to learn an api now is it? (Do linux developers hate c++/oo programming or do they just willfully ignore it?) Apart from the opening few lines about the gnu gpl there are 3 (count 'em) 3, one line comments in a source file of over 1500 lines. But if the alsa developers can't be bothered to write the docs I suppose I don't have much choice.
Cathal
Quoted 9 lines · Lee Revell
Quoted 2 lines · Chuckles
So...is there? If anyone can even give me a simple "open mixer, set pcm to 50%, close mixer" example that'd be great.
Why don't you look at the source to xmms or mplayer?
Lee
-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies from IBM. Find simple to follow Roadmaps, straightforward articles, informative Webcasts and more! Get everything you need to get up to speed, fast. http://ads.osdn.com/?ad_idt77&alloc_id492&op=click
Quoted 8 lines · Chuckles
So that's a no then. I had been looking at the source for
amixer.cbut what can I tell ya? Pouring over 1500 lines of uncommented, (mostly) static methods written in C is hardly the best way to learn an api now is it? (Do linux developers hate c++/oo programming or do they just willfully ignore it?) Apart from the opening few lines about the gnu gpl there are 3 (count 'em) 3, one line comments in a source file of over 1500 lines. But if the alsa developers can't be bothered to write the docs I suppose I don't have much choice.
The amixer code cannot be easier, but I agree that C++ programmer will have trouble with it, because functions contains more than 10 lines ;-)
Write some docs in doxygen, we'll include it to our repository.
Jaroslav
-----
Jaroslav Kysela <[email protected]>
Linux Kernel Sound Maintainer
ALSA Project, SUSE Labs
-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies from IBM. Find simple to follow Roadmaps, straightforward articles, informative Webcasts and more! Get everything you need to get up to speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
Re: Alsa Mixer api documentation. (Damn u C programmers!)
Quoted 2 lines
The amixer code cannot be easier, but I agree that C++ programmer will have trouble with it, because functions contains more than 10 lines ;-)
I can see my eternal damnation now, an eternity sorting through uncommented C programs in hell's ironic punishment department. :op
Quoted 3 lines
Write some docs in doxygen, we'll include it to our repository.
Jaroslav
No probs. I'd be more than willing to write some docs for the mixer api, if I could work out how to use it. So can you answer some questions about it? I'm confused as to why its necessary to use elements, simple elements and a high level control interface to set sound levels on the mixer. I have done some mixer programming with OSS, but this is very different. I see the snd_mixer_open function opens an empty mixer, fine, does this imply that a software mixer has to be built from the ground up? As in you add a pcm element, a master element, a cd element depending on what is available on your particular sound card to this empty mixer?
Cathal
-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies from IBM. Find simple to follow Roadmaps, straightforward articles, informative Webcasts and more! Get everything you need to get up to speed, fast. http://ads.osdn.com/?ad_idt77&alloc_id492&op=click
Re: Alsa Mixer api documentation. (Damn u C programmers!)
Quoted 9 lines · Chuckles
Quoted 3 lines
Write some docs in doxygen, we'll include it to our repository.
Jaroslav
No probs. I'd be more than willing to write some docs for the mixer api, if I could work out how to use it. So can you answer some questions about it? I'm confused as to why its necessary to use elements, simple elements and a high level control interface to set sound levels on the mixer.
Please, choose only one method. You can access directly the universal control elements (direct mapping to driver) or use more simple interface (snd_mixer_selem* function / defines).
Quoted 5 lines
I have done some mixer programming with OSS, but this is very different. I see the
snd_mixer_openfunction opens an empty mixer, fine, does this imply that a software mixer has to be built from the ground up? As in you add a pcm element, a master element, a cd element depending on what is available on your particular sound card to this empty mixer?
The alsa-lib does all this work. You need only enumerate (see selems() function in amixer.c) and write/read values (see sset() function in amixer.c) from such elements. Also note that all elements might be dynamic (removed / added on the fly).
Basically, you need only to create a connection between driver (universal control interface) and the more abstract layer in the initialization phase.
Jaroslav
-----
Jaroslav Kysela <[email protected]>
Linux Kernel Sound Maintainer
ALSA Project, SUSE Labs
-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies from IBM. Find simple to follow Roadmaps, straightforward articles, informative Webcasts and more! Get everything you need to get up to speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click