| 1 |
/*************************************************************************** |
| 2 |
* Copyright (C) 2005-2019 by the FIFE team * |
| 3 |
* http://www.fifengine.net * |
| 4 |
* This file is part of FIFE. * |
| 5 |
* * |
| 6 |
* FIFE is free software; you can redistribute it and/or * |
| 7 |
* modify it under the terms of the GNU Lesser General Public * |
| 8 |
* License as published by the Free Software Foundation; either * |
| 9 |
* version 2.1 of the License, or (at your option) any later version. * |
| 10 |
* * |
| 11 |
* This library 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 GNU * |
| 14 |
* Lesser General Public License for more details. * |
| 15 |
* * |
| 16 |
* You should have received a copy of the GNU Lesser General Public * |
| 17 |
* License along with this library; if not, write to the * |
| 18 |
* Free Software Foundation, Inc., * |
| 19 |
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * |
| 20 |
***************************************************************************/ |
| 21 |
|
| 22 |
%module soundemitter |
| 23 |
%{ |
| 24 |
#include "audio/soundemitter.h" |
| 25 |
%} |
| 26 |
|
| 27 |
%include "model/metamodel/modelcoords.i" |
| 28 |
|
| 29 |
namespace FIFE { |
| 30 |
|
| 31 |
%feature("director") SoundEmitterListener; |
| 32 |
class SoundEmitterListener { |
| 33 |
public: |
| 34 |
virtual ~SoundEmitterListener() {}; |
| 35 |
virtual void onSoundFinished(uint32_t emitterId, uint32_t soundClipId) = 0; |
| 36 |
}; |
| 37 |
|
| 38 |
enum SoundPositionType { |
| 39 |
SD_SAMPLE_POS, |
| 40 |
SD_TIME_POS, |
| 41 |
SD_BYTE_POS |
| 42 |
}; |
| 43 |
|
| 44 |
enum SoundStateType { |
| 45 |
SD_UNKNOWN_STATE, |
| 46 |
SD_INITIAL_STATE, |
| 47 |
SD_PLAYING_STATE, |
| 48 |
SD_PAUSED_STATE, |
| 49 |
SD_STOPPED_STATE |
| 50 |
}; |
| 51 |
|
| 52 |
class SoundManager; |
| 53 |
|
| 54 |
class SoundEmitter { |
| 55 |
public: |
| 56 |
uint32_t getId() const; |
| 57 |
bool isActive() const; |
| 58 |
uint8_t getEffectCount(); |
| 59 |
|
| 60 |
void setSoundClip(SoundClipPtr soundClip); |
| 61 |
SoundClipPtr getSoundClip(); |
| 62 |
void reset(bool defaultall = false); |
| 63 |
void release(); |
| 64 |
|
| 65 |
void play(); |
| 66 |
void play(float inTime, float outTime); |
| 67 |
void pause(); |
| 68 |
void stop(); |
| 69 |
void stop(float time); |
| 70 |
void rewind(); |
| 71 |
|
| 72 |
void setGain(float gain); |
| 73 |
float getGain() const; |
| 74 |
void setMaxGain(float gain); |
| 75 |
float getMaxGain() const; |
| 76 |
void setMinGain(float gain); |
| 77 |
float getMinGain() const; |
| 78 |
|
| 79 |
void setLooping(bool loop); |
| 80 |
bool isLooping() const; |
| 81 |
void setRolloff(float rolloff); |
| 82 |
float getRolloff() const; |
| 83 |
void setRelativePositioning(bool relative); |
| 84 |
bool isRelativePositioning() const; |
| 85 |
void setPosition(const AudioSpaceCoordinate& position); |
| 86 |
AudioSpaceCoordinate getPosition() const; |
| 87 |
void setReferenceDistance(float distance); |
| 88 |
float getReferenceDistance() const; |
| 89 |
void setMaxDistance(float distance); |
| 90 |
float getMaxDistance() const; |
| 91 |
void setDirection(const AudioSpaceCoordinate& direction); |
| 92 |
AudioSpaceCoordinate getDirection() const; |
| 93 |
void setVelocity(const AudioSpaceCoordinate& velocity); |
| 94 |
AudioSpaceCoordinate getVelocity() const; |
| 95 |
void setPitch(float pitch); |
| 96 |
float getPitch() const; |
| 97 |
void setConeInnerAngle(float inner); |
| 98 |
float getConeInnerAngle() const; |
| 99 |
void setConeOuterAngle(float outer); |
| 100 |
float getConeOuterAngle() const; |
| 101 |
void setConeOuterGain(float gain); |
| 102 |
float getConeOuterGain() const; |
| 103 |
|
| 104 |
bool isStereo(); |
| 105 |
int16_t getBitResolution(); |
| 106 |
uint64_t getSampleRate(); |
| 107 |
uint64_t getDecodedLength(); |
| 108 |
uint64_t getDuration(); |
| 109 |
void setCursor(SoundPositionType type, float value); |
| 110 |
float getCursor(SoundPositionType type); |
| 111 |
SoundStateType getState(); |
| 112 |
|
| 113 |
void setGroup(const std::string& group); |
| 114 |
const std::string& getGroup(); |
| 115 |
|
| 116 |
void addListener(SoundEmitterListener* listener); |
| 117 |
void removeListener(SoundEmitterListener* listener); |
| 118 |
|
| 119 |
private: |
| 120 |
SoundEmitter(SoundManager* manager, uint32_t uid); |
| 121 |
}; |
| 122 |
} |
| 123 |
|