o Wojciech Wrona [12/22/08 21:46]:
Stefan Sayer wrote:
you can use AmAudioQueue (AmAdvancedAudio.h) to write audio to two
AmAudio devices.
put both the audio_connector and the AmAudioFile in the write queue,
and it will write to both. You don't even have to modify the
AmAudioConnector, you just catch the b2abconnectaudio event, and after
it is connected, you get the output with getOutput() and put it in the
queue, like
MySession::onB2ABEvent(ev) {
AmB2ABCallerSession::onB2ABEvent(ev);
if (ev-event-id==B2ABConnectAudio) {
lockAudio();
audio_queue.pushAudio(getOutput(), AmAudioQueue::OutputQueue,
AmAudioQueue::Back, true, false);
audio_queue.pushAudio(my_audio_file, AmAudioQueue::OutputQueue,
AmAudioQueue::Back, true, false);
setOutput(audio_queue);
unlockAudio();
}
Now, with r1203 you can use the AmAudioMixIn to mix the audio from two
AmAudios by using AUDIO_MIXIN_IMMEDIATE_START | AUDIO_MIXIN_ONCE as
flags. Additionally, you can use AmAudioBridge to connect read and
write (input and output), this way by using getInput() and with an
extra AmAudioQueue you can do the whole thing in the caller session
easily I guess.
I'm not sure that i get it well. So in Your solution both legs of the
b2abua call all recorded to diffrent files ? So, there is now way to
write contents from one AmAudio to another ?
Can You explain a little more that idea with AmAudioMixIn ? I guess that
it was intented to mix AmAudio with a static file. An AmAudioFile object
is especially AmAudio so i can mix two files, but what then ? I get
another AmAudio object which i don't know how to write to disk :(
well, AmAudioMixIn mixes on the output side (get()/read()), thus you'd
have to tweak audio queues a bit more for it to work. note that the
second AmAudio in AmAudioMixIn is AmAudioFile only because of my
lazyness - for rewind() it could also be dynamic_cast'ed.
i figured for li the audio is not mixed, and the audio queue is already
there...so i added AmAudioMixer, which mixes on input from a number of
sources and writes to a number of sinks. it is not as elegant a solution
as the AudioPumps Raphael proposed some time back, but together with
AmAudioQueue it should suffice for most, if not all applications. you
can use it like this
if (ev->event_id == B2ABConnectAudio) {
// delayed processing of first INVITE request
AmSession::onInvite(invite_req);
+ AmB2ABCallerSession::onB2ABEvent(ev);
+ my_audio_file.open(fname, AmAudioFile::Write);
+
+ src1 = mixer.addSource();
+ src2 = mixer.addSource();
+ mixer.addSink(&my_audio_file);
+
+ lockAudio();
+ audio_queue.pushAudio(getOutput(), AmAudioQueue::OutputQueue,
AmAudioQueue::Back, false, true);
+ audio_queue.pushAudio(src1, AmAudioQueue::OutputQueue,
AmAudioQueue::Back, true, false);
+
+ audio_queue.pushAudio(getInput(), AmAudioQueue::InputQueue,
AmAudioQueue::Back, true, false);
+ audio_queue.pushAudio(src2, AmAudioQueue::InputQueue,
AmAudioQueue::Back, true, false);
+
+ unlockAudio();
+ setInOut(&audio_queue,&audio_queue);
+ return;
}
don't forget to popAndGetAudio the things from the queues otherwise it
will think it owns it and try to delete them twice in the dtor.
happy hacking
Stefan
Best regards,
--
Stefan Sayer
VoIP Services
[email protected]
www.iptego.com
IPTEGO GmbH
Am Borsigturm 40
13507 Berlin
Germany
Amtsgericht Charlottenburg, HRB 101010
Geschaeftsfuehrer: Alexander Hoffmann
_______________________________________________
Semsdev mailing list
[email protected]
http://lists.iptel.org/mailman/listinfo/semsdev