Arctic Engine
Designed to give you control and not take anything away.
arctic::Sound Class Reference

Public Member Functions

void Clear ()
 Clears the sound data.
 
void Create (double duration)
 Creates a sound with a specified duration. More...
 
double Duration () const
 Gets the duration of the sound in seconds, 0.0 if not loaded. More...
 
Si32 DurationSamples ()
 Gets the duration of the sound in samples, 0 if not loaded. More...
 
std::shared_ptr< SoundInstanceGetInstance ()
 Gets the sound instance. More...
 
bool IsPlaying ()
 Checks if the sound is currently playing. More...
 
void Load (const char *file_name)
 Loads a sound file. More...
 
void Load (const char *file_name, bool do_unpack)
 Loads a sound file with the option to unpack it. More...
 
void Load (const char *file_name, bool do_unpack, std::vector< Ui8 > *in_data)
 Loads a sound file with the option to unpack it and provide input data. More...
 
void Load (const std::string &file_name)
 Loads a sound file. More...
 
void Load (const std::string &file_name, bool do_unpack)
 Loads a sound file with the option to unpack it. More...
 
SoundHandle Play ()
 Plays the sound. More...
 
SoundHandle Play (float volume)
 Plays the sound with a specified volume. More...
 
Si16 * RawData ()
 Gets the raw sound data. More...
 
void Stop ()
 Stops the sound.
 
Si32 StreamOut (Si32 offset, Si32 size, Si16 *out_buffer, Si32 out_buffer_samples)
 Streams out a portion of the sound data. More...
 

Member Function Documentation

◆ Create()

void arctic::Sound::Create ( double  duration)

Creates a sound with a specified duration.

Parameters
durationThe duration of the sound in seconds
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Duration()

double arctic::Sound::Duration ( ) const

Gets the duration of the sound in seconds, 0.0 if not loaded.

Returns
The duration of the sound in seconds

◆ DurationSamples()

Si32 arctic::Sound::DurationSamples ( )

Gets the duration of the sound in samples, 0 if not loaded.

Returns
The duration of the sound in samples
Here is the caller graph for this function:

◆ GetInstance()

std::shared_ptr< SoundInstance > arctic::Sound::GetInstance ( )

Gets the sound instance.

Returns
A shared pointer to the sound instance
Here is the caller graph for this function:

◆ IsPlaying()

bool arctic::Sound::IsPlaying ( )

Checks if the sound is currently playing.

Returns
True if the sound is playing, false otherwise

◆ Load() [1/5]

void arctic::Sound::Load ( const char *  file_name)

Loads a sound file.

Parameters
file_nameThe name of the file to load
Here is the call graph for this function:

◆ Load() [2/5]

void arctic::Sound::Load ( const char *  file_name,
bool  do_unpack 
)

Loads a sound file with the option to unpack it.

Parameters
file_nameThe name of the file to load
do_unpackWhether to unpack the sound data
Here is the call graph for this function:

◆ Load() [3/5]

void arctic::Sound::Load ( const char *  file_name,
bool  do_unpack,
std::vector< Ui8 > *  in_data 
)

Loads a sound file with the option to unpack it and provide input data.

Parameters
file_nameThe name of the file (used for logging only)
do_unpackWhether to unpack the sound data
in_dataPointer to input data vector
Here is the call graph for this function:

◆ Load() [4/5]

void arctic::Sound::Load ( const std::string &  file_name)

Loads a sound file.

Parameters
file_nameThe name of the file to load
Here is the call graph for this function:

◆ Load() [5/5]

void arctic::Sound::Load ( const std::string &  file_name,
bool  do_unpack 
)

Loads a sound file with the option to unpack it.

Parameters
file_nameThe name of the file to load
do_unpackWhether to unpack the sound data
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Play() [1/2]

SoundHandle arctic::Sound::Play ( )

Plays the sound.

Returns
A handle to the played sound
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Play() [2/2]

SoundHandle arctic::Sound::Play ( float  volume)

Plays the sound with a specified volume.

Parameters
volumeThe volume to play the sound at, 1.0f is the default
Returns
A handle to the played sound
Here is the call graph for this function:

◆ RawData()

Si16 * arctic::Sound::RawData ( )

Gets the raw sound data.

Returns
Pointer to the raw sound data

◆ StreamOut()

Si32 arctic::Sound::StreamOut ( Si32  offset,
Si32  size,
Si16 *  out_buffer,
Si32  out_buffer_samples 
)

Streams out a portion of the sound data.

Parameters
offsetThe starting offset in samples
sizeThe number of samples to stream
out_bufferThe output buffer to write the samples to
out_buffer_samplesThe size of the output buffer in samples
Returns
The number of samples actually written
Here is the call graph for this function:
Here is the caller graph for this function:

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