Csound Csound-dev Csound-tekno Search About

[Cs-dev] can't open device

Date2009-11-26 18:22
FromFelipe Sateler
Subject[Cs-dev] can't open device
AttachmentsNone  None  
When I have my music player paused (or any program with audio, but not
necessarily audio running), csound can't play, either portaudio or alsa.
When using portaudio I get:

PortAudio V19-devel (built Sep  1 2009)
PortAudio: available output devices:
   0: HDA Intel: STAC92xx Digital (hw:0,1)
   1: iec958
   2: spdif
   3: default
   4: dmix
PortAudio: failed to obtain device info.
Failed to initialize real time audio output


And with alsa I get

 *** Can't open device 'plughw' for audio output: Device or resource busy

Now, I could say that the ALSA driver is buggy and doesn't allow
multiple apps at the same time, but I can open any number of other audio
applications at the same time (eg, mplayer, vlc, youtube videos) without
problems.

Any hints on why is this? My soundcard is an Intel HDA (the integrated
chip on my inspiron 1420 notebook).


Hmm, I just discovered that if I use -odac:default -B 1881 -b 1881 I can
get sound. csound insisted that I set -B 1881 and the only way to do
that was to set -b 1881, since otherwise csound rounds up to the next
multiple of -b.


-- 
Saludos,
Felipe Sateler

Date2009-11-26 19:27
Fromvictor
SubjectRe: [Cs-dev] can't open device
Sounds like a dmix issue. There was a patch fixing the buffer size issue for 
use with the dmix only last week or the week before.

Victor
----- Original Message ----- 
From: "Felipe Sateler" 
To: "Developer discussions" 
Sent: Thursday, November 26, 2009 6:22 PM
Subject: [Cs-dev] can't open device


> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 
> 30-Day
> trial. Simplify your report design, integration and deployment - and focus 
> on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july


--------------------------------------------------------------------------------


> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
> 


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2009-11-26 22:13
FromFelipe Sateler
SubjectRe: [Cs-dev] can't open device
AttachmentsNone  None  
On Thu, 2009-11-26 at 19:27 +0000, victor wrote:
> Sounds like a dmix issue. There was a patch fixing the buffer size issue for 
> use with the dmix only last week or the week before.

Ah, I see that CVS auto-corrects the -b and -B values. I've checked the
sources, though, and thought the default for alsa should change from
"plughw" to "default". I'm not quite sure how to make portaudio use the
default alsa interface instead of whatever it is choosing. Does anyone
object to that change?


-- 
Saludos,
Felipe Sateler

Date2009-11-27 21:49
FromFelipe Sateler
SubjectRe: [Cs-dev] can't open device
AttachmentsNone  None  
On Thu, 2009-11-26 at 19:13 -0300, Felipe Sateler wrote:
> On Thu, 2009-11-26 at 19:27 +0000, victor wrote:
> > Sounds like a dmix issue. There was a patch fixing the buffer size issue for 
> > use with the dmix only last week or the week before.
> 
> Ah, I see that CVS auto-corrects the -b and -B values. I've checked the
> sources, though, and thought the default for alsa should change from
> "plughw" to "default". I'm not quite sure how to make portaudio use the
> default alsa interface instead of whatever it is choosing. Does anyone
> object to that change?

I've changed the default in alsa.


-- 
Saludos,
Felipe Sateler

Date2009-11-27 22:26
FromLilith Bryant
SubjectRe: [Cs-dev] can't open device
I second the change to make "default" the default for alsa output. 
Please do this.  After all it's called "default" for a reason.

Are you sure about PortAudio?.  My testing indicates CVS PortAudio picks 
"default" if it's available.

However, PortAudio's xrun recovery algorithm doesn't work with dmix, so 
it's nearly useless as it is.   You can locally patch the CVS PortAudio 
sources:

In src/hostapi/pa_linux_alsa.c: PaAlsaStream_HandleXrun (near line 2400)

change:
	errplayback = snd_pcm_recover( self->playback.pcm, -EPIPE, 0 );
to
	errplayback = 1;

and
	errcapture = snd_pcm_recover( self->capture.pcm, -EPIPE, 0 );
to:
	errcapture = 1;

This forces a complete pcm re-setup on an xrun, because snd_pcm_recover 
seems to return 0, but does nothing useful with dmix.

I don't fancy battling with both the ALSA and the PortAudio people to 
get someone to fix this properly, but there's you are, this works.

This also makes gnaural and audacity work reliably too :)

Lilith.

On 11/28/2009 10:49 AM, Felipe Sateler wrote:
> On Thu, 2009-11-26 at 19:13 -0300, Felipe Sateler wrote:
>> On Thu, 2009-11-26 at 19:27 +0000, victor wrote:
>>> Sounds like a dmix issue. There was a patch fixing the buffer size issue for
>>> use with the dmix only last week or the week before.
>>
>> Ah, I see that CVS auto-corrects the -b and -B values. I've checked the
>> sources, though, and thought the default for alsa should change from
>> "plughw" to "default". I'm not quite sure how to make portaudio use the
>> default alsa interface instead of whatever it is choosing. Does anyone
>> object to that change?
>
> I've changed the default in alsa.
>
>
>
>
>
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
>
>
>
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2009-11-28 08:20
FromVictor Lazzarini
SubjectRe: [Cs-dev] can't open device
Hi Lilith,

have you told the PortAudio developers about this xrun situation?  
They'd probably be interested in incorporating your solution.

Victor
On 27 Nov 2009, at 22:26, Lilith Bryant wrote:

> I second the change to make "default" the default for alsa output.
> Please do this.  After all it's called "default" for a reason.
>
> Are you sure about PortAudio?.  My testing indicates CVS PortAudio  
> picks
> "default" if it's available.
>
> However, PortAudio's xrun recovery algorithm doesn't work with dmix,  
> so
> it's nearly useless as it is.   You can locally patch the CVS  
> PortAudio
> sources:
>
> In src/hostapi/pa_linux_alsa.c: PaAlsaStream_HandleXrun (near line  
> 2400)
>
> change:
> 	errplayback = snd_pcm_recover( self->playback.pcm, -EPIPE, 0 );
> to
> 	errplayback = 1;
>
> and
> 	errcapture = snd_pcm_recover( self->capture.pcm, -EPIPE, 0 );
> to:
> 	errcapture = 1;
>
> This forces a complete pcm re-setup on an xrun, because  
> snd_pcm_recover
> seems to return 0, but does nothing useful with dmix.
>
> I don't fancy battling with both the ALSA and the PortAudio people to
> get someone to fix this properly, but there's you are, this works.
>
> This also makes gnaural and audacity work reliably too :)
>
> Lilith.
>
> On 11/28/2009 10:49 AM, Felipe Sateler wrote:
>> On Thu, 2009-11-26 at 19:13 -0300, Felipe Sateler wrote:
>>> On Thu, 2009-11-26 at 19:27 +0000, victor wrote:
>>>> Sounds like a dmix issue. There was a patch fixing the buffer  
>>>> size issue for
>>>> use with the dmix only last week or the week before.
>>>
>>> Ah, I see that CVS auto-corrects the -b and -B values. I've  
>>> checked the
>>> sources, though, and thought the default for alsa should change from
>>> "plughw" to "default". I'm not quite sure how to make portaudio  
>>> use the
>>> default alsa interface instead of whatever it is choosing. Does  
>>> anyone
>>> object to that change?
>>
>> I've changed the default in alsa.
>>
>>
>>
>>
>>
>> ------------------------------------------------------------------------------
>> Let Crystal Reports handle the reporting - Free Crystal Reports  
>> 2008 30-Day
>> trial. Simplify your report design, integration and deployment -  
>> and focus on
>> what you do best, core application coding. Discover what's new with
>> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
>>
>>
>>
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>
>
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008  
> 30-Day
> trial. Simplify your report design, integration and deployment - and  
> focus on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2009-11-29 10:28
FromLilith Bryant
SubjectRe: [Cs-dev] can't open device
More investigation is needed before I raise the issue with them.  I 
initially thought it was a problem with ALSA, but I must correct myself, 
all simple ALSA dmix xrun handling test cases I have made seem to work 
flawlessly, so there's something else going on with PortAudio that I 
haven't gotten to the bottom of just yet.

Lilith.

On 11/28/2009 09:20 PM, Victor Lazzarini wrote:
> Hi Lilith,
>
> have you told the PortAudio developers about this xrun situation?
> They'd probably be interested in incorporating your solution.
>
> Victor
> On 27 Nov 2009, at 22:26, Lilith Bryant wrote:
>
>> I second the change to make "default" the default for alsa output.
>> Please do this.  After all it's called "default" for a reason.
>>
>> Are you sure about PortAudio?.  My testing indicates CVS PortAudio
>> picks
>> "default" if it's available.
>>
>> However, PortAudio's xrun recovery algorithm doesn't work with dmix,
>> so
>> it's nearly useless as it is.   You can locally patch the CVS
>> PortAudio
>> sources:
>>
>> In src/hostapi/pa_linux_alsa.c: PaAlsaStream_HandleXrun (near line
>> 2400)
>>
>> change:
>> 	errplayback = snd_pcm_recover( self->playback.pcm, -EPIPE, 0 );
>> to
>> 	errplayback = 1;
>>
>> and
>> 	errcapture = snd_pcm_recover( self->capture.pcm, -EPIPE, 0 );
>> to:
>> 	errcapture = 1;
>>
>> This forces a complete pcm re-setup on an xrun, because
>> snd_pcm_recover
>> seems to return 0, but does nothing useful with dmix.
>>
>> I don't fancy battling with both the ALSA and the PortAudio people to
>> get someone to fix this properly, but there's you are, this works.
>>
>> This also makes gnaural and audacity work reliably too :)
>>
>> Lilith.
>>
>> On 11/28/2009 10:49 AM, Felipe Sateler wrote:
>>> On Thu, 2009-11-26 at 19:13 -0300, Felipe Sateler wrote:
>>>> On Thu, 2009-11-26 at 19:27 +0000, victor wrote:
>>>>> Sounds like a dmix issue. There was a patch fixing the buffer
>>>>> size issue for
>>>>> use with the dmix only last week or the week before.
>>>>
>>>> Ah, I see that CVS auto-corrects the -b and -B values. I've
>>>> checked the
>>>> sources, though, and thought the default for alsa should change from
>>>> "plughw" to "default". I'm not quite sure how to make portaudio
>>>> use the
>>>> default alsa interface instead of whatever it is choosing. Does
>>>> anyone
>>>> object to that change?
>>>
>>> I've changed the default in alsa.
>>>
>>>
>>>
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> Let Crystal Reports handle the reporting - Free Crystal Reports
>>> 2008 30-Day
>>> trial. Simplify your report design, integration and deployment -
>>> and focus on
>>> what you do best, core application coding. Discover what's new with
>>> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
>>>
>>>
>>>
>>> _______________________________________________
>>> Csound-devel mailing list
>>> Csound-devel@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>
>>
>> ------------------------------------------------------------------------------
>> Let Crystal Reports handle the reporting - Free Crystal Reports 2008
>> 30-Day
>> trial. Simplify your report design, integration and deployment - and
>> focus on
>> what you do best, core application coding. Discover what's new with
>> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>
>
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net