Planeshift
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes

psMusic Class Reference

This object represents a planeshift Soundtrack. More...

#include <psmusic.h>

List of all members.

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

Static Public Member Functions

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

Public Attributes

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

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

is this soundtrack active?

Definition at line 51 of file psmusic.h.

number of milliseconds fading should use

Definition at line 46 of file psmusic.h.

handle if this soundtrack is active

Definition at line 52 of file psmusic.h.

frame when jumping back to loopstart (when looping)

Definition at line 50 of file psmusic.h.

frame to start at when looping

Definition at line 49 of file psmusic.h.

volume this track is playing at

Definition at line 45 of file psmusic.h.

volume when fading in

Definition at line 44 of file psmusic.h.

sound resource

Definition at line 42 of file psmusic.h.

time when this music starts playing

Definition at line 47 of file psmusic.h.

time till this music is playing

Definition at line 48 of file psmusic.h.

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: