Changeset 4204:79a5aeb80b85 in roaraudio for include/libroar/vs.h


Ignore:
Timestamp:
08/19/10 02:41:06 (14 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

write comments about the functions

File:
1 edited

Legend:

Unmodified
Added
Removed
  • include/libroar/vs.h

    r4184 r4204  
    4343typedef struct roar_vs roar_vs_t; 
    4444 
     45/* return readable string descriping the problem */ 
    4546const char * roar_vs_strerr(int error); 
    4647 
     48/* create a new VS object from normal RoarAudio connection object 
     49 * The connection must not be closed caller before roar_vs_close() is called. 
     50 * The connection is not closed by roar_vs_close(). 
     51 */ 
    4752roar_vs_t * roar_vs_new_from_con(struct roar_connection * con, int * error); 
     53 
     54/* create a new VS object with a new connection */ 
    4855roar_vs_t * roar_vs_new(const char * server, const char * name, int * error); 
    4956 
     57/* start a the stream in the VS object */ 
    5058int roar_vs_stream(roar_vs_t * vss, const struct roar_audio_info * info, int dir, int * error); 
    5159 
     60/* connect to server and start stream in once 
     61 * this is basicly roar_vs_new() and roar_vs_stream() in one function. 
     62 */ 
    5263roar_vs_t * roar_vs_new_simple(const char * server, const char * name, int rate, int channels, int codec, int bits, int dir, int * error); 
    5364 
     65/* create a VS object for playback. 
     66 * This is roar_vs_new_simple() with direction set to 'playback' (wave form data) 
     67 */ 
    5468#define roar_vs_new_playback(s,n,r,c,e,b,error) roar_vs_new_simple((s), (n), (r), (c), (e), (b), ROAR_DIR_PLAY, (error)) 
    5569 
     70/* Boolean TRUE for VS functions */ 
    5671#define ROAR_VS_TRUE     1 
     72/* Boolean FALSE for VS functions */ 
    5773#define ROAR_VS_FALSE    0 
     74/* Boolean TOGGLE for VS functions */ 
    5875#define ROAR_VS_TOGGLE  -1 
     76/* Boolean value used to ask for a value, do not change the value only ask for current value */ 
    5977#define ROAR_VS_ASK     -2 
    6078 
     79/* close and free the VS object 
     80 * This does all needed cleanup. 
     81 * If server connection was made by VS it is closed, too. 
     82 * If server connectionw as provided by caller it is untouched. 
     83 */ 
    6184int roar_vs_close(roar_vs_t * vss, int killit, int * error); 
    6285 
     86/* write data to a stream 
     87 * This function writes some data to the stream. 
     88 * return is number of bytes written or -1 on error. 
     89 * return value can be zero to intercate no data can be written but no error. 
     90 * this may be the case with non-blocking streams. 
     91 * retruned value can be less then requested value. indecates a short write. 
     92 * you should wait some (short!) time (for example one main loop interation) and try again. 
     93 */ 
    6394ssize_t roar_vs_write(roar_vs_t * vss, const void * buf, size_t len, int * error); 
     95 
     96/* read data from a stream 
     97 * This function reads some data from the stream. 
     98 * return is number of bytes read or -1 on error. 
     99 * return value can be zero to intercate no data can be read but no error. 
     100 * this may be the case with non-blocking streams. 
     101 * retruned value can be less then requested value. indecates a short read. 
     102 * you should wait some (short!) time (for example one main loop interation) and try again. 
     103 */ 
    64104ssize_t roar_vs_read (roar_vs_t * vss,       void * buf, size_t len, int * error); 
    65105 
     106/* wait value for waiting */ 
    66107#define ROAR_VS_WAIT   1 
     108/* wait value for no waiting */ 
    67109#define ROAR_VS_NOWAIT 0 
    68110 
     111/* sync a stream with the server (flush buffers) 
     112 * Returns 0 on no error and -1 on error. 
     113 */ 
    69114int     roar_vs_sync (roar_vs_t * vss, int wait, int * error); 
    70115 
     116/* set blocking mode of stream 
     117 * returns old blocking state 
     118 */ 
    71119int     roar_vs_blocking (roar_vs_t * vss, int val, int * error); 
    72120 
     121/* TODO: document this */ 
    73122#define ROAR_VS_BACKEND_DEFAULT ROAR_VS_BACKEND_FIRST 
    74123#define ROAR_VS_BACKEND_NONE    -1 
     
    78127ssize_t roar_vs_latency(roar_vs_t * vss, int backend, int * error); 
    79128 
     129/* set pause flag 
     130 * The pause flag should be set whenever the user presses the pause button or simular. 
     131 * The stream may be come blocking after the pause flag has been set. 
     132 * returns old pause setting (usefull with ROAR_VS_TOGGLE) 
     133 */ 
    80134int     roar_vs_pause(roar_vs_t * vss, int val, int * error); 
    81135 
     136/* set the mute flag of the stream 
     137 * Thie pause flag should be set wehnever the user mutes the stream in some way. 
     138 * This flag is used so the volume is not changed and can be restored by the server 
     139 * while unmuting. 
     140 * It is very recommended to use this flag and not just set the volume to zero 
     141 * returns old mute setting (usefull with ROAR_VS_TOGGLE) 
     142 */ 
    82143int     roar_vs_mute (roar_vs_t * vss, int val, int * error); 
    83144 
     145/* set volume of stream (all channels to the same value) 
     146 * volume c is float from 0 ('muted', see above) to 1 (full volume). 
     147 * Returns 0 on no error and -1 on error. 
     148 */ 
    84149int     roar_vs_volume_mono   (roar_vs_t * vss, float c, int * error); 
     150/* set volume of stream (like volume + ballance, stereo mode) 
     151 * volume l and r are floats from 0 ('muted', see above) to 1 (full volume). 
     152 * Returns 0 on no error and -1 on error. 
     153 */ 
    85154int     roar_vs_volume_stereo (roar_vs_t * vss, float l, float r, int * error); 
    86155 
     156/* get volume from stream (like volume + ballance, stereo mode) 
     157 * volume pinters l and r are floats from 0 ('muted', see above) to 1 (full volume). 
     158 * Returns 0 on no error and -1 on error. 
     159 * NOTE: if you want a 'mono' volume (like roar_vs_volume_mono() takes) 
     160 * you can just use: c = (*l + *r)/2 
     161 */ 
    87162int     roar_vs_volume_get    (roar_vs_t * vss, float * l, float * r, int * error); 
    88163 
     164/* set an array of meta data for the stream 
     165 * This sets an array of meta data stored in kv of length len for 
     166 * the stream. 
     167 * This should be called before streaming is started using read or write functions 
     168 * but may be called at any time (for example to updata meta data). 
     169 * Returns 0 on no error and -1 on error. 
     170 * Example: 
     171 * struct roar_keyval kv = {.key = "TITLE", .value = "Some artist"}; 
     172 * ret = roar_vs_meta(vss, &kv, 1, &err); 
     173 */ 
    89174int     roar_vs_meta          (roar_vs_t * vss, struct roar_keyval * kv, size_t len, int * error); 
    90175 
     176/* Get used connection object 
     177 * This may be usefull if you want to use functions from the main API. 
     178 * Returns used connection object or NULL on error. 
     179 */ 
    91180struct roar_connection * roar_vs_connection_obj(roar_vs_t * vss, int * error); 
     181 
     182/* Get used stream object 
     183 * This may be usefull if you want to use functions from the main API. 
     184 * Returns used stream object or NULL on error. 
     185 */ 
    92186struct roar_stream     * roar_vs_stream_obj    (roar_vs_t * vss, int * error); 
     187 
     188/* Get used VIO object 
     189 * This may be usefull if you want to use functions from the main API. 
     190 * For example this can be used in non-blocking mode 
     191 * to test if we can read or write. To test that use roar_vio_select(). 
     192 * Returns used VIO object or NULL on error. 
     193 */ 
    93194struct roar_vio_calls  * roar_vs_vio_obj       (roar_vs_t * vss, int * error); 
    94195 
     196/* send NOOP command to server 
     197 * This can be used to ping the server. 
     198 * This is of no use normaly. 
     199 * Returns 0 on no error and -1 on error. 
     200 */ 
    95201#define roar_vs_noop(v, error) roar_noop(roar_vs_connection_obj((v), (error))) 
    96202 
Note: See TracChangeset for help on using the changeset viewer.