coastline 0.0.4
Loading...
Searching...
No Matches
coastline::SoundEffects Class Reference

Converted sound selection and per-sample level matching for one game session. More...

#include <soundeffects.h>

Public Types

enum class  Source { Pc , N64 }
 The preferred converted race sound library; menu feedback retains front-end samples. More...

Public Member Functions

 SoundEffects (const std::filesystem::path &assets, Source source, bool enabled)
 Register the exclusive sound selection context.
 ~SoundEffects ()
 Unregister sample selection and release cached converted samples.
 SoundEffects (const SoundEffects &)=delete
 Prevent copying the registered sound selection context.
SoundEffects & operator= (const SoundEffects &)=delete
 Prevent assignment of the registered sound selection context.

Static Public Member Functions

static bool LoadRaceWave (const char *path, int sample, SDL_AudioSpec *spec, Uint8 **data, Uint32 *bytes)
 Read a race sample, matching available N64 substitutions to the PC sample's rate and level.
static bool LoadMenuWave (const std::filesystem::path &path, SDL_AudioSpec *spec, Uint8 **data, Uint32 *bytes)
 Read menu feedback as mono unsigned 8-bit PCM at 10999 frames per second.

Detailed Description

Converted sound selection and per-sample level matching for one game session.

Member Enumeration Documentation

◆ Source

The preferred converted race sound library; menu feedback retains front-end samples.

Enumerator
Pc 

Use the PC race samples at their native playback rates.

N64 

Substitute console samples at matched PC rates and levels; silence unmapped taunts.

Constructor & Destructor Documentation

◆ SoundEffects() [1/2]

coastline::SoundEffects::SoundEffects ( const std::filesystem::path & assets,
Source source,
bool enabled )

Register the exclusive sound selection context.

Another instance must not be active.

Parameters
assetsThe prepared asset directory used to locate console substitutions.
sourceThe preferred race sample library.
enabledWhether loaded samples remain audible; false produces silent samples.

◆ ~SoundEffects()

coastline::SoundEffects::~SoundEffects ( )

Unregister sample selection and release cached converted samples.

◆ SoundEffects() [2/2]

coastline::SoundEffects::SoundEffects ( const SoundEffects & )
delete

Prevent copying the registered sound selection context.

Member Function Documentation

◆ operator=()

SoundEffects & coastline::SoundEffects::operator= ( const SoundEffects & )
delete

Prevent assignment of the registered sound selection context.

◆ LoadRaceWave()

bool coastline::SoundEffects::LoadRaceWave ( const char * path,
int sample,
SDL_AudioSpec * spec,
Uint8 ** data,
Uint32 * bytes )
static

Read a race sample, matching available N64 substitutions to the PC sample's rate and level.

Parameters
pathThe UTF-8 PC reference WAV path, used directly without a matching substitution.
sampleThe race sound index; N64 mode silences taunts absent from the console.
specReceives the format of the decoded or converted PCM; must not be null.
dataNon-null output pointer for allocated PCM; free with SDL_free() after success.
bytesReceives the PCM byte count; must not be null.
Returns
Whether decoding and allocation succeed. Outputs are unspecified on failure.

◆ LoadMenuWave()

bool coastline::SoundEffects::LoadMenuWave ( const std::filesystem::path & path,
SDL_AudioSpec * spec,
Uint8 ** data,
Uint32 * bytes )
static

Read menu feedback as mono unsigned 8-bit PCM at 10999 frames per second.

Parameters
pathThe converted front-end WAV file.
specReceives the PCM format; must not be null.
dataNon-null output pointer for allocated PCM; free with SDL_free() after success.
bytesReceives the PCM byte count; must not be null.
Returns
Whether decoding, conversion, and allocation succeed. Outputs are unspecified on failure.

The documentation for this class was generated from the following file: