Re: [Alsa-devel] ALSA driver 1.0.2c: divide by zero oops

2004-03-17 Thread Jonathan Woithe
Takashi

> > > > I have been trying cinelerra 1.1.9 in OSS mode against the OSS emulation
> > > > driver (snd-pcm-oss) from ALSA driver 1.0.2c. Whenever anything is done to
> > > > start audio playback (such as playing a video clip) the ALSA driver panics
> > > > with a divide by zero error.  The decoded oops is found below.
> > > > 
> > > > Under native OSS from 2.4.23 cinelerra works fine.  Furthermore, all other
> > > > OSS applications I've tried against ALSA driver 1.0.2c seem to be fine. 
> > > > Thus the problem seems to be associated with the way cinelerra does things -
> > > > something it does is upsetting ALSA but is fine under native OSS.  Of
> > > > course, even a misbehaving application not running as root should not be
> > > > able to panic the kernel.
> > > 
> > > sure.  what soundcard/soundchip are you using?
> > 
> > It's an Ensoniq AudioPCI card with the ES-1370 chipset.
> :
> please turn on the debug option.  it will help to catch the bug there,
> at least we can know whether it's really zero division.

I did this last night.  The following is my analysis of the problem.

With full debug selected, the only message reported by the ALSA system is
  ALSA ../alsa-kernel/core/pcm_timer.c:70: BUG? (rate != 0) 
  (called from d8c33a79)
That is, the assertion "rate!=0" fails.  This confirms the reported oops
trigger (that is, divide by zero).

Address d8c33a79 appears to be in snd_pcm_hw_params().  The call to 
snd_pcm_timer_resolution_change() appears at pcm_native.c:396.

In debug mode the divide isn't done when rate==0: the action in response to
the failed assertion is to return before attempting the divide.  When using
the debug mode ALSA driver cinelerra appears to function without any
immediately apparent problems (except of course the above debug message is
sent to the logs).

The earliest ALSA call in the previously reported oops backtrace appears to
be snd_pcm_oss_set_format(), which is called via the SNDCTL_DSP_SETFMT
ioctl.

cinelerra calls SNDCTL_DSP_SETFMT in a number of places in audiooss.C:
* AudioOSS::open_input():
if(ioctl(dsp_in[i], SNDCTL_DSP_SETFRAGMENT, &buffer_info))
  printf("SNDCTL_DSP_SETFRAGMENT failed.\n");
if(ioctl(dsp_in[i], SNDCTL_DSP_SETFMT, &format) < 0)
  printf("SNDCTL_DSP_SETFMT failed\n");
if(ioctl(dsp_in[i], SNDCTL_DSP_CHANNELS,&device->in_config->oss_in_channels[i]) < 
0) 
  printf("SNDCTL_DSP_CHANNELS failed\n");
if(ioctl(dsp_in[i], SNDCTL_DSP_SPEED,&device->in_samplerate) < 0) 
  printf("SNDCTL_DSP_SPEED failed\n");
* AudioOSS::open_output():
dsp_out[i] = open(device->out_config->oss_out_device[i],
 O_WRONLY /*| O_NDELAY*/);
set_cloexec_flag(dsp_out[i], 1);
if(ioctl(dsp_out[i], SNDCTL_DSP_SETFRAGMENT, &buffer_info))
  printf("SNDCTL_DSP_SETFRAGMENT 2 failed.\n");
if(ioctl(dsp_out[i], SNDCTL_DSP_SETFMT, &format) < 0) 
  printf("SNDCTL_DSP_SETFMT 2 failed\n");
if(ioctl(dsp_out[i], SNDCTL_DSP_CHANNELS, 
&device->out_config->oss_out_channels[i]) < 0) 
  printf("SNDCTL_DSP_CHANNELS 2 failed\n");
if(ioctl(dsp_out[i], SNDCTL_DSP_SPEED,&device->out_samplerate) < 0) 
  printf("SNDCTL_DSP_SPEED 2 failed\n");
ioctl(dsp_out[i], SNDCTL_DSP_GETOSPACE, &playinfo);
* AudioOSS::open_duplex():
As for AudioOSS::open_output() with
  if(ioctl(dsp_duplex[i], SNDCTL_DSP_SETDUPLEX, 1) == -1)
printf("SNDCTL_DSP_SETDUPLEX failed\n");
added after SNDCTL_DSP_SETFRAGMENT call.

In the case of the oops AudioOSS::open_output() was the function being used.
The SNDCTL_DSP_SETFMT call triggering the oops is preceeded with a call to
SNDCTL_DSP_SETFRAGMENT.  Commenting out the SNDCTL_DSP_SETFRAGMENT call
makes the "rate!=0" assertion pass - in other words, it appears that rate
becomes zero as a consequence of calling SNDCTL_DSP_SETFRAGMENT.  Thus the
problem would appear to be the SNDCTL_DSP_SETFRAGMENT preceeding
SNDCTL_DSP_SETFMT call.  Since cinelerra's call sequence for setting up OSS
devices (as shown above) agrees with the published API it therefore appears
that there is a glitch in the ALSA emulation system.

The other OSS apps I've used do not call SNDCTL_DSP_SETFRAGMENT which
probably explains why I've had no problem with other OSS applications.

I hope this helps track down the problem.  I am happy to run more tests if
needed.

Regards
  jonathan
-- 
* Jonathan Woithe[EMAIL PROTECTED]*
*http://www.physics.adelaide.edu.au/~jwoithe*
***---***
** "Time is an illusion; lunchtime doubly so"  **
*  "...you wouldn't recognize a subtle plan if it painted itself purple and *
*   danced naked on a harpsichord singing 'subtle plans are here again'"*


---
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CE

[Alsa-devel] Missing module dependencies in ALSA CVS

2004-03-17 Thread Chris Rankin
Hi,

ALSA CVS is still failing to generate all of dependent
modules in my particular config:

--with-kernel=/home/chris/linux-2.6.4
--with-moddir=/lib/modules/2.6.4/kernel/sound
--with-oss=yes
--with-sequencer=yes
--with-cards=intel8x0,emu10k1,dummy

I have managed to "hack" the (generated) acinclude.m4
file to fix it:

...
if test "$cards" = "all"; then
  ALSA_TOPLEVEL_ALL
  AC_MSG_RESULT(all)
else
>   CONFIG_SOUND="y"
>   CONFIG_SND="m"
>   CONFIG_SND_TIMER="m"
>   AC_DEFINE(CONFIG_SND_MODULE)
>   AC_DEFINE(CONFIG_SND_TIMER_MODULE)
  cards=`echo $cards | sed 's/,/ /g'`
  for card in $cards
  do
...

...
  emu10k1)
CONFIG_SND_HWDEP="m"
AC_DEFINE(CONFIG_SND_HWDEP_MODULE)
CONFIG_SND_RAWMIDI="m"
AC_DEFINE(CONFIG_SND_RAWMIDI_MODULE)
CONFIG_SND_AC97_CODEC="m"
AC_DEFINE(CONFIG_SND_AC97_CODEC_MODULE)
CONFIG_SND_EMU10K1="m"
AC_DEFINE(CONFIG_SND_EMU10K1_MODULE)
> if ( test "$CONFIG_SND_SEQUENCER" == "y" -o
"$CONFIG_SND_SEQUENCER" == "m" ); then
>   CONFIG_SND_VIRMIDI="m"
>   AC_DEFINE(CONFIG_SND_VIRMIDI_MODULE)
> fi
;;
...

Cheers,
Chris






___
Yahoo! Messenger - Communicate instantly..."Ping" 
your friends today! Download Messenger Now 
http://uk.messenger.yahoo.com/download/index.html


---
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
___
Alsa-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-devel


Re: [Alsa-devel] Echo Canceler with ALSA

2004-03-17 Thread Peter Kirk
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Am Mittwoch, 17. März 2004 20:22 schrieb [EMAIL PROTECTED]:
> Hi everyone,
>
> my diploma project is to develop an echo canceler for controlling
> application with speech. For this purpose, I need to know what a
> sound card is  currently playing. I was trying to find out how to
> read the DMA buffer which contains mixed samples prepared to be
> passed to the sound card. Is there any API call to do this? The
> second thing - What is the best way to allow applications to
> access the echo-cancelled microphone input?
>
> Thank a lot
>
> Jan C.

Hi there,

though I cant really answer your questions, you might want to have a look at 
the speex project ( http://speex.org ), they develop a codec for the 
compression of speech, and they already have experimental echo cancellation 
routines in their most recent development version...but, as the lead 
developer puts it:

Am Montag, 9. Februar 2004 08:21 schrieb Jean-Marc Valin:
> Yes, the echo cancellation code is very experimental. The algorithm
> implemented (MDF) is very efficient, but it will *not* work out of the
> box yet. Right now, it's mainly missing a cross-talk detector and some
> tuning of the adaptation rate. I can't give a target date at which the
> code will work, but if someone with echo-cancelling experience
> volunteers to help, it might happen faster.

As you seem to be somebody with experience in the area, maybe you could build 
up your diploma work on speex ?

Just a thought.

Peter
- -- 
Quantity is no substitute for quality, but its the only one we've got.
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFAWLlIg2ieGvTmHiURAl+LAKCCbPkKsclSo3xkuOhS8Z4vrDjBkwCfVzN7
rWxYRXxcMCP1IOjGJnDkp5g=
=JeR/
-END PGP SIGNATURE-



---
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id70&alloc_id638&op=click
___
Alsa-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-devel


[Alsa-devel] Echo Canceler with ALSA

2004-03-17 Thread jcep
Hi everyone,

my diploma project is to develop an echo canceler for controlling
application with speech. For this purpose, I need to know what a
sound card is  currently playing. I was trying to find out how to
read the DMA buffer which contains mixed samples prepared to be
passed to the sound card. Is there any API call to do this? The
second thing - What is the best way to allow applications to
access the echo-cancelled microphone input?

Thank a lot

Jan C.


-- 
Surfujete pres VOLNY? Tak proc jeste nejste ve VOLNY klubu?
Nyni exkluzivne pro cleny klubu soutez o skvele ceny.
http://klub.volny.cz




---
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
___
Alsa-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-devel


[Alsa-devel] A few ideas about environmental audio...

2004-03-17 Thread Manuel Jander
Hi,

So far i'm following this list, there are some people interested in
environmental audio, and advanced effect processing support. Regarding
this i would like to share some thoughts about and hopefully collect
some critics and comments.

How i visualize environmental audio for the common user:

  Context: The user has a Soundboard with several audio outputs (most of
them do). He/She may connect just a headphone or 2 speakers or a 5.1
setup, 7.1, or whatever the card supports.

  Problem: It's up to the application to support either 5.1, headphones
or whatever. You may end up not hearing some channels (your soundcard
has 6 outputs, but you just have headphones, or you have 6 speakers and
your are hearing a stereo stream on just 2 speakers). There is a lot of
duplicated code in different applications, and there is no standard
about how this down or up mix should be done. It may be impossible to
exploit any advanced hardware feature (see Advantage).
  Idea: Support any audio channel arrangement, and mix it in hardware or
software (plugins, dmix ?) to the actual number of speaker/headphones
channels. Define a standard how channel formatting should be
converted/mixed, etc.
  Requirements: The user has to tell ALSA what kind of
speakers/headphones is she/he using (not a big deal).
  Advantage: We could support 7.1 or 5.1 environmental audio on
headphones, by using hardware HRTF filters to put each stream at the
desired spatial position. On some soundcards this is trivial (just a
matter of routing).
  Caveats: It involves work obviously. I'm willing to volunteer on this.

Any comments are gladly welcome.

Best Regards

Manuel







---
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
___
Alsa-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-devel


Re: [Alsa-devel] undefined reference to `snd_pcm_hw_params_sizeof'

2004-03-17 Thread Jaroslav Kysela
On Wed, 17 Mar 2004, Tim Hollingsworth wrote:

> Hi
> 
> I'm a newbie with alsa and rusty with c.  I am trying to get a basic 
> pcm application going.  I have:
> 
>   #include 
> 
> but when I try to:
> 
>   snd_pcm_hw_params_alloca(&hwparams);
> 
> I get:
> 
> /tmp/ccJB6E1d.o(.text+0x18): In function `initSound':
> : undefined reference to `snd_pcm_hw_params_sizeof'
> /tmp/ccJB6E1d.o(.text+0x31): In function `initSound':
> : undefined reference to `snd_pcm_hw_params_sizeof'
> collect2: ld returned 1 exit status

gcc -lasound 

Jaroslav

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


---
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
___
Alsa-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-devel


[Alsa-devel] undefined reference to `snd_pcm_hw_params_sizeof'

2004-03-17 Thread Tim Hollingsworth
Hi

I'm a newbie with alsa and rusty with c.  I am trying to get a basic 
pcm application going.  I have:

	#include 

but when I try to:

	snd_pcm_hw_params_alloca(&hwparams);

I get:

/tmp/ccJB6E1d.o(.text+0x18): In function `initSound':
: undefined reference to `snd_pcm_hw_params_sizeof'
/tmp/ccJB6E1d.o(.text+0x31): In function `initSound':
: undefined reference to `snd_pcm_hw_params_sizeof'
collect2: ld returned 1 exit status
any help appreciated
cheers
Tim
Full source so far:

#include 

/* Handle for the PCM device */
snd_pcm_t *pcm_handle;
/* Playback stream */
snd_pcm_stream_t stream = SND_PCM_STREAM_PLAYBACK;
/* This structure contains information about*/
/* the hardware and can be used to specify the  */
/* configuration to be used for the PCM stream. */
snd_pcm_hw_params_t *hwparams;
/* Name of the PCM device, like plughw:0,0  */
/* The first number is the number of the soundcard, */
/* the second number is the number of the device.   */
char *pcm_name;
int initSound(int channels, int sampleRate, int framebytes)
{
/* Init pcm_name. Of course, later you */
/* will make this configurable ;-) */
pcm_name = strdup("plughw:0,0");
/* Allocate the snd_pcm_hw_params_t structure on the stack. */
snd_pcm_hw_params_alloca(&hwparams);
}
main(){}



---
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
___
Alsa-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-devel


Re: [Alsa-devel] snd-usb-audio and midisport1x1 little hack fixes hotplug pb

2004-03-17 Thread Clemens Ladisch
Hartmut Geissbauer wrote:
> I removed the quick hack from Mathieu and inserted snd_printk's in
> snd_usbmidi_disconnect.
>
> The new function:
> ...
> if (ep->out && ep->out->urb)
> usb_unlink_urb(ep->out->urb);
> snd_printk(KERN_INFO "usb_unlink_urb out\n");

Please note that this is C, not Python.  :-)

> The output from dmesg I got:
>
> ohci_hcd :00:02.0: urb e2e2b4c0 path 2.4 ep1in 5e16 cc 5 --> status -110
> hub 1-2:1.0: port 4, status 100, change 1, 12 Mb/s
> usb 1-2.4: USB disconnect, address 5
> usb 1-2.4: usb_disable_device nuking all URBs

It seems we don't need to unlink the URBs as the kernel does this for
us, but it doesn't hurt.

> ...
> ALSA sound/usb/usbmidi.c:723: usb_unlink_urb in
> ALSA sound/usb/usbaudio.c:2924: snd_usb_audio_disconnect called, refcount = 0

Apparently, snd_usb_audio_disconnect is called recursively, caused by
the call to usb_driver_release_interface, and then deadlocks.

The USB core will release all interfaces automatically, so we don't
need this call.  Please remove the usb_driver_release_interface line.


HTH
Clemens




---
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
___
Alsa-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-devel