Planeshift
psmusic.h
Go to the documentation of this file.
1 /*
2  * psmusic.h
3  *
4  * Copyright (C) 2001-2010 Atomic Blue (info@planeshift.it, http://www.planeshift.it)
5  *
6  * Credits : Saul Leite <leite@engineer.com>
7  * Mathias 'AgY' Voeroes <agy@operswithoutlife.net>
8  * and all past and present planeshift coders
9  *
10  * This program is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU General Public License
12  * as published by the Free Software Foundation (version 2 of the License.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21  *
22  */
23 
24 #ifndef _PSMUSIC_H_
25 #define _PSMUSIC_H_
26 
27 //------------------------------------------------------------------------------------
28 // Forward Declarations
29 //------------------------------------------------------------------------------------
30 class SoundHandle;
31 
32 
39 class psMusic
40 {
41 public:
42  csString resource;
43  int type;
44  float minvol;
45  float maxvol;
46  int fadedelay;
47  int timeofday;
49  size_t loopstart;
50  size_t loopend;
51  bool active;
53 
58  psMusic();
63  ~psMusic();
70  bool CheckTimeOfDay(int time);
76  bool CheckType(const int _type);
80  void FadeDownAndStop();
84  void FadeDown();
88  void FadeUp();
94  bool Play(bool loopToggle, SoundControl* &ctrl);
98  void Stop();
104  void SetUnManaged();
109  void SetManaged();
113  void Loop();
117  void DontLoop();
121  void UpdateHandleCallback();
127  static void StopCallback(void* object);
128 };
129 
130 #endif /*_PSMUSIC_H_*/
SoundHandle * handle
handle if this soundtrack is active
Definition: psmusic.h:52
void FadeDownAndStop()
Fades this Soundtrack down and stops it.
bool CheckType(const int _type)
Compares soundstracks type against a given type.
~psMusic()
Destructor Removes Handle callback if theres one.
int timeofday
time when this music starts playing
Definition: psmusic.h:47
void SetUnManaged()
Sets Autoremove to true.
float minvol
volume when fading in
Definition: psmusic.h:44
void FadeDown()
Fades this Soundtrack down.
psMusic()
Constructor Sets active to false and handle to NULL.
void DontLoop()
Disable looping.
This namespace contains a set of functions that are usefull for the processing of music and musical s...
Definition: musicutil.h:215
size_t loopstart
frame to start at when looping
Definition: psmusic.h:49
csString resource
sound resource
Definition: psmusic.h:42
static void StopCallback(void *object)
Callback function for Stop.
int fadedelay
number of milliseconds fading should use
Definition: psmusic.h:46
void FadeUp()
Fades this Soundtrack up.
void UpdateHandleCallback()
Updates Handles Callback.
A Volume and Sound control class.
Definition: control.h:40
void Stop()
Stops this Soundtrack immediatly.
bool CheckTimeOfDay(int time)
Check time of day.
bool active
is this soundtrack active?
Definition: psmusic.h:51
void SetManaged()
Set Autoremove to false.
size_t loopend
frame when jumping back to loopstart (when looping)
Definition: psmusic.h:50
void Loop()
Enable or resume looping.
int timeofdayrange
time till this music is playing
Definition: psmusic.h:48
float maxvol
volume this track is playing at
Definition: psmusic.h:45
bool Play(bool loopToggle, SoundControl *&ctrl)
Play this SoundTrack.
int type
type can be anything i use it for weather checks and similar thhings
Definition: psmusic.h:43