coastline 0.0.4
Loading...
Searching...
No Matches
soundbuffer.h
Go to the documentation of this file.
1#pragma once
2
8
9#if TGR_PLATFORM == TGR_PLATFORM_WIN
10#include <windows.h>
11// The headers below need the types of windows.h.
12#include <dsound.h>
13#else
14#include "ear/sdlmixer.h"
15#endif
16
17#include "common/assetnames.h"
18#include "common/soundbank.h"
19#include "common/soundsample.h"
20#include "common/soundsystem.h"
21#include "ear/wavechunks.h"
22
23#if TGR_PLATFORM != TGR_PLATFORM_WIN
25typedef int32_t HRESULT;
26#endif
27
28#ifdef __cplusplus
29extern "C" {
30#endif
31
32#if TGR_PLATFORM == TGR_PLATFORM_WIN
40
48
56#endif /* TGR_PLATFORM == TGR_PLATFORM_WIN */
57
65
70#if TGR_PLATFORM == TGR_PLATFORM_WIN
72#else
74#endif
76 int nPan;
77 int nVolume;
80 char abUnknown20[4];
83 char abUnknown2c[0x70];
84#if TGR_PLATFORM == TGR_PLATFORM_WIN
88#else
90 int nNameOffset;
91 char szPath[0x400];
92#endif
94};
95
103
115
125
135
143
152bool IsSoundChannelPlaying(int nChannel);
153
163bool SetAudioChannelLooping(int nChannel, int bLooping);
164
174void SetSoundBankEntryIndex(int nVoice, int nIndex);
175
183
191
193enum {
196};
197
208
218
228
239
250
261
272
282
293bool SetSoundChannelFrequency(int nSample, int nChannel, DWORD dwFrequency);
294
305bool SetSoundVoiceFrequencyFloat(int nSample, int nVoice, float fFrequency);
306
316bool StopSoundVoice(int nSample, int nVoice);
317
329
337
347bool SetAudioChannelStereoLevels(int nChannel, DWORD dwLevels);
348
356
367bool AssignAudioChannel(int nSample, int nChannel);
368
379bool SetAudioChannelFrequency(int nChannel, long long llFrequency);
380
392bool StartSoundChannelPlayback(int nSample, int nChannel, int bLooping);
393
409 short nChannel, int nSample, int nLength, int nLoopLength, DWORD dwLevels);
410
422bool SetStereoAndPlaySoundChannel(int nSample, int nChannel, DWORD dwLevels, int bLooping);
423
434bool PlaySoundChannelOneWithStereo(int nSample, DWORD dwLevels, int bLooping);
435
446bool SetSoundChannelStereo(int nSample, int nChannel, DWORD dwLevels);
447
458bool SetSoundVoiceStereo(int nSample, int nVoice, DWORD dwLevels);
459
469bool PlaySoundChannelOneOnce(int nSample, DWORD dwLevels);
470
482bool PlayLoopedSoundVoiceWithStereo(int nSample, int nVoice, DWORD dwLevels);
483
494#if TGR_PLATFORM == TGR_PLATFORM_SDL
496SoundBufferNode *LoadAudioFile(const char *pszPath, int sample = -1);
497#else
498SoundBufferNode *LoadAudioFile(const char *pszPath);
499#endif
500
512bool LoadSfxWaveVariants(int nEffect);
513
524bool LoadSoundSet(int nSet);
525
535
546
558
568
569#ifdef __cplusplus
570}
571#endif
A buffer of samples the mixer plays, as a secondary buffer of DirectSound plays in the original.
Definition sdlmixer.h:18
#define MAX_PATH
The longest path of the Windows API, the size of the paths the settings save.
Definition rallyconfig.h:14
HRESULT StopAllSoundBuffersInList(SoundBufferNode *pHead)
Stop every sound buffer of a list.
bool LoadSoundSet(int nSet)
Load the samples of a set of sounds into the channels the banks of sounds enable, from the second sam...
bool PlaySoundChannelOneOnce(int nSample, DWORD dwLevels)
Set the levels of the two sides of channel 1 of a sample and play it once.
bool LoadSfxWaveVariants(int nEffect)
Load the three files of a sound effect of a race, named by the prefixes the banks of sounds select fo...
bool SetAudioChannelStereoLevels(int nChannel, DWORD dwLevels)
Set the levels of the two sides of the buffer of a channel and record them, when sound is on.
SoundChannelState g_aSoundChannelState[SOUND_CHANNEL_COUNT]
The settings last applied to the buffer of each channel.
SoundBufferNode * g_apSoundChannelBuffer[SOUND_CHANNEL_COUNT]
The sound buffers of the channels of the sound effects.
HRESULT ApplySoundBufferPan(SoundBufferNode *pNode)
Set the pan of the buffer of a node from nPan.
bool SetSoundChannelFrequency(int nSample, int nChannel, DWORD dwFrequency)
Set the frequency of a channel of a sample, when sound is on.
bool SetSoundVoiceFrequencyFloat(int nSample, int nVoice, float fFrequency)
Set the frequency of the even channel of a voice of a sample, dropping the fraction.
bool ShutdownDirectSound(void)
Drop a user of DirectSound.
bool InitializeDirectSound(void)
Add a user of DirectSound when sound effects play.
HRESULT StopSoundBuffer(SoundBufferNode *pNode)
Stop the buffer of DirectSound of a node that plays.
void ResetSoundBankTables(void)
Clear the first entries of the three tables of the banks of sounds.
HRESULT RestartOrPlaySoundBuffer(SoundBufferNode *pNode)
Play the buffer of a node from its start: a buffer that plays goes back to its start,...
HRESULT ApplySoundBufferVolume(SoundBufferNode *pNode)
Set the volume of the buffer of a node from nVolume scaled by g_bSfxVolume, or silence it when the so...
bool StartSoundChannelPlayback(int nSample, int nChannel, int bLooping)
Play the buffer of a sample for a channel and give it to the channel, when sound is on.
IDirectSound * g_pDirectSound
DirectSound.
bool IsSoundChannelPlaying(int nChannel)
Report whether the buffer of a channel plays, when sound is on.
IDirectSoundBuffer * g_pDirectSoundPrimaryBuffer
The primary buffer of DirectSound.
bool SetSoundChannelStereo(int nSample, int nChannel, DWORD dwLevels)
Set the levels of the two sides of a channel of a sample, when sound is on.
double g_adChannelFrequencyScale[SOUND_CHANNEL_COUNT]
The scale of a frequency of each channel, from the sample assigned to it.
bool SetSoundBufferStereoLevels(SoundBufferNode *pNode, DWORD dwLevels)
Set the volume and the pan of the buffer of a node from the levels of its two sides.
bool PlayLoopedSoundVoiceWithStereo(int nSample, int nVoice, DWORD dwLevels)
Set the levels of the two sides of the even channel of a voice of a sample and play it in a loop.
bool SetAudioChannelLooping(int nChannel, int bLooping)
Set whether the buffer of a channel plays in a loop, when sound is on.
HRESULT FreeSoundBufferList(SoundBufferNode *pHead)
Release and free every node of a list of sound buffers, with the sample and the format of each,...
void SetSoundBankEntryIndex(int nVoice, int nIndex)
Record a sound for the even channel of a voice in the first row of the banks and in the rows of the v...
bool SetStereoAndPlaySoundChannel(int nSample, int nChannel, DWORD dwLevels, int bLooping)
Set the levels of the two sides of a channel of a sample and play it, when sound is on.
bool AssignAudioChannel(int nSample, int nChannel)
Stop the buffer of a channel and give the channel the buffer of a sample for it, when sound is on.
bool SetSoundBufferFrequency(SoundBufferNode *pNode, DWORD dwFrequency)
Set the frequency of the buffer of a node, when sound is on.
bool InitSoundChannelWithVolume(short nChannel, int nSample, int nLength, int nLoopLength, DWORD dwLevels)
Request a sample and levels for a channel, give the channel the buffer of the sample,...
int AppendSoundBufferToList(SoundBufferNode *pHead, SoundBufferNode *pNode)
Add a node at the end of a list of sound buffers, not playing.
SoundBufferNode * LoadAudioFile(const char *pszPath, int sample=-1)
Load a wave file into a node of a buffer of DirectSound at the end of g_SoundBufferListHead,...
bool IsSoundBufferPlaying(SoundBufferNode *pNode)
Report whether the buffer of a node plays.
bool SetSoundVoiceStereo(int nSample, int nVoice, DWORD dwLevels)
Set the levels of the two sides of the even channel of a voice of a sample.
HRESULT PlaySoundBuffer(SoundBufferNode *pNode, int bLooping)
Set whether the buffer of a node loops and play it from its start.
int g_dwLoadedSoundSampleCount
The number of entries of g_aSoundChannelBuffers that are loaded.
@ SOUND_SET_RACE
Definition soundbuffer.h:195
@ SOUND_SET_FRONT_END
Definition soundbuffer.h:194
bool SetAudioChannelFrequency(int nChannel, long long llFrequency)
Set the frequency of the buffer of a channel, scaled by its sample, and record it,...
HRESULT CreateDirectSoundBufferFromSample(SoundBufferNode *pNode)
Create the buffer of DirectSound of a sample, static with control of the frequency,...
HRESULT ReleaseSoundBuffer(SoundBufferNode *pNode)
Release the buffer of DirectSound of a node.
int g_dwDirectSoundRefCount
The users of DirectSound.
bool PlaySoundChannelOneWithStereo(int nSample, DWORD dwLevels, int bLooping)
Set the levels of the two sides of channel 1 of a sample and play it.
SoundBufferNode g_SoundBufferListHead
The head of the list of the sound buffers.
WAVEFORMATEX * g_pDirectSoundWaveFormat
The wave format of the primary buffer, in locked global memory.
bool StopSoundVoice(int nSample, int nVoice)
Stop the buffer of the first channel of a voice of a sample, when sound is on.
HRESULT ApplySoundBufferFrequency(SoundBufferNode *pNode)
Set the frequency of the buffer of a node from dwFrequency.
#define SOUND_CHANNEL_COUNT
The number of sound channels.
Definition soundsample.h:10
The music, the volumes, and the channels of the sound effects of the Boss Rally release,...
A sound buffer of a sample, in a list.
Definition soundbuffer.h:67
SoundBufferNode * pNext
Definition soundbuffer.h:93
void * pSampleData
Definition soundbuffer.h:68
char abUnknown20[4]
Definition soundbuffer.h:80
char abUnknown2c[0x70]
Definition soundbuffer.h:83
DWORD dwFrequency
Definition soundbuffer.h:75
int bStickyFocus
Definition soundbuffer.h:82
int nPan
Definition soundbuffer.h:76
int nVolume
Definition soundbuffer.h:77
WAVEFORMATEX * pWaveFormat
Definition soundbuffer.h:71
IDirectSoundBuffer * pBuffer
Definition soundbuffer.h:85
int bLooping
Definition soundbuffer.h:78
int nNameOffset
Definition soundbuffer.h:86
int bPlaying
Definition soundbuffer.h:79
char szPath[MAX_PATH]
Definition soundbuffer.h:87
DWORD dwSampleSize
Definition soundbuffer.h:69
int bHardware
Definition soundbuffer.h:81
The settings of the buffer of a channel, as requested or as last applied.
Definition soundsystem.h:67
WAVEFORMATEX EarWaveFormat
Definition wavechunks.h:23
typedef DWORD
typedef HRESULT