/** * @brief 结束并关闭声音的播放 * @param idSnd - 播放声音ID */ void SFSnd_Stop(SFSND_ID idSnd) { if(idSnd==1) { mdi_audio_stop_string(); } else if(idSnd==2) { mdi_audio_stop_string(); } }
/** * @brief 开始播放一个声音 * @param pSndBuffer - 声音缓冲 * @param uBufferSize - 声音缓冲大小 * @param format - 声音数据格式 * @param nLoopCount - 0表示循环播放,其他表示播放次数 * @return 播放ID */ SFSND_ID SFSnd_Play(void*pSndBuffer,unsigned int uBufferSize,SFSND_FORMAT format,int nLoopCount) { if(!g_bBgMusicOn || (MMI_PROFILE_SILENT == gactivatedprofile) || (MMI_PROFILE_MEETING == gactivatedprofile)) { return 0; } //Output audio only through the earphone when earphone plugged if(isEarphonePlugged) { if(format==SNDFORMAT_MIDI) { if(g_kernal.bMidiPlaying) mdi_audio_stop_string(); //PlayAudioMidiStream((U8*)pSndBuffer,(U16)uBufferSize,0); mdi_audio_play_string_with_vol_path(pSndBuffer,uBufferSize,MDI_FORMAT_SMF,nLoopCount==1?DEVICE_AUDIO_PLAY_ONCE:DEVICE_AUDIO_PLAY_INFINITE,SFNull,SFNull,255,MDI_DEVICE_SPEAKER2); g_kernal.bMidiPlaying=SFTrue; return 1; } else if(format==SNDFORMAT_WAVE) { if(g_kernal.bWavPlaying) mdi_audio_stop_string(); //PlayAudioWavStream((U8*)pSndBuffer,(U16)uBufferSize,0); mdi_audio_play_string_with_vol_path(pSndBuffer,uBufferSize,MDI_FORMAT_WAV,nLoopCount==1?DEVICE_AUDIO_PLAY_ONCE:DEVICE_AUDIO_PLAY_INFINITE,SFNull,SFNull,255,MDI_DEVICE_SPEAKER2); g_kernal.bWavPlaying=SFTrue; return 2; } } else { if(format==SNDFORMAT_MIDI) { if(g_kernal.bMidiPlaying) mdi_audio_stop_string(); mdi_audio_play_string_with_vol_path(pSndBuffer,uBufferSize,MDI_FORMAT_SMF,nLoopCount==1?DEVICE_AUDIO_PLAY_ONCE:DEVICE_AUDIO_PLAY_INFINITE,SFNull,SFNull,255,MDI_DEVICE_SPEAKER_BOTH); g_kernal.bMidiPlaying=SFTrue; return 1; } else if(format==SNDFORMAT_WAVE) { if(g_kernal.bWavPlaying) mdi_audio_stop_string(); mdi_audio_play_string_with_vol_path(pSndBuffer,uBufferSize,MDI_FORMAT_WAV,nLoopCount==1?DEVICE_AUDIO_PLAY_ONCE:DEVICE_AUDIO_PLAY_INFINITE,SFNull,SFNull,255,MDI_DEVICE_SPEAKER_BOTH); g_kernal.bWavPlaying=SFTrue; return 2; } } return 0; }
void SFSystem_Finalize(void) { if(g_kernal.bWavPlaying || g_kernal.bMidiPlaying) mdi_audio_stop_string(); if(g_kernal.pHeap) { sf_system_free(g_kernal.pHeap); g_kernal.pHeap=SFNull; } }
/** * @brief 关闭设备 * @param aDevice - 创建的声音设备 */ void SFPCMDevice_Close(SFPCMDevice* aDevice) { PARAM_UNUSED(aDevice); if(u8_g_sound_playflag == 1) { u8_g_sound_playflag = 0; mdi_audio_stop_string(); } return; }
void StopAudioStream(void) { #if 1 mdi_audio_stop_string(); #else /* under construction !*/ /* under construction !*/ /* under construction !*/ /* under construction !*/ #endif }
/** * @brief 停止声音播放 * @param aDevice - 播放的设备 */ void SFPCMDevice_Stop(SFPCMDevice* aDevice) { PARAM_UNUSED(aDevice); if((MMI_PROFILE_SILENT == gactivatedprofile) || (MMI_PROFILE_MEETING == gactivatedprofile)) { return; } u8_g_sound_playflag = 0; mdi_audio_stop_string(); }
/********************************************************************* Function : AudioStopReq Purpose : This function stops sound playing. Input Parameters : U8 soundId Output Parameters : none Returns : void **********************************************************************/ void AudioStopReq(U16 soundId) { if(soundId>=FILESYSTEM_AUDIO_BASE && soundId<=FILESYSTEM_AUDIO_BASE_END) { StopAudioFileSystem(soundId); } #ifdef __MMI_PROFILE_EXTMELODY_SUPPORT__ else if(soundId>=PMG_EXT_MELODY_BEGIN && soundId<=PMG_EXT_MELODY_END) { mdi_audio_stop_file(); } #endif #if defined( __MMI_HUMAN_VOICE_KEYPAD_TONE__ ) else if( soundId >= MIN_HUMAN_VOICE_ID && soundId <= MAX_HUMAN_VOICE_ID ) mdi_audio_stop_string(); #endif else { #ifdef MMI_ON_HARDWARE_P mdi_audio_stop_id(soundId); #else MYQUEUE Message; mmi_eq_stop_audio_req_struct* msg_p; msg_p = OslConstructDataPtr(sizeof(mmi_eq_stop_audio_req_struct)); msg_p->sound_id = (U8)soundId; Message.oslMsgId = PRT_EQ_STOP_AUDIO_REQ; Message.oslDataPtr = (oslParaType *)msg_p; Message.oslPeerBuffPtr= NULL; Message.oslSrcId=MOD_MMI; Message.oslDestId=MOD_L4C; OslMsgSendExtQueue(&Message); #endif } }
/***************************************************************************** * FUNCTION * mmi_sample_3dgame_exit_app_screen * DESCRIPTION * exit dev3dgame screen, restore to normal mmi environment * PARAMETERS * void * RETURNS * void *****************************************************************************/ void mmi_sample_3dgame_exit_app_screen(void) { /*----------------------------------------------------------------*/ /* Local Variables */ /*----------------------------------------------------------------*/ /*----------------------------------------------------------------*/ /* Code Body */ /*----------------------------------------------------------------*/ /* restore timer to default accuracy */ UI_enable_alignment_timers(); #ifndef WIN32 /* disable faster key handling */ mmi_frm_set_key_handle_in_high_frequency(MMI_FALSE); #endif /* WIN32 */ /* re-enable the keypad tone */ mmi_frm_kbd_set_tone_state(MMI_KEY_TONE_ENABLED); /* stop all playing audio and vibration */ mdi_audio_stop_string(); VibratorOff(); /* resume background play */ mdi_audio_resume_background_play(); #ifdef __MMI_SUBLCD__ /* resume sublcd */ GoBackSubLCDHistory(); #endif /* __MMI_SUBLCD__ */ /* let MMI can sleep */ TurnOffBacklight(); }