Lines Matching refs:visu_ctxt

557 uint32_t visualizer_get_delta_time_ms_from_updated_time(visualizer_context_t* visu_ctxt) {  in visualizer_get_delta_time_ms_from_updated_time()  argument
559 if (visu_ctxt->buffer_update_time.tv_sec != 0) { in visualizer_get_delta_time_ms_from_updated_time()
562 time_t secs = ts.tv_sec - visu_ctxt->buffer_update_time.tv_sec; in visualizer_get_delta_time_ms_from_updated_time()
563 long nsec = ts.tv_nsec - visu_ctxt->buffer_update_time.tv_nsec; in visualizer_get_delta_time_ms_from_updated_time()
576 visualizer_context_t * visu_ctxt = (visualizer_context_t *)context; in visualizer_reset() local
578 visu_ctxt->capture_idx = 0; in visualizer_reset()
579 visu_ctxt->last_capture_idx = 0; in visualizer_reset()
580 visu_ctxt->buffer_update_time.tv_sec = 0; in visualizer_reset()
581 visu_ctxt->latency = DSP_OUTPUT_LATENCY_MS; in visualizer_reset()
582 memset(visu_ctxt->capture_buf, 0x80, CAPTURE_BUF_SIZE); in visualizer_reset()
590 visualizer_context_t * visu_ctxt = (visualizer_context_t *)context; in visualizer_init() local
609 visu_ctxt->capture_size = VISUALIZER_CAPTURE_SIZE_MAX; in visualizer_init()
610 visu_ctxt->scaling_mode = VISUALIZER_SCALING_MODE_NORMALIZED; in visualizer_init()
613 visu_ctxt->channel_count = audio_channel_count_from_out_mask(context->config.inputCfg.channels); in visualizer_init()
614 visu_ctxt->meas_mode = MEASUREMENT_MODE_NONE; in visualizer_init()
615 visu_ctxt->meas_wndw_size_in_buffers = MEASUREMENT_WINDOW_MAX_SIZE_IN_BUFFERS; in visualizer_init()
616 visu_ctxt->meas_buffer_idx = 0; in visualizer_init()
617 for (i=0 ; i<visu_ctxt->meas_wndw_size_in_buffers ; i++) { in visualizer_init()
618 visu_ctxt->past_meas[i].is_valid = false; in visualizer_init()
619 visu_ctxt->past_meas[i].peak_u16 = 0; in visualizer_init()
620 visu_ctxt->past_meas[i].rms_squared = 0; in visualizer_init()
643 visualizer_context_t *visu_ctxt = (visualizer_context_t *)context; in visualizer_get_parameter() local
653 ALOGV("%s get capture_size = %d", __func__, visu_ctxt->capture_size); in visualizer_get_parameter()
654 *((uint32_t *)p->data + 1) = visu_ctxt->capture_size; in visualizer_get_parameter()
659 ALOGV("%s get scaling_mode = %d", __func__, visu_ctxt->scaling_mode); in visualizer_get_parameter()
660 *((uint32_t *)p->data + 1) = visu_ctxt->scaling_mode; in visualizer_get_parameter()
665 ALOGV("%s get meas_mode = %d", __func__, visu_ctxt->meas_mode); in visualizer_get_parameter()
666 *((uint32_t *)p->data + 1) = visu_ctxt->meas_mode; in visualizer_get_parameter()
678 visualizer_context_t *visu_ctxt = (visualizer_context_t *)context; in visualizer_set_parameter() local
685 visu_ctxt->capture_size = *((uint32_t *)p->data + 1); in visualizer_set_parameter()
686 ALOGV("%s set capture_size = %d", __func__, visu_ctxt->capture_size); in visualizer_set_parameter()
689 visu_ctxt->scaling_mode = *((uint32_t *)p->data + 1); in visualizer_set_parameter()
690 ALOGV("%s set scaling_mode = %d", __func__, visu_ctxt->scaling_mode); in visualizer_set_parameter()
695 ALOGV("%s set latency = %d", __func__, visu_ctxt->latency); in visualizer_set_parameter()
698 visu_ctxt->meas_mode = *((uint32_t *)p->data + 1); in visualizer_set_parameter()
699 ALOGV("%s set meas_mode = %d", __func__, visu_ctxt->meas_mode); in visualizer_set_parameter()
712 visualizer_context_t *visu_ctxt = (visualizer_context_t *)context; in visualizer_process() local
725 if (visu_ctxt->meas_mode & MEASUREMENT_MODE_PEAK_RMS) { in visualizer_process()
730 for (inIdx = 0 ; inIdx < inBuffer->frameCount * visu_ctxt->channel_count ; inIdx++) { in visualizer_process()
739 visu_ctxt->past_meas[visu_ctxt->meas_buffer_idx].peak_u16 = (uint16_t)max_sample; in visualizer_process()
740 visu_ctxt->past_meas[visu_ctxt->meas_buffer_idx].rms_squared = in visualizer_process()
741 rms_squared_acc / (inBuffer->frameCount * visu_ctxt->channel_count); in visualizer_process()
742 visu_ctxt->past_meas[visu_ctxt->meas_buffer_idx].is_valid = true; in visualizer_process()
743 if (++visu_ctxt->meas_buffer_idx >= visu_ctxt->meas_wndw_size_in_buffers) { in visualizer_process()
744 visu_ctxt->meas_buffer_idx = 0; in visualizer_process()
751 if (visu_ctxt->scaling_mode == VISUALIZER_SCALING_MODE_NORMALIZED) { in visualizer_process()
774 assert(visu_ctxt->scaling_mode == VISUALIZER_SCALING_MODE_AS_PLAYED); in visualizer_process()
780 uint8_t *buf = visu_ctxt->capture_buf; in visualizer_process()
781 for (in_idx = 0, capt_idx = visu_ctxt->capture_idx; in visualizer_process()
795 visu_ctxt->capture_idx = capt_idx; in visualizer_process()
797 if (clock_gettime(CLOCK_MONOTONIC, &visu_ctxt->buffer_update_time) < 0) { in visualizer_process()
798 visu_ctxt->buffer_update_time.tv_sec = 0; in visualizer_process()
812 visualizer_context_t * visu_ctxt = (visualizer_context_t *)context; in visualizer_command() local
816 if (pReplyData == NULL || *replySize != visu_ctxt->capture_size) { in visualizer_command()
818 __func__, *replySize, visu_ctxt->capture_size); in visualizer_command()
826 int32_t latency_ms = visu_ctxt->latency; in visualizer_command()
827 const uint32_t delta_ms = visualizer_get_delta_time_ms_from_updated_time(visu_ctxt); in visualizer_command()
834 int32_t capture_point = visu_ctxt->capture_idx - visu_ctxt->capture_size - delta_smp; in visualizer_command()
835 int32_t capture_size = visu_ctxt->capture_size; in visualizer_command()
842 visu_ctxt->capture_buf + CAPTURE_BUF_SIZE + capture_point, in visualizer_command()
849 visu_ctxt->capture_buf + capture_point, in visualizer_command()
855 if ((visu_ctxt->last_capture_idx == visu_ctxt->capture_idx) && in visualizer_command()
856 (visu_ctxt->buffer_update_time.tv_sec != 0)) { in visualizer_command()
859 visu_ctxt->buffer_update_time.tv_sec = 0; in visualizer_command()
860 memset(pReplyData, 0x80, visu_ctxt->capture_size); in visualizer_command()
863 visu_ctxt->last_capture_idx = visu_ctxt->capture_idx; in visualizer_command()
865 memset(pReplyData, 0x80, visu_ctxt->capture_size); in visualizer_command()
875 const int32_t delay_ms = visualizer_get_delta_time_ms_from_updated_time(visu_ctxt); in visualizer_command()
879 for (i=0 ; i<visu_ctxt->meas_wndw_size_in_buffers ; i++) { in visualizer_command()
880 visu_ctxt->past_meas[i].is_valid = false; in visualizer_command()
881 visu_ctxt->past_meas[i].peak_u16 = 0; in visualizer_command()
882 visu_ctxt->past_meas[i].rms_squared = 0; in visualizer_command()
884 visu_ctxt->meas_buffer_idx = 0; in visualizer_command()
890 for (i=0 ; i < visu_ctxt->meas_wndw_size_in_buffers ; i++) { in visualizer_command()
891 if (visu_ctxt->past_meas[i].is_valid) { in visualizer_command()
892 if (visu_ctxt->past_meas[i].peak_u16 > peak_u16) { in visualizer_command()
893 peak_u16 = visu_ctxt->past_meas[i].peak_u16; in visualizer_command()
895 sum_rms_squared += visu_ctxt->past_meas[i].rms_squared; in visualizer_command()
954 visualizer_context_t *visu_ctxt = (visualizer_context_t *)calloc(1, in effect_lib_create() local
956 context = (effect_context_t *)visu_ctxt; in effect_lib_create()