[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Discuss-gnuradio] Problem with valve and audio sink

From: Volker Schroer
Subject: Re: [Discuss-gnuradio] Problem with valve and audio sink
Date: Tue, 07 Dec 2010 14:23:49 +0100
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv: Gecko/20101027 Thunderbird/3.0.10

Introducing a static variable helps in my case, but in other situations it might still fail.

In between I had a deeper look to the source and I propose a solution depending on the state of the stream.

--- audio_alsa_sink.cc  2010-12-07 14:05:30.000000000 +0100
+++ audio_alsa_sink_new.cc      2010-12-07 14:06:42.000000000 +0100
@@ -219,9 +219,15 @@
   int nchan = ninputs;
   int err;

-  // FIXME check_topology may be called more than once.
+  // Check the state of the stream
// Ensure that the pcm is in a state where we can still mess with the hw_params
+  snd_pcm_state_t state;
+  state=snd_pcm_state(d_pcm_handle);
+  if ( state== SND_PCM_STATE_RUNNING)
+    return true;  // If stream is running, don't change any parameters
+  else if(state == SND_PCM_STATE_XRUN )
+ snd_pcm_prepare ( d_pcm_handle ); // Prepare stream on underrun, and we can set parameters;
   bool special_case = nchan == 1 && d_special_case_mono_to_stereo;
   if (special_case)
     nchan = 2;

Thank you


try running the same fix with the static variable, this problem will show up 
even with simple setups because it's in the alsa audio source block.  even 
though the fix works i wouldn't recommend it for long term solution because 
it's a hack.  you can look into the FIXME section of the code to make a more 
permenant solution.


-----Original Message-----
From: Volker Schroer<address@hidden>
To: Discuss-gnuradio<address@hidden>
Sent: Mon, Dec 6, 2010 11:40 am
Subject: [Discuss-gnuradio] Problem with valve and audio sink

Hi all,
I get an runtime error, when switching a valve.
I saw a similar problem some months ago, but the setup was different.
My setup is quite easy:
A signal source ( cosine, float ) connected to a audio sink.
he same signal source is connected to a valve and the valve is
onnected to a scope sink.
The valve is switched by a checkbox.
Switching the valve leads to
audio_alsa_sink[hw:0,0]: snd_pcm_hw_params failed: File descriptor in
ad state
erminate called after throwing an instance of 'std::runtime_error'
   what():  check topology failed on audio_alsa_sink(1) using ninputs=1,
I wonder how the valve affects the audio sink.
Any ideas ?
Thanks in advance
iscuss-gnuradio mailing list

reply via email to

[Prev in Thread] Current Thread [Next in Thread]