Colobot
sound.h
Go to the documentation of this file.
1 /*
2  * This file is part of the Colobot: Gold Edition source code
3  * Copyright (C) 2001-2016, Daniel Roux, EPSITEC SA & TerranovaTeam
4  * http://epsitec.ch; http://colobot.info; http://github.com/colobot
5  *
6  * This program is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (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.
14  * See the 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, see http://gnu.org/licenses
18  */
19 
25 #pragma once
26 
27 #include "sound/sound_type.h"
28 
29 #include <string>
30 
31 namespace Math
32 {
33 struct Vector;
34 } // namespace Math
35 
39 const float MAXVOLUME = 100.0f;
40 
41 
47 {
49  SOPER_STOP = 2,
50  SOPER_LOOP = 3,
51 };
52 
53 
61 {
62 public:
64  virtual ~CSoundInterface();
65 
68  virtual bool Create();
69 
73  void CacheAll();
74 
81  virtual bool Cache(SoundType sound, const std::string &file);
82 
88  virtual void CacheMusic(const std::string &file);
89 
94  virtual bool IsCached(SoundType sound);
95 
100  virtual bool IsCachedMusic(const std::string &file);
101 
105  virtual bool GetEnable();
106 
110  virtual void SetAudioVolume(int volume);
111 
115  virtual int GetAudioVolume();
116 
120  virtual void SetMusicVolume(int volume);
121 
125  virtual int GetMusicVolume();
126 
131  virtual void SetListener(const Math::Vector &eye, const Math::Vector &lookat);
132 
136  virtual void FrameMove(float rTime);
137 
145  virtual int Play(SoundType sound, float amplitude=1.0f, float frequency=1.0f, bool loop = false);
146 
155  virtual int Play(SoundType sound, const Math::Vector &pos, float amplitude=1.0f, float frequency=1.0f, bool loop = false);
156 
161  virtual bool FlushEnvelope(int channel);
162 
171  virtual bool AddEnvelope(int channel, float amplitude, float frequency, float time, SoundNext oper);
172 
178  virtual bool Position(int channel, const Math::Vector &pos);
179 
185  virtual bool Frequency(int channel, float frequency);
186 
191  virtual bool Stop(int channel);
192 
196  virtual bool StopAll();
197 
202  virtual bool MuteAll(bool mute);
203 
210  virtual void PlayMusic(const std::string &filename, bool repeat, float fadeTime = 2.0f);
211 
215  virtual void StopMusic(float fadeTime=2.0f);
216 
220  virtual bool IsPlayingMusic();
221 
228  virtual void PlayPauseMusic(const std::string &filename, bool repeat);
229 
233  virtual void StopPauseMusic();
234 };
Definition: sound.h:49
Definition: sound.h:50
Definition: sound.h:48
const float MAXVOLUME
Definition: sound.h:39
Namespace for (new) math code.
Definition: device.h:39
SoundNext
Enum representing operation that will be performend on a sound at given time.
Definition: sound.h:46
SoundType
Enum representing sound file.
Definition: sound_type.h:34
3D (3x1) vector
Definition: vector.h:53
Defines the SoundType enum.
Sound plugin interface.
Definition: sound.h:60