blob: 98ad6b36a396bc2a6d715e239b36b59eec75ce92 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
|
//=============================================================================
// Copyright (C) 2002 Radical Entertainment Ltd. All rights reserved.
//
// File: simpsonssoundplayer.h
//
// Description: Declaration for SimpsonsSoundPlayer class, which interacts with
// the sound renderer to play sounds, and tracks the player
// resources in use.
//
// History: 29/06/2002 + Created -- Darren
//
//=============================================================================
#ifndef SIMPSONSSOUNDPLAYER_H
#define SIMPSONSSOUNDPLAYER_H
//========================================
// Nested Includes
//========================================
#include <sound/soundrenderer/soundsystem.h>
//========================================
// Forward References
//========================================
namespace Sound
{
class daSoundResourceManager;
class daSoundClipStreamPlayer;
class daSoundPlayerManager;
}
struct IDaSoundResource;
class SoundLoader;
class SoundRenderingPlayerCallback;
struct IRadSoundHalPositionalGroup;
//=============================================================================
//
// Synopsis: SimpsonsSoundPlayerCallback
//
//=============================================================================
struct SimpsonsSoundPlayerCallback
{
virtual void OnSoundReady() = 0;
virtual void OnPlaybackComplete() = 0;
};
//=============================================================================
//
// Synopsis: SimpsonsSoundPlayer
//
//=============================================================================
class SimpsonsSoundPlayer
{
public:
SimpsonsSoundPlayer();
virtual ~SimpsonsSoundPlayer();
bool PlaySound( const char* resourceName, SimpsonsSoundPlayerCallback* callback = NULL );
bool PlaySound( Sound::daResourceKey resourceKey, SimpsonsSoundPlayerCallback* callback = NULL );
virtual bool PlayResource( IDaSoundResource* resource,
SimpsonsSoundPlayerCallback* callback = NULL );
bool QueueSound( const char* resourceName,
SimpsonsSoundPlayerCallback* callback = NULL )
{ return( QueueSound( ::radMakeKey32( resourceName ), callback ) ); }
bool QueueSound( radKey32 resourceKey,
SimpsonsSoundPlayerCallback* callback = NULL );
bool QueueSound( IDaSoundResource* resource,
SimpsonsSoundPlayerCallback* callback = NULL );
virtual void PlayQueuedSound( SimpsonsSoundPlayerCallback* callback = NULL );
void Stop();
void Pause();
void Continue();
bool IsPaused();
void OnPlaybackComplete();
bool IsInUse() { return( m_playa != NULL ); }
void SetPitch( float pitch );
void SetTrim( float trim );
protected:
//
// Sound renderer's player object
//
Sound::daSoundClipStreamPlayer* m_playa;
//
// Call when we're done with the sound renderer player object
//
virtual void dumpSoundPlayer();
protected:
enum Type { Type_Positional, Type_NonPositional } m_Type;
private:
//Prevent wasteful constructor creation.
SimpsonsSoundPlayer( const SimpsonsSoundPlayer& original );
SimpsonsSoundPlayer& operator=( const SimpsonsSoundPlayer& rhs );
//
// Sound renderer resource manager
//
static Sound::daSoundResourceManager* s_resourceManager;
static Sound::daSoundPlayerManager* s_playerManager;
static SoundLoader* s_soundLoader;
//
// Statistics on players in use
//
static unsigned int s_playersCreated;
static unsigned int s_clipPlayersInUse;
static unsigned int s_streamPlayersInUse;
//
// Callback object for playback completion
//
SoundRenderingPlayerCallback* m_callback;
};
#endif // SIMPSONSSOUNDPLAYER_H
|