Broken interfaces
This commit is contained in:
parent
4dff5eadae
commit
148e6af912
|
@ -2,12 +2,14 @@
|
|||
#define CAUDIO_H_INCLUDED
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include "AL/al.h"
|
||||
#include "AL/alut.h"
|
||||
#include <vector>
|
||||
|
||||
#define BUFFER_SIZE ( 1024 * 32 )
|
||||
#include "../include/IAudio.h"
|
||||
#include "../Include/cVector3.h"
|
||||
|
||||
namespace cAudio
|
||||
{
|
||||
class cAudio : public IAudio
|
||||
|
@ -18,14 +20,14 @@ namespace cAudio
|
|||
//!plays the audio file 2d no distance.
|
||||
void play2d(bool loop = false);
|
||||
//!plays the audio file and sets it to 3d
|
||||
void play3d(bool loop = false, float x = 0.0, float y = 0.0, float z = 0.0, float soundstr = 1.0);
|
||||
void play3d(cVector3 position, float soundstr = 1.0 , bool loop = false);
|
||||
|
||||
//!allows us to set the position or reset the position
|
||||
void setPosition(float posx,float posy,float posz);
|
||||
void setPosition(cVector3 position);
|
||||
//!allows you to set the audio objects velocity
|
||||
void setVelocity(float velx,float vely,float velz);
|
||||
void setVelocity(cVector3 velocity);
|
||||
//!allows us to set the direction the audio should play in
|
||||
void setDirection(float dirx,float diry,float dirz);
|
||||
void setDirection(cVector3 direction);
|
||||
//! Sets the audios pitch level
|
||||
void setPitch(float pitch);
|
||||
//!allows us to set and reset the sound strenght
|
||||
|
@ -35,7 +37,7 @@ namespace cAudio
|
|||
//!Set the doppler strength
|
||||
void setDopplerStrength(float doop);
|
||||
//!Set doppler velocity
|
||||
void setDopplerVelocity(float doopx,float doopy,float doopz);
|
||||
void setDopplerVelocity(cVector3 dvelocity);
|
||||
|
||||
//!Seek the audio stream
|
||||
void seek(float secs);
|
||||
|
@ -88,6 +90,14 @@ namespace cAudio
|
|||
bool pauseaudio;
|
||||
//!if audio is paused
|
||||
bool paused();
|
||||
//! Stores the position of the audio object
|
||||
cVector3 position;
|
||||
//! Stores the velocity of the audio object
|
||||
cVector3 velocity;
|
||||
//! Stores the direction of the audio object
|
||||
cVector3 direction;
|
||||
//! Stores the doppler velocity
|
||||
cVector3 dvelocity;
|
||||
};
|
||||
}
|
||||
#endif //! CAUDIO_H_INCLUDED
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
#include "../Headers/cAudio.h"
|
||||
#include <iostream>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "../Headers/cAudio.h"
|
||||
|
||||
namespace cAudio
|
||||
{
|
||||
|
@ -174,10 +173,11 @@ namespace cAudio
|
|||
}
|
||||
|
||||
//!Plays the given audio file with 3d position
|
||||
void cAudio::play3d(bool loop, float x, float y, float z,float soundstr)
|
||||
void cAudio::play3d(cVector3 position, float soundstr, bool loop)
|
||||
{
|
||||
this->position = position;
|
||||
alSourcei (source, AL_SOURCE_RELATIVE, false);
|
||||
alSource3f(source, AL_POSITION, x, y, z);
|
||||
alSource3f(source, AL_POSITION, position.x, position.y, position.z);
|
||||
alSourcef (source, AL_ROLLOFF_FACTOR, soundstr);
|
||||
toloop = loop;
|
||||
play();
|
||||
|
@ -191,21 +191,24 @@ namespace cAudio
|
|||
}
|
||||
|
||||
//!Used to move the audio sources position after the initial creation
|
||||
void cAudio::setPosition(float posx,float posy,float posz)
|
||||
void cAudio::setPosition(cVector3 position)
|
||||
{
|
||||
alSource3f(source, AL_POSITION, posx, posy, posz);
|
||||
this->position = position;
|
||||
alSource3f(source, AL_POSITION, position.x, position.y, position.z);
|
||||
}
|
||||
|
||||
//!Used to set the velocity of the audio source.
|
||||
void cAudio::setVelocity(float velx,float vely, float velz)
|
||||
void cAudio::setVelocity(cVector3 velocity)
|
||||
{
|
||||
alSource3f(source, AL_VELOCITY, velx, vely, velz);
|
||||
this->velocity = velocity;
|
||||
alSource3f(source, AL_VELOCITY, velocity.x, velocity.y, velocity.z);
|
||||
}
|
||||
|
||||
//!Used to set the direction of the audio source
|
||||
void cAudio::setDirection(float dirx,float diry,float dirz)
|
||||
void cAudio::setDirection(cVector3 direction)
|
||||
{
|
||||
alSource3f(source, AL_DIRECTION, dirx, diry, dirz);
|
||||
this->direction = direction;
|
||||
alSource3f(source, AL_DIRECTION, direction.x, direction.y, direction.z);
|
||||
}
|
||||
|
||||
//!Used to set the sound strength or roll off factor
|
||||
|
@ -233,9 +236,10 @@ namespace cAudio
|
|||
}
|
||||
|
||||
//!Used to set the doppler velocity of the audio source
|
||||
void cAudio::setDopplerVelocity(float doopx,float doopy,float doopz)
|
||||
void cAudio::setDopplerVelocity(cVector3 dvelocity)
|
||||
{
|
||||
alSource3f(source, AL_DOPPLER_VELOCITY, doopx, doopy, doopz);
|
||||
this->dvelocity = dvelocity;
|
||||
alSource3f(source, AL_DOPPLER_VELOCITY, dvelocity.x, dvelocity.y, dvelocity.z);
|
||||
}
|
||||
|
||||
//!Allows us to seek through a stream
|
||||
|
|
|
@ -214,14 +214,6 @@
|
|||
RelativePath=".\Headers\cRawDecoder.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Headers\cUtils.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\cVector3.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Headers\cWavAudioDecoderFacotry.h"
|
||||
>
|
||||
|
@ -230,38 +222,6 @@
|
|||
RelativePath=".\Headers\cWavDecoder.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\EAudioFormats.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\IAudio.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\IAudioCapture.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\IAudioDecoder.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\IAudioDecoderFactory.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\IAudioManager.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\IDataSource.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\IListener.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Resource Files"
|
||||
|
@ -319,6 +279,54 @@
|
|||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Include"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\include\EAudioFormats.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\IAudio.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\IAudioCapture.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\IAudioDecoder.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\IAudioDecoderFactory.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\IAudioManager.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\IDataSource.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\IListener.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Util"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\Headers\cUtils.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\cVector3.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
#include "IAudioDecoder.h"
|
||||
|
||||
class cVector3;
|
||||
namespace cAudio
|
||||
{
|
||||
class IAudio
|
||||
|
@ -16,13 +17,13 @@ namespace cAudio
|
|||
//!plays the audio file 2d no distance.
|
||||
virtual void play2d(bool loop = false) = 0;
|
||||
//!plays the audio file and sets it to 3d
|
||||
virtual void play3d(bool loop = false, float x = 0.0, float y = 0.0, float z = 0.0, float soundstr = 1.0) = 0;
|
||||
virtual void play3d(cVector3 position, float soundstr = 1.0 , bool loop = false) = 0;
|
||||
//!allows us to set the position or reset the position
|
||||
virtual void setPosition(float posx,float posy,float posz) = 0;
|
||||
virtual void setPosition(cVector3 position) = 0;
|
||||
//!allows you to set the audio objects velocity
|
||||
virtual void setVelocity(float velx,float vely,float velz) = 0;
|
||||
virtual void setVelocity(cVector3 velocity) = 0;
|
||||
//!allows us to set the direction the audio should play in
|
||||
virtual void setDirection(float dirx,float diry,float dirz) = 0;
|
||||
virtual void setDirection(cVector3 direction) = 0;
|
||||
//! Sets the audios pitch level
|
||||
virtual void setPitch(float pitch) = 0;
|
||||
//!allows us to set and reset the sound strength
|
||||
|
@ -32,7 +33,7 @@ namespace cAudio
|
|||
//!Set the doppler strength
|
||||
virtual void setDopplerStrength(float doop) = 0;
|
||||
//!Set the doppler velocity
|
||||
virtual void setDopplerVelocity(float doopx,float doopy,float doopz) = 0;
|
||||
virtual void setDopplerVelocity(cVector3 dvelocity) = 0;
|
||||
//!Seek through the audio stream
|
||||
virtual void seek(float secs) = 0;
|
||||
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
#ifndef IAUDIOMANAGER_H
|
||||
#define IAUDIOMANAGER_H
|
||||
#include <string>
|
||||
|
|
Loading…
Reference in New Issue