While game application under developing is running, I want to play MIDI file (running simultaneously; background)

The CAudioTask that developed runs MIDI file repeatedly without any problem.

Hardware’s eertain event (game pauses when the button is pushed, game pauses when loose focus and game resumes when gain focus that cause Pause and Resume

At first, it seems running fine without any problem

Upon Resume, MIDI file does not play

With ErrorCode( -4 ), MmcuoStateChanged function appears,

After then, the entire MIDI engine related control stops.

Can it be something I forgot that cause such problem?

Can it be a hardware problem?

Below is the class that is developed

class CAudioTask : public MMidiClientUtilityObserver
{
public:
CAudioTask()
{
myPlayer = CMidiClientUtility::NewL(*this);
}

~CAudioTask()
{
myPlayer->Stop(0);
myPlayer->Close();
delete myPlayer;
}

void MmcuoStateChanged(TMidiState aOldState,TMidiState aNewState,const TTimeIntervalMicroSeconds& aTime,TInt aError)
{
if( aOldState == EMidiStateClosedDisengaged && aNewState == EMidiStateOpenDisengaged )
{
myCurrentlyPlaying->SetRepeatsL( 1000, 0 );
myCurrentlyPlaying->Play();
}

if( aError != 0 )
{
myLog::SetError(aError);
}
}

void MmcuoTempoChanged(TInt aMicroBeatsPerMinute) { }
...
void MmcuoInstrumentChanged(TInt aChannel,TInt aBankId,TInt aInstrumentId) { }

void PlayMusic( )
{
myPlayer->OpenFile(_L"game.mid");
}

void StopMusic( )
{
myPlayer->Stop(0);
myPlayer->Close();
}

// Called when Lose Focus.
void PauseMusic( )
{
StopMusic();
}

// Called when Got Focus.
void ResumeMusic( )
{
PlayMusic();
}

CMidiClientUtility* myPlayer;
};

Thanks for your reply.