diff options
author | Michał Zieliński <michal@zielinscy.org.pl> | 2012-12-27 12:40:58 +0100 |
---|---|---|
committer | Michał Zieliński <michal@zielinscy.org.pl> | 2012-12-27 12:40:58 +0100 |
commit | fb13c0f219282ef888562fb0fcbbeefd915307d4 (patch) | |
tree | 52816490c878fc5f57a97e3c2357d934cb70e294 /src/sound/oalsound/channel.h | |
parent | 4e2982d4ddbd4c16793e0adaa96f5bfd6bd9148c (diff) | |
parent | c2ebd5551ff2569f56e3321efd2d9bedaf079955 (diff) | |
download | colobot-fb13c0f219282ef888562fb0fcbbeefd915307d4.tar.gz colobot-fb13c0f219282ef888562fb0fcbbeefd915307d4.tar.bz2 colobot-fb13c0f219282ef888562fb0fcbbeefd915307d4.zip |
Merge branch 'dev-desktop-file' of git://github.com/OdyX/colobot
Diffstat (limited to 'src/sound/oalsound/channel.h')
-rw-r--r-- | src/sound/oalsound/channel.h | 99 |
1 files changed, 99 insertions, 0 deletions
diff --git a/src/sound/oalsound/channel.h b/src/sound/oalsound/channel.h new file mode 100644 index 0000000..165ff50 --- /dev/null +++ b/src/sound/oalsound/channel.h @@ -0,0 +1,99 @@ +// * This file is part of the COLOBOT source code +// * Copyright (C) 2012, Polish Portal of Colobot (PPC) +// * +// * This program is free software: you can redistribute it and/or modify +// * it under the terms of the GNU General Public License as published by +// * the Free Software Foundation, either version 3 of the License, or +// * (at your option) any later version. +// * +// * This program is distributed in the hope that it will be useful, +// * but WITHOUT ANY WARRANTY; without even the implied warranty of +// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// * GNU General Public License for more details. +// * +// * You should have received a copy of the GNU General Public License +// * along with this program. If not, see http://www.gnu.org/licenses/. + +// channel.h + +#pragma once + +#include <string> +#include <deque> +#include <cassert> + +#include <AL/al.h> +#include <AL/alc.h> + +#include "sound/sound.h" + +#include "buffer.h" +#include "check.h" + +struct SoundOper +{ + float finalAmplitude; + float finalFrequency; + float totalTime; + SoundNext nextOper; +}; + + +class Channel +{ + public: + Channel(); + ~Channel(); + + bool Play(); + bool Stop(); + bool SetPosition(Math::Vector); + + bool SetFrequency(float); + float GetFrequency(); + + float GetCurrentTime(); + void SetCurrentTime(float); + float GetDuration(); + + bool SetVolume(float); + float GetVolume(); + bool IsPlaying(); + bool IsReady(); + + bool SetBuffer(Buffer *); + bool HasEnvelope(); + SoundOper& GetEnvelope(); + void PopEnvelope(); + + int GetPriority(); + void SetPriority(int); + + void SetStartAmplitude(float); + void SetStartFrequency(float); + void SetChangeFrequency(float); + void SetInitFrequency(float); + + float GetStartAmplitude(); + float GetStartFrequency(); + float GetChangeFrequency(); + float GetInitFrequency(); + + void AddOper(SoundOper); + void ResetOper(); + Sound GetSoundType(); + void AdjustFrequency(float); + void AdjustVolume(float); + + private: + Buffer *mBuffer; + ALuint mSource; + + int mPriority; + float mStartAmplitude; + float mStartFrequency; + float mChangeFrequency; + float mInitFrequency; + std::deque<SoundOper> mOper; + bool mReady; +}; |