Ignore:
Timestamp:
Mar 23, 2006 1:15:59 PM (18 years ago)
Author:
bennylp
Message:

Changed sound device framework to allow opening bidirectional streams from one device

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjmedia/include/pjmedia/sound.h

    r321 r352  
    112112 
    113113/** 
    114  * Create a new audio stream for audio capture purpose. 
     114 * Create sound stream for both capturing audio and audio playback,  from the  
     115 * same device. This is the recommended way to create simultaneous recorder  
     116 * and player streams, because it should work on backends that does not allow 
     117 * a device to be opened more than once. 
     118 * 
     119 * @param rec_id            Device index for recorder/capture stream, or 
     120 *                          -1 to use the first capable device. 
     121 * @param play_id           Device index for playback stream, or -1 to use  
     122 *                          the first capable device. 
     123 * @param clock_rate        Sound device's clock rate to set. 
     124 * @param channel_count     Set number of channels, 1 for mono, or 2 for 
     125 *                          stereo. The channel count determines the format 
     126 *                          of the frame. 
     127 * @param samples_per_frame Number of samples per frame. 
     128 * @param bits_per_sample   Set the number of bits per sample. The normal  
     129 *                          value for this parameter is 16 bits per sample. 
     130 * @param rec_cb            Callback to handle captured audio samples. 
     131 * @param play_cb           Callback to be called when the sound player needs 
     132 *                          more audio samples to play. 
     133 * @param user_data         User data to be associated with the stream. 
     134 * @param p_snd_strm        Pointer to receive the stream instance. 
     135 * 
     136 * @return                  PJ_SUCCESS on success. 
     137 */ 
     138PJ_DECL(pj_status_t) pjmedia_snd_open(int rec_id, 
     139                                      int play_id, 
     140                                      unsigned clock_rate, 
     141                                      unsigned channel_count, 
     142                                      unsigned samples_per_frame, 
     143                                      unsigned bits_per_sample, 
     144                                      pjmedia_snd_rec_cb rec_cb, 
     145                                      pjmedia_snd_play_cb play_cb, 
     146                                      void *user_data, 
     147                                      pjmedia_snd_stream **p_snd_strm); 
     148 
     149 
     150/** 
     151 * Create a unidirectional audio stream for capturing audio samples from 
     152 * the sound device. 
    115153 * 
    116154 * @param index             Device index, or -1 to let the library choose the  
     
    129167 * @return                  PJ_SUCCESS on success. 
    130168 */ 
    131 PJ_DECL(pj_status_t) pjmedia_snd_open_recorder( int index, 
     169PJ_DECL(pj_status_t) pjmedia_snd_open_rec( int index, 
    132170                                           unsigned clock_rate, 
    133171                                           unsigned channel_count, 
     
    139177 
    140178/** 
    141  * Create a new audio stream for playing audio samples. 
     179 * Create a unidirectional audio stream for playing audio samples to the 
     180 * sound device. 
    142181 * 
    143182 * @param index             Device index, or -1 to let the library choose the  
     
    166205                                         pjmedia_snd_stream **p_snd_strm ); 
    167206 
     207 
    168208/** 
    169209 * Start the stream. 
Note: See TracChangeset for help on using the changeset viewer.