void CMusicPlayer::InitPlayer(PLAY_PROC playProc, GET_MEDIA getNext, GET_MEDIA getPrev, GET_MEDIA getRandom) { m_pZplayer = CreateZPlay(); if (!m_pZplayer) return; m_pZplayer->SetCallbackFunc(CallbackFunc, (TCallbackMessage)(MsgPlay|MsgStop|MsgStopAsync|MsgPlayAsync|MsgWaveBuffer), this); m_PlayProc = playProc; m_PlayNextMedia = getNext; m_PlayRandomMedia = getRandom; m_PlayPrevMedia = getPrev; // 回音效果 TEchoEffect effect[2]; effect[0].nLeftDelay = 1000; effect[0].nLeftEchoVolume = 20; effect[0].nLeftSrcVolume = 80; effect[0].nRightDelay = 500; effect[0].nRightEchoVolume = 20; effect[0].nRightSrcVolume = 80; effect[1].nLeftDelay = 300; effect[1].nLeftEchoVolume = 20; effect[1].nLeftSrcVolume = 0; effect[1].nRightDelay = 300; effect[1].nRightEchoVolume = 20; effect[1].nRightSrcVolume = 0; // set echo effects m_pZplayer->SetEchoParam(effect, 2); }
Player_impl::Player_impl(MessageQueue* mq):mq_(mq){ player_ = CreateZPlay(); //no sound card found assert(player_->EnumerateWaveOut() != 0); }
/******************************************************************************* * @file : CMusicProcessor.cpp * @summary : 对libzplay开源库进行封转,MusicPlayer动作的处理类 * @author : Li Jiachun * @time : 2013-3-24 14:53:06 * @history : ********************************************************************************/ #include "stdafx.h" #include "CMusicProcessor.h" // 私有静态数据成员初始化 ZPlay* CMusicProcessor::player = CreateZPlay(); /***************************************************** * @func : getInstance * @summary: 单例模式实现 * @in : void * @out : none * @return : CMusicProcessor* * @author : DaPPer * @time : 2013-3-24 15:08:21 * @history: ******************************************************/ CMusicProcessor* CMusicProcessor::getInstance(void ) { static CMusicProcessor obj; return &obj; } /*****************************************************