Re: [linux-audio-dev] OSS question

New Message Reply About this list Date view Thread view Subject view Author view Other groups

Subject: Re: [linux-audio-dev] OSS question
From: Iain Sandoe (iain_AT_sandoe.co.uk)
Date: Mon Jul 30 2001 - 16:04:23 EEST


Hi Jan,

Mon, Jul 30, 2001, Jan Weil wrote:
> I really enjoy reading all your posts about GUI-Design, packaging and
> (sometimes ;) linux audio development.

;-)

> Now I have a question which probably will be answered in between.
>
> Writing a frame based (10 ms) decoder/player, how do I ensure that the
> (OSS) audio device is not blocked (still open) when my application is
> killed?

your frames are 10ms - but is that also true of the OSS driver? (see
questions below)..

> In detail:
> At the moment I do the following:
>
> open device
> decode frame, play frame
> decode frame, play frame
> [...]
> close device
>
> When my process (I do not use threads) is killed the audio device is
> blocked for at least two seconds.

what size (and how many) fragments are you using (and what AFMT)?

> Do I have to 'open - write to - close' the device for every frame?

No. That probably wouldn't work at all - there's a hint in the OSS manual
that allows drivers to buffer two frames before starting output...

> Do I have to setup a signal handler for SIGTERM to close the audio
> device properly?

This shouldn't be necessary either.

---

OK. This may depend on how well the OSS driver conforms to the OSS spec. and will depend on the fragment size. When you close the device audio that is already buffered may still be output (although I'd expect the driver to keep your application in sleep until it was finished).

You could try issuing a SNDCTL_DSP_POST (which tells the driver you're through with sending audio) - or, if that fails, a SNDCTL_DSP_RESET.

If that doesn't work ... then maybe you could look at the driver and see if there's something missing from the OSS implementation.

ciao, Iain.


New Message Reply About this list Date view Thread view Subject view Author view Other groups

This archive was generated by hypermail 2b28 : Mon Jul 30 2001 - 16:04:57 EEST