* Problem writing to PCM plugin @ 2004-08-11 13:33 Arve Knudsen 2004-08-11 13:36 ` Jaroslav Kysela 2004-08-11 13:45 ` Clemens Ladisch 0 siblings, 2 replies; 7+ messages in thread From: Arve Knudsen @ 2004-08-11 13:33 UTC (permalink / raw) To: alsa-devel@lists.sourceforge.net I'm currently trying to implement support for user defined pcm plugins in PortAudio ALSA (ALSA-lib 1.05), and I've got as far as discovering the pcms. In order to test I defined a routing plugin, which moves data from channel 0/1 to 16/17 (S/PDIF) on my Hammerfall Lite. With aplay this plugin works just fine, but when I open it with PortAudio the same way as with any hardware device, the output is simply silent (I can't listen to any of the ADAT channels since I lack ADAT gear). Defining a simple plugin which does nothing but drive my onboard nForce2 (routing fails with this assertion: 'pcm_plug.c:363: snd_pcm_plug_change_channels: Assertion `snd_pcm_format_linear(slv->format)' failed') works the same as if I open the hw device. The obvious difference to aplay I can think of is that we use floating point format in the PortAudio tests, so there is an intermediate conversion before the audio gets to the routing plugin. Could this be the cause of the problem? If you wish I can provide output from snd_pcm_dump. Thanks Arve Knudsen ------------------------------------------------------- SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media 100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33 Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift. http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285 ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Problem writing to PCM plugin 2004-08-11 13:33 Problem writing to PCM plugin Arve Knudsen @ 2004-08-11 13:36 ` Jaroslav Kysela 2004-08-11 13:53 ` Arve Knudsen 2004-08-11 13:45 ` Clemens Ladisch 1 sibling, 1 reply; 7+ messages in thread From: Jaroslav Kysela @ 2004-08-11 13:36 UTC (permalink / raw) To: Arve Knudsen; +Cc: alsa-devel@lists.sourceforge.net On Wed, 11 Aug 2004, Arve Knudsen wrote: > point format in the PortAudio tests, so there is an intermediate > conversion before the audio gets to the routing plugin. Could this be the > cause of the problem? If you wish I can provide output from snd_pcm_dump. Yes, send the dump, please. Jaroslav ----- Jaroslav Kysela <perex@suse.cz> Linux Kernel Sound Maintainer ALSA Project, SUSE Labs ------------------------------------------------------- SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media 100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33 Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift. http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285 ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Problem writing to PCM plugin 2004-08-11 13:36 ` Jaroslav Kysela @ 2004-08-11 13:53 ` Arve Knudsen 0 siblings, 0 replies; 7+ messages in thread From: Arve Knudsen @ 2004-08-11 13:53 UTC (permalink / raw) To: Jaroslav Kysela; +Cc: alsa-devel@lists.sourceforge.net The plugin: pcm.9636SPDIF { type plug slave.pcm "hw:1" ttable.0.16 1 ttable.1.17 1 } The dump: Plug PCM: Linear Integer <-> Linear Float conversion PCM (S32_LE) Its setup is: stream : PLAYBACK access : MMAP_INTERLEAVED format : FLOAT_LE subformat : STD channels : 2 rate : 44100 exact rate : 44100 (44100/1) msbits : 32 buffer_size : 2048 period_size : 1024 period_time : 23219 tick_time : 1000 tstamp_mode : MMAP period_step : 1 sleep_min : 0 avail_min : 1024 xfer_align : 1 start_threshold : 1024 stop_threshold : 2048 silence_threshold: 0 silence_size : 2147483647 boundary : 1073741824 Slave: Route conversion PCM (sformat=S32_LE) Transformation table: 0 <- none 1 <- none Its setup is: stream : PLAYBACK access : MMAP_INTERLEAVED format : S32_LE subformat : STD channels : 2 rate : 44100 exact rate : 44100 (44100/1) msbits : 32 buffer_size : 2048 period_size : 1024 period_time : 23219 tick_time : 1000 tstamp_mode : MMAP period_step : 1 sleep_min : 0 avail_min : 1024 xfer_align : 1 start_threshold : 1024 stop_threshold : 2048 silence_threshold: 0 silence_size : 2147483647 boundary : 1073741824 Slave: Route conversion PCM (sformat=S32_LE) Transformation table: 0 <- none 1 <- none 2 <- none 3 <- none 4 <- none 5 <- none 6 <- none 7 <- none 8 <- none 9 <- none 10 <- none 11 <- none 12 <- none 13 <- none 14 <- none 15 <- none 16 <- 0 17 <- 1 Its setup is: stream : PLAYBACK access : MMAP_INTERLEAVED format : S32_LE subformat : STD channels : 2 rate : 44100 exact rate : 44100 (44100/1) msbits : 32 buffer_size : 2048 period_size : 1024 period_time : 23219 tick_time : 1000 tstamp_mode : MMAP period_step : 1 sleep_min : 0 avail_min : 1024 xfer_align : 1 start_threshold : 1024 stop_threshold : 2048 silence_threshold: 0 silence_size : 2147483647 boundary : 1073741824 Slave: Hardware PCM card 1 'RME Digi9636 (Rev 1.5)' device 0 subdevice 0 Its setup is: stream : PLAYBACK access : MMAP_NONINTERLEAVED format : S32_LE subformat : STD channels : 18 rate : 44100 exact rate : 44100 (44100/1) msbits : 24 buffer_size : 2048 period_size : 1024 period_time : 23219 tick_time : 1000 tstamp_mode : MMAP period_step : 1 sleep_min : 0 avail_min : 1024 xfer_align : 1 start_threshold : 1024 stop_threshold : 2048 silence_threshold: 0 silence_size : 2147483647 boundary : 1073741824 On Wed, 11 Aug 2004 15:36:24 +0200 (CEST), Jaroslav Kysela <perex@suse.cz> wrote: > On Wed, 11 Aug 2004, Arve Knudsen wrote: > >> point format in the PortAudio tests, so there is an intermediate >> conversion before the audio gets to the routing plugin. Could this be >> the >> cause of the problem? If you wish I can provide output from >> snd_pcm_dump. > > Yes, send the dump, please. > > Jaroslav > > ----- > Jaroslav Kysela <perex@suse.cz> > Linux Kernel Sound Maintainer > ALSA Project, SUSE Labs ------------------------------------------------------- SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media 100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33 Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift. http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285 ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Problem writing to PCM plugin 2004-08-11 13:33 Problem writing to PCM plugin Arve Knudsen 2004-08-11 13:36 ` Jaroslav Kysela @ 2004-08-11 13:45 ` Clemens Ladisch 2004-08-11 14:00 ` Arve Knudsen 2004-08-11 15:06 ` Arve Knudsen 1 sibling, 2 replies; 7+ messages in thread From: Clemens Ladisch @ 2004-08-11 13:45 UTC (permalink / raw) To: Arve Knudsen; +Cc: alsa-devel@lists.sourceforge.net Arve Knudsen wrote: > pcm_plug.c:363: snd_pcm_plug_change_channels: Assertion > `snd_pcm_format_linear(slv->format)' failed' > > The obvious difference to aplay I can think of is that we use floating > point format in the PortAudio tests, so there is an intermediate > conversion before the audio gets to the routing plugin. The route plugin doesn't support floating point formats. Try wrapping it into a lfloat (or plug) plugin. HTH Clemens ------------------------------------------------------- SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media 100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33 Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift. http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285 ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Problem writing to PCM plugin 2004-08-11 13:45 ` Clemens Ladisch @ 2004-08-11 14:00 ` Arve Knudsen 2004-08-11 15:06 ` Arve Knudsen 1 sibling, 0 replies; 7+ messages in thread From: Arve Knudsen @ 2004-08-11 14:00 UTC (permalink / raw) To: Clemens Ladisch; +Cc: alsa-devel@lists.sourceforge.net Actually the plugin is of type "plug", and according to snd_pcm_dump it seems ALSA-lib takes care of converting the sample format. Only getting to know the plugin system here ... Regards Arve Knudsen On Wed, 11 Aug 2004 15:45:29 +0200 (METDST), Clemens Ladisch <clemens@ladisch.de> wrote: > Arve Knudsen wrote: >> pcm_plug.c:363: snd_pcm_plug_change_channels: Assertion >> `snd_pcm_format_linear(slv->format)' failed' >> >> The obvious difference to aplay I can think of is that we use floating >> point format in the PortAudio tests, so there is an intermediate >> conversion before the audio gets to the routing plugin. > > The route plugin doesn't support floating point formats. Try wrapping > it into a lfloat (or plug) plugin. > > > HTH > Clemens > > ------------------------------------------------------- SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media 100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33 Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift. http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285 ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Problem writing to PCM plugin 2004-08-11 13:45 ` Clemens Ladisch 2004-08-11 14:00 ` Arve Knudsen @ 2004-08-11 15:06 ` Arve Knudsen 2004-08-11 15:03 ` Jaroslav Kysela 1 sibling, 1 reply; 7+ messages in thread From: Arve Knudsen @ 2004-08-11 15:06 UTC (permalink / raw) To: Clemens Ladisch; +Cc: alsa-devel@lists.sourceforge.net Based on your suggestion I rewrote the plugin, so it wraps a route plugin. And now things work as I would expect. I must say I'm still confused on the issue, as I haven't found any explanation why my original approach wouldn't work. What's the difference between defining a translation table directly inside a "plug" plugin, and aggregating a slave "route" plugin within a "plug"? Sort of weird that the plugin caused an assertion only when used in combination with the nForce2 chip, and not the Hammerfall (just silent operation). Thanks Arve Knudsen On Wed, 11 Aug 2004 15:45:29 +0200 (METDST), Clemens Ladisch <clemens@ladisch.de> wrote: > Arve Knudsen wrote: >> pcm_plug.c:363: snd_pcm_plug_change_channels: Assertion >> `snd_pcm_format_linear(slv->format)' failed' >> >> The obvious difference to aplay I can think of is that we use floating >> point format in the PortAudio tests, so there is an intermediate >> conversion before the audio gets to the routing plugin. > > The route plugin doesn't support floating point formats. Try wrapping > it into a lfloat (or plug) plugin. > > > HTH > Clemens > > > > > ------------------------------------------------------- > SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media > 100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33 > Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift. > http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285 > _______________________________________________ > Alsa-devel mailing list > Alsa-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/alsa-devel ------------------------------------------------------- SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media 100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33 Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift. http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285 ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Problem writing to PCM plugin 2004-08-11 15:06 ` Arve Knudsen @ 2004-08-11 15:03 ` Jaroslav Kysela 0 siblings, 0 replies; 7+ messages in thread From: Jaroslav Kysela @ 2004-08-11 15:03 UTC (permalink / raw) To: Arve Knudsen; +Cc: Clemens Ladisch, alsa-devel@lists.sourceforge.net On Wed, 11 Aug 2004, Arve Knudsen wrote: > Based on your suggestion I rewrote the plugin, so it wraps a route plugin. > And now things work as I would expect. I must say I'm still confused on > the issue, as I haven't found any explanation why my original approach > wouldn't work. What's the difference between defining a translation table > directly inside a "plug" plugin, and aggregating a slave "route" plugin > within a "plug"? There was an error in the plug plugin - one route plugin was inserted by mistake. This patch will fix the wrong plug behaviour: Index: pcm_plug.c =================================================================== RCS file: /cvsroot/alsa/alsa-lib/src/pcm/pcm_plug.c,v retrieving revision 1.126 diff -u -r1.126 pcm_plug.c --- pcm_plug.c 19 Apr 2004 13:24:19 -0000 1.126 +++ pcm_plug.c 11 Aug 2004 15:06:02 -0000 @@ -53,7 +53,7 @@ int srate; enum snd_pcm_plug_route_policy route_policy; snd_pcm_route_ttable_entry_t *ttable; - int ttable_ok; + int ttable_ok, ttable_last; unsigned int tt_ssize, tt_cused, tt_sused; } snd_pcm_plug_t; @@ -361,7 +361,8 @@ snd_pcm_route_ttable_entry_t *ttable; int err; assert(snd_pcm_format_linear(slv->format)); - if (clt->channels == slv->channels && !plug->ttable) + if (clt->channels == slv->channels && + (!plug->ttable || !plug->ttable_last)) return 0; if (clt->rate != slv->rate && clt->channels > slv->channels) @@ -560,7 +561,7 @@ }; snd_pcm_plug_params_t p = *slave; unsigned int k = 0; - plug->ttable_ok = 0; + plug->ttable_ok = plug->ttable_last = 0; while (client->format != p.format || client->channels != p.channels || client->rate != p.rate || @@ -584,6 +585,7 @@ if (plug->ttable && !plug->ttable_ok) { snd_pcm_t *new; int err; + plug->ttable_last = 1; err = snd_pcm_plug_change_channels(pcm, &new, client, &p); if (err < 0) { snd_pcm_plug_clear(pcm); Jaroslav ----- Jaroslav Kysela <perex@suse.cz> Linux Kernel Sound Maintainer ALSA Project, SUSE Labs ------------------------------------------------------- SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media 100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33 Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift. http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285 ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2004-08-11 15:06 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2004-08-11 13:33 Problem writing to PCM plugin Arve Knudsen 2004-08-11 13:36 ` Jaroslav Kysela 2004-08-11 13:53 ` Arve Knudsen 2004-08-11 13:45 ` Clemens Ladisch 2004-08-11 14:00 ` Arve Knudsen 2004-08-11 15:06 ` Arve Knudsen 2004-08-11 15:03 ` Jaroslav Kysela
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.