All pastes #564234 Raw Edit

Anonymous

public text v1 · immutable
·published 2007-06-13 14:34 UTC
rendered paste body
/*
    This file is part of FallDown - GCN.

    FallDown - GCN is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    FallDown - GCN is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Foobar; if not, write to the Free Software
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
*/
/*
    http://falldown.forge.games-creators.org/
    Developer(s) : TrizoLakai
*/

/***********************************************/
/** BIENTOT PATHAUDIO SERA REMPLACE PAR ALIAS **/
/***********************************************/


#if !defined(_CAUDIO_H)
#define _CAUDIO_H





#include <SDL/SDL_mixer.h>
#include <string>
#include <list>





#include "PathHandler.hh"





class Audio : private PathHandler{
private:
    bool Init_;
    Mix_Music *Musique_;


    /* Les listes de gestion des samples */
	std::list<std::string> ListePathSamples_;
	std::list<Mix_Chunk *> ListeSamples_;           //Il faut decharger tout ca a la fin
	std::list<int> ListeChanels_;



	/* Leurs iterateurs */
	std::list<std::string>::iterator ItListePathSamples_;
	std::list<Mix_Chunk *>::iterator ItListeSamples_;
	std::list<int>::iterator ItListeChanels_;


	static Audio *Instance_;


    Audio();

public:
    ~Audio();


    /* ------------------------------- GETINSTANCE -------------------------------
    // Description : Fournis un pointeur de l'objet moteur.
    // ---------------------------------------------------------------------------
    // Renvois : le pointeur sur l'objet moteur
    // --------------------------------------------------------------------------*/
    static Audio *getInstance();



    /* ----------------------------- INITIALISATION ------------------------------
    // Description : Initialise la couche audio
    // ---------------------------------------------------------------------------
    // Renvois : true si tout c'est bien passe ou que l'initialisation a deja ete faite
    // --------------------------------------------------------------------------*/
	bool Initialisation();



    /* --------------------------------- CHARGER ---------------------------------
    // Description : Charge PathAudio en memoire si il n'a jamais etais charge
    // ---------------------------------------------------------------------------
    // Arguments : PathAudio, le chemin vers le fichier audio
    //              Sample, a true si c'est un sample, false pour une musique
    // ---------------------------------------------------------------------------
    // Renvois : true si tout c'est bien passe ou que le chargement a deja ete fais.
    // --------------------------------------------------------------------------*/
	bool Charger(std::string PathAudio, bool Sample = true);



    /* --------------------------- GETNUMBEROFCHANNELS ---------------------------
    // Description : renvois le nombre de chanel ouvert par l'initialisation de l'audio
    // ---------------------------------------------------------------------------
    // Renvois : voir Description.
    // --------------------------------------------------------------------------*/
	static int getNumberOfChanels(){
	    return 8;
	}



    /* ---------------------------------- JOUER ----------------------------------
    // Description : Joue une musique ou un sample. Si le sample n'a
    //      pas ete charge on le charge. Une musique ne sera pas rechargee
    // ---------------------------------------------------------------------------
    // Arguments : PathAudio, le chemin vers le fichier audio
    //              Sample, a true si c'est un sample, false pour une musique
    // ---------------------------------------------------------------------------
    // Renvois : true si tout c'est bien passe ou que le chargement a deja ete fais.
    // --------------------------------------------------------------------------*/
	bool Jouer(std::string PathAudio, bool Sample = true);



    /* --------------------------------- ARRETER ---------------------------------
    // Description : Arrete la lecture d'une musique ou un sample
    //          /!\ Par encore code /!\
    // ---------------------------------------------------------------------------
    // Arguments : PathAudio, le chemin vers le fichier audio
    // --------------------------------------------------------------------------*/
	void Arreter(std::string PathAudio);
};

#endif  //_CAUDIO_H