Lines Matching refs:out

135 static void out_set_eq(struct alsa_stream_out* out) {  in out_set_eq()  argument
136 out->speaker_eq = NULL; in out_set_eq()
148 out->speaker_eq = fir_init( in out_set_eq()
149 out->config.channels, FIR_SINGLE_FILTER, num_taps, in out_set_eq()
150 out_get_buffer_size(&out->stream.common) / out->config.channels / sizeof(int16_t), in out_set_eq()
156 static int start_output_stream(struct alsa_stream_out *out) in start_output_stream() argument
158 struct alsa_audio_device *adev = out->dev; in start_output_stream()
163 out->write_threshold = PLAYBACK_PERIOD_COUNT * PLAYBACK_PERIOD_SIZE; in start_output_stream()
164 out->config.start_threshold = PLAYBACK_PERIOD_START_THRESHOLD * PLAYBACK_PERIOD_SIZE; in start_output_stream()
165 out->config.avail_min = PLAYBACK_PERIOD_SIZE; in start_output_stream()
166 out->unavailable = true; in start_output_stream()
168 int out_port = get_audio_output_port(out->devices); in start_output_stream()
171 out->pcm = pcm_open(CARD_OUT, out_port, PCM_OUT | PCM_MONOTONIC, &out->config); in start_output_stream()
172 if ((out->pcm != NULL) && pcm_is_ready(out->pcm)) { in start_output_stream()
175 ALOGE("cannot open pcm_out driver: %s", pcm_get_error(out->pcm)); in start_output_stream()
176 if (out->pcm != NULL) { in start_output_stream()
177 pcm_close(out->pcm); in start_output_stream()
178 out->pcm = NULL; in start_output_stream()
187 out->unavailable = false; in start_output_stream()
188 adev->active_output = out; in start_output_stream()
194 struct alsa_stream_out *out = (struct alsa_stream_out *)stream; in out_get_sample_rate() local
195 return out->config.rate; in out_get_sample_rate()
218 struct alsa_stream_out *out = (struct alsa_stream_out *)stream; in out_get_channels() local
219 return audio_channel_out_mask_from_count(out->config.channels); in out_get_channels()
225 struct alsa_stream_out *out = (struct alsa_stream_out *)stream; in out_get_format() local
226 return audio_format_from_pcm_format(out->config.format); in out_get_format()
235 static int do_output_standby(struct alsa_stream_out *out) in do_output_standby() argument
237 struct alsa_audio_device *adev = out->dev; in do_output_standby()
239 fir_reset(out->speaker_eq); in do_output_standby()
241 if (!out->standby) { in do_output_standby()
242 pcm_close(out->pcm); in do_output_standby()
243 out->pcm = NULL; in do_output_standby()
245 out->standby = 1; in do_output_standby()
254 struct alsa_stream_out *out = (struct alsa_stream_out *)stream; in out_standby() local
257 pthread_mutex_lock(&out->dev->lock); in out_standby()
258 pthread_mutex_lock(&out->lock); in out_standby()
259 status = do_output_standby(out); in out_standby()
260 pthread_mutex_unlock(&out->lock); in out_standby()
261 pthread_mutex_unlock(&out->dev->lock); in out_standby()
274 struct alsa_stream_out *out = (struct alsa_stream_out *)stream; in out_set_parameters() local
275 struct alsa_audio_device *adev = out->dev; in out_set_parameters()
286 pthread_mutex_lock(&out->lock); in out_set_parameters()
287 if (((out->devices & AUDIO_DEVICE_OUT_ALL) != val) && (val != 0)) { in out_set_parameters()
288 out->devices &= ~AUDIO_DEVICE_OUT_ALL; in out_set_parameters()
289 out->devices |= val; in out_set_parameters()
291 pthread_mutex_unlock(&out->lock); in out_set_parameters()
308 struct alsa_stream_out *out = (struct alsa_stream_out *)stream; in out_get_latency() local
309 return (PLAYBACK_PERIOD_SIZE * PLAYBACK_PERIOD_COUNT * 1000) / out->config.rate; in out_get_latency()
323 struct alsa_stream_out *out = (struct alsa_stream_out *)stream; in out_write() local
324 struct alsa_audio_device *adev = out->dev; in out_write()
328 ALOGV("%s: devices: %d, bytes %zu", __func__, out->devices, bytes); in out_write()
335 pthread_mutex_lock(&out->lock); in out_write()
336 if (out->standby) { in out_write()
337 ret = start_output_stream(out); in out_write()
342 out->standby = 0; in out_write()
348 if (out->speaker_eq != NULL) { in out_write()
349 fir_process_interleaved(out->speaker_eq, (int16_t*)buffer, (int16_t*)buffer, out_frames); in out_write()
352 ret = pcm_write(out->pcm, buffer, out_frames * frame_size); in out_write()
354 out->frames_written += out_frames; in out_write()
357 get_pcm_timestamp(out->pcm, out->config.rate, &info, true /*isOutput*/); in out_write()
358 out->timestamp = info.timestamp; in out_write()
367 pthread_mutex_unlock(&out->lock); in out_write()
390 struct alsa_stream_out* out = (struct alsa_stream_out*)stream; in out_get_presentation_position() local
392 *frames = out->frames_written; in out_get_presentation_position()
393 *timestamp = out->timestamp; in out_get_presentation_position()
790 struct alsa_stream_out *out; in adev_open_output_stream() local
800 out = (struct alsa_stream_out *)calloc(1, sizeof(struct alsa_stream_out)); in adev_open_output_stream()
801 if (!out) in adev_open_output_stream()
804 out->stream.common.get_sample_rate = out_get_sample_rate; in adev_open_output_stream()
805 out->stream.common.set_sample_rate = out_set_sample_rate; in adev_open_output_stream()
806 out->stream.common.get_buffer_size = out_get_buffer_size; in adev_open_output_stream()
807 out->stream.common.get_channels = out_get_channels; in adev_open_output_stream()
808 out->stream.common.get_format = out_get_format; in adev_open_output_stream()
809 out->stream.common.set_format = out_set_format; in adev_open_output_stream()
810 out->stream.common.standby = out_standby; in adev_open_output_stream()
811 out->stream.common.dump = out_dump; in adev_open_output_stream()
812 out->stream.common.set_parameters = out_set_parameters; in adev_open_output_stream()
813 out->stream.common.get_parameters = out_get_parameters; in adev_open_output_stream()
814 out->stream.common.add_audio_effect = out_add_audio_effect; in adev_open_output_stream()
815 out->stream.common.remove_audio_effect = out_remove_audio_effect; in adev_open_output_stream()
816 out->stream.get_latency = out_get_latency; in adev_open_output_stream()
817 out->stream.set_volume = out_set_volume; in adev_open_output_stream()
818 out->stream.write = out_write; in adev_open_output_stream()
819 out->stream.get_render_position = out_get_render_position; in adev_open_output_stream()
820 out->stream.get_next_write_timestamp = out_get_next_write_timestamp; in adev_open_output_stream()
821 out->stream.get_presentation_position = out_get_presentation_position; in adev_open_output_stream()
823 out->config.channels = CHANNEL_STEREO; in adev_open_output_stream()
824 out->config.rate = PLAYBACK_CODEC_SAMPLING_RATE; in adev_open_output_stream()
825 out->config.format = PCM_FORMAT_S16_LE; in adev_open_output_stream()
826 out->config.period_size = PLAYBACK_PERIOD_SIZE; in adev_open_output_stream()
827 out->config.period_count = PLAYBACK_PERIOD_COUNT; in adev_open_output_stream()
829 if (out->config.rate != config->sample_rate || in adev_open_output_stream()
831 out->config.format != pcm_format_from_audio_format(config->format) ) { in adev_open_output_stream()
832 config->sample_rate = out->config.rate; in adev_open_output_stream()
833 config->format = audio_format_from_pcm_format(out->config.format); in adev_open_output_stream()
839 out->config.channels, out->config.rate, out->config.format, devices); in adev_open_output_stream()
841 out->dev = ladev; in adev_open_output_stream()
842 out->standby = 1; in adev_open_output_stream()
843 out->unavailable = false; in adev_open_output_stream()
844 out->devices = devices; in adev_open_output_stream()
846 config->format = out_get_format(&out->stream.common); in adev_open_output_stream()
847 config->channel_mask = out_get_channels(&out->stream.common); in adev_open_output_stream()
848 config->sample_rate = out_get_sample_rate(&out->stream.common); in adev_open_output_stream()
850 *stream_out = &out->stream; in adev_open_output_stream()
852 out->speaker_eq = NULL; in adev_open_output_stream()
854 out_set_eq(out); in adev_open_output_stream()
855 if (out->speaker_eq == NULL) { in adev_open_output_stream()
864 int aec_ret = init_aec_reference_config(ladev->aec, out); in adev_open_output_stream()
880 struct alsa_stream_out* out = (struct alsa_stream_out*)stream; in adev_close_output_stream() local
881 fir_release(out->speaker_eq); in adev_close_output_stream()