4 * Implementation of the abstract sound object
8 * ***** BEGIN GPL LICENSE BLOCK *****
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; either version 2
13 * of the License, or (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software Foundation,
22 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
25 * All rights reserved.
27 * The Original Code is: all of this file.
29 * Contributor(s): none yet.
31 * ***** END GPL LICENSE BLOCK *****
34 #ifndef __SND_SOUNDOBJECT_H
35 #define __SND_SOUNDOBJECT_H
37 #include "SND_Object.h"
38 #include "STR_String.h"
41 * SND_SoundObject is a class for api independent sounddata storage conected to an actuator
44 class SND_SoundObject : public SND_Object
47 STR_String m_samplename; /* name of the sample */
48 STR_String m_objectname; /* name of the object */
49 unsigned int m_buffer;
51 bool m_active; /* is the object active or not? */
53 MT_Scalar m_lifespan; /* the lifespan of the sound seconds */
54 MT_Scalar m_timestamp;
56 MT_Scalar m_length; /* length of the sample in seconds */
58 MT_Scalar m_gain; /* the gain of the object */
59 MT_Scalar m_rollofffactor; /* the scaling factor to increase or decrease the range
60 of a source by decreasing or increasing the
61 attenuation, respectively */
62 MT_Scalar m_referencedistance;/* the distance at which the listener will experience
64 MT_Scalar m_mingain; /* indicates the minimal gain which is always guaranteed
66 MT_Scalar m_maxgain; /* indicates the maximal gain which is always guaranteed
69 MT_Scalar m_pitch; /* the pitch of the object */
70 MT_Vector3 m_position; /* position; left/right, up/down, in/out */
71 MT_Vector3 m_velocity; /* velocity of the object */
72 MT_Matrix3x3 m_orientation; /* orientation of the object */
73 unsigned int m_loopmode; /* loop normal or bidirectional? */
74 unsigned int m_loopstart; /* start of looppoint in samples! */
75 unsigned int m_loopend; /* end of looppoint in samples! */
76 bool m_is3d; /* is the object 3D or 2D? */
77 int m_playstate; /* flag for current state of object */
79 unsigned int m_running;
80 bool m_highpriority; /* may the sound be ditched when we run out of voices? */
87 void SetBuffer(unsigned int buffer);
88 void SetActive(bool active);
93 void DeleteWhenFinished();
95 void SetObjectName(STR_String objectname);
96 void SetSampleName(STR_String samplename);
97 void SetLength(MT_Scalar length);
99 void SetPitch(MT_Scalar pitch);
100 void SetGain(MT_Scalar gain);
101 void SetMinGain(MT_Scalar mingain);
102 void SetMaxGain(MT_Scalar maxgain);
103 void SetRollOffFactor(MT_Scalar rollofffactor);
104 void SetReferenceDistance(MT_Scalar distance);
105 void SetPosition(const MT_Vector3& pos);
106 void SetVelocity(const MT_Vector3& vel);
107 void SetOrientation(const MT_Matrix3x3& orient);
108 void SetLoopMode(unsigned int loopmode);
109 void SetLoopStart(unsigned int loopstart);
110 void SetLoopEnd(unsigned int loopend);
111 void Set3D(bool threedee);
112 void SetPlaystate(int playstate);
113 void SetHighPriority(bool priority);
117 void SetTimeStamp(MT_Scalar timestamp);
119 void SetModified(bool modified);
121 bool IsLifeSpanOver(MT_Scalar curtime) const;
122 bool IsActive() const;
123 bool IsModified() const;
124 bool IsHighPriority() const;
127 bool IsRunning() const;
131 MT_Scalar GetLifeSpan() const;
132 MT_Scalar GetTimestamp() const;
134 unsigned int GetBuffer();
135 const STR_String& GetSampleName();
136 const STR_String& GetObjectName();
138 MT_Scalar GetLength() const;
139 MT_Scalar GetGain() const;
140 MT_Scalar GetPitch() const;
142 MT_Scalar GetMinGain() const;
143 MT_Scalar GetMaxGain() const;
144 MT_Scalar GetRollOffFactor() const;
145 MT_Scalar GetReferenceDistance() const;
147 MT_Vector3 GetPosition() const;
148 MT_Vector3 GetVelocity() const;
149 MT_Matrix3x3 GetOrientation() const;
150 unsigned int GetLoopMode() const;
151 unsigned int GetLoopStart() const;
152 unsigned int GetLoopEnd() const;
154 int GetPlaystate() const;
158 #endif //__SND_SOUNDOBJECT_H