coastline 0.0.4
Loading...
Searching...
No Matches
sound.h File Reference

The music of the PC port. More...

#include <windows.h>
#include <mmsystem.h>
#include "common/soundbuffer.h"
#include "common/soundsystem.h"
Include dependency graph for sound.h:

Go to the source code of this file.

Functions

bool InitializeEarSound (HWND hWnd)
 Load the EAR library and start it for a window, when the game plays music in mode 2.
bool InitializeMusicPlayback (void)
 Start the music library and its channel.
WPARAM GetEarMusicEventHandle (void)
 The event the music library signals at the end of a track.
bool PostCdAudioPlayNotify (int nTrack)
 Make a track of the CD audio current, and post a notice of MCI to the window of the music that the play finished, for the window to play the track.
bool PlayEarMusicTrack (int nTrack)
 Play a track of music through the EAR library.
int GetCurrentMusicTrack (void)
 The track of music that plays, from the CD audio in music mode 1 and the EAR library otherwise.
int GetCdAudioCurrentTrack (void)
 The track of the CD audio that plays, as MCI reports it.
int GetEarMusicCurrentTrack (void)
 The track of music the EAR library plays.
bool ReplayCurrentMusicTrack (void)
 Play the current track of the music again when the music is active.
bool HandleMusicPauseResume (unsigned char bVolume)
 Pause the music of the CD when its volume turns 0, and play its track again when the volume turns from 0, while a track plays.
bool SetScaledAudioVolume (unsigned char bVolume)
 Set the attenuation of the channel of the music of the EAR library from a volume, scaled from 0 to 255 into 0 to 10000, when the music is active.
MCIERROR MciPlayCdTracks (HWND hWnd, unsigned char nTrack)
 Play the tracks of the CD audio from a track on.
bool AdvanceMusicTrackWrapping (void)
 Play the next track of music, from the first again after the last.
bool StopMusicTrack (void)
 Stop the track of music that plays.
int ShutDownEarMusicChannel (void)
 Close the music channel of the EAR library.
bool PauseCdAudio (void)
 Pause the CD audio.
bool PlayCdAudioFromCurrentTrack (void)
 Play the tracks of the CD audio from the current track on.
bool RouteMusicInitByFlag (HWND hWnd)
 Set the music up, opening CD audio through MCI when g_dwPlayMusicMode is 1 and starting the software music otherwise.
bool OpenCdaudioMci (HWND hWnd)
 Open the CD audio through MCI for the first user of the device of the music, with the time in tracks, and read the number of tracks.
bool InitSoftwareMusicStack (HWND hWnd)
 Set up the EAR library for the first user of the device of the music and start its music.
bool ReleaseMusicDeviceReference (void)
 Drop a user of the device of the music.
bool ShutdownEarSound (void)
 Drop a user of the EAR library.

Variables

UINT g_uEarSoundWindowMessage
 The message the music library sends the main window, in music mode 2.
MCIDEVICEID g_dwMciCdAudioDeviceId
 The MCI device of the CD audio, in music mode 1.
unsigned char g_bCdMusicVolume
 The volume of the music the CD audio last had.
int g_nCurrentMusicTrack
 The track of music that plays.
int g_nMusicTrackMin
 The first track of music.
int g_nMusicTrackMax
 The last track of music.
HWND g_hMusicNotifyWnd
 The window told when the tracks of the CD audio end.
int g_bCdAudioPlaying
 Whether the CD audio was paused.
int g_dwEarMusicChannel
 The channel of the EAR library the music plays on, 100.
int g_nMusicDeviceRefCount
 The users of the device of the music.
int g_bMusicActive
 Whether music is active, with the tracks of the CD read or the channel of the EAR library started.
int g_bEarOutputInitialized
 Whether the output of the EAR library is set up.

Detailed Description

The music of the PC port.

Function Documentation

◆ InitializeEarSound()

bool InitializeEarSound ( HWND hWnd)

Load the EAR library and start it for a window, when the game plays music in mode 2.

Only the first call does the work. A failure shows a message and exits the game.

Parameters
hWndThe window the library posts its messages to.
Returns
Always true.
Ghidra address:
BRD3D: 0x1002adc0
Ghidra address:
BRGlide: 0x10017e30

◆ InitializeMusicPlayback()

bool InitializeMusicPlayback ( void )

Start the music library and its channel.

Returns
Always true.
Ghidra address:
BRD3D: 0x10002260
Ghidra address:
BRGlide: 0x10002580

◆ GetEarMusicEventHandle()

WPARAM GetEarMusicEventHandle ( void )

The event the music library signals at the end of a track.

Returns
The event.
Ghidra address:
BRD3D: 0x10002480
Ghidra address:
BRGlide: 0x100027a0

◆ PostCdAudioPlayNotify()

bool PostCdAudioPlayNotify ( int nTrack)

Make a track of the CD audio current, and post a notice of MCI to the window of the music that the play finished, for the window to play the track.

Parameters
nTrackThe track.
Returns
Always true.
Ghidra address:
BRD3D: 0x10002870
Ghidra address:
BRGlide: 0x10002ba0

◆ PlayEarMusicTrack()

bool PlayEarMusicTrack ( int nTrack)

Play a track of music through the EAR library.

Parameters
nTrackThe track.
Returns
Always true.
Ghidra address:
BRD3D: 0x100027f0
Ghidra address:
BRGlide: 0x10002b20

◆ GetCurrentMusicTrack()

int GetCurrentMusicTrack ( void )

The track of music that plays, from the CD audio in music mode 1 and the EAR library otherwise.

Returns
The track.
Ghidra address:
BRD3D: 0x10002910
Ghidra address:
BRGlide: 0x10002c50

◆ GetCdAudioCurrentTrack()

int GetCdAudioCurrentTrack ( void )

The track of the CD audio that plays, as MCI reports it.

Returns
The track, or 0 when no music plays.
Ghidra address:
BRD3D: 0x100024c0
Ghidra address:
BRGlide: 0x100027e0

◆ GetEarMusicCurrentTrack()

int GetEarMusicCurrentTrack ( void )

The track of music the EAR library plays.

Returns
The track, or 0 when no music plays.
Ghidra address:
BRD3D: 0x10002490
Ghidra address:
BRGlide: 0x100027b0

◆ ReplayCurrentMusicTrack()

bool ReplayCurrentMusicTrack ( void )

Play the current track of the music again when the music is active.

Returns
The result of SetCurrentMusicTrack(), or true when the music is not active.
Ghidra address:
BRD3D: 0x10002b40
Ghidra address:
BRGlide: 0x10002e80

◆ HandleMusicPauseResume()

bool HandleMusicPauseResume ( unsigned char bVolume)

Pause the music of the CD when its volume turns 0, and play its track again when the volume turns from 0, while a track plays.

The volume is recorded in g_bCdMusicVolume.

Parameters
bVolumeThe volume.
Returns
Always true.
Ghidra address:
BRD3D: 0x10002a80
Ghidra address:
BRGlide: 0x10002dc0

◆ SetScaledAudioVolume()

bool SetScaledAudioVolume ( unsigned char bVolume)

Set the attenuation of the channel of the music of the EAR library from a volume, scaled from 0 to 255 into 0 to 10000, when the music is active.

Parameters
bVolumeThe volume.
Returns
Always true.
Ghidra address:
BRD3D: 0x10002a20
Ghidra address:
BRGlide: 0x10002d60

◆ MciPlayCdTracks()

MCIERROR MciPlayCdTracks ( HWND hWnd,
unsigned char nTrack )

Play the tracks of the CD audio from a track on.

Parameters
hWndThe window told when the tracks end.
nTrackThe first track.
Returns
The error of MCI, or 0.
Ghidra address:
BRD3D: 0x10002550
Ghidra address:
BRGlide: 0x10002870

◆ AdvanceMusicTrackWrapping()

bool AdvanceMusicTrackWrapping ( void )

Play the next track of music, from the first again after the last.

Returns
Always true.
Ghidra address:
BRD3D: 0x100029b0
Ghidra address:
BRGlide: 0x10002cf0

◆ StopMusicTrack()

bool StopMusicTrack ( void )

Stop the track of music that plays.

A CD audio that does not stop has its device closed.

Returns
Whether the music stopped, and true when no music plays.
Ghidra address:
BRD3D: 0x10002c30
Ghidra address:
BRGlide: 0x10002f70

◆ ShutDownEarMusicChannel()

int ShutDownEarMusicChannel ( void )

Close the music channel of the EAR library.

Returns
The result of the EAR library, or 1 when no music plays.
Ghidra address:
BRD3D: 0x10002440
Ghidra address:
BRGlide: 0x10002760

◆ PauseCdAudio()

bool PauseCdAudio ( void )

Pause the CD audio.

A CD audio that does not pause has its device closed.

Returns
Whether the CD audio paused, and true when no music plays.
Ghidra address:
BRD3D: 0x10002ae0
Ghidra address:
BRGlide: 0x10002e20

◆ PlayCdAudioFromCurrentTrack()

bool PlayCdAudioFromCurrentTrack ( void )

Play the tracks of the CD audio from the current track on.

Returns
Whether the tracks play, and true when no music plays.
Ghidra address:
BRD3D: 0x10002510
Ghidra address:
BRGlide: 0x10002830

◆ RouteMusicInitByFlag()

bool RouteMusicInitByFlag ( HWND hWnd)

Set the music up, opening CD audio through MCI when g_dwPlayMusicMode is 1 and starting the software music otherwise.

Parameters
hWndThe main window.
Returns
The result of OpenCdaudioMci() or InitSoftwareMusicStack().
Ghidra address:
BRD3D: 0x100025c0
Ghidra address:
BRGlide: 0x100028e0

◆ OpenCdaudioMci()

bool OpenCdaudioMci ( HWND hWnd)

Open the CD audio through MCI for the first user of the device of the music, with the time in tracks, and read the number of tracks.

The music then plays tracks 2 to the last.

Parameters
hWndThe window told of the end of a track.
Returns
False when the device does not open or answer, true otherwise.
Ghidra address:
BRD3D: 0x10002660
Ghidra address:
BRGlide: 0x10002980

◆ InitSoftwareMusicStack()

bool InitSoftwareMusicStack ( HWND hWnd)

Set up the EAR library for the first user of the device of the music and start its music.

Parameters
hWndThe main window.
Returns
Always true.
Ghidra address:
BRD3D: 0x100025f0
Ghidra address:
BRGlide: 0x10002910

◆ ReleaseMusicDeviceReference()

bool ReleaseMusicDeviceReference ( void )

Drop a user of the device of the music.

In music mode 1 the CD audio stops, and the last user closes its device. In mode 2 the music channel of the EAR library is cleared, and the last user shuts the library down.

Returns
Whether every command of the device succeeded, and true in music mode 0.
Ghidra address:
BRD3D: 0x10002cf0
Ghidra address:
BRGlide: 0x10003030

◆ ShutdownEarSound()

bool ShutdownEarSound ( void )

Drop a user of the EAR library.

The last user shuts the library down.

Returns
Always true.
Ghidra address:
BRD3D: 0x1002aea0
Ghidra address:
BRGlide: 0x10017f10

Variable Documentation

◆ g_uEarSoundWindowMessage

UINT g_uEarSoundWindowMessage
extern

The message the music library sends the main window, in music mode 2.

Ghidra address:
BRD3D: 0x10575478
Ghidra address:
BRGlide: 0x104b1620

◆ g_dwMciCdAudioDeviceId

MCIDEVICEID g_dwMciCdAudioDeviceId
extern

The MCI device of the CD audio, in music mode 1.

Ghidra address:
BRD3D: 0x10220c40
Ghidra address:
BRGlide: 0x1021c770

◆ g_bCdMusicVolume

unsigned char g_bCdMusicVolume
extern

The volume of the music the CD audio last had.

Only whether it is 0 matters, and the music of the CD is paused at 0.

Ghidra address:
BRD3D: 0x10220cdc
Ghidra address:
BRGlide: 0x1021c80c

◆ g_nCurrentMusicTrack

int g_nCurrentMusicTrack
extern

The track of music that plays.

Ghidra address:
BRD3D: 0x10220cd4
Ghidra address:
BRGlide: 0x1021c804

◆ g_nMusicTrackMin

int g_nMusicTrackMin
extern

The first track of music.

Ghidra address:
BRD3D: 0x10220c44
Ghidra address:
BRGlide: 0x1021c774

◆ g_nMusicTrackMax

int g_nMusicTrackMax
extern

The last track of music.

Ghidra address:
BRD3D: 0x10220c38
Ghidra address:
BRGlide: 0x1021c768

◆ g_hMusicNotifyWnd

HWND g_hMusicNotifyWnd
extern

The window told when the tracks of the CD audio end.

Ghidra address:
BRD3D: 0x10220c4c
Ghidra address:
BRGlide: 0x1021c77c

◆ g_bCdAudioPlaying

int g_bCdAudioPlaying
extern

Whether the CD audio was paused.

Ghidra address:
BRD3D: 0x10220cd8
Ghidra address:
BRGlide: 0x1021c808

◆ g_dwEarMusicChannel

int g_dwEarMusicChannel
extern

The channel of the EAR library the music plays on, 100.

Ghidra address:
BRD3D: 0x100940a8
Ghidra address:
BRGlide: 0x1007b078

◆ g_nMusicDeviceRefCount

int g_nMusicDeviceRefCount
extern

The users of the device of the music.

Ghidra address:
BRD3D: 0x10220cd0
Ghidra address:
BRGlide: 0x1021c800

◆ g_bMusicActive

int g_bMusicActive
extern

Whether music is active, with the tracks of the CD read or the channel of the EAR library started.

Ghidra address:
BRD3D: 0x10220c3c
Ghidra address:
BRGlide: 0x1021c76c

◆ g_bEarOutputInitialized

int g_bEarOutputInitialized
extern

Whether the output of the EAR library is set up.

Ghidra address:
BRD3D: 0x10220c48
Ghidra address:
BRGlide: 0x1021c778