Changeset 16:c4585a26128b in roaraudio
- Timestamp:
- 06/19/08 21:13:21 (16 years ago)
- Branch:
- default
- Phase:
- public
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
TODO
r15 r16 5 5 * add support for sync streams 6 6 * add a lot other things 7 * add code to handle streams with more than ROAR_MAX_CHANNELS channels -
include/roaraudio/audio.h
r0 r16 55 55 #define ROAR_RATE_DEFAULT 44100 56 56 57 #define ROAR_MAX_CHANNELS 64 58 57 59 struct roar_audio_info { 58 60 unsigned int rate; … … 65 67 unsigned channels; 66 68 roar_intm16 scale; 67 roar_intm16 * mixer;69 roar_intm16 mixer[ROAR_MAX_CHANNELS]; 68 70 }; 69 71 -
roard/include/mixer.h
r0 r16 12 12 int mix_clients_32bit (void * output, void ** input, int samples); 13 13 14 int change_vol (void * output, int bits, void * input, int samples, int channels, struct roar_mixer_settings * set); 15 int change_vol_8bit (void * output, void * input, int samples, int channels, struct roar_mixer_settings * set); 16 int change_vol_16bit (void * output, void * input, int samples, int channels, struct roar_mixer_settings * set); 17 int change_vol_24bit (void * output, void * input, int samples, int channels, struct roar_mixer_settings * set); 18 int change_vol_32bit (void * output, void * input, int samples, int channels, struct roar_mixer_settings * set); 19 14 20 #endif 15 21 -
roard/include/streams.h
r0 r16 21 21 size_t need_extra; 22 22 void * output; 23 struct roar_mixer_settings mixer; 23 24 } * g_streams[ROAR_STREAMS_MAX]; 24 25 -
roard/mixer.c
r0 r16 103 103 } 104 104 105 int change_vol (void * output, int bits, void * input, int samples, int channels, struct roar_mixer_settings * set) { 106 if ( bits == 8 ) { 107 return change_vol_8bit(output, input, samples, channels, set); 108 } else if ( bits == 16 ) { 109 return change_vol_16bit(output, input, samples, channels, set); 110 } else if ( bits == 24 ) { 111 return change_vol_24bit(output, input, samples, channels, set); 112 } else if ( bits == 32 ) { 113 return change_vol_32bit(output, input, samples, channels, set); 114 } else { 115 return -1; 116 } 117 } 118 119 int change_vol_8bit (void * output, void * input, int samples, int channels, struct roar_mixer_settings * set) { 120 char * in = input, out = output; 121 int i; 122 int s; 123 124 if ( !(in && out) ) 125 return -1; 126 127 for (i = 0; i < samples; i++) { 128 s = in[i]; 129 s *= set->mixer[i % channels]; 130 s /= set->scale; 131 out[i] = s; 132 } 133 134 return 0; 135 } 136 137 int change_vol_16bit (void * output, void * input, int samples, int channels, struct roar_mixer_settings * set) { 138 int16_t * in = input, out = output; 139 int i; 140 int s; 141 142 if ( !(in && out) ) 143 return -1; 144 145 for (i = 0; i < samples; i++) { 146 s = in[i]; 147 s *= set->mixer[i % channels]; 148 s /= set->scale; 149 out[i] = s; 150 } 151 152 return 0; 153 } 154 155 int change_vol_24bit (void * output, void * input, int samples, int channels, struct roar_mixer_settings * set) { 156 return -1; 157 } 158 159 int change_vol_32bit (void * output, void * input, int samples, int channels, struct roar_mixer_settings * set) { 160 return -1; 161 } 162 163 105 164 //ll -
roard/streams.c
r0 r16 26 26 27 27 int streams_new (void) { 28 int i ;28 int i, j; 29 29 struct roar_stream * n = NULL; 30 30 … … 46 46 n->offset = 0; 47 47 48 ((struct roar_stream_server*)n)->client = -1; 49 ((struct roar_stream_server*)n)->buffer = NULL; 50 ((struct roar_stream_server*)n)->need_extra = 0; 51 ((struct roar_stream_server*)n)->output = NULL; 48 ((struct roar_stream_server*)n)->client = -1; 49 ((struct roar_stream_server*)n)->buffer = NULL; 50 ((struct roar_stream_server*)n)->need_extra = 0; 51 ((struct roar_stream_server*)n)->output = NULL; 52 ((struct roar_stream_server*)n)->mixer.scale = 65535; 53 for (j = 0; j < ROAR_MAX_CHANNELS; j++) 54 ((struct roar_stream_server*)n)->mixer.mixer[j] = 65535; 52 55 53 56 g_streams[i] = (struct roar_stream_server*)n;
Note: See TracChangeset
for help on using the changeset viewer.