Planeshift
psMusic Class Reference

This object represents a planeshift Soundtrack. More...

#include <psmusic.h>

Public Types

enum  Accidental {
  NO_ACCIDENTAL, DOUBLE_FLAT, FLAT, NATURAL,
  SHARP, DOUBLE_SHARP
}
 
enum  Duration {
  SIXTEENTH_DURATION = 1, EIGHTH_DURATION = 2, DOTTED_EIGHTH_DURATION = 3, QUARTER_DURATION = 4,
  DOTTED_QUARTER_DURATION = 6, HALF_DURATION = 8, DOTTED_HALF_DURATION = 12, WHOLE_DURATION = 16,
  DOTTED_WHOLE_DURATION = 24
}
 The number associated to each duration is the number of quarter divisions as specified in DURATION_QUARTER_DIVISIONS. More...
 

Public Member Functions

bool CheckTimeOfDay (int time)
 Check time of day. More...
 
bool CheckType (const int _type)
 Compares soundstracks type against a given type. More...
 
void DontLoop ()
 Disable looping. More...
 
void FadeDown ()
 Fades this Soundtrack down. More...
 
void FadeDownAndStop ()
 Fades this Soundtrack down and stops it. More...
 
void FadeUp ()
 Fades this Soundtrack up. More...
 
void Loop ()
 Enable or resume looping. More...
 
bool Play (bool loopToggle, SoundControl *&ctrl)
 Play this SoundTrack. More...
 
 psMusic ()
 Constructor Sets active to false and handle to NULL. More...
 
void SetManaged ()
 Set Autoremove to false. More...
 
void SetUnManaged ()
 Sets Autoremove to true. More...
 
void Stop ()
 Stops this Soundtrack immediatly. More...
 
void UpdateHandleCallback ()
 Updates Handles Callback. More...
 
 ~psMusic ()
 Destructor Removes Handle callback if theres one. More...
 

Static Public Member Functions

static void StopCallback (void *object)
 Callback function for Stop. More...
 

Public Attributes

bool active
 is this soundtrack active? More...
 
int fadedelay
 number of milliseconds fading should use More...
 
SoundHandlehandle
 handle if this soundtrack is active More...
 
size_t loopend
 frame when jumping back to loopstart (when looping) More...
 
size_t loopstart
 frame to start at when looping More...
 
float maxvol
 volume this track is playing at More...
 
float minvol
 volume when fading in More...
 
csString resource
 sound resource More...
 
int timeofday
 time when this music starts playing More...
 
int timeofdayrange
 time till this music is playing More...
 
int type
 type can be anything i use it for weather checks and similar thhings More...
 

Detailed Description

This object represents a planeshift Soundtrack.

It maybe an ambient or a real soundtrack they are very similiar. it has methods to perform the most common operations.

Definition at line 39 of file psmusic.h.

Member Enumeration Documentation

Enumerator
NO_ACCIDENTAL 
DOUBLE_FLAT 
FLAT 
NATURAL 
SHARP 
DOUBLE_SHARP 

Definition at line 218 of file musicutil.h.

The number associated to each duration is the number of quarter divisions as specified in DURATION_QUARTER_DIVISIONS.

Enumerator
SIXTEENTH_DURATION 
EIGHTH_DURATION 
DOTTED_EIGHTH_DURATION 
QUARTER_DURATION 
DOTTED_QUARTER_DURATION 
HALF_DURATION 
DOTTED_HALF_DURATION 
WHOLE_DURATION 
DOTTED_WHOLE_DURATION 

Definition at line 240 of file musicutil.h.

Constructor & Destructor Documentation

psMusic::psMusic ( )

Constructor Sets active to false and handle to NULL.

psMusic::~psMusic ( )

Destructor Removes Handle callback if theres one.

Member Function Documentation

bool psMusic::CheckTimeOfDay ( int  time)

Check time of day.

Checks if time is within this soundtracks timewindow. Returns true if it is.

Parameters
time<24 && >0 is resonable but can be any valid int
bool psMusic::CheckType ( const int  _type)

Compares soundstracks type against a given type.

Returns true if they are both equal

Parameters
_typetype to compare against
void psMusic::DontLoop ( )

Disable looping.

void psMusic::FadeDown ( )

Fades this Soundtrack down.

void psMusic::FadeDownAndStop ( )

Fades this Soundtrack down and stops it.

void psMusic::FadeUp ( )

Fades this Soundtrack up.

void psMusic::Loop ( )

Enable or resume looping.

bool psMusic::Play ( bool  loopToggle,
SoundControl *&  ctrl 
)

Play this SoundTrack.

Parameters
loopToggleloop? maybe true or false
ctrlSoundControl for this sound
void psMusic::SetManaged ( )

Set Autoremove to false.

The SoundHandle wont be removed even if paused.

void psMusic::SetUnManaged ( )

Sets Autoremove to true.

The SoundHandle will be removed when this sound has stopped playing. Warning: doesnt happen when looping!

void psMusic::Stop ( )

Stops this Soundtrack immediatly.

static void psMusic::StopCallback ( void *  object)
static

Callback function for Stop.

SoundHandles callback will point to this and inform us if it gets destroyed. It sets active to false and Handle to NULL

void psMusic::UpdateHandleCallback ( )

Updates Handles Callback.

Member Data Documentation

bool psMusic::active

is this soundtrack active?

Definition at line 51 of file psmusic.h.

int psMusic::fadedelay

number of milliseconds fading should use

Definition at line 46 of file psmusic.h.

SoundHandle* psMusic::handle

handle if this soundtrack is active

Definition at line 52 of file psmusic.h.

size_t psMusic::loopend

frame when jumping back to loopstart (when looping)

Definition at line 50 of file psmusic.h.

size_t psMusic::loopstart

frame to start at when looping

Definition at line 49 of file psmusic.h.

float psMusic::maxvol

volume this track is playing at

Definition at line 45 of file psmusic.h.

float psMusic::minvol

volume when fading in

Definition at line 44 of file psmusic.h.

csString psMusic::resource

sound resource

Definition at line 42 of file psmusic.h.

int psMusic::timeofday

time when this music starts playing

Definition at line 47 of file psmusic.h.

int psMusic::timeofdayrange

time till this music is playing

Definition at line 48 of file psmusic.h.

int psMusic::type

type can be anything i use it for weather checks and similar thhings

Definition at line 43 of file psmusic.h.


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