summaryrefslogtreecommitdiffstats
path: root/src/sound/oalsound/channel.cpp
diff options
context:
space:
mode:
authorerihel <erihel@gmail.com>2013-04-12 01:46:30 +0200
committererihel <erihel@gmail.com>2013-04-12 01:46:30 +0200
commit8a0383c9f088f47e0c70dfbf86f36f95fd191b8c (patch)
tree362632357db73b0dfe1d368b81cf0efc1a0c605e /src/sound/oalsound/channel.cpp
parent82fdc2ba238a9cb0f60e82681f0dac26d2db7bc9 (diff)
downloadcolobot-8a0383c9f088f47e0c70dfbf86f36f95fd191b8c.tar.gz
colobot-8a0383c9f088f47e0c70dfbf86f36f95fd191b8c.tar.bz2
colobot-8a0383c9f088f47e0c70dfbf86f36f95fd191b8c.zip
* More work on sound
Diffstat (limited to 'src/sound/oalsound/channel.cpp')
-rw-r--r--src/sound/oalsound/channel.cpp38
1 files changed, 34 insertions, 4 deletions
diff --git a/src/sound/oalsound/channel.cpp b/src/sound/oalsound/channel.cpp
index 01ec3de..c5b05fa 100644
--- a/src/sound/oalsound/channel.cpp
+++ b/src/sound/oalsound/channel.cpp
@@ -17,7 +17,8 @@
#include "channel.h"
-Channel::Channel() {
+Channel::Channel()
+{
alGenSources(1, &mSource);
if (alCheck()) {
@@ -35,10 +36,12 @@ Channel::Channel() {
mStartAmplitude = 0.0f;
mStartFrequency = 0.0f;
mChangeFrequency = 0.0f;
+ mVolume = 0.0f;
}
-Channel::~Channel() {
+Channel::~Channel()
+{
if (mReady) {
alSourceStop(mSource);
alSourcei(mSource, AL_BUFFER, 0);
@@ -49,7 +52,8 @@ Channel::~Channel() {
}
-bool Channel::Play() {
+bool Channel::Play()
+{
if (!mReady || mBuffer == nullptr) {
return false;
}
@@ -65,7 +69,8 @@ bool Channel::Play() {
}
-bool Channel::SetPosition(Math::Vector pos) {
+bool Channel::SetPan(Math::Vector pos)
+{
if (!mReady || mBuffer == nullptr) {
return false;
}
@@ -79,6 +84,18 @@ bool Channel::SetPosition(Math::Vector pos) {
}
+void Channel::SetPosition(Math::Vector pos)
+{
+ mPosition = pos;
+}
+
+
+Math::Vector Channel::GetPosition()
+{
+ return mPosition;
+}
+
+
bool Channel::SetFrequency(float freq)
{
if (!mReady || mBuffer == nullptr) {
@@ -143,6 +160,19 @@ float Channel::GetVolume()
}
+void Channel::SetVolumeAtrib(float volume)
+{
+ mVolume = volume;
+}
+
+
+float Channel::GetVolumeAtrib()
+{
+ return mVolume;
+}
+
+
+
int Channel::GetPriority()
{
return mPriority;