[pulseaudio-discuss] dynamic routing through pulse audio
Himanshu Chug
himanshu.chug at gmail.com
Mon Jun 6 01:08:38 PDT 2011
Thanks Colin for your suggestions, that give me some good directions to
start with.
I tried to modify existing module "module-cork-music-on-phone" , I have few
queries:
1. I am now able to Cork(Pause) the "event" stream while a new "phone"
stream arrives. but instead my requirement is to to permanently STOP the
"event" stream
instead of Corking while "phone" call stream exists? Is there any
event/api I can use to achieve this?
(Currently I am corking the stream using pa_sink_input_send_event(ignore,
PA_STREAM_EVENT_REQUEST_CORK, NULL) API )
2. I just need to give a try to play sample cache (beep) first in the same
module (module-cork-music-on-phone)
{Just Playback no role supression initially at this stage} for that:
- How to init the module so that it would load the suppression_sound
(if present) into the sample cache
- Where (Location) to copy the sound (beep) .wav file ?
- How to Play the .wav from the module?
Thanks in advance.
Best Regards,
Himanshu Chug
> 'Twas brillig, and Himanshu Chug at 02/06/11 14:29 did gyre and gimble:
> > Thanks Colin. got your point here.
> > Now similar to music cork over phone, I need to cork the stream with
> > role="event" when another stream with role="phone" becomes active.
> > (here event can be sms alert etc) , Do I need to write any new module
> > for this? or this can be achieved some how, any pointers can be helpful?
>
> Initially I'd suggest that you could modify cork-music-on-phone to be
> more generic (I've a funny feeling I've suggested this to someone before
> too), perhaps renaming it to module-auto-cork or something suitably
> generic. Then make it configurable which streams to cork and on which
> triggers. e.g.
>
> load-module module-auto-cork trigger_roles=phone,event
> cork_roles=music,video
>
> The defaults being "phone" for trigger_roles and "music,video" for
> cork_roles.
>
> But...
>
> > I need to Play a Beep kind of sound when an "event" stream (say sms)
> > came during active "phone" call stream and cork the actual "event"
> > (sms tone) stream.
> >
> > So there are two requirements now:
> > 1. Cork the "event" stream during active "phone" stream.
> > 2. Mixing the "phone" stream with new Beep stream.
>
> OK, so now this gets a little more complicated. Ultimately you want to
> change the event sound to something else... I think this specifically
> requires a more specialised module.
>
> Something that, when it finds an event stream while a phone stream is
> active, actually plays a different, (much more subtle and unobtrusive)
> sound (perhaps a sample in the sound sample cache?) instead.
>
> I think this in particular is more specialise and thus has to be handled
> before the module-auto-cork got it's hands on it.
>
> For that reason, I'd suggest a module-event-suppress module, that works
> in the following way:
>
> load-module module-role-suppress suppress_roles="event"
> suppression_sound=/path/to/sound.wav
>
> This module would work pretty much like I describe above. On init, it
> would load the suppression_sound (if present) into the sample cache and
> then suppress any event sounds and instead play the sample cache.
>
> I think this would work pretty well.
>
>
On Thu, Jun 2, 2011 at 7:17 PM, Himanshu Chug <himanshu.chug at gmail.com>wrote:
> Adding to my question:
>
> + I need to Play a Beep kind of sound when an "event" stream (say sms) came
> during active "phone" call stream and cork the actual "event" (sms tone)
> stream.
>
> So there are two requirements now:
> 1. Cork the "event" stream during active "phone" stream.
> 2. Mixing the "phone" stream with new Beep stream.
>
> Thanks,
> Himanshu
>
>
>
> On Thu, Jun 2, 2011 at 5:59 PM, Himanshu Chug <himanshu.chug at gmail.com>wrote:
>
>> Thanks Colin. got your point here.
>> Now similar to music cork over phone, I need to cork the stream with
>> role="event" when another stream with role="phone" becomes active.
>> (here event can be sms alert etc) , Do I need to write any new module for
>> this? or this can be achieved some how, any pointers can be helpful?
>>
>> Best Regards,
>> Himanshu
>>
>>
>> On Wed, Jun 1, 2011 at 2:03 PM, Colin Guthrie <gmane at colin.guthr.ie>wrote:
>>
>>> 'Twas brillig, and Himanshu Chug at 01/06/11 07:27 did gyre and gimble:
>>> > Thanks for the quick reply Amanda, actually I need to understand this
>>> in
>>> > some more details ,
>>> > since I am new to pulseaudio please forgive if I ask something with not
>>> > much sense
>>> > 1. What this module do? and how PA modules can be loaded?
>>>
>>> It more or less does as Amanda suggests. It corks/pauses the music
>>> streams when a phone stream is active on the same sink.
>>>
>>> In order to "cork" the application must handle cork requests from PA
>>> (thus allowing the app to properly pause itself). Just in case the app
>>> does not handle the cork, PA will mute the stream also. When the phone
>>> stream disappears, the stream is unmuted and the uncork request is sent.
>>> It's up to the music app to handle this gracefully.
>>>
>>> Modules are loaded typically by the default.pa script that is processed
>>> on startup. module-cork-music-on-phone is part of the default.pa we
>>> ship.
>>>
>>> > 2. How and When the module "module-cork-music-on-phone" comes to
>>> > picture or gets loaded? What condition triggers to load this module?
>>>
>>> It's listens for new streams and when it find both two streams tagged
>>> with phone and a music respectively, it will cork/pause the music one.
>>>
>>> > 3. I am setting the role through music application.
>>>
>>> Yeah, if you set it explicitly that's best but PA also tries to parse
>>> the .desktop file shipped with apps to try and augment the properties if
>>> possible. This is why, e.g. we know that lastfm-player (which uses alsa)
>>> is a "Music" app.
>>>
>>> HTHs
>>>
>>> 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 at lists.freedesktop.org
>>> http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss
>>>
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/pulseaudio-discuss/attachments/20110606/3c705162/attachment.html>
More information about the pulseaudio-discuss
mailing list