📄 audiosrc.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).
*
*****************************************************************************/
/*******************************************************************************
* Copyright Notice
* ?2002 - 2003, Pixtel Communications, Inc., 1489 43rd Ave. W.,
* Vancouver, B.C. V6M 4K8 Canada. All Rights Reserved.
* (It is illegal to remove this copyright notice from this software or any
* portion of it)
*******************************************************************************/
/*******************************************************************************
*
* Filename:
* ---------
* AudioSrc.c
*
* Project:
* --------
* MediaTeck GSM
*
* Description:
* ------------
* This Module defines the L4 Audio Driver Routines.
*
* Author:
* -------
* -------
*
*
* HISTORY
* -------
* Created On 12 March
*******************************************************************************/
#include "stdC.h"
#include "L4Dr1.h"
#ifdef MMI_ON_HARDWARE_P
#include "aud_defs.h"
#include "l4dr.h"
#include "QueueGprot.h"
#endif /* MMI_ON_HARDWARE_P */
#include "audioInc.h"
#include "taskInit.h"
#include "ProtocolEvents.h"
#include "Unicodexdcl.h"
#include "DownloadProtos.h"
#include "gpioInc.h"
#include "ProfilesGexdcl.h"
#include "FileSystemDef.h"
#include "FileMgr.h"
#ifdef __MMI_PROFILE_EXTMELODY_SUPPORT__
#include "ProfileMgrGProt.h"
#include "ProfilesGexdcl.h"
#endif /* __MMI_PROFILE_EXTMELODY_SUPPORT__ */
#if defined(__MMI_HUMAN_VOICE_KEYPAD_TONE__)
#include "resource_audio.h"
#include "SettingProfile.h"
#endif /* defined(__MMI_HUMAN_VOICE_KEYPAD_TONE__) */
#include "ProfileGprots.h"
#include "mdi_datatype.h"
#include "mdi_audio.h"
#include "IdleAppDef.h"
extern void StopAudioFileSystem(U16 AudioId); // defined in DownloadSrc.c
extern void mmi_profiles_set_ring_tone_playing(BOOL);
#if defined(__MMI_HUMAN_VOICE_KEYPAD_TONE__)
static U8 IsHumanVoiceKeyTonePlaying = 0;
/*****************************************************************************
* FUNCTION
* CanPlayHumanVoiceKeyTone
* DESCRIPTION
*
* PARAMETERS
* void
* RETURNS
*
*****************************************************************************/
U8 CanPlayHumanVoiceKeyTone(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
return (g_idle_context.IsOnIdleScreen || g_idle_context.IsOnSimErrorScreen ||
g_idle_context.IsOnSimErrorDialerScreen || g_idle_context.IsOnDialerScreen) &&
(mdi_audio_is_pause_mode()||mdi_audio_is_idle() || IsHumanVoiceKeyTonePlaying);
}
/*****************************************************************************
* FUNCTION
* HumanVoiceKeyTonePlayHandler
* DESCRIPTION
*
* PARAMETERS
* result [IN]
* RETURNS
* void
*****************************************************************************/
void HumanVoiceKeyTonePlayHandler(mdi_result result)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
IsHumanVoiceKeyTonePlaying = 0;
}
#endif /* defined(__MMI_HUMAN_VOICE_KEYPAD_TONE__) */
#if defined(__MMI_CUST_KEYPAD_TONE__)
static U8 IsCustKeyTonePlaying = 0;
/*****************************************************************************
* FUNCTION
* CanPlayCustKeyTone
* DESCRIPTION
*
* PARAMETERS
* void
* RETURNS
*
*****************************************************************************/
U8 CanPlayCustKeyTone(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
return (g_idle_context.IsOnIdleScreen || g_idle_context.IsOnSimErrorScreen ||
g_idle_context.IsOnSimErrorDialerScreen || g_idle_context.IsOnDialerScreen) &&
(mdi_audio_is_idle() || IsCustKeyTonePlaying);
}
/*****************************************************************************
* FUNCTION
* CustKeyTonePlayHandler
* DESCRIPTION
*
* PARAMETERS
* result [IN]
* RETURNS
* void
*****************************************************************************/
void CustKeyTonePlayHandler(mdi_result result)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
IsCustKeyTonePlaying = 0;
}
#endif /* defined(__MMI_CUST_KEYPAD_TONE__) */
/*********************************************************************
* Function : AudioPlayToneMDICallBack
*
* Purpose : This function is call back function for AudioPlayToneWithCallBack
* if play file fail.
*
* Input Parameters : mdi_result result
*
* Output Parameters : none
*
* Returns : void
*
* Remarks : There are 3 types of tone might use file
*
* 1. Incomming Call
* 2. Aalrm Tone
* 3. Message Tone
*
* File might play fail, cause of file broken or file not exist,
* This function will be call back if mdi play fail
*
*
**********************************************************************/
static U8 tone_style_callback = 0, tone_type_callback = 0, tone_volume_callback = 0;
/*****************************************************************************
* FUNCTION
* AudioPlayToneMDICallBack
* DESCRIPTION
*
* PARAMETERS
* result [IN]
* RETURNS
* void
*****************************************************************************/
void AudioPlayToneMDICallBack(mdi_result result)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
if (result != MDI_AUDIO_SUCCESS && result != MDI_AUDIO_TERMINATED &&
result != MDI_AUDIO_RESUME && result != MDI_AUDIO_BLOCKED && result != MDI_AUDIO_END_OF_FILE)
{
switch (tone_type_callback)
{
case INCOMING_CALL_TONE:
tone_volume_callback = GetRingVolumeLevel();
mdi_audio_play_id_with_vol_path(
gstartMidiId,
tone_style_callback,
NULL,
NULL,
tone_volume_callback,
MDI_DEVICE_SPEAKER_BOTH);
break;
case ALARM_TONE:
mdi_audio_play_id_with_vol_path(
(U16) (gstartMidiId + 1),
tone_style_callback,
NULL,
NULL,
tone_volume_callback,
MDI_DEVICE_SPEAKER_BOTH);
break;
case MESSAGE_TONE:
mdi_audio_play_id_with_vol_path(
(U16) (gstartMiscToneId + 4),
tone_style_callback,
NULL,
NULL,
tone_volume_callback,
MDI_DEVICE_SPEAKER_BOTH);
break;
default:
ASSERT(0);
break;
}
mmi_profiles_set_ring_tone_playing(TRUE);
}
else
{
mmi_profiles_set_ring_tone_playing(FALSE);
}
}
/*********************************************************************
* Function : AudioPlayToneWithCallBack
*
* Purpose : This function is play tone function with callbakc for mdi interface
*
* Input Parameters : U16 soundId, U8 style, U8 tone_type
*
* Output Parameters : none
*
* Returns : void
*
* Remarks : There are 3 types of tone might use file
*
* 1. Incomming Call ( StartRingTone() )
* 2. Aalrm Tone ( playRequestedTone(ALARM_TONE) )
* 3. Message Tone ( playRequestedTone(MESSAGE_TONE) )
*
* File might play fail, cause of file broken or file not exist,
* This function will be call back register function if mdi play fail
* Shall play default ringtone in callback function
*
**********************************************************************/
/*****************************************************************************
* FUNCTION
* AudioPlayToneWithCallBack
* DESCRIPTION
*
* PARAMETERS
* soundId [IN]
* style [IN]
* tone_type [IN]
* RETURNS
* void
*****************************************************************************/
void AudioPlayToneWithCallBack(U16 soundId, U8 style, U8 tone_type)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
AudioPlayToneWithCallBackVolPath(soundId, style, tone_type, GetRingVolumeLevel(), MDI_DEVICE_SPEAKER_BOTH);
}
/*********************************************************************
* Function : AudioPlayToneWithCallBackVolPath
*
* Purpose : This function is play tone function with callbakc for mdi interface
*
* Input Parameters : U16 soundId, U8 style, U8 tone_type, U8 volume, U8 path
*
* Output Parameters : none
*
* Returns : void
*
* Remarks : There are 3 types of tone might use file
*
* 1. Incomming Call ( StartRingTone() )
* 2. Aalrm Tone ( playRequestedTone(ALARM_TONE) )
* 3. Message Tone ( playRequestedTone(MESSAGE_TONE) )
*
* File might play fail, cause of file broken or file not exist,
* This function will be call back register function if mdi play fail
* Shall play default ringtone in callback function
*
**********************************************************************/
/*****************************************************************************
* FUNCTION
* AudioPlayToneWithCallBackVolPath
* DESCRIPTION
*
* PARAMETERS
* soundId [IN]
* style [IN]
* tone_type [IN]
* volume [IN]
* path [IN]
* RETURNS
* void
*****************************************************************************/
void AudioPlayToneWithCallBackVolPath(U16 soundId, U8 style, U8 tone_type, U8 volume, U8 path)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -