[pulseaudio-discuss] [PATCH] Add Rear Mic to alsa mixer paths.

2010-11-19 Thread David Henningsson
This should be a patch without any controversy. Patch is against 
stable-queue.


--
David Henningsson, Canonical Ltd.
http://launchpad.net/~diwic
From ff068f1dc07e086ba01b4a4db398d9d81f79f60b Mon Sep 17 00:00:00 2001
From: David Henningsson david.hennings...@canonical.com
Date: Fri, 19 Nov 2010 10:41:46 +0100
Subject: [PATCH] Add Rear Mic to alsa mixer paths.

Signed-off-by: David Henningsson david.hennings...@canonical.com
---
 .../alsa/mixer/paths/analog-input-mic.conf.common  |9 +
 .../alsa/mixer/paths/analog-input.conf.common  |4 
 2 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/src/modules/alsa/mixer/paths/analog-input-mic.conf.common b/src/modules/alsa/mixer/paths/analog-input-mic.conf.common
index 4663305..9bddd48 100644
--- a/src/modules/alsa/mixer/paths/analog-input-mic.conf.common
+++ b/src/modules/alsa/mixer/paths/analog-input-mic.conf.common
@@ -62,6 +62,15 @@ name = input-boost-on
 [Option Front Mic Boost:off]
 name = input-boost-off
 
+[Element Rear Mic Boost]
+switch = select
+
+[Option Rear Mic Boost:on]
+name = input-boost-on
+
+[Option Rear Mic Boost:off]
+name = input-boost-off
+
 [Element Int Mic Boost]
 switch = select
 
diff --git a/src/modules/alsa/mixer/paths/analog-input.conf.common b/src/modules/alsa/mixer/paths/analog-input.conf.common
index 6c5fae9..5e73ae6 100644
--- a/src/modules/alsa/mixer/paths/analog-input.conf.common
+++ b/src/modules/alsa/mixer/paths/analog-input.conf.common
@@ -90,6 +90,10 @@ priority = 19
 name = input-microphone
 priority = 19
 
+[Option Input Source:Rear Mic]
+name = input-microphone
+priority = 19
+
 [Option Input Source:Line]
 name = input-linein
 priority = 18
-- 
1.7.1

___
pulseaudio-discuss mailing list
pulseaudio-discuss@mail.0pointer.de
https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] How to capture one of multiple radios that these radios play at the same time?

2010-11-19 Thread Colin Guthrie
'Twas brillig, and Tsai Yu-Chin at 19/11/10 02:29 did gyre and gimble:
 Thank you for your help.
 I refer to source code of pavucontrol and I program a simple code below:

Ultimately what your code is doing is thus:

1. Get the Sink Index the stream is using.
2. Get the Monitor Source for the Sink.
3. Record from the Monitor of the Sink.


The sink monitor will contain the product of *all* streams playing on
the sink. There is a special Sink Input Monitor that you can connect
to for your recording. It's will just contain the sound for the Sink
Input itself. You still need to get the Monitor for the sink to which
your stream is attached, but you pass this in to the
pa_stream_connect_record function as a string.

In pavucontrol's mainwindow.cc see the method:
MainWindow::createMonitorStreamForSinkInput()


int sink_input_index = ?; /* You should have this value already in your
code */
int sink_monitor_source_index = ?; /* You should have this value already
in your code */
char dev[16];
pa_stream *stream;

/* assume variable ss is your sample spec and attr is your buffer
attributes */

if (!(stream = pa_stream_new(context, _(Single Radio Snooper!), ss,
NULL))) {
  /* ERROR */
  return;
}

/* Put the source which we'll record here (i.e. the montior of the sink
the stream is playing on) */
dev = snprintf(dev, sizeof(dev), %u, sink_monitor_source_index);

/* restrict the recording to just one monitor stream */
pa_stream_set_monitor_stream(stream, sink_input_index);

/* Set callbacks */
pa_stream_set_read_callback(stream, );
pa_stream_set_suspended_callback(stream, );

if (pa_stream_connect_record(stream, dev, attr, (pa_stream_flags_t)
(PA_STREAM_DONT_MOVE|PA_STREAM_ADJUST_LATENCY))  0) {
  /* ERROR */
  pa_stream_unref(stream);
  stream = NULL;
  return;
}



Obviously if the user moves your stream to another device you have to
tear down and recreate your stream against the new monitor source. Not
ideal, but should be fine in most circumstances. Sadly there isn't a way
to record the radio fully across device moves as far as I know...
although perhaps not setting the PA_STREAM_DONT_MOVE flag will allow the
record stream to automatically move if the stream is moved? I don't know...

HTHs

-- 

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited [http://www.tribalogic.net/]
Open Source:
  Mageia Contributor [http://www.mageia.org/]
  PulseAudio Hacker [http://www.pulseaudio.org/]
  Trac Hacker [http://trac.edgewall.org/]

___
pulseaudio-discuss mailing list
pulseaudio-discuss@mail.0pointer.de
https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] How to capture one of multiple radios that these radios play at the same time?

2010-11-19 Thread Tsai Yu-Chin
Thank you for your answers.
But I can't still realize how to create a Sink Input Monitor?
I also use pa_stream_set_monitor_stream method in my code before,
but it still records all streams playing on the sink.
I want to create a Sink Input Monitor; however,it seems that I
create Sink Monitor.
I want to record only one audio form a unique sink input, but I record
all audios from whole sink.

Can you teach me how to create a Sink Input Monitor to record a
single audio in one sink input again?
Maybe I am silly so that I can't realize your answer before.

Thank you very much.

2010/11/19 Colin Guthrie gm...@colin.guthr.ie:
 'Twas brillig, and Colin Guthrie at 19/11/10 11:33 did gyre and gimble:
 'Twas brillig, and Tsai Yu-Chin at 19/11/10 02:29 did gyre and gimble:
 Thank you for your help.
 I refer to source code of pavucontrol and I program a simple code below:

 Ultimately what your code is doing is thus:

 1. Get the Sink Index the stream is using.
 2. Get the Monitor Source for the Sink.
 3. Record from the Monitor of the Sink.


 The sink monitor will contain the product of *all* streams playing on
 the sink. There is a special Sink Input Monitor that you can connect
 to for your recording. It's will just contain the sound for the Sink
 Input itself. You still need to get the Monitor for the sink to which
 your stream is attached, but you pass this in to the
 pa_stream_connect_record function as a string.

 In pavucontrol's mainwindow.cc see the method:
 MainWindow::createMonitorStreamForSinkInput()


 For clarity, the code below is NOT from the above function. I meant to
 include some text saying so you could write something like this: here :)

 int sink_input_index = ?; /* You should have this value already in your
 code */
 int sink_monitor_source_index = ?; /* You should have this value already
 in your code */
 char dev[16];
 pa_stream *stream;

 /* assume variable ss is your sample spec and attr is your buffer
 attributes */

 if (!(stream = pa_stream_new(context, _(Single Radio Snooper!), ss,
 NULL))) {
   /* ERROR */
   return;
 }

 /* Put the source which we'll record here (i.e. the montior of the sink
 the stream is playing on) */
 dev = snprintf(dev, sizeof(dev), %u, sink_monitor_source_index);

 /* restrict the recording to just one monitor stream */
 pa_stream_set_monitor_stream(stream, sink_input_index);

 /* Set callbacks */
 pa_stream_set_read_callback(stream, );
 pa_stream_set_suspended_callback(stream, );

 if (pa_stream_connect_record(stream, dev, attr, (pa_stream_flags_t)
 (PA_STREAM_DONT_MOVE|PA_STREAM_ADJUST_LATENCY))  0) {
   /* ERROR */
   pa_stream_unref(stream);
   stream = NULL;
   return;
 }



 Obviously if the user moves your stream to another device you have to
 tear down and recreate your stream against the new monitor source. Not
 ideal, but should be fine in most circumstances. Sadly there isn't a way
 to record the radio fully across device moves as far as I know...
 although perhaps not setting the PA_STREAM_DONT_MOVE flag will allow the
 record stream to automatically move if the stream is moved? I don't know...

 HTHs



 --

 Colin Guthrie
 gmane(at)colin.guthr.ie
 http://colin.guthr.ie/

 Day Job:
  Tribalogic Limited [http://www.tribalogic.net/]
 Open Source:
  Mageia Contributor [http://www.mageia.org/]
  PulseAudio Hacker [http://www.pulseaudio.org/]
  Trac Hacker [http://trac.edgewall.org/]

 ___
 pulseaudio-discuss mailing list
 pulseaudio-discuss@mail.0pointer.de
 https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss

___
pulseaudio-discuss mailing list
pulseaudio-discuss@mail.0pointer.de
https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] How to capture one of multiple radios that these radios play at the same time?

2010-11-19 Thread Colin Guthrie
'Twas brillig, and Tsai Yu-Chin at 19/11/10 02:29 did gyre and gimble:
 pa_ml=pa_mainloop_new();
 pa_mlapi=pa_mainloop_get_api(pa_ml);
 context=pa_context_new(pa_mlapi,(*td).pa_ctx_name);
 pa_context_connect(context,NULL,0,NULL);
 
 if(!(stream=pa_stream_new(context,(*td).pa_ctx_name,sample_spec,NULL))){
 printf(Failed to create monitoring stream\n);
 goto quit;
 }
 
 pa_stream_set_monitor_stream(stream,atoi((*td).sink_input_index));
 pa_stream_set_read_callback(stream,read_callback,fd);
 
 uint32_t 
 monitor_source_index=get_monitor_source_index(context,pa_ml,atoi((*td).sink_input_index));
 snprintf(msi,sizeof(msi),%u,monitor_source_index);
 
 
 if(pa_stream_connect_record(stream,msi,attr,(pa_stream_flags_t)(PA_STREAM_DONT_MOVE|PA_STREAM_PEAK_DETECT))0){
 printf(Failed to connect monitoring stream\n);
 pa_stream_unref(stream);
 goto quit;
 }
 
 if(end)
 quit(pa_mlapi,0);
 
 
 signal(SIGALRM,alarm_handler);
 alarm(10);
 
 if(pa_mainloop_run(pa_ml,ret)0){
 printf(mainloop run failed.\n);
 goto quit;
 }


You appear to be using the sink_input_index value before you even run
the main loop... This value will just contain the default values and
thus I suspect they all have 0's which ultimately maps to the default
monitor source and no specific sink input.

You need to run the main loop and let all the necessary call backs be
called and get all the necessary index values before you actually use them.

Col



-- 

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited [http://www.tribalogic.net/]
Open Source:
  Mageia Contributor [http://www.mageia.org/]
  PulseAudio Hacker [http://www.pulseaudio.org/]
  Trac Hacker [http://trac.edgewall.org/]

___
pulseaudio-discuss mailing list
pulseaudio-discuss@mail.0pointer.de
https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] How to capture one of multiple radios that these radios play at the same time?

2010-11-19 Thread Tanu Kaskinen
On Fri, 2010-11-19 at 13:48 +, Colin Guthrie wrote:
 You appear to be using the sink_input_index value before you even run
 the main loop... This value will just contain the default values and
 thus I suspect they all have 0's which ultimately maps to the default
 monitor source and no specific sink input.
 
 You need to run the main loop and let all the necessary call backs be
 called and get all the necessary index values before you actually use them.

The program does run the mainloop, using pa_mainloop_iterate in a few
places. And sink_input_index is given on the command line anyway, not
queried from anywhere. To me it looks like the program is pretty
correct. I can verify that it really records the mixed audio, though. I
wonder if the separate stream monitoring feature has broken at some
point - I think it's not widely used.

-- 
Tanu

___
pulseaudio-discuss mailing list
pulseaudio-discuss@mail.0pointer.de
https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] How to capture one of multiple radios that these radios play at the same time?

2010-11-19 Thread Tsai Yu-Chin
2010/11/20 Tsai Yu-Chin yorj...@gmail.com:
 2010/11/20 Tanu Kaskinen ta...@iki.fi:
 On Fri, 2010-11-19 at 13:48 +, Colin Guthrie wrote:
 You appear to be using the sink_input_index value before you even run
 the main loop... This value will just contain the default values and
 thus I suspect they all have 0's which ultimately maps to the default
 monitor source and no specific sink input.
 I observe sink input indexs in PulseAudio Manager:
 Sink input indexs have no change when I run my code.
 But Source output appears each time,and the index of source outputs

~~~
 are increment.
~~
=There is only one source output index at the same time.


 I can't find monitor source index in PulseAudio Panel.


 You need to run the main loop and let all the necessary call backs be
 called and get all the necessary index values before you actually use them.
 So,do you want to tell me monitor source index is decided after
 running main loop and all necessary callbacks?

 Thank for your ideas.

___
pulseaudio-discuss mailing list
pulseaudio-discuss@mail.0pointer.de
https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] [PATCH] MP3 passthrough over A2DP (2nd version)

2010-11-19 Thread João Paulo Rechi Vita
Hello Pierre,

On Wed, Nov 10, 2010 at 17:00, pl bossart bossart.nos...@gmail.com wrote:
 Here's the corrected path with most comments from Tanu implemented. I
 attached some additional gstreamer patches so that people can test the
 actual functionality.

As Tanu said previously, it seems the gstreamer patches didn't make to
the list. Could you please make them available somehow? I'm also
curious to test this.

-- 
João Paulo Rechi Vita
http://jprvita.wordpress.com/
___
pulseaudio-discuss mailing list
pulseaudio-discuss@mail.0pointer.de
https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss