breakdeps/coesndpy.cpp
author William Roberts <williamr@symbian.org>
Fri, 15 Oct 2010 14:49:09 +0100
changeset 55 f1c1302a0b48
parent 54 dcd1a22c2899
permissions -rw-r--r--
Create stem_cone.dll, breaking dependency on mediaclientaudio.dll and mediaclient.dll
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
42
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
     1
// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
     2
// All rights reserved.
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
     3
// This component and the accompanying materials are made available
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
     4
// under the terms of "Eclipse Public License v1.0"
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
     5
// which accompanies this distribution, and is available
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
     7
//
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
     8
// Initial Contributors:
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
     9
// Nokia Corporation - initial contribution.
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
    10
//
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
    11
// Contributors:
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
    12
//
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
    13
// Description:
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
    14
//
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
    15
55
f1c1302a0b48 Create stem_cone.dll, breaking dependency on mediaclientaudio.dll and mediaclient.dll
William Roberts <williamr@symbian.org>
parents: 54
diff changeset
    16
//#include <mda/client/utility.h>
f1c1302a0b48 Create stem_cone.dll, breaking dependency on mediaclientaudio.dll and mediaclient.dll
William Roberts <williamr@symbian.org>
parents: 54
diff changeset
    17
//#include <mdaaudiosampleplayer.h>
f1c1302a0b48 Create stem_cone.dll, breaking dependency on mediaclientaudio.dll and mediaclient.dll
William Roberts <williamr@symbian.org>
parents: 54
diff changeset
    18
//#include <mdaaudiotoneplayer.h>
42
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
    19
#include <bassnd.h>
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
    20
#include <coesndpy.h>
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
    21
#include <coemain.h>
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
    22
#include "coepanic.h"
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
    23
#include <coeutils.h>
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
    24
55
f1c1302a0b48 Create stem_cone.dll, breaking dependency on mediaclientaudio.dll and mediaclient.dll
William Roberts <williamr@symbian.org>
parents: 54
diff changeset
    25
#if 0
42
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
    26
const TUid KLafSoundPlayerUid={0x10005F1A};
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
    27
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
    28
class CCoeSoundPlayer;
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
    29
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
    30
//
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
    31
// class MCoeSoundPlayerObserver
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
    32
//
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
    33
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
    34
class MCoeSoundPlayerObserver
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
    35
	{
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
    36
public:
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
    37
	virtual void PlayEnded(const CCoeSoundPlayer& aPlayer)=0;
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
    38
	};
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
    39
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
    40
//
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
    41
// class CCoeSoundPlayer
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
    42
//
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
    43
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
    44
class CCoeSoundPlayer : public CBase
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
    45
	{
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
    46
public:
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
    47
	~CCoeSoundPlayer();
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
    48
public:
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
    49
	inline const TBaSystemSoundInfo& SoundInfo() const;
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
    50
	inline TBool IsPlaying() const;
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
    51
	virtual void StartPlay()=0;
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
    52
protected:
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
    53
	CCoeSoundPlayer(MCoeSoundPlayerObserver& aObserver,const TBaSystemSoundInfo& aInfo,
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
    54
						TInt aPlayCount,TTimeIntervalMicroSeconds32 aGap);
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
    55
	void BaseConstructL();
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
    56
	static TInt PlayTimerCallBack(TAny* aSelf);
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
    57
private:
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
    58
	virtual void Play()=0;
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
    59
protected:
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
    60
	MCoeSoundPlayerObserver& iObserver;
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
    61
	TBaSystemSoundInfo iSoundInfo;
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
    62
	TInt iPlayCount;
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
    63
	TTimeIntervalMicroSeconds32 iGap;
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
    64
	CPeriodic* iTimer;
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
    65
	TBool iPlaying;
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
    66
	};
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
    67
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
    68
inline const TBaSystemSoundInfo& CCoeSoundPlayer::SoundInfo() const
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
    69
	{return iSoundInfo;}
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
    70
inline TBool CCoeSoundPlayer::IsPlaying() const
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
    71
	{return iPlaying;}
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
    72
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
    73
CCoeSoundPlayer::~CCoeSoundPlayer()
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
    74
	{
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
    75
	delete iTimer;
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
    76
	}
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
    77
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
    78
CCoeSoundPlayer::CCoeSoundPlayer(MCoeSoundPlayerObserver& aObserver,const TBaSystemSoundInfo& aInfo,
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
    79
									TInt aPlayCount,TTimeIntervalMicroSeconds32 aGap)
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
    80
	: iObserver(aObserver), iSoundInfo(aInfo), iPlayCount(aPlayCount), iGap(aGap), iPlaying(EFalse)
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
    81
	{}
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
    82
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
    83
void CCoeSoundPlayer::BaseConstructL()
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
    84
	{
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
    85
	}
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
    86
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
    87
TInt CCoeSoundPlayer::PlayTimerCallBack(TAny* aSelf)
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
    88
	{ // static
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
    89
	CCoeSoundPlayer* player=REINTERPRET_CAST(CCoeSoundPlayer*,aSelf);
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
    90
	player->iTimer->Cancel();
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
    91
	player->Play();
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
    92
	return 0;
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
    93
	}
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
    94
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
    95
//
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
    96
// class CCoeTonePlayer
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
    97
//
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
    98
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
    99
class CCoeTonePlayer : public CCoeSoundPlayer, public MMdaAudioToneObserver
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   100
	{
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   101
public:
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   102
	static CCoeTonePlayer* NewLC(MCoeSoundPlayerObserver& aObserver,const TBaSystemSoundInfo& aInfo,
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   103
									CMdaServer& aMdaServer,TInt aPlayCount,TTimeIntervalMicroSeconds32 aGap);
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   104
	~CCoeTonePlayer();
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   105
private:
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   106
	CCoeTonePlayer(MCoeSoundPlayerObserver& aObserver,const TBaSystemSoundInfo& aInfo,
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   107
						TInt aPlayCount,TTimeIntervalMicroSeconds32 aGap);
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   108
	void ConstructL(CMdaServer& aMdaServer);
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   109
private: // from CCoeSoundPlayer
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   110
	void StartPlay();
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   111
	void Play();
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   112
private: // from MMdaAudioToneObserver
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   113
	void MatoPrepareComplete(TInt aError);
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   114
	void MatoPlayComplete(TInt aError);
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   115
private:
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   116
	CMdaAudioToneUtility* iPlayUtility;
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   117
	};
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   118
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   119
CCoeTonePlayer* CCoeTonePlayer::NewLC(MCoeSoundPlayerObserver& aObserver,const TBaSystemSoundInfo& aInfo,
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   120
								CMdaServer& aMdaServer,TInt aPlayCount,TTimeIntervalMicroSeconds32 aGap)
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   121
	{ // static
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   122
	CCoeTonePlayer* self=new(ELeave) CCoeTonePlayer(aObserver,aInfo,aPlayCount,aGap);
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   123
	CleanupStack::PushL(self);
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   124
	self->ConstructL(aMdaServer);
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   125
	return self;
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   126
	}
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   127
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   128
CCoeTonePlayer::~CCoeTonePlayer()
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   129
	{
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   130
	delete iPlayUtility;
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   131
	}
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   132
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   133
CCoeTonePlayer::CCoeTonePlayer(MCoeSoundPlayerObserver& aObserver,const TBaSystemSoundInfo& aInfo,
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   134
					TInt aPlayCount,TTimeIntervalMicroSeconds32 aGap)
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   135
	: CCoeSoundPlayer(aObserver,aInfo,aPlayCount,aGap)
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   136
	{}
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   137
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   138
void CCoeTonePlayer::ConstructL(CMdaServer& aMdaServer)
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   139
	{
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   140
	iPlayUtility=CMdaAudioToneUtility::NewL(*this,&aMdaServer);
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   141
	BaseConstructL();
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   142
	}
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   143
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   144
void CCoeTonePlayer::StartPlay()
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   145
	{
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   146
	TBaSystemSoundInfo::TSoundCategory soundCat=iSoundInfo.SoundCategory();
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   147
	if (soundCat==TBaSystemSoundInfo::ESequence)
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   148
		iPlayUtility->PrepareToPlayFixedSequence(iSoundInfo.FixedSequenceNumber());
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   149
	else if (soundCat==TBaSystemSoundInfo::ETone)
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   150
		{
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   151
		TBaSystemSoundInfo::TTone tone=iSoundInfo.Tone();
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   152
		TInt64 time(tone.iDuration.Int());
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   153
		TTimeIntervalMicroSeconds duration(time);
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   154
		iPlayUtility->PrepareToPlayTone(tone.iFrequency,duration);
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   155
		}
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   156
	else
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   157
		iObserver.PlayEnded(*this);
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   158
	}
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   159
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   160
void CCoeTonePlayer::Play()
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   161
	{
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   162
    iPlayUtility->SetVolume(iSoundInfo.iVolume);
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   163
	iPlayUtility->Play();
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   164
	}
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   165
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   166
void CCoeTonePlayer::MatoPrepareComplete(TInt aError)
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   167
	{
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   168
	if (aError == KErrNone)
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   169
		{
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   170
		iPlayUtility->SetVolume(iSoundInfo.iVolume);
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   171
		iPlayUtility->SetPriority(iSoundInfo.iPriority,EMdaPriorityPreferenceNone);
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   172
		iPlaying=ETrue;
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   173
		if (--iPlayCount>0)
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   174
			{
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   175
			TInt64 val(iGap.Int());
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   176
			TTimeIntervalMicroSeconds gap(val);
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   177
			iPlayUtility->SetRepeats(iPlayCount,gap);
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   178
			}
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   179
		iPlayUtility->Play();
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   180
		}
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   181
	else
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   182
		iObserver.PlayEnded(*this);
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   183
	}
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   184
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   185
void CCoeTonePlayer::MatoPlayComplete(TInt /*aError*/)
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   186
	{
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   187
	iObserver.PlayEnded(*this);
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   188
	}
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   189
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   190
//
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   191
// class CCoeFilePlayer
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   192
//
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   193
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   194
class CCoeFilePlayer : public CCoeSoundPlayer, public MMdaAudioPlayerCallback
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   195
	{
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   196
public:
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   197
	static CCoeFilePlayer* NewLC(MCoeSoundPlayerObserver& aObserver,const TBaSystemSoundInfo& aInfo,
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   198
									TInt aPlayCount,TTimeIntervalMicroSeconds32 aGap);
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   199
	~CCoeFilePlayer();
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   200
private:
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   201
	CCoeFilePlayer(MCoeSoundPlayerObserver& aObserver,const TBaSystemSoundInfo& aInfo,
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   202
						TInt aPlayCount,TTimeIntervalMicroSeconds32 aGap);
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   203
	void ConstructL();
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   204
private: // from CCoeSoundPlayer
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   205
	void StartPlay();
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   206
	void Play();
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   207
private: // from MMdaAudioPlayerCallback
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   208
	void MapcInitComplete(TInt aStatus, const TTimeIntervalMicroSeconds& aDuration);
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   209
	void MapcPlayComplete(TInt aErr);
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   210
private:
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   211
	CMdaAudioPlayerUtility* iPlayUtility;
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   212
	TBool iReadyToPlay;
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   213
	};
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   214
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   215
CCoeFilePlayer* CCoeFilePlayer::NewLC(MCoeSoundPlayerObserver& aObserver,const TBaSystemSoundInfo& aInfo,
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   216
								TInt aPlayCount,TTimeIntervalMicroSeconds32 aGap)
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   217
	{ // static
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   218
	CCoeFilePlayer* self=new(ELeave) CCoeFilePlayer(aObserver,aInfo,aPlayCount,aGap);
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   219
	CleanupStack::PushL(self);
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   220
	self->ConstructL();
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   221
	return self;
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   222
	}
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   223
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   224
CCoeFilePlayer::~CCoeFilePlayer()
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   225
	{
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   226
	delete iPlayUtility;
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   227
	}
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   228
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   229
CCoeFilePlayer::CCoeFilePlayer(MCoeSoundPlayerObserver& aObserver,const TBaSystemSoundInfo& aInfo,
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   230
					TInt aPlayCount,TTimeIntervalMicroSeconds32 aGap)
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   231
	: CCoeSoundPlayer(aObserver,aInfo,aPlayCount,aGap)
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   232
	{}
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   233
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   234
void CCoeFilePlayer::ConstructL()
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   235
	{
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   236
	BaseConstructL();
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   237
	TFileName name=iSoundInfo.FileName();
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   238
	iPlayUtility=CMdaAudioPlayerUtility::NewFilePlayerL(name,*this,iSoundInfo.iPriority);
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   239
	}
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   240
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   241
void CCoeFilePlayer::StartPlay()
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   242
	{
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   243
	if (iReadyToPlay)
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   244
		Play();
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   245
	else
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   246
		iReadyToPlay=ETrue;
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   247
	}
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   248
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   249
void CCoeFilePlayer::Play()
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   250
	{
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   251
	if(iSoundInfo.iVolume > iPlayUtility->MaxVolume() )
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   252
		{
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   253
		iSoundInfo.iVolume = iPlayUtility->MaxVolume();
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   254
		}
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   255
	iPlayUtility->SetVolume(iSoundInfo.iVolume); 
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   256
	iPlaying=ETrue;
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   257
	iPlayUtility->Play();
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   258
	}
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   259
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   260
void CCoeFilePlayer::MapcInitComplete(TInt aStatus,const TTimeIntervalMicroSeconds& /*aDuration*/)
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   261
	{
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   262
	if (aStatus!=KErrNone)
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   263
		iObserver.PlayEnded(*this);
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   264
	else
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   265
		{
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   266
		iPlayUtility->SetVolume(iSoundInfo.iVolume);
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   267
		if (--iPlayCount>0)
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   268
			{
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   269
			TInt64 val(iGap.Int());
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   270
			TTimeIntervalMicroSeconds gap(val);
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   271
			iPlayUtility->SetRepeats(iPlayCount,gap);
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   272
			}
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   273
 		if (iReadyToPlay)
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   274
			{
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   275
			Play();
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   276
			}
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   277
 		else
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   278
			{
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   279
			iReadyToPlay=ETrue;
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   280
			}
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   281
   		}
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   282
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   283
	}
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   284
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   285
void CCoeFilePlayer::MapcPlayComplete(TInt /*aErr*/)
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   286
	{
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   287
	iObserver.PlayEnded(*this);
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   288
	}
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   289
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   290
//
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   291
// class CCoeSoundPlayerManager
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   292
//
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   293
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   294
class CCoeSoundPlayerManager : public CCoeStatic, public MCoeSoundPlayerObserver
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   295
	{
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   296
public:
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   297
	static CCoeSoundPlayerManager* NewL();
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   298
	void PlaySoundL(const TBaSystemSoundType& aType,TInt aPlayCount,const TTimeIntervalMicroSeconds32& aGap,TBool aInterrupt);
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   299
	void CancelSound(const TBaSystemSoundType& aType);
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   300
private: // from MCoeSoundPlayerObserver
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   301
	void PlayEnded(const CCoeSoundPlayer& aPlayer);
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   302
private:
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   303
	CCoeSoundPlayerManager();
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   304
	~CCoeSoundPlayerManager();
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   305
	void ConstructL();
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   306
private:
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   307
	CArrayPtrFlat<CCoeSoundPlayer> iPlayers;
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   308
	CMdaServer* iMdaServer;
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   309
	};
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   310
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   311
CCoeSoundPlayerManager* CCoeSoundPlayerManager::NewL()
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   312
	{ // static
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   313
	CCoeSoundPlayerManager* self=new(ELeave) CCoeSoundPlayerManager();
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   314
	CleanupStack::PushL(self);
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   315
	self->ConstructL();
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   316
	CleanupStack::Pop(); // self
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   317
	return self;
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   318
	}
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   319
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   320
/*
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   321
 * Initialize the sound matching aType.  Interrupt any lower priority sound but, if a higher or 
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   322
 * equal priority sound is already playing, then wait for it to finish
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   323
 *
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   324
 */
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   325
void CCoeSoundPlayerManager::PlaySoundL(const TBaSystemSoundType& aType,TInt aPlayCount,
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   326
												const TTimeIntervalMicroSeconds32& aGap,TBool aInterrupt)
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   327
	{
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   328
	TBaSystemSoundInfo info;
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   329
	User::LeaveIfError( BaSystemSound::GetSound(CCoeEnv::Static()->FsSession(),aType,info) );
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   330
	if (info.SoundCategory()==TBaSystemSoundInfo::EFile)
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   331
		{
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   332
		TBaSystemSoundName fileName=info.FileName();
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   333
		if (aType.iMinor!=KNullUid && !ConeUtils::FileExists(fileName))
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   334
			{
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   335
			TBaSystemSoundType defaultType(aType.iMajor,KNullUid);
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   336
		 	User::LeaveIfError( BaSystemSound::GetSound(CCoeEnv::Static()->FsSession(),defaultType,info) );
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   337
			}
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   338
		}
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   339
	if (info.iVolume == 0) //do not play the sound, if the volume is set to silent.
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   340
		return;
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   341
	info.iType=aType; // clients will try to cancel this sound using aType rather than whatever sound was actually found
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   342
	TInt count=iPlayers.Count();
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   343
	if (count)
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   344
		{
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   345
		CCoeSoundPlayer* player=iPlayers[0];
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   346
		if (aInterrupt || player->SoundInfo().iPriority<info.iPriority)
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   347
			{
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   348
			delete player;
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   349
			iPlayers.Delete(0);
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   350
			--count;
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   351
			}
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   352
		}
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   353
	CCoeSoundPlayer* player=NULL;
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   354
	if (info.SoundCategory()==TBaSystemSoundInfo::EFile)
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   355
		player=CCoeFilePlayer::NewLC(*this,info,aPlayCount,aGap);
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   356
	else
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   357
		player=CCoeTonePlayer::NewLC(*this,info,*iMdaServer,aPlayCount,aGap);
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   358
	TInt ii=0;
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   359
	for (;ii<count;ii++)
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   360
		{
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   361
		if (iPlayers[ii]->SoundInfo().iPriority<info.iPriority)
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   362
			{
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   363
			iPlayers.InsertL(ii,player);
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   364
			break;
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   365
			}
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   366
		}
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   367
	if (iPlayers.Count()==count) // we haven't managed to insert it anywhere
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   368
		iPlayers.AppendL(player);
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   369
	CleanupStack::Pop(); // player
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   370
	if (ii==0)
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   371
		iPlayers[0]->StartPlay();
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   372
	}
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   373
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   374
void CCoeSoundPlayerManager::CancelSound(const TBaSystemSoundType& aType)
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   375
	{
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   376
	TInt loop=0;
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   377
	while (loop<iPlayers.Count())
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   378
		{
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   379
		CCoeSoundPlayer* player=iPlayers[loop];
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   380
		if (player->SoundInfo().iType==aType)
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   381
			{
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   382
			delete player;
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   383
			iPlayers.Delete(loop);
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   384
			}
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   385
		else
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   386
			++loop;
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   387
		}
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   388
	if (iPlayers.Count()==0)
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   389
		delete this;
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   390
	}
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   391
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   392
void CCoeSoundPlayerManager::PlayEnded(const CCoeSoundPlayer& aPlayer)
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   393
// don't need to check the actaul player that's finished as it's always
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   394
// index 0.  Leave the code alone for now in case we change once apps
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   395
// start using it
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   396
	{
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   397
	TInt ii=-1;
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   398
	FOREVER
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   399
		{
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   400
		CCoeSoundPlayer* player=iPlayers[++ii];
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   401
		if (&aPlayer==player)
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   402
			{
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   403
			delete player;
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   404
			iPlayers.Delete(ii);
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   405
			break;
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   406
			}
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   407
		}
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   408
	if (iPlayers.Count())
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   409
		iPlayers[0]->StartPlay();
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   410
	else
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   411
		delete this; // no more sounds to play so allow media server to close
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   412
	}
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   413
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   414
CCoeSoundPlayerManager::CCoeSoundPlayerManager()
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   415
	: CCoeStatic(KLafSoundPlayerUid), iPlayers(1)
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   416
	{}
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   417
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   418
CCoeSoundPlayerManager::~CCoeSoundPlayerManager()
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   419
	{
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   420
	iPlayers.ResetAndDestroy();
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   421
	delete iMdaServer;
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   422
	}
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   423
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   424
void CCoeSoundPlayerManager::ConstructL()
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   425
	{
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   426
	iMdaServer=CMdaServer::NewL();
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   427
	}
55
f1c1302a0b48 Create stem_cone.dll, breaking dependency on mediaclientaudio.dll and mediaclient.dll
William Roberts <williamr@symbian.org>
parents: 54
diff changeset
   428
#endif
42
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   429
//
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   430
// class CoeSoundPlayer
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   431
//
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   432
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   433
EXPORT_C void CoeSoundPlayer::PlaySound(const TBaSystemSoundType& aType,TInt aPlayCount,
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   434
											TTimeIntervalMicroSeconds32 aGap,TBool aInterrupt)
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   435
	{ // static
55
f1c1302a0b48 Create stem_cone.dll, breaking dependency on mediaclientaudio.dll and mediaclient.dll
William Roberts <williamr@symbian.org>
parents: 54
diff changeset
   436
	//TRAP_IGNORE(ManagerL()->PlaySoundL(aType,aPlayCount,aGap,aInterrupt));
42
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   437
	}
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   438
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   439
EXPORT_C void CoeSoundPlayer::CancelSound(const TBaSystemSoundType& aType)
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   440
/** Stops playing the specified sound.
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   441
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   442
@param aType The sound to stop playing. */
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   443
	{ // static
55
f1c1302a0b48 Create stem_cone.dll, breaking dependency on mediaclientaudio.dll and mediaclient.dll
William Roberts <williamr@symbian.org>
parents: 54
diff changeset
   444
	//TRAP_IGNORE(ManagerL()->CancelSound(aType));
42
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   445
	}
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   446
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   447
CCoeSoundPlayerManager* CoeSoundPlayer::ManagerL()
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   448
	{ // static
55
f1c1302a0b48 Create stem_cone.dll, breaking dependency on mediaclientaudio.dll and mediaclient.dll
William Roberts <williamr@symbian.org>
parents: 54
diff changeset
   449
#if 0	
42
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   450
	CCoeEnv* env=CCoeEnv::Static();
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   451
	__ASSERT_ALWAYS(env,Panic(ECoePanicNullEnvironment));
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   452
	CCoeSoundPlayerManager* manager=
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   453
		STATIC_CAST(CCoeSoundPlayerManager*,env->FindStatic(KLafSoundPlayerUid));
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   454
	if (!manager)
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   455
		manager=CCoeSoundPlayerManager::NewL();
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   456
	return manager;
55
f1c1302a0b48 Create stem_cone.dll, breaking dependency on mediaclientaudio.dll and mediaclient.dll
William Roberts <williamr@symbian.org>
parents: 54
diff changeset
   457
#endif
f1c1302a0b48 Create stem_cone.dll, breaking dependency on mediaclientaudio.dll and mediaclient.dll
William Roberts <williamr@symbian.org>
parents: 54
diff changeset
   458
	return NULL;
42
29cf161020cf Break CONE dependency on MediaClient.dll and MediaClientAudio.dll
markw <markw@symbian.org>
parents:
diff changeset
   459
	}