Main Page
Namespaces
Classes
Files
File List
File Members
Gosu
Audio.hpp
Go to the documentation of this file.
1
2
3
4
#ifndef GOSU_AUDIO_HPP
5
#define GOSU_AUDIO_HPP
6
7
#ifdef WIN32
8
#ifndef NOMINMAX
9
#define NOMINMAX
10
#endif
11
#include <windows.h>
12
#endif
13
#include <
Gosu/Fwd.hpp
>
14
#include <
Gosu/IO.hpp
>
15
#include <
Gosu/Platform.hpp
>
16
#include <
Gosu/TR1.hpp
>
17
#include <memory>
18
#include <string>
19
20
namespace
Gosu
21
{
22
// Deprecated.
23
#ifndef SWIG
24
GOSU_DEPRECATED
class
Audio;
25
#endif
26
32
class
SampleInstance
33
{
34
int
handle, extra;
35
bool
alive()
const
;
36
37
public
:
39
SampleInstance
(
int
handle,
int
extra);
40
41
bool
playing
()
const
;
42
bool
paused
()
const
;
44
void
pause
();
45
void
resume
();
48
void
stop
();
49
52
void
changeVolume
(
double
volume);
54
void
changePan
(
double
pan);
58
void
changeSpeed
(
double
speed);
59
};
60
64
class
Sample
65
{
66
struct
SampleData;
67
std::tr1::shared_ptr<SampleData> data;
68
69
public
:
72
explicit
Sample
(
const
std::wstring& filename);
73
76
explicit
Sample
(
Reader
reader);
77
84
SampleInstance
play
(
double
volume = 1,
double
speed = 1,
85
bool
looping =
false
)
const
;
86
96
SampleInstance
playPan
(
double
pan,
double
volume = 1,
double
speed = 1,
97
bool
looping =
false
)
const
;
98
99
#ifndef SWIG
100
GOSU_DEPRECATED
Sample
(Audio& audio,
const
std::wstring& filename);
101
GOSU_DEPRECATED
Sample
(Audio& audio,
Reader
reader);
102
#endif
103
};
104
107
class
Song
108
{
109
class
BaseData;
110
class
ModuleData;
111
class
StreamData;
112
Song
(
const
Song
&);
113
Song
& operator=(
const
Song
&);
114
std::auto_ptr<BaseData> data;
115
116
public
:
120
explicit
Song
(
const
std::wstring& filename);
121
124
explicit
Song
(
Reader
reader);
125
126
~Song
();
127
131
static
Song
*
currentSong
();
132
135
void
play
(
bool
looping =
false
);
138
void
pause
();
141
bool
paused
()
const
;
144
void
stop
();
146
bool
playing
()
const
;
148
double
volume
()
const
;
150
void
changeVolume
(
double
volume);
151
153
static
void
update
();
154
155
#ifndef SWIG
156
enum
Type
{
stStream
,
stModule
};
157
GOSU_DEPRECATED
Song
(Audio&,
const
std::wstring& filename);
158
GOSU_DEPRECATED
Song
(Audio&,
Type
type,
Reader
reader);
159
#endif
160
};
161
}
162
163
#endif