Ignore:
Timestamp:
Mar 15, 2006 8:56:04 PM (18 years ago)
Author:
bennylp
Message:

Tidying up sound device, register PortAudio? error codes, and initial support for stereo sound device (untested)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjmedia/src/pjmedia/conference.c

    r318 r319  
    140140    unsigned              samples_per_frame;    /**< Samples per frame.     */ 
    141141    unsigned              bits_per_sample;      /**< Bits per sample.       */ 
    142     pj_snd_stream_info    snd_info;     /**< Sound device parameter.        */ 
    143142}; 
    144143 
     
    287286 
    288287 
    289     /* Init default sound device parameters. */ 
    290     pj_memset(&conf->snd_info, 0, sizeof(conf->snd_info)); 
    291     conf->snd_info.samples_per_sec = conf->clock_rate; 
    292     conf->snd_info.bits_per_sample = conf->bits_per_sample; 
    293     conf->snd_info.samples_per_frame = conf->samples_per_frame; 
    294     conf->snd_info.bytes_per_frame = conf->samples_per_frame *  
    295                                conf->bits_per_sample / 8; 
    296     conf->snd_info.frames_per_packet = 1; 
    297      
    298288 
    299289    /* Create port */ 
     
    389379static pj_status_t create_sound( pjmedia_conf *conf ) 
    390380{ 
     381    pj_status_t status; 
     382 
    391383    /* Open recorder only if mic is not disabled. */ 
    392384    if ((conf->options & PJMEDIA_CONF_NO_MIC) == 0) { 
    393         conf->snd_rec = pj_snd_open_recorder(-1 ,&conf->snd_info,  
    394                                              &rec_cb, conf); 
    395         if (conf->snd_rec == NULL) { 
    396             return -1; 
     385        status = pj_snd_open_recorder(-1, conf->clock_rate, 1,  
     386                                      conf->samples_per_frame, 
     387                                      conf->bits_per_sample, 
     388                                      &rec_cb, conf, &conf->snd_rec); 
     389        if (status != PJ_SUCCESS) { 
     390            conf->snd_rec = NULL; 
     391            return status; 
    397392        } 
    398393    } 
    399394 
    400395    /* Open player */ 
    401     conf->snd_player = pj_snd_open_player(-1, &conf->snd_info, &play_cb, conf); 
    402     if (conf->snd_player == NULL) { 
     396    status = pj_snd_open_player(-1, conf->clock_rate, 1, 
     397                                conf->samples_per_frame, 
     398                                conf->bits_per_sample,  
     399                                &play_cb, conf, &conf->snd_player); 
     400    if (status != PJ_SUCCESS) { 
    403401        if (conf->snd_rec) { 
    404402            pj_snd_stream_close(conf->snd_rec); 
     403            conf->snd_rec = NULL; 
    405404        } 
    406         return -1; 
     405        conf->snd_player = NULL; 
     406        return status; 
    407407    } 
    408408 
Note: See TracChangeset for help on using the changeset viewer.