22 #ifndef TITANIC_QMIXER_H 23 #define TITANIC_QMIXER_H 25 #include "audio/mixer.h" 26 #include "titanic/sound/wave_file.h" 34 QMIX_OPENAVAILABLE = 3,
39 QMIX_CONTROL_NOREMIX = 0x04,
45 enum QMixChannelFlag {
46 QMIX_CHANNEL_STEREO = 0x0000,
47 QMIX_CHANNEL_QSOUND = 0x0001,
48 QMIX_CHANNEL_DOPPLER = 0x0002,
49 QMIX_CHANNEL_RANGE = 0x0004,
50 QMIX_CHANNEL_ELEVATION = 0x0008,
51 QMIX_CHANNEL_NODOPPLERPITCH = 0x0010,
52 QMIX_CHANNEL_PITCH_COPY = 0x0000,
53 QMIX_CHANNEL_PITCH_LINEAR = 0x0100,
54 QMIX_CHANNEL_PITCH_SPLINE = 0x0200,
55 QMIX_CHANNEL_PITCH_FILTER = 0x0300,
56 QMIX_CHANNEL_PITCH_MASK = 0x0700
71 QMIX_QUEUEWAVE = 0x0000,
72 QMIX_CLEARQUEUE = 0x0001,
73 QMIX_USELRUCHANNEL = 0x0002,
74 QMIX_HIGHPRIORITY = 0x0004,
76 QMIX_IMMEDIATE = 0x0020,
78 QMIX_PLAY_SETEVENT = 0x0100,
79 QMIX_PLAY_PULSEEVENT = 0x0200,
80 QMIX_PLAY_NOTIFYSTOP = 0x0400
89 uint32 dwSamplingRate;
98 QMIXCONFIG() : dwSize(40), dwFlags(0), dwSamplingRate(0), lpIDirectSound(
nullptr),
99 lpGuid(
nullptr), iChannels(0), iOutput(0), iLatency(0), iMath(0), hwnd(0) {}
100 QMIXCONFIG(uint32 rate,
int channels,
int latency) : dwSize(40), dwFlags(0),
101 dwSamplingRate(rate), iChannels(channels), iLatency(latency),
102 lpIDirectSound(
nullptr), lpGuid(
nullptr), iOutput(0), iMath(0), hwnd(0) {}
113 QSVECTOR() : x(0.0), y(0.0), z(0.0) {}
114 QSVECTOR(
double xp,
double yp,
double zp) : x(xp), y(yp), z(zp) {}
125 QSPOLAR() : azimuth(0.0), range(0.0), elevation(0.0) {}
126 QSPOLAR(
double azimuth_,
double range_,
double elevation_) :
127 azimuth(azimuth_), range(range_), elevation(elevation_) {}
137 QMIX_DISTANCES(
double minDistance_,
double maxDistance_,
double scale_) :
138 cbSize(16), minDistance(minDistance_), maxDistance(maxDistance_),
scale(scale_) {}
141 typedef void (*LPQMIXDONECALLBACK)(
int iChannel,
CWaveFile *lpWave,
void *dwUser);
147 LPQMIXDONECALLBACK callback;
153 const void *lpChannelParams;
157 QMIXPLAYPARAMS() : dwSize(36), lpImage(
nullptr), hwndNotify(0), callback(
nullptr),
158 dwUser(
nullptr), lStart(0), lStartLoop(0), lEndLoop(0), lEnd(0),
178 LPQMIXDONECALLBACK _callback;
181 SoundEntry() : _started(
false), _waveFile(
nullptr), _callback(
nullptr),
182 _loops(0), _userData(
nullptr) {}
184 SoundEntry(
CWaveFile *waveFile, LPQMIXDONECALLBACK callback,
int loops,
void *userData) :
185 _started(
false), _waveFile(waveFile), _callback(callback), _loops(loops), _userData(userData) {}
187 struct ChannelEntry {
195 uint _volumeChangeStart;
196 uint _volumeChangeEnd;
203 ChannelEntry() : _volume(0), _panRate(0), _volumeChangeStart(0),
204 _volumeChangeEnd(0), _volumeStart(0), _volumeEnd(0),
205 _distance(0.0), _resetDistance(
true) {}
211 byte getRawVolume()
const;
224 bool qsWaveMixInitEx(
const QMIXCONFIG &config);
229 void qsWaveMixActivate(
bool fActivate);
234 int qsWaveMixOpenChannel(
int iChannel, QMixFlag mode);
239 int qsWaveMixEnableChannel(
int iChannel, uint flags,
bool enabled);
244 void qsWaveMixCloseSession();
254 void qsWaveMixFlushChannel(
int iChannel, uint flags = 0);
264 void qsWaveMixSetPanRate(
int iChannel, uint flags, uint rate);
269 void qsWaveMixSetVolume(
int iChannel, uint flags, uint volume);
277 void qsWaveMixSetSourcePosition(
int iChannel, uint flags,
const QSVECTOR &position);
285 void qsWaveMixSetPolarPosition(
int iChannel, uint flags,
const QSPOLAR &position);
290 void qsWaveMixSetListenerPosition(
const QSVECTOR &position, uint flags = 0);
295 void qsWaveMixSetListenerOrientation(
const QSVECTOR &direction,
const QSVECTOR &up, uint flags = 0);
300 void qsWaveMixSetDistanceMapping(
int iChannel, uint flags,
const QMIX_DISTANCES &distances);
305 void qsWaveMixSetFrequency(
int iChannel, uint flags, uint frequency);
310 void qsWaveMixSetSourceVelocity(
int iChannel, uint flags,
const QSVECTOR &velocity);
325 bool qsWaveMixIsChannelDone(
int iChannel)
const;
330 void qsWaveMixPump();
Graphics::Surface * scale(const Graphics::Surface &srcImage, int xSize, int ySize)
SoundType
Definition: mixer.h:62
Definition: wave_file.h:35