META_MELODY_cb.cpp
上传用户:gelin96
上传日期:2017-01-08
资源大小:20993k
文件大小:9k
- /*****************************************************************************
- * 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:
- * ---------
- * META_Melody_cb.cpp
- *
- * Project:
- * --------
- * Maui META APP
- *
- * Description:
- * ------------
- * Melody callback source
- *
- * Author:
- * -------
- * Andy Ueng (mtk00490)
- *
- *============================================================================
- * HISTORY
- * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
- *------------------------------------------------------------------------------
- * $Revision$
- * $Modtime$
- * $Log$
- *
- *------------------------------------------------------------------------------
- * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
- *============================================================================
- ****************************************************************************/
- #include <windows.h>
- #pragma hdrstop
- #include "meta.h"
- #include "meta_msg.h"
- #include "META_MELODY_cb.h"
- #include "form_Melody.h"
- //------------------------------------------------------------------------------
- extern TfrmMelody *frmMelody;
- extern HANDLE hForm_PostMsgTarget;
- //------------------------------------------------------------------------------
- //Midi Call back function
- //------------------------------------------------------------------------------
- void l1sp_headset_ind_cb( BOOL bInsert )
- {
- // META_LAB_MainForm->i_CB_Msg_id = eL1SP_HEADSET_IND;
- PostMessage(
- hForm_PostMsgTarget,
- WM_L1SP_HEADSET_IND,
- bInsert, // unsigned short -> unsigned int
- bInsert // int -> long
- );
- // META_LAB_MainForm->l1sp_headset_insert = bInsert;
- }
- //------------------------------------------------------------------------------
- // marked by Andy Ueng
- // void midi_download_cb( FdmWriteMelody_Cnf *cnf )
- // {
- //// META_LAB_MainForm->i_CB_Msg_id = eMIDI_DOWNLOAD;
- // PostMessage(
- // hForm_PostMsgTarget,
- // WM_MIDI_DOWNLOAD,
- // cnf->status, // unsigned short -> unsigned int
- // 0 // int -> long
- // );
- //
- // }
- // end of marked
- //------------------------------------------------------------------------------
- // modified by Andy Ueng
- // void midi_play_cnf_cb( FT_MELODY_PLAY_CNF *cnf)
- void __stdcall melody_play_cnf_cb( const FT_MELODY_PLAY_CNF *cnf, short token, void *usrData)
- // end of added
- {
- // modified by Andy Ueng
- // if ( cnf->ok != 0)
- if ( cnf.status == STATUS_MELODY_PLAY_SUCCESS)
- // end of modified
- {
- frmMelody->sb_L1sp->Panels->Items[0]->Text = (AnsiString) " Play Melody successfully";
- frmMelody->sb_L1sp->Panels->Items[1]->Text = (AnsiString) "";
- // META_LAB_MainForm->i_CB_Msg_id = eMIDI_PLAY_CNF;
- // PostMessage(
- // hForm_PostMsgTarget,
- // WM_MIDI_PLAY_CNF,
- // 0, // unsigned short -> unsigned int
- // // cnf->ok // int -> long // modified by Andy Ueng
- // cnf.status
- // );
- } else
- {
- Application->MessageBox( "Play Melody Failure", "FAILURE", MB_OK );
- frmMelody->btnPlayMelody->Enabled = true;
- frmMelody->btnStopPlayMelody->Enabled = false;
- // META_LAB_MainForm->i_CB_Msg_id = eMIDI_PLAY_FAIL;
- // PostMessage(
- // hForm_PostMsgTarget,
- // WM_MIDI_PLAY_FAIL,
- // 0, // unsigned short -> unsigned int
- // cnf.status // int -> long
- // );
- }
- }
- //------------------------------------------------------------------------------
- // modified by Andy Ueng
- // void midi_play_over_ind_cb()
- void __stdcall melody_play_over_ind_cb(const short token, void *usrData)
- // end of modified
- {
- // static unsigned char melody_play_times = 0;
- // melody_play_times++;
- // if(melody_play_times == frmMelody->repeats)
- {
- frmMelody->sb_L1sp->Panels->Items[0]->Text = (AnsiString) " play Melody finish";
- frmMelody->sb_L1sp->Panels->Items[1]->Text = (AnsiString) "";
- frmMelody->btnPlayMelody->Enabled = true;
- frmMelody->btnStopPlayMelody->Enabled = false;
- }
- // else
- // {
- // char buf[20];
- // sprintf(buf, "%d times", melody_play_times);
- // frmMelody->sb_L1sp->Panels->Items[0]->Text = " playing Melody";
- // frmMelody->sb_L1sp->Panels->Items[1]->Text = buf;
- // }
- // PostMessage(
- // hForm_PostMsgTarget,
- // WM_MIDI_PLAY_OVER,
- // 0, // unsigned short -> unsigned int
- // 0 // int -> long
- // );
- }
- //------------------------------------------------------------------------------
- // marked by Andy Ueng
- // void midi_info_cnf_cb( MelodyInformation *cnf )
- // {
- //// META_LAB_MainForm->i_CB_Msg_id = eMIDI_INFO;
- // PostMessage(
- // hForm_PostMsgTarget,
- // WM_MIDI_INFO,
- // cnf->recordNum, // unsigned char -> unsigned int
- // (long) &(cnf->record) // int -> long
- // );
- //
- //
- // }
- // end of marked
- //------------------------------------------------------------------------------
- void __stdcall melody_stop_cnf_cb( const FT_MELODY_STOP_CNF *cnf, const short token, void *usrData)
- {
- // modified by Andy Ueng
- // if ( cnf->ok != 0)
- if ( cnf.status == STATUS_IMELODY_STOP_SUCCESS)
- // end of modified
- {
- frmMelody->sb_L1sp->Panels->Items[0]->Text = " Stop play Melody successfully";
- frmMelody->sb_L1sp->Panels->Items[1]->Text = "";
- frmMelody->btnPlayMelody->Enabled = true;
- frmMelody->btnStopPlayMelody->Enabled = false;
- // META_LAB_MainForm->i_CB_Msg_id = eMIDI_PLAY_CNF;
- // PostMessage(
- // hForm_PostMsgTarget,
- // WM_IMELODY_STOP_CNF,
- // 0, // unsigned short -> unsigned int
- // // cnf->ok // int -> long // modified by Andy Ueng
- // cnf.status
- // );
- } else
- {
- Application->MessageBox( "Stop play Melody Failure", "FAILURE", MB_OK );
- frmMelody->sb_L1sp->Panels->Items[0]->Text = " Stop play Melody fail";
- frmMelody->sb_L1sp->Panels->Items[1]->Text = "";
- frmMelody->btnPlayMelody->Enabled = true;
- frmMelody->btnStopPlayMelody->Enabled = false;
- // META_LAB_MainForm->i_CB_Msg_id = eMIDI_PLAY_FAIL;
- // PostMessage(
- // hForm_PostMsgTarget,
- // WM_IMELODY_STOP_FAIL,
- // 0, // unsigned short -> unsigned int
- // // cnf->ok // int -> long // modified by Andy Ueng
- // cnf.status
- // );
- }
- }