Re: Send audio wav only on left device channel

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

 



Hi Lele,

 

if you set splitcomb like this:

 

/* Connect channel0 (left channel) to conference port slot0 */

status = pjmedia_splitcomb_set_channel(sc, 0 /* ch0 */, 0 /*options*/, conf);

status = pjmedia_splitcomb_create_rev_channel(pool, sc, 1  /* ch1 */, 0  /* options */, &sc_ch1);

status = pjsua_conf_add_port(pool, sc_ch1, &sc_ch1_slot);

 

and after creating wav player connect it to conference bridge like this:

 

status = pjsua_conf_add_port(pool, file_port, &file_slot);

 

then you have following ports in conference bridge:

 

0 = left

sc_ch1_slot = right

file_slot = wav player

 

Now connect wav audio to left channel like this:

 

pjsua_conf_connect(file_slot, 0);

 

Best regards

Adam

 

 

Von: pjsip [mailto:pjsip-bounces@xxxxxxxxxxxxxxx] Im Auftrag von Lele
Gesendet: Mittwoch, 15. März 2017 16:58
An: pjsip@xxxxxxxxxxxxxxx
Betreff: Send audio wav only on left device channel

 

Hi guys,

I’m working on pjmedia split audio channel left/right and I have the following issue. I don’t know how to send audio from wav audio file only on left channel of default my audio device. My source code is:

 

//Test split left right channel

pjmedia_snd_port *snd;

pjmedia_port *sc, *sc_ch1;

pjsua_conf_port_id   sc_slot, sc_ch1_slot;

 

pjmedia_port *conf;

pj_status_t status;

 

/* Disable existing sound device */

conf = pjsua_set_no_snd_dev();

 

/* Create stereo-mono splitter/combiner */

status = pjmedia_splitcomb_create( pool, PJMEDIA_PIA_SRATE(&conf->info) /* clock rate */, 2 /* stereo */, 2 * PJMEDIA_PIA_SPF(&conf->info), PJMEDIA_PIA_BITS(&conf->info), 0 /* options */, &sc);

pj_assert(status == PJ_SUCCESS);

 

/* Connect channel0 (left channel) to conference port slot0 */

status = pjmedia_splitcomb_set_channel(sc, 1 /* ch1 */, 0 /*options*/, conf);

pj_assert(status == PJ_SUCCESS);

 

/* Create reverse channel for channel1 (right channel?)... */

status = pjmedia_splitcomb_create_rev_channel(pool, sc, 0  /* ch0 */, 0  /* options */, &sc_ch1);

pj_assert(status == PJ_SUCCESS);

 

status = pjsua_conf_add_port(pool, sc_ch1, &sc_ch1_slot);

pj_assert(status == PJ_SUCCESS);

 

pj_caching_pool cp;

pj_pool_t *poolAs;

pjmedia_port *file_port;

pjmedia_snd_port *snd_port;

 

/* Must create a pool factory before we can allocate any memory. */

pj_caching_pool_init(&cp, &pj_pool_factory_default_policy, 0);

 

/* Create memory pool for our file player */

poolAs = pj_pool_create(&cp.factory, /* pool factory */ "wav", /* pool name. */ 4000, /* init size */ 4000, /* increment size */ NULL /* callback on error */);

 

/* Create file media port from the WAV file */

status = pjmedia_wav_player_port_create(pool, /* memory pool */ "testSound.wav", /* file to play */ 20, /* ptime. */ 0, /* flags */ 0, /* default buffer */ &file_port/* returned port */    );

if (status != PJ_SUCCESS) {

       error("Unable to use WAV file", status);

}

 

/* Create sound player port. */

status = pjmedia_snd_port_create_player(poolAs, /* pool */

                     -1, /* use default dev. */

                     PJMEDIA_PIA_SRATE(&file_port->info),/* clock rate. */

                     PJMEDIA_PIA_CCNT(&file_port->info),/* # of channels. */

                     PJMEDIA_PIA_SPF(&file_port->info), /* samples per frame. */

                     PJMEDIA_PIA_BITS(&file_port->info),/* bits per sample. */

                     0, /* options */

                     &snd /* returned port */

              );

              if (status != PJ_SUCCESS) {

                     error("Unable to open sound device", status);

              }

 

              /* Connect file port to the sound player.

             

              status = pjmedia_snd_port_connect(snd, file_sc);

 

 

              /*

              * File should be playing and looping now, using sound device's thread.

              */

 

 

              /* Sleep to allow log messages to flush */

              pj_thread_sleep(100);

 

How can I solve the issue? Thanks in advice.

 

Best regards

Ll


DFS Deutsche Flugsicherung GmbH
Am DFS-Campus
D - 63225 Langen

Tel.: +49-(0)6103-707-0

Sitz der Gesellschaft: Langen/Hessen
Zuständiges Registergericht: AG Offenbach am Main, HRB 34977
Vorsitzende des Aufsichtsrats: Dr. Martina Hinricher
Geschäftsführer: Prof. Klaus-Dieter Scheurle (Vors.), Robert Schickling, Dr. Michael Hann

Internet: http://www.dfs.de
Public-Key der DFS: http://www.dfs.de/dfs/public_key.asc


_______________________________________________
Visit our blog: http://blog.pjsip.org

pjsip mailing list
pjsip@xxxxxxxxxxxxxxx
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org

[Index of Archives]     [Asterisk Users]     [Asterisk App Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [Linux API]
  Powered by Linux