92 lines
2.6 KiB
C++
92 lines
2.6 KiB
C++
#ifndef _CSOUND_HPP_
|
|
#define _CSOUND_HPP_
|
|
|
|
/*** SDL Header Files ***/
|
|
#include <SDL.h>
|
|
#include <SDL_mixer.h>
|
|
|
|
/*** DLL Header File ***/
|
|
#include "dllExport.h"
|
|
|
|
/*** Custom Header Files ***/
|
|
#include "../UtilityEngine/cString.hpp"
|
|
|
|
using UtilityEngine::cString;
|
|
|
|
namespace AudioEngine {
|
|
class EXPORT_FROM_MYDLL cSound
|
|
{
|
|
public:
|
|
cSound( const cString& dir = "", const cString& filename = "", const unsigned char volume = 255,
|
|
const unsigned char distance = 100, const short int angle = 0, const long int channel = -1,
|
|
const long int loops = -1 );
|
|
/* Copy constructor */
|
|
cSound( const cSound& copy );
|
|
~cSound();
|
|
|
|
///Functions
|
|
/* Plays the sound if loaded */
|
|
void PlaySound();
|
|
/* Fades in the sound for time */
|
|
void FadeIn( const unsigned int time = 1000 ) const;
|
|
/* Fades out the sound for time */
|
|
void FadeOut( const unsigned int time = 1000 ) const;
|
|
|
|
///Sets
|
|
/* Sets the directory of the sound */
|
|
void setDir( const cString& dir );
|
|
/* Sets the file name of the sound */
|
|
void setFileName( const cString& filename );
|
|
/* Sets the file name and the directory of the sound */
|
|
void setFileNameandDir( const cString& filename, const cString& dir = "" );
|
|
/* Sets the Volume of the sound */
|
|
void setVolume( const unsigned char volume = 255 );
|
|
/* Sets the Distance of the sound */
|
|
void setDistance( const unsigned char distance = 100 );
|
|
/* Sets the Angle of the sound */
|
|
void setAngle( const short int angle = 0 );
|
|
/* Sets the Channel of the sound */
|
|
void setChannel( const long int channel = -1);
|
|
/* Sets how many times the sound loops */
|
|
void setLoops( const long int loops = -1 );
|
|
|
|
|
|
///Gets
|
|
/* Gets the directory of the sound */
|
|
const cString& getDir() const;
|
|
/* Gets the file name of the sound */
|
|
const cString& getFileName() const;
|
|
/* Gets the Volume of the sound */
|
|
const unsigned char getVolume() const;
|
|
/* Gets the Distance of the sound */
|
|
const unsigned char getDistance() const;
|
|
/* Gets the Angle of the sound */
|
|
const short int getAngle() const;
|
|
/* Gets the Channel of the sound */
|
|
const long int getChannel() const;
|
|
/* Gets how many times the sound loops */
|
|
const long int getLoops() const;
|
|
|
|
private:
|
|
///Functions
|
|
void LoadSound();
|
|
void UnloadSound();
|
|
|
|
private:
|
|
///Variables
|
|
Mix_Chunk* mp_sound;// = nullptr
|
|
|
|
cString m_dir;// = ""
|
|
cString m_fileName;// = ""
|
|
|
|
|
|
unsigned char m_volume;// = 255
|
|
unsigned char m_distance;// = 100
|
|
|
|
short int m_angle;// = 0
|
|
long int m_channel;// = -1
|
|
long int m_loops;// = 0
|
|
};/// END CLASS DEFINITION cSound
|
|
}/// END NAMESPACE DEFINITION AudioEngine
|
|
#endif/// END IFNDEF _CSOUND_HPP_
|