Changeset 5509:cd1927035f25 in roaraudio for libroarpulse
- Timestamp:
- 05/25/12 03:37:56 (12 years ago)
- Branch:
- default
- Phase:
- public
- Location:
- libroarpulse
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
libroarpulse/introspect.c
r5381 r5509 63 63 64 64 painfo.name = ROAR_PA_DEFAULT_SINK; 65 painfo.index = 0; 65 painfo.index = 0; // fixme! 66 66 painfo.description = "RoarAudio default mixer"; 67 67 painfo.owner_module = PA_INVALID_INDEX; … … 140 140 141 141 /** Get some information about a sink input by its index */ 142 pa_operation* pa_context_get_sink_input_info(pa_context *c, uint32_t idx, pa_sink_input_info_cb_t cb, void *userdata); 142 pa_operation* pa_context_get_sink_input_info(pa_context *c, uint32_t idx, pa_sink_input_info_cb_t cb, void *userdata) { 143 pa_sink_input_info pa_info; 144 // struct roar_stream_info info; 145 struct roar_stream stream; 146 struct roar_mixer_settings mixer; 147 long long int s; 148 int channels; 149 char buf[256]; 150 int i; 151 152 memset(&pa_info, 0, sizeof(pa_info)); 153 154 roar_get_stream(roar_pa_context_get_con(c), &stream, idx); 155 156 roar_stream_get_name(roar_pa_context_get_con(c), &stream, buf, sizeof(buf)); 157 158 if ( roar_get_vol(roar_pa_context_get_con(c), idx, &mixer, &channels) == -1 ) { 159 channels = 1; 160 mixer.mixer[0] = 65535; 161 mixer.rpg_mul = mixer.rpg_div = 1; 162 } 163 164 // roar_stream_get_info(roar_pa_context_get_con(c), &stream, &info); 165 166 pa_info.index = idx; 167 pa_info.name = buf; 168 pa_info.owner_module = PA_INVALID_INDEX; 169 pa_info.client = PA_INVALID_INDEX; 170 pa_info.sink = idx; 171 //libroarpulse.c:int roar_pa_auinfo2sspec (pa_sample_spec * ss, const struct roar_audio_info * info) { 172 roar_pa_auinfo2sspec(&(pa_info.sample_spec), &(stream.info)); 173 pa_info.volume.channels = channels; 174 for (i = 0; i < channels; i++) { 175 s = mixer.mixer[i]; 176 s *= mixer.rpg_mul; 177 s *= PA_VOLUME_NORM; 178 s /= mixer.rpg_div; 179 s /= 65535; 180 pa_info.volume.values[i] = s; 181 } 182 pa_info.resample_method = "server side"; 183 pa_info.driver = "RoarAudio"; 184 // pa_info.mute = (info.flags & ROAR_FLAG_MUTE) ? 1 : 0; 185 186 cb(c, &pa_info, 1, userdata); 187 188 return roar_pa_operation_new(PA_OPERATION_DONE); 189 } 143 190 144 191 /** Get the complete sink input list */ … … 164 211 165 212 /** Set the volume of a sink input stream */ 166 pa_operation* pa_context_set_sink_input_volume(pa_context *c, uint32_t idx, const pa_cvolume *volume, pa_context_success_cb_t cb, void *userdata); 213 pa_operation* pa_context_set_sink_input_volume(pa_context *c, uint32_t idx, const pa_cvolume *volume, pa_context_success_cb_t cb, void *userdata) { 214 struct roar_mixer_settings mixer; 215 long long int s; 216 size_t i; 217 218 mixer.rpg_mul = 1; 219 mixer.rpg_div = 1; 220 221 for (i = 0; i < volume->channels; i++) { 222 s = volume->values[i]; 223 s *= 65535; 224 s /= PA_VOLUME_NORM; 225 mixer.mixer[i] = s; 226 } 227 228 if ( roar_set_vol(roar_pa_context_get_con(c), idx, &mixer, volume->channels, ROAR_SET_VOL_ALL) == -1 ) { 229 cb(c, 0, userdata); 230 } else { 231 cb(c, 1, userdata); 232 } 233 234 return roar_pa_operation_new(PA_OPERATION_DONE); 235 } 167 236 168 237 /** Set the volume of a source device specified by its index \since 0.8 */ -
libroarpulse/stream.c
r5508 r5509 177 177 /** Return the device (sink input or source output) index this stream is connected to */ 178 178 uint32_t pa_stream_get_index(pa_stream *s) { 179 (void)s; 180 return 0; 179 struct roar_stream_info info; 180 181 if ( roar_stream_get_info(roar_pa_context_get_con(s->c), &(s->stream), &info) == -1 ) 182 return 0; 183 184 if ( info.mixer == -1 ) 185 return 0; 186 187 return info.mixer; 181 188 } 182 189 … … 697 704 698 705 /** Pause (or resume) playback of this stream temporarily. Available on both playback and recording streams. \since 0.3 */ 699 pa_operation* pa_stream_cork(pa_stream *s, int b, pa_stream_success_cb_t cb, void *userdata); 706 pa_operation* pa_stream_cork(pa_stream *s, int b, pa_stream_success_cb_t cb, void *userdata) { 707 int action = b ? ROAR_SET_FLAG : ROAR_RESET_FLAG; 708 709 if ( roar_stream_set_flags(roar_pa_context_get_con(s->c), &(s->stream), ROAR_FLAG_PAUSE, action) == -1 ) { 710 cb(s, 0, userdata); 711 } else { 712 cb(s, 1, userdata); 713 } 714 715 return roar_pa_operation_new(PA_OPERATION_DONE); 716 } 717 718 /** Return 1 if the this stream has been corked. This will return 0 if 719 * not, and negative on error. \since 0.9.11 */ 720 int pa_stream_is_corked(pa_stream *s) { 721 struct roar_stream_info info; 722 723 if ( roar_stream_get_info(roar_pa_context_get_con(s->c), &(s->stream), &info) == -1 ) 724 return -1; 725 726 return (info.flags & ROAR_FLAG_PAUSE) ? 1 : 0; 727 } 700 728 701 729 /** Flush the playback buffer of this stream. Most of the time you're
Note: See TracChangeset
for help on using the changeset viewer.