Skip to contentSkip to conversation

trigger commands

DISCUSSION Giuliano Pochini 4 participants 11 messages Mar 23, 2003 – Mar 26, 2003

lore
Share & tools
lore
#0 lore raw

What are PUSH, RELEASE, SUSPEND, RESUME trigger commands supposed to do ?

Bye.

-------------------------------------------------------
This SF.net email is sponsored by:Crypto Challenge is now open! Get cracking and register here for some mind boggling fun and the chance of winning an Apple iPod:
http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0031en

#1 lore raw

At 23 Mar 2003 18:31:04 +0000,

Quoted 3 lines · Giuliano Pochini

What are PUSH, RELEASE, SUSPEND, RESUME trigger commands supposed to do ?

* pcm stream pausing
imagine the pause-button is pushed and released.
these commands are issued only when SNDRV_PCM_INFO_PAUSE is set to info field of snd_pcm_hardware_t.

- PAUSE_PUSH
pause the stream
- PAUSE_RELEASE
restart the paused stream

* power-management
called when the power-management status is changed. these commands are issued only when SNDRV_PCM_INFO_RESUME is set to info field of snd_pcm_hardware_t (and of course pm is supported).

- SUSPEND
suspend the streams; usually identical with STOP command
- RESUME
resume the streams; usually identical with START command

Takashi

-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf

#2 lore raw
Quoted 9 lines
Quoted 3 lines

What are PUSH, RELEASE, SUSPEND, RESUME trigger commands supposed to do ?

* pcm stream pausing
imagine the pause-button is pushed and released.
these commands are issued only when SNDRV_PCM_INFO_PAUSE is set to info field of snd_pcm_hardware_t.

Quoted 4 lines

- PAUSE_PUSH
pause the stream
- PAUSE_RELEASE
restart the paused stream

Ok, PAUSE_PUSH-->stop() and TRIGGER_STOP-->stop()-and-reset dma pointer. In my case RELEASE and START are the same thing.

Quoted 9 lines

* power-management
called when the power-management status is changed. these commands are issued only when SNDRV_PCM_INFO_RESUME is set to info field of snd_pcm_hardware_t (and of course pm is supported).

- SUSPEND
suspend the streams; usually identical with STOP command
- RESUME
resume the streams; usually identical with START command

Way down on the TODO list :)

Tnx.

-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf

#3 lore raw

At Mon, 24 Mar 2003 11:48:50 +0100 (CET),

Quoted 10 lines · Giuliano Pochini
Quoted 10 lines
Quoted 4 lines

What are PUSH, RELEASE, SUSPEND, RESUME trigger commands supposed to do ?

* pcm stream pausing
imagine the pause-button is pushed and released.
these commands are issued only when SNDRV_PCM_INFO_PAUSE is set to info field of snd_pcm_hardware_t.

Quoted 7 lines
Quoted 4 lines

- PAUSE_PUSH
pause the stream
- PAUSE_RELEASE
restart the paused stream

Ok, PAUSE_PUSH-->stop() and TRIGGER_STOP-->stop()-and-reset dma pointer. In my case RELEASE and START are the same thing.

note that resetting the dma pointer wouldn't be necessary in STOP trigger (although it may be safer), since the dma pointer will be reprogrammed anyway by the succeeding call or prepare callback from the ALSA middle layer.

Takashi

-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf

#4 lore raw
Quoted 7 lines · On 24-Mar-2003 Takashi Iwai wrote:
Quoted 2 lines

Ok, PAUSE_PUSH-->stop() and TRIGGER_STOP-->stop()-and-reset dma pointer. In my case RELEASE and START are the same thing.

note that resetting the dma pointer wouldn't be necessary in STOP trigger (although it may be safer), since the dma pointer will be reprogrammed anyway by the succeeding call or prepare callback from the ALSA middle layer.

I didn't know that prepare callback had to reset the dma pointer. That could explain why sometimes the sound "jerks" when I change track with xmms and stop/start/prepare are called 2-3 times in a very short time.

Bye.

-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf

#5 lore raw

pcm interfaces questions

In reply to Takashi Iwai

snd_pcm_new() has two parameters for the number of substreams for playback and capture. Yes, but what does it mean ? If I have N playback substreams, can I service N applications that use one stream ? Can channels be allocated on demand, to allow the user to use 4 xmms or 1 xmms and a dvd player (5.1) at the same time ? :)) It's quite useless... I'm just curious. Also snd_pcm_new() can create multiple pcm interfaces. SP/DIF and ADAT i/o need a pcm instance too, isn't it ?

Bye.

-------------------------------------------------------
This SF.net email is sponsored by:
The Definitive IT and Networking Event. Be There! NetWorld+Interop Las Vegas 2003 -- Register today!
http://ads.sourceforge.net/cgi-bin/redirect.pl?keyn0001en

#6 lore raw

Re: pcm interfaces questions

Quoted 2 lines

snd_pcm_new() has two parameters for the number of substreams for playback and capture.

its a language problem. its not the number of substreams as in "the quantity of substreams". rather, it means "the ID of the substream".

Quoted 5 lines

Yes, but what does it mean ? If I
have N playback substreams, can I service N applications that use one stream ? Can channels be allocated on demand, to allow the user to use 4 xmms or 1 xmms and a dvd player (5.1) at the same time ? :))

this depends on (1) whether the underlying hardware supports it and
(2) whether you use a "dmix" PCM device rather than a "hw" PCM device. the "hw" PCM device only offers the capabilities of the hardware, nothing more.

-------------------------------------------------------
This SF.net email is sponsored by:
The Definitive IT and Networking Event. Be There! NetWorld+Interop Las Vegas 2003 -- Register today!
http://ads.sourceforge.net/cgi-bin/redirect.pl?keyn0001en

#7 lore raw

Re: pcm interfaces questions

In reply to Giuliano Pochini

At Tue, 25 Mar 2003 18:24:13 +0100 (CET),

Quoted 9 lines · Giuliano Pochini

snd_pcm_new() has two parameters for the number of substreams for playback and capture. Yes, but what does it mean ? If I have N playback substreams, can I service N applications that use one stream ? Can channels be allocated on demand, to allow the user to use 4 xmms or 1 xmms and a dvd player (5.1) at the same time ? :)) It's quite useless... I'm just curious. Also snd_pcm_new() can create multiple pcm interfaces. SP/DIF and ADAT i/o need a pcm instance too, isn't it ?

well, the term "stream" is a bit confusing.

in ALSA, the term "pcm stream" defines the direction of pcm, either playback or capture. hence, there are at most two streams per pcm instance.

the "pcm substreams" belong to each pcm stream. when you open a pcm device, one pcm substream will be used at each time. snd_pcm_new() takes the argument how many pcm substreams are created for each pcm stream. you can give more than one here only if the hardware supports multiple-playback/capture, such as emu10k1. otherwise, these arguments must be 1 or 0.

for the multiple-playback/capture, each created substream is numbered from 0 to (N-1). if you open the pcm without specifying the substream number, the empty substream is searched and assigned to be opened. if you specify the substream number (e.g. "hw:0,0,2"), the specified substream is tried for open (the substream #2 in the example).

again, if the HARDWARE supports the multiple open, you can play 4 xmms simultaneously. if it doesn't, dmix plugin is your friend.

Takashi

-------------------------------------------------------
This SF.net email is sponsored by:
The Definitive IT and Networking Event. Be There! NetWorld+Interop Las Vegas 2003 -- Register today!
http://ads.sourceforge.net/cgi-bin/redirect.pl?keyn0001en

#8 lore raw

Re: pcm interfaces questions

Quoted 6 lines · On 26-Mar-2003 Takashi Iwai wrote:

the "pcm substreams" belong to each pcm stream. when you open a pcm device, one pcm substream will be used at each time. snd_pcm_new() takes the argument how many pcm substreams are created for each pcm stream. you can give more than one here only if the hardware supports multiple-playback/capture, such as emu10k1. otherwise, these arguments must be 1 or 0.

The hw supports it. My cards has 8 analog outputs that can be used indipendently or grouped. From inside hw_params callback I have no way to know which channels the user wants to use. My idea is to tell snd_pcm_new() to create 8 playback substreams. When an app opens substream N, C channels wide, I use substream N, and I make substreams from N+1 to N+C-1 not available.

Bye.

-------------------------------------------------------
This SF.net email is sponsored by:
The Definitive IT and Networking Event. Be There! NetWorld+Interop Las Vegas 2003 -- Register today!
http://ads.sourceforge.net/cgi-bin/redirect.pl?keyn0001en

#9 lore raw

Re: pcm interfaces questions

Quoted 7 lines
Quoted 6 lines

the "pcm substreams" belong to each pcm stream. when you open a pcm device, one pcm substream will be used at each time. snd_pcm_new() takes the argument how many pcm substreams are created for each pcm stream. you can give more than one here only if the hardware supports multiple-playback/capture, such as emu10k1. otherwise, these arguments must be 1 or 0.

Quoted 6 lines

The hw supports it. My cards has 8 analog outputs that can be used indipendently or grouped. From inside hw_params callback I have no way to know which channels the user wants to use. My idea is to tell snd_pcm_new() to create 8 playback substreams. When an app opens substream N, C channels wide, I use substream N, and I make substreams from N+1 to N+C-1 not available.

sorry, i misread your original question. i thought you were asking about the user of the user-space snd_pcm_open() call, not a driver side function.

i am not sure this is the best way to do this. i used this approach with the original hammerfall driver (26 channels), and it got very unworkable. i found it much better (and more efficient) to create 1 device with the capability to handle up to 26 channels.

your description is a bit confusing as well. when you say the h/w supports 8 analog outputs, do you mean 8 independent audio streams, or do you mean 8 synced channels of output? these are very different things.

--p

-------------------------------------------------------
This SF.net email is sponsored by:
The Definitive IT and Networking Event. Be There! NetWorld+Interop Las Vegas 2003 -- Register today!
http://ads.sourceforge.net/cgi-bin/redirect.pl?keyn0001en

#10 lore raw

Re: pcm interfaces questions

In reply to Giuliano Pochini
Quoted 9 lines · Giuliano Pochini
Quoted 6 lines · On 26-Mar-2003 Takashi Iwai wrote:

the "pcm substreams" belong to each pcm stream. when you open a pcm device, one pcm substream will be used at each time. snd_pcm_new() takes the argument how many pcm substreams are created for each pcm stream. you can give more than one here only if the hardware supports multiple-playback/capture, such as emu10k1. otherwise, these arguments must be 1 or 0.

Quoted 6 lines

The hw supports it. My cards has 8 analog outputs that can be used indipendently or grouped. From inside hw_params callback I have no way to know which channels the user wants to use. My idea is to tell snd_pcm_new() to create 8 playback substreams. When an app opens substream N, C channels wide, I use substream N, and I make substreams from N+1 to N+C-1 not available.

It's a bit tricky. I'd prefer to allocate different PCM devices for this behaviour:

#0 - four stereo substreams
#1 - one 8-channel substream
#2 - eight mono substreams

So the user has always equal substreams.

Jaroslav

-----
Jaroslav Kysela <[email protected]>
Linux Kernel Sound Maintainer
ALSA Project, SuSE Labs

-------------------------------------------------------
This SF.net email is sponsored by:
The Definitive IT and Networking Event. Be There! NetWorld+Interop Las Vegas 2003 -- Register today!
http://ads.sourceforge.net/cgi-bin/redirect.pl?keyn0001en