📄 aud_mma.c
字号:
/*****************************************************************************
* Copyright Statement:
* --------------------
* This software is protected by Copyright and the information contained
* herein is confidential. The software may not be copied and the information
* contained herein may not be used or disclosed except with the written
* permission of MediaTek Inc. (C) 2005
*
* BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
* THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
* RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
* AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
* NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
* SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
* SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
* THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
* NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
* SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
*
* BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
* LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
* AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
* OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
* MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
*
* THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
* WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
* LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
* RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
* THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
*
*****************************************************************************/
/*******************************************************************************
* Filename:
* ---------
* aud_mma.c
*
* Project:
* --------
* Maui
*
* Description:
* ------------
* This file is to handle all messages for Java MMAPI.
*
* Author:
* -------
* -------
*
*==============================================================================
* HISTORY
* Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
*------------------------------------------------------------------------------
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
*------------------------------------------------------------------------------
* Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
*==============================================================================
*******************************************************************************/
#ifndef MED_NOT_PRESENT
/*==== INCLUDES =========*/
/* system includes */
#include "kal_release.h"
#include "kal_trace.h"
#include "stack_common.h"
#include "stack_msgs.h"
#include "app_ltlcom.h" /* Task message communiction */
#include "syscomp_config.h"
#include "task_config.h" /* Task creation */
#include "app_buff_alloc.h" /* Declaration of buffer management API */
#include "stacklib.h" /* Basic type for dll, evshed, stacktimer */
#include "event_shed.h" /* Event scheduler */
#include "stack_timer.h" /* Stack timer */
/* global includes */
#include "l1audio.h"
#include "device.h"
#include "custom_equipment.h"
#include "resource_audio.h"
#include "nvram_enums.h"
#include "nvram_struct.h"
#include "nvram_user_defs.h"
#include "nvram_data_items.h"
#include "custom_nvram_editor_data_item.h"
/* local includes */
#include "med_global.h"
#include "med_main.h"
#include "aud_defs.h"
#include "med_struct.h"
#include "med_api.h"
#include "med_context.h"
#include "aud_main.h"
#include "med_main.h"
#include "med_utility.h"
#ifdef __AUD_TRACE_ON__
#include "med_trc.h"
#endif
#ifdef __MED_MMA_MOD__
typedef void (*media_handler) (Media_Handle *handle, Media_Event event);
/*==== FUNCTIONS ===========*/
/*****************************************************************************
* FUNCTION
* aud_mma_startup
* DESCRIPTION
* This function is to start mma module.
* PARAMETERS
* void
* RETURNS
* kal_bool
*****************************************************************************/
kal_bool aud_mma_startup(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
kal_mem_set(aud_context_p->player, 0, sizeof(aud_player_struct) * MMA_NO_OF_PLAYER);
return KAL_TRUE;
}
/*****************************************************************************
* FUNCTION
* aud_mma_close_all_single_player
* DESCRIPTION
* This function is to close all mma single player.
* PARAMETERS
* void
* RETURNS
* void
*****************************************************************************/
void aud_mma_close_all_single_player(void)
{
#ifdef MMA_AMR_SUPPORT
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
aud_player_struct *player_p;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
/* close AMR player */
player_p = &(aud_context_p->player[MMA_PLAYER_AMR]);
if (player_p->used)
{
JAmr_Stop((Media_Handle*) player_p->handle);
JAmr_Close((Media_Handle*) player_p->handle);
player_p->used = KAL_FALSE;
player_p->handle = NULL;
}
#ifdef DAF_DECODE
player_p = &(aud_context_p->player[MMA_PLAYER_DAF]);
if (player_p->used)
{
Media_Stop();
player_p->used = KAL_FALSE;
player_p->handle = NULL;
}
#endif /* DAF_DECODE */
#ifdef AAC_DECODE
player_p = &(aud_context_p->player[MMA_PLAYER_AAC]);
if (player_p->used)
{
Media_Stop();
player_p->used = KAL_FALSE;
player_p->handle = NULL;
}
#endif /* AAC_DECODE */
player_p = &(aud_context_p->player[MMA_PLAYER_AU]);
if (player_p->used)
{
Media_Stop();
player_p->used = KAL_FALSE;
player_p->handle = NULL;
}
#endif /* MMA_AMR_SUPPORT */
}
/*****************************************************************************
* FUNCTION
* aud_mma_close_all_multi_player
* DESCRIPTION
* This function is to close all multi-players.
* PARAMETERS
* void
* RETURNS
* void
*****************************************************************************/
void aud_mma_close_all_multi_player(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
kal_uint8 i;
aud_player_struct *player_p;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
/* close IMY player */
player_p = &(aud_context_p->player[MMA_PLAYER_IMY]);
{
if (player_p->used)
{
JImy_Stop((Media_Handle*) player_p->handle);
aud_melody_stop_driver();
JImy_Close((Media_Handle*) player_p->handle);
player_p->used = KAL_FALSE;
player_p->handle = NULL;
}
}
/* close SMF player */
for (i = MMA_PLAYER_SMF_1; i <= MMA_PLAYER_SMF_4; i++)
{
player_p = &(aud_context_p->player[i]);
if (player_p->used)
{
JSmf_Stop((Media_Handle*) player_p->handle);
JSmf_Close((Media_Handle*) player_p->handle);
player_p->used = KAL_FALSE;
player_p->handle = NULL;
}
}
/* close TONE player */
for (i = MMA_PLAYER_TONE_S1; i <= MMA_PLAYER_TONE_S4; i++)
{
player_p = &(aud_context_p->player[i]);
if (player_p->used)
{
JTone_Stop((Media_Handle*) player_p->handle);
JTone_Close((Media_Handle*) player_p->handle);
player_p->used = KAL_FALSE;
player_p->handle = NULL;
}
}
/* close WAV player */
for (i = MMA_PLAYER_WAV_1; i <= MMA_PLAYER_WAV_3; i++)
{
player_p = &(aud_context_p->player[i]);
if (player_p->used)
{
JWav_Stop((Media_Handle*) player_p->handle);
JWav_Close((Media_Handle*) player_p->handle);
med_free_ext_mem((void **)&(player_p->buf_p));
player_p->used = KAL_FALSE;
player_p->handle = NULL;
}
}
/* close XWAV player */
player_p = &(aud_context_p->player[MMA_PLAYER_XWAV]);
{
if (player_p->used)
{
JXWav_Stop((Media_Handle*) player_p->handle);
JXWav_Close((Media_Handle*) player_p->handle);
player_p->used = KAL_FALSE;
player_p->handle = NULL;
}
}
}
/*****************************************************************************
* FUNCTION
* aud_mma_close_all
* DESCRIPTION
* This function is to close all mma tasks.
* PARAMETERS
* void
* RETURNS
* void
*****************************************************************************/
void aud_mma_close_all(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
aud_mma_close_all_multi_player();
aud_mma_close_all_single_player();
}
/*****************************************************************************
* FUNCTION
* aud_mma_event_callback
* DESCRIPTION
* This function is to handle play event callback.
* PARAMETERS
* handle [?]
* event [IN]
* RETURNS
* void
*****************************************************************************/
#ifdef __J2ME__
extern kal_uint8 jam_get_vib_on(void);
#endif
void aud_mma_event_callback(Media_Handle *handle, Media_Event event)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
media_mma_play_event_ind_struct *ind_p = NULL;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
switch (event)
{
case MEDIA_LED_ON:
aud_melody_imy_led_hdlr(KAL_TRUE);
return;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -