SuperTuxKart
sfx_base.hpp
1 //
2 // SuperTuxKart - a fun racing game with go-kart
3 // Copyright (C) 2006-2015 Patrick Ammann <pammann@aro.ch>
4 // Copyright (C) 2008-2015 Joerg Henrichs, Patrick Ammann
5 //
6 // This program is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU General Public License
8 // as published by the Free Software Foundation; either version 3
9 // of the License, or (at your option) any later version.
10 //
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 
20 #ifndef HEADER_SFX_HPP
21 #define HEADER_SFX_HPP
22 
23 #include "audio/sfx_manager.hpp"
24 #include "utils/no_copy.hpp"
25 
31 class Vec3;
32 
42 class SFXBase : public NoCopy
43 {
44 public:
46  enum SFXStatus : int
47  {
48  SFX_UNKNOWN = -1, SFX_STOPPED = 0, SFX_PAUSED = 1, SFX_PLAYING = 2,
49  SFX_NOT_INITIALISED = 3
50  };
51 
52  virtual ~SFXBase() {}
53 
55  virtual bool init() = 0;
56  virtual bool isLooped() = 0;
57  virtual void updatePlayingSFX(float dt) = 0;
58  virtual void setPosition(const Vec3 &p) = 0;
59  virtual void reallySetPosition(const Vec3 &p) = 0;
60  virtual void setSpeedPosition(float factor,
61  const Vec3 &p) = 0;
62  virtual void reallySetSpeedPosition(float f,
63  const Vec3 &p)= 0;
64  virtual void setLoop(bool status) = 0;
65  virtual void reallySetLoop(bool status) = 0;
66  virtual void play() = 0;
67  virtual void reallyPlayNow(SFXBuffer* buffer = NULL) = 0;
68  virtual void play(const Vec3 &xyz, SFXBuffer* buffer = NULL) = 0;
69  virtual void reallyPlayNow(const Vec3 &xyz, SFXBuffer* buffer = NULL) = 0;
70  virtual void stop() = 0;
71  virtual void reallyStopNow() = 0;
72  virtual void pause() = 0;
73  virtual void reallyPauseNow() = 0;
74  virtual void resume() = 0;
75  virtual void reallyResumeNow() = 0;
76  virtual void deleteSFX() = 0;
77  virtual void setSpeed(float factor) = 0;
78  virtual void reallySetSpeed(float factor) = 0;
79  virtual void setVolume(float gain) = 0;
80  virtual void reallySetVolume(float gain) = 0;
81  virtual void setMasterVolume(float gain) = 0;
82  virtual void reallySetMasterVolumeNow(float gain) = 0;
83  virtual void onSoundEnabledBack() = 0;
84  virtual void setRolloff(float rolloff) = 0;
85  virtual SFXBuffer* getBuffer() const = 0;
86  virtual SFXStatus getStatus() = 0;
87 
88 }; // SFXBase
89 
90 
91 #endif // HEADER_SFX_HPP
92 
virtual bool init()=0
Late creation, if SFX was initially disabled.
A wrapper around bullets btVector3 to include conventient conversion functions (e.g.
Definition: vec3.hpp:34
The buffer (data) for one kind of sound effects.
Definition: sfx_buffer.hpp:43
Utility class, you can inherit from this class to disallow the assignment operator and copy construct...
Definition: no_copy.hpp:25
SFXStatus
Status of a sound effect.
Definition: sfx_base.hpp:46
The base class for sound effects.
Definition: sfx_base.hpp:42