#include "stdafx.h"
#include "audioClass.h"


audioClass::audioClass()
{
	// Initializes the sound device.
	engine = createIrrKlangDevice();

	// Load MP3 playback plug in.
	engine->loadPlugins("ikpMP3.dll");
	// Load Flac playback plug in.
	engine->loadPlugins("ikpFlac.dll");

	//*currentlyPlaying = "";
}

/************************************************************************/
/* Destructor Removes audio engine from memory.							*/
/************************************************************************/
audioClass::~audioClass() {
	if( engine ) {
		engine->drop();
	}
}

/*
* This method loads a song into the queue
*/
void audioClass::loadSong( string *filePath ) {
	currentlyPlaying = filePath;
}

/************************************************************************/
/* Plays the current song in the queue                                  */
/************************************************************************/
void audioClass::playSong() {
	engine->stopAllSounds();
	playing = engine->play2D( currentlyPlaying->c_str(), false );
}

void audioClass::stopSong() {
	engine->stopAllSounds();
}