/***************************************************************************** * FUNCTION * aud_media_stop_by_id_req_hdlr * DESCRIPTION * * PARAMETERS * ilm_ptr [?] * RETURNS * void *****************************************************************************/ void aud_media_stop_by_id_req_hdlr(ilm_struct *ilm_ptr) { /*----------------------------------------------------------------*/ /* Local Variables */ /*----------------------------------------------------------------*/ kal_uint8 audio_id; media_aud_stop_by_id_req_struct *req_p = (media_aud_stop_by_id_req_struct*) ilm_ptr->local_para_ptr; media_aud_stop_by_id_cnf_struct *cnf_p = NULL; /*----------------------------------------------------------------*/ /* Code Body */ /*----------------------------------------------------------------*/ aud_context_p->src_mod = ilm_ptr->src_mod_id; audio_id = req_p->audio_id; if (audio_id <= TONE_KEY_CLICK) { aud_keytone_stop(); } else if ((audio_id > TONE_KEY_CLICK) && (audio_id <= MAX_TONE_ID)) { aud_tone_stop(); } cnf_p = (media_aud_stop_by_id_cnf_struct*) construct_local_para(sizeof(media_aud_stop_by_id_cnf_struct), TD_CTRL); cnf_p->result = MED_RES_OK; aud_send_ilm(ilm_ptr->src_mod_id, MSG_ID_MEDIA_AUD_STOP_BY_ID_CNF, cnf_p, NULL); }
/***************************************************************************** * FUNCTION * aud_media_play_by_id_req_hdlr * DESCRIPTION * * PARAMETERS * ilm_ptr [?] * RETURNS * void *****************************************************************************/ void aud_media_play_by_id_req_hdlr(ilm_struct *ilm_ptr) { /*----------------------------------------------------------------*/ /* Local Variables */ /*----------------------------------------------------------------*/ kal_uint8 audio_id; kal_uint8 audio_out_device; kal_uint8 volume; media_aud_play_by_id_req_struct *req_p = (media_aud_play_by_id_req_struct*) ilm_ptr->local_para_ptr; media_aud_play_by_id_cnf_struct *cnf_p = NULL; /*----------------------------------------------------------------*/ /* Code Body */ /*----------------------------------------------------------------*/ audio_id = req_p->audio_id; if (req_p->output_path == AUDIO_DEVICE_SPEAKER2) { /* Use default configuration */ aud_cfg_audio_out_device(audio_id, &audio_out_device); } else { /* Use user-specified path */ audio_out_device = req_p->output_path; } if (audio_id <= TONE_KEY_CLICK) { aud_keytone_stop(); /* Update keytone volume */ volume = aud_get_volume_gain(aud_context_p->audio_mode, AUD_VOLUME_KEY, req_p->volume); aud_keytone_set_output_volume(volume, 0); aud_keytone_play(audio_id, audio_out_device, req_p->play_style); } else if ((audio_id > TONE_KEY_CLICK) && (audio_id <= MAX_TONE_ID)) { /* if keytone is playing, stop it */ aud_keytone_stop(); if (req_p->play_style == DEVICE_AUDIO_PLAY_INFINITE) { aud_context_p->tone_playing = KAL_TRUE; } /* Update tone volume */ volume = aud_get_volume_gain(aud_context_p->audio_mode, AUD_VOLUME_CTN, req_p->volume); aud_tone_set_output_volume(volume, 0); aud_tone_play(audio_id, audio_out_device); } cnf_p = (media_aud_play_by_id_cnf_struct*) construct_local_para(sizeof(media_aud_play_by_id_cnf_struct), TD_CTRL); cnf_p->result = MED_RES_OK; aud_send_ilm(ilm_ptr->src_mod_id, MSG_ID_MEDIA_AUD_PLAY_BY_ID_CNF, cnf_p, NULL); }
/***************************************************************************** * FUNCTION * aud_rec_start_record * DESCRIPTION * This function is to handle a record request. For normal record, the record * process starts here. For video-call, the record process will be started * when speech is on. * PARAMETERS * ilm_ptr [IN] * RETURNS * void *****************************************************************************/ kal_int32 aud_rec_start_record(ilm_struct *ilm_ptr) { /*----------------------------------------------------------------*/ /* Local Variables */ /*----------------------------------------------------------------*/ l4aud_media_record_req_struct *msg_p = NULL; kal_bool is_low_priority; kal_int32 result = MED_RES_OK; kal_uint8 resource = AUD_RESOURCE_SND_RECORD; /*----------------------------------------------------------------*/ /* Code Body */ /*----------------------------------------------------------------*/ msg_p = (l4aud_media_record_req_struct*) ilm_ptr->local_para_ptr; /* Check resource */ if (!msg_p->default_input) /* FMR record */ { resource = AUD_RESOURCE_FMR_RECORD; } if (! aud_media_is_resource_available(resource)) { return MED_RES_BUSY; } /* if keytone is playing, stop it */ aud_keytone_stop(); /* if tone is playing, stop it */ if (aud_context_p->tone_playing) { aud_tone_stop(); } #ifdef __MED_MMA_MOD__ /* close all mma tasks */ aud_mma_close_all(); #endif /* __MED_MMA_MOD__ */ if (!(aud_context_p->state == AUD_MEDIA_RECORD || aud_context_p->state == AUD_MEDIA_RECORD_PAUSED || aud_context_p->state == AUD_MEDIA_WAIT_RECORD || aud_context_p->state == AUD_VM_RECORD)) { aud_stop_unfinished_process(); } switch (aud_context_p->state) { case AUD_MEDIA_IDLE: { /* Check if there is enough space margin for recording */ if ((result = aud_check_disc_space(msg_p->file_name, AUD_RECORD_MEM_MARGIN)) != MED_RES_OK) { return result; } /* Determine if we should use low priority record. If low priority record * is applied, we will use MED-V thread to write data to file system - this * could prevent MED thread from being blocked when writing data to file * system. This also implies that if the MED thread doesn't have expected * performance during record, we have to change the conditions for low * priority record. */ #if !defined(MED_V_NOT_PRESENT) && defined(__VOIP__) if ((msg_p->format == MEDIA_VOIPEVL) || AM_IsVoIPOn()) { is_low_priority = KAL_TRUE; } else #endif /* #ifndef MED_V_NOT_PRESENT */ { is_low_priority = KAL_FALSE; } /* Open a recorder handle */ result = _aud_rec_recorder_open(msg_p->file_name, msg_p->format, msg_p->quality, is_low_priority, (kal_bool)(! msg_p->default_input), &aud_context_p->recorder_p); _AUD_MODULE_RECORD_TRACE(result); if ((result == MED_RES_OK) && (aud_context_p->recorder_p != NULL)) { /* Set maximum record size and time */ aud_context_p->recorder_p->set(aud_context_p->recorder_p, AUD_RECORDER_SET_SIZE_LIMIT, (void*)msg_p->size_limit, sizeof(kal_uint32)); aud_context_p->recorder_p->set(aud_context_p->recorder_p, AUD_RECORDER_SET_TIME_LIMIT, (void*)msg_p->time_limit, sizeof(kal_uint32)); /* Set input device of record. If the default input is not applied, it is FM record. * Note that we have to restore input source when record is stopped. */ if (! msg_p->default_input) { L1SP_SetInputSource(custom_cfg_hw_aud_input_path(msg_p->input_source)); } /* If it is 3G324M, the recording will be started when speech is on. */ #ifdef __MED_VCALL_MOD__ if ((aud_context_p->rat_mode == RAT_3G324M_MODE) && !aud_context_p->speech_on) { /* Enter wait-record state first. The recording will be started when speech is on. */ aud_enter_state(AUD_MEDIA_WAIT_RECORD); } else #endif /*__MED_VCALL_MOD__*/ { /* Start record */ result = _aud_rec_recorder_start(); } } break; } default: result = MED_RES_BUSY; break; } return result; }