Skip to contentSkip to conversation

snd_pcm_hw_params_current() ?

DISCUSSION Florian Bomers 3 participants 5 messages Oct 4, 2002 – Oct 8, 2002

lore
Share & tools
lore
#0 lore raw

Hi,

there is snd_pcm_sw_params_current() but not snd_pcm_hw_params_current(). How can I get the current hardware configuration for a given snd_pcm_t handle ? Am I missing something ?

Thanks,
Florian

Signature · 10 lines
Florian Bomers
Java Sound
Java Software/Sun Microsystems, Inc.
http://java.sun.com/products/java-media/sound/


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
#1 lore raw
Quoted 5 lines · Florian Bomers

Hi,

there is snd_pcm_sw_params_current() but not snd_pcm_hw_params_current(). How can I get the current hardware configuration for a given snd_pcm_t handle ? Am I missing something ?

Hardware parameters must be configured from application all time.

Jaroslav

-----
Jaroslav Kysela <[email protected]>
Linux Kernel Sound Maintainer
ALSA Project http://www.alsa-project.org
SuSE Linux http://www.suse.com

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

#2 lore raw
Quoted 10 lines · Jaroslav Kysela
Quoted 5 lines · Florian Bomers

Hi,

there is snd_pcm_sw_params_current() but not snd_pcm_hw_params_current(). How can I get the current hardware configuration for a given snd_pcm_t handle ? Am I missing something ?

Hardware parameters must be configured from application all time.

So that means that I need to cache hw params if I ever want to use them again ? E.g. my app does this:

open(), set hw params, set sw params
free hw params and sw params to save memory

work with the device: start/write/stop/etc.

When I now want to know the buffer size, I would like to obtain the current hw params which I had set above to the pcm handle.

I understand that I initially need to set hw params to a pcm handle before I could get current hw params, but once I did that, especially in prepared/running state, the device has well-defined hw params and why shouldn't people be allowed to query them ?

Thanks !
Florian

Quoted 17 lines

Jaroslav

-----
Jaroslav Kysela <[email protected]>
Linux Kernel Sound Maintainer
ALSA Project http://www.alsa-project.org
SuSE Linux http://www.suse.com

-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Alsa-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/alsa-devel

Signature · 10 lines
Florian Bomers
Java Sound
Java Software/Sun Microsystems, Inc.
http://java.sun.com/products/java-media/sound/


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

At Fri, 04 Oct 2002 11:04:23 -0700,

Quoted 21 lines · Florian Bomers
Quoted 10 lines · Jaroslav Kysela
Quoted 5 lines · Florian Bomers

Hi,

there is snd_pcm_sw_params_current() but not snd_pcm_hw_params_current(). How can I get the current hardware configuration for a given snd_pcm_t handle ? Am I missing something ?

Hardware parameters must be configured from application all time.

So that means that I need to cache hw params if I ever want to use them again ? E.g. my app does this:

open(), set hw params, set sw params
free hw params and sw params to save memory

work with the device: start/write/stop/etc.

Quoted 7 lines

When I now want to know the buffer size, I would like to obtain the current hw params which I had set above to the pcm handle.

I understand that I initially need to set hw params to a pcm handle before I could get current hw params, but once I did that, especially in prepared/running state, the device has well-defined hw params and why shouldn't people be allowed to query them ?

simply because the query function is not implemented on the kernel side :)

or, we can add the code to alsa-lib to duplicate the hw_params / sw_params privately, and returns it via the query function. but it's not much different fromt keeping hw_params or sw_params record in the application by yourself.

please note that on the kernel, hw_params and sw_params are not stored as they are but their members are copied to runtime struct. so if the query api is implemented, we need a function to convert from runtime to hw_params or sw_params.

Takashi

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

#4 lore raw

the thing that looks like bad API design is that snd_pcm_sw_params_current() exists and snd_pcm_hw_params_current() does not. I think it wouldn't even hurt if snd_pcm_hw_params_t would be cached in the lib for that. Maybe in a later ALSA revision, ALSA kernel support for that could be implemented.

Thanks,
Florian

Quoted 55 lines · Takashi Iwai

At Fri, 04 Oct 2002 11:04:23 -0700,

Quoted 21 lines · Florian Bomers
Quoted 10 lines · Jaroslav Kysela
Quoted 5 lines · Florian Bomers

Hi,

there is snd_pcm_sw_params_current() but not snd_pcm_hw_params_current(). How can I get the current hardware configuration for a given snd_pcm_t handle ? Am I missing something ?

Hardware parameters must be configured from application all time.

So that means that I need to cache hw params if I ever want to use them again ? E.g. my app does this:

open(), set hw params, set sw params
free hw params and sw params to save memory

work with the device: start/write/stop/etc.

Quoted 7 lines

When I now want to know the buffer size, I would like to obtain the current hw params which I had set above to the pcm handle.

I understand that I initially need to set hw params to a pcm handle before I could get current hw params, but once I did that, especially in prepared/running state, the device has well-defined hw params and why shouldn't people be allowed to query them ?

simply because the query function is not implemented on the kernel side :)

or, we can add the code to alsa-lib to duplicate the hw_params / sw_params privately, and returns it via the query function. but it's not much different fromt keeping hw_params or sw_params record in the application by yourself.

please note that on the kernel, hw_params and sw_params are not stored as they are but their members are copied to runtime struct. so if the query api is implemented, we need a function to convert from runtime to hw_params or sw_params.

Takashi

-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Alsa-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/alsa-devel

Signature · 10 lines
Florian Bomers
Java Sound
Java Software/Sun Microsystems, Inc.
http://java.sun.com/products/java-media/sound/


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