2013-07-12 21:30:13 +02:00
|
|
|
/*****************************************************************************
|
|
|
|
* SoundEffect.h *
|
|
|
|
* *
|
|
|
|
* XFX::Audio::SoundEffect class definition file *
|
|
|
|
* Copyright (c) XFX Team. All Rights Reserved *
|
|
|
|
*****************************************************************************/
|
2013-05-05 18:18:41 +02:00
|
|
|
#ifndef _XFX_AUDIO_SOUNDEFFECT_
|
|
|
|
#define _XFX_AUDIO_SOUNDEFFECT_
|
|
|
|
|
|
|
|
#include <System/Interfaces.h>
|
2013-06-02 14:32:43 +02:00
|
|
|
#include <System/String.h>
|
2013-05-05 18:18:41 +02:00
|
|
|
#include <System/TimeSpan.h>
|
|
|
|
#include <System/IO/Stream.h>
|
|
|
|
#include "Enums.h"
|
|
|
|
|
|
|
|
using namespace System;
|
|
|
|
using namespace System::IO;
|
|
|
|
|
|
|
|
namespace XFX
|
|
|
|
{
|
|
|
|
namespace Audio
|
|
|
|
{
|
|
|
|
class SoundEffectInstance;
|
|
|
|
|
2013-07-12 21:30:13 +02:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
*/
|
2013-05-05 18:18:41 +02:00
|
|
|
class SoundEffect : public IDisposable, public Object
|
|
|
|
{
|
2013-08-13 20:04:25 +02:00
|
|
|
friend class SoundEffectInstance;
|
|
|
|
|
2013-05-05 18:18:41 +02:00
|
|
|
private:
|
2013-06-02 14:32:43 +02:00
|
|
|
static float distanceScale;
|
|
|
|
static float dopplerScale;
|
2013-07-22 01:38:59 +02:00
|
|
|
TimeSpan duration;
|
|
|
|
bool isDisposed;
|
2013-06-02 14:32:43 +02:00
|
|
|
static float masterVolume;
|
2013-08-13 20:04:25 +02:00
|
|
|
int referenceCount;
|
2013-06-02 14:32:43 +02:00
|
|
|
static float speedOfSound;
|
2013-07-22 01:38:59 +02:00
|
|
|
float volume;
|
2013-06-02 14:32:43 +02:00
|
|
|
|
2013-05-05 18:18:41 +02:00
|
|
|
void Dispose(bool disposing);
|
|
|
|
|
|
|
|
public:
|
2013-06-02 14:32:43 +02:00
|
|
|
static float getDistanceScale();
|
|
|
|
static void setDistanceScale(float value);
|
|
|
|
static float getDopplerScale();
|
|
|
|
static void setDopplerScale(float value);
|
|
|
|
TimeSpan getDuration() const;
|
|
|
|
bool IsDisposed() const;
|
|
|
|
static float getMasterVolume();
|
|
|
|
static void setMasterVolume(float value);
|
|
|
|
String Name;
|
|
|
|
static float getSpeedOfSound();
|
|
|
|
static void setSpeedOfSound(float value);
|
|
|
|
|
|
|
|
SoundEffect(byte buffer[], const int offset, const int count, const int sampleRate, AudioChannels_t channels, const int loopStart, const int loopLength);
|
2013-05-05 18:18:41 +02:00
|
|
|
SoundEffect(byte buffer[], const int sampleRate, const AudioChannels_t numChannels);
|
|
|
|
SoundEffect(const SoundEffect &obj);
|
|
|
|
~SoundEffect();
|
|
|
|
|
2013-06-02 14:32:43 +02:00
|
|
|
SoundEffectInstance* CreateInstance();
|
2013-05-05 18:18:41 +02:00
|
|
|
void Dispose();
|
2013-06-02 14:32:43 +02:00
|
|
|
static SoundEffect* FromStream(Stream * const stream);
|
|
|
|
static TimeSpan GetSampleDuration(int sizeInBytes, int sampleRate, AudioChannels_t channels);
|
|
|
|
static int GetSampleSizeInBytes(TimeSpan duration, int sampleRate, AudioChannels_t channels);
|
2013-07-12 21:30:13 +02:00
|
|
|
static const Type& GetType();
|
2013-05-05 18:18:41 +02:00
|
|
|
bool Play();
|
|
|
|
bool Play(const float volume, const float pitch, const float pan);
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif //_XFX_AUDIO_SOUNDEFFECT_
|