Jason Penton wrote:
> Hi *,
>
> Is there anyone that give me / point me to a tutorial on mixing audio 
> streams in SEMS without using a conferencechannel?
>

Hi Jason,

i cannot point you at any tutorial, as there are none on that subject. 
But i can give you some good hints.

The first thing you need is something like a Y-cable, if you know what i 
mean ;-) If you have a close look at the AmSessionAudioConnector 
(AmB2ABSession.{h,cpp}), you will see that it interconnects both 
sessions with one buffer in the middle for each stream direction. The 
buffer is implemented by AmAudioDelayBridge.

If your hack yourself into the write function, you could write the data 
to another destination as well (for example to a mixer ;-)): this is the 
Y-cable.

Then you need a mixer: AmMultipartyMixer is your (only?) choice. It has 
a very easy interface. Then, you can use the same strategy as proposed 
in Stefan's emails: one channel for each side of the call, and a third 
for recording. Then, you just have to add the recording code to one of 
the "read" sides.

Here is what i mean, expressed with *very simplified* code:

class AmAudioDelayBridgeY: public AmAudioDelayBridge
{
    AmMultipartyMixer* mixer;
    unsigned int channel;

    AmAudioDelayBridgeY(AmMultipartyMixer* mixer)
       : AmAudioDelayBridge(), mixer(mixer)
    {
       channel = mixer->addChannel();
    }

    int write(...){
       mixer->PutChannelPacket(channel,ts,buffer,size);
       return AmAudioDelayBridge::write(...);
    }
};


class AmAudioDelayBridgeRec: public AmAudioDelayBridgeY
{
    unsigned int rec_channel;

    AmAudioDelayBridgeRec(AmMultipartyMixer* mixer)
       : AmAudioDelayBridgeY(mixer)
    {
       rec_channel = mixer->addChannel();
    }

    int read(...){
       mixer->GetChannelPacket(rec_channel,ts,buffer,size);
       return AmAudioDelayBridge::read(...);
    }
};


class My_AmSessionAudioConnector {

    .../...

    //
    // instead of AmAudioDelayBridge audio_connectors[2];
    //
    AmAudioDelayBridgeY audio_connector0;
    AmAudioDelayBridgeRec audio_connector1;
    .../...
}



Well, and then you need some AmB2ABSession to use your AudioConnector 
intead of the built-in one. This will surely require some changes in 
AmB2ABSession.h, which we can review and accept/modify into trunk.


Hope this helps you!

-Raphael.
> Kind regards
> Jason
> On Fri, Jun 13, 2008 at 10:45 AM, Raphael Coeffic <[EMAIL PROTECTED] 
> <mailto:[EMAIL PROTECTED]>> wrote:
>
>     Hi Jason & Stefan,
>
>
>
>     Stefan Sayer wrote:
>
>         o Jason Penton [06/12/08 13:59]:
>          
>
>             Hi Stefan
>
>             No quite, I'm trying to record the entire conference, i.e. all
>             participants with the ultimate goal of just recording a
>             sip call using
>             sems i.e. 2 party conference being recorded.
>                
>
>         ah ok, now then thats a bit simpler, i have to say i did not
>         properly read your original post where you were saying you'd
>         just only want to do this...
>
>         so, this should be solvable with the audio queue and second
>         conference 'room' (different cid) which mixes the output from
>         the main conference and the input from the caller. but you
>         could implement this with less overhead by modifying the
>         SessionAudioConnector in AmB2ABSession so that it would
>         additionally mix the two audio streams and write them to an
>         AudioFile.
>
>          
>
>     Just out of curiosity... Is there a reason why a AmB2ABSession
>     wouldn't fit the use case? Then you just have to record what is
>     getting passed from either side and mix those two streams together.
>
>     Cheers
>     Raphael.
>
>

_______________________________________________
Semsdev mailing list
[email protected]
http://lists.iptel.org/mailman/listinfo/semsdev

Reply via email to