Untitled Game engine no.5  1.0
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | List of all members
Engine::Clip Struct Reference

Struct to hold music data. More...

#include <Clip.hpp>

Public Member Functions

void playClip ()
 play the referenced Clip
 
void loopClip ()
 play the referenced Clip and loop it
 
void endClip ()
 end the referenced Clip
 
 ~Clip ()
 

Static Public Member Functions

static void InitAudio ()
 
static Ref< ClipLoadClip (const std::string &path)
 
static void callback (void *userdata, Uint8 *stream, int len)
 Callback passed into the SDL Audio library. More...
 

Public Attributes

Uint32 clipLen
 
Uint32 trackPos = 0
 
Uint8 * data
 
SDL_AudioSpec spec
 
bool loop = false
 
bool active = false
 

Static Public Attributes

static std::vector< Ref< Clip > > sounds
 

Detailed Description

Struct to hold music data.

Includes looping and tracking of music position.

Constructor & Destructor Documentation

◆ ~Clip()

Engine::Clip::~Clip ( )
inline

Deconstructor

Deletes the all stored audio buffer data.

Member Function Documentation

◆ callback()

static void Engine::Clip::callback ( void *  userdata,
Uint8 *  stream,
int  len 
)
inlinestatic

Callback passed into the SDL Audio library.

Loops through all loaded sounds and mixes them together if they are active.

Parameters
userdatanot used
streamaudio buffer
lenlength of the buffer

◆ InitAudio()

static void Engine::Clip::InitAudio ( )
inlinestatic

Initialize global audio data.

◆ LoadClip()

Ref< Clip > Engine::Clip::LoadClip ( const std::string &  path)
static

Generate an audio clip from a system path.

Parameters
path
Returns
A reference to the loaded Clip

Member Data Documentation

◆ active

bool Engine::Clip::active = false

is the clip playing or not

◆ clipLen

Uint32 Engine::Clip::clipLen

clip length

◆ data

Uint8* Engine::Clip::data

audio data

◆ loop

bool Engine::Clip::loop = false

flag to set the clip looping

◆ sounds

std::vector< Ref< Clip > > Engine::Clip::sounds
static

static list of all sounds

◆ spec

SDL_AudioSpec Engine::Clip::spec

audio specs

◆ trackPos

Uint32 Engine::Clip::trackPos = 0

track position


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