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

The XM player and sample mixers of the Nintendo 64 release, streamed as native stereo PCM. More...

#include <music.h>

Public Member Functions

 N64Audio ()
 Initialise channels in the active N64MixerContext, without opening an audio device.
 ~N64Audio ()
 Destroy the playback stream before the mixer context is destroyed.
 N64Audio (const N64Audio &)=delete
 Prevent copying the playback stream and module storage.
N64Audio & operator= (const N64Audio &)=delete
 Prevent assignment of the playback stream and module storage.
bool OpenDevice ()
 Open the default playback device.
void Play (std::span< const std::uint8_t > module)
 Load a module and start it from its first order.
void Stop ()
 Stop the module and silence its channels.
bool Pause ()
bool Resume ()
bool UpdateVolumeProcessing ()
 Suspend the device while paused or while both enabled audio categories are silent.
void SetProcessingEnabled (bool music, bool soundEffects)
 Enable each category independently of transient fades and playback pauses.
void SetMusicGain (float gain)
 Scale the music of the modules, apart from the sound effects the player mixes with it.
std::vector< std::int16_t > Render (std::size_t frames)
 Render stereo 16-bit frames without a device, as the device would receive them.

Detailed Description

The XM player and sample mixers of the Nintendo 64 release, streamed as native stereo PCM.

Mixer controls advance every 10 milliseconds, with lookahead for notes and sound effects.

Constructor & Destructor Documentation

◆ N64Audio() [1/2]

coastline::N64Audio::N64Audio ( )

Initialise channels in the active N64MixerContext, without opening an audio device.

◆ ~N64Audio()

coastline::N64Audio::~N64Audio ( )

Destroy the playback stream before the mixer context is destroyed.

◆ N64Audio() [2/2]

coastline::N64Audio::N64Audio ( const N64Audio & )
delete

Prevent copying the playback stream and module storage.

Member Function Documentation

◆ operator=()

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

Prevent assignment of the playback stream and module storage.

◆ OpenDevice()

bool coastline::N64Audio::OpenDevice ( )

Open the default playback device.

Returns
Whether the device opened. The player still renders without it.

◆ Play()

void coastline::N64Audio::Play ( std::span< const std::uint8_t > module)

Load a module and start it from its first order.

Parameters
moduleA valid imported XM module, copied into player storage before playback.

◆ Stop()

void coastline::N64Audio::Stop ( )

Stop the module and silence its channels.

◆ Pause()

bool coastline::N64Audio::Pause ( )
Returns
Whether the device paused, and true without a device.

◆ Resume()

bool coastline::N64Audio::Resume ( )
Returns
Whether the device resumed, and true without a device.

◆ UpdateVolumeProcessing()

bool coastline::N64Audio::UpdateVolumeProcessing ( )

Suspend the device while paused or while both enabled audio categories are silent.

Returns
Whether the required device transition succeeds, or true without a transition.

◆ SetProcessingEnabled()

void coastline::N64Audio::SetProcessingEnabled ( bool music,
bool soundEffects )

Enable each category independently of transient fades and playback pauses.

Parameters
musicWhether to process music while its volume is nonzero.
soundEffectsWhether to process effects while their master volume is nonzero.

◆ SetMusicGain()

void coastline::N64Audio::SetMusicGain ( float gain)

Scale the music of the modules, apart from the sound effects the player mixes with it.

Parameters
gainThe finite scale, clamped to 0 through 8, with 1 for the console level.

◆ Render()

std::vector< std::int16_t > coastline::N64Audio::Render ( std::size_t frames)

Render stereo 16-bit frames without a device, as the device would receive them.

The volumes of the game are published first.

Parameters
framesThe frames to render.
Returns
The interleaved samples.

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