On November 27, 2003 06:21 am, Sylvain Petreolle wrote:
Is this second attempt better ? (not tested with alsa 0.9)
Why don't you define the snd_pcm_hw_params_* macros for alsa 0.9. For example, this bit:
- snd_pcm_format_t format = snd_pcm_hw_params_get_format(hw_params); - snd_pcm_access_t access = snd_pcm_hw_params_get_access(hw_params); + snd_pcm_format_t format; + snd_pcm_access_t access; + snd_pcm_uframes_t buffer_size, bufsize_min, bufsize_max; + int dir=0, channels, channels_min, channels_max; + long int period_size, periods_min=0, periods_max=0; + +#if (SND_LIB_MAJOR == 0) + format = snd_pcm_hw_params_get_format(hw_params); + access = snd_pcm_hw_params_get_access(hw_params); +#else + snd_pcm_hw_params_get_format(hw_params,&format); + snd_pcm_hw_params_get_access(hw_params,&access); +#endif
Could have been coded like so:
+#if (SND_LIB_MAJOR == 0) +# define snd_pcm_hw_params_get_format(hw_params,format) do{ *format = snd_pcm_hw_params_get_format(hw_params);} while(0) +# define snd_pcm_hw_params_get_access(hw_params,access) do{ *access = snd_pcm_hw_params_get_access(hw_params);} while(0) ... more snd_pcm_hw_params_* definitions +#endif ... - snd_pcm_format_t format = snd_pcm_hw_params_get_format(hw_params); - snd_pcm_access_t access = snd_pcm_hw_params_get_access(hw_params); + snd_pcm_format_t format; + snd_pcm_access_t access; + snd_pcm_uframes_t buffer_size, bufsize_min, bufsize_max; + int dir=0, channels, channels_min, channels_max; + long int period_size, periods_min=0, periods_max=0; + + snd_pcm_hw_params_get_format(hw_params,&format); + snd_pcm_hw_params_get_access(hw_params,&access);
Eliminates a lot of #ifdefs, cleaner code, etc.
--- "Dimitrie O. Paun" dpaun@rogers.com a écrit : > On November 27, 2003 06:21 am, Sylvain Petreolle wrote:
Is this second attempt better ? (not tested with alsa 0.9)
Why don't you define the snd_pcm_hw_params_* macros for alsa 0.9. For example, this bit:
<snip>
Eliminates a lot of #ifdefs, cleaner code, etc.
I agree that there are lesser #ifdefs. Cleaner code => I didnt modify the actual code, no need it to change it anymore. Im trying to use the new API since the release of alsa 1 is for soon.
===== Sylvain Petreolle (spetreolle_at_users_dot_sourceforge_dot_net) ICQ #170597259 Say NO to software patents Dites NON aux brevets logiciels
"What if tomorrow the War could be over ?" Morpheus, in "Reloaded".
___________________________________________________________ Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français ! Yahoo! Mail : http://fr.mail.yahoo.com