Changeset 3941:085ef7e26ab1 in roaraudio
- Timestamp:
- 06/21/10 21:57:21 (14 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libroarrsound/libroarrsound.c
r3933 r3941 83 83 } 84 84 85 /* This is a simpler function that initializes an rsound struct, sets params as given, 86 and starts the stream. Should this function fail, the structure will stay uninitialized. 87 Should NULL be passed in either host, port or ident, defaults will be used. */ 88 89 int rsd_simple_start (rsound_t **rd, const char* host, const char* port, const char* ident, 90 int rate, int channels, int format) { 91 rsound_t * rsound; 92 93 if ( rsd_init(rd) == -1 ) 94 return -1; 95 96 if ( *rd == NULL ) 97 return -1; 98 99 rsound = *rd; 100 101 if ( host != NULL ) { 102 if ( rsd_set_param(rsound, RSD_HOST, (void*)host) == -1 ) { 103 rsd_free(rsound); 104 return -1; 105 } 106 } 107 108 if ( port != NULL ) { 109 if ( rsd_set_param(rsound, RSD_PORT, (void*)port) == -1 ) { 110 rsd_free(rsound); 111 return -1; 112 } 113 } 114 115 if ( ident != NULL ) { 116 if ( rsd_set_param(rsound, RSD_IDENTITY, (void*)ident) == -1 ) { 117 rsd_free(rsound); 118 return -1; 119 } 120 } 121 122 if ( rsd_set_param(rsound, RSD_FORMAT, &format) == -1 ) { 123 rsd_free(rsound); 124 return -1; 125 } 126 127 if ( rsd_set_param(rsound, RSD_CHANNELS, &channels) == -1 ) { 128 rsd_free(rsound); 129 return -1; 130 } 131 132 if ( rsd_set_param(rsound, RSD_SAMPLERATE, &rate) == -1 ) { 133 rsd_free(rsound); 134 return -1; 135 } 136 137 if ( rsd_start(rsound) == -1 ) { 138 rsd_free(rsound); 139 return -1; 140 } 141 142 return 0; 143 } 144 145 85 146 /* Frees an rsound_t struct. */ 86 147 int rsd_free (rsound_t *rd) {
Note: See TracChangeset
for help on using the changeset viewer.