00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef GLUON_AUDIO_SOUND_H
00022 #define GLUON_AUDIO_SOUND_H
00023
00024 #include <QtCore/QObject>
00025 #include <QtGui/QVector3D>
00026 #include <al.h>
00027
00028 #include "gluon_audio_export.h"
00029
00030 namespace GluonAudio
00031 {
00032 class Buffer;
00033
00034 class GLUON_AUDIO_EXPORT Sound : public QObject
00035 {
00036 Q_OBJECT
00037
00038 public:
00039 Sound( QObject* parent = 0 );
00044 explicit Sound( const QString& soundFile, QObject* parent = 0 );
00049 explicit Sound( Buffer* buffer, QObject* parent = 0 );
00054 explicit Sound( ALuint buffer, QObject* parent = 0 );
00055
00056 void load( const QString& soundFile );
00057 void load( Buffer* buffer );
00058 void load( ALuint buffer );
00059
00063 ~Sound();
00064
00068 ALfloat elapsedTime() const ;
00069
00073 ALint status() const ;
00074
00075 bool isPlaying();
00076 bool isLooping();
00077
00082 QString lastError() const ;
00083
00089 QVector3D position() const;
00090
00096 ALfloat x() const ;
00097
00103 ALfloat y() const ;
00104
00110 ALfloat z() const ;
00111
00116 ALfloat volume() const ;
00117
00122 ALfloat pitch() const ;
00123
00127 ALfloat radius() const;
00128
00129 ALfloat duration() const ;
00130
00131 ALuint source() const ;
00132
00133 public Q_SLOTS:
00139 void play();
00144 void pause();
00145
00150 void stop();
00151
00156 void rewind();
00157
00163 void setLoop( bool enabled = true );
00164
00182 void setPosition( QVector3D position );
00183
00189 void setPosition( ALfloat x = 0.0, ALfloat y = 0.0, ALfloat z = 0.0 );
00190
00203 void setVolume( ALfloat volume = 1.0f );
00204
00210 void setPitch( ALfloat pitch = 1.0f );
00211
00216 void setRadius( ALfloat radius = 10000.0f );
00217
00222 void setMinVolume( ALfloat min = 0.0f );
00223
00228 void setMaxVolume( ALfloat max = 10.0f );
00229 void setVelocity( ALfloat vx, ALfloat vy, ALfloat vz );
00230 void setDirection( ALfloat dx, ALfloat dy, ALfloat dz );
00231
00237 void setTimePosition( ALfloat time );
00238
00239
00240
00241 protected:
00242 void setupSource();
00243
00244 private:
00245 Q_DISABLE_COPY( Sound )
00246
00247 class SoundPrivate;
00248 SoundPrivate* const d;
00249 };
00250 }
00251
00252 #endif // GLUON_AUDIO_SOUND_H