hey everyone
if you have a project and you dont wanna use SDL for sound i have nicely wrapped up the Fmod library in c++ style for anyone who wants it, it still needs a lot of work to include all the features of FMOD but it will work to play music and sound effects easily enjoy, add both files to your project
CODE
#ifndef SOUND_MANAGER_H
#define SOUND_MANAGER_H
#include <string>
#include "fmod.h"
class SoundManager
{
public:
static SoundManager* Instance();
~SoundManager();
bool PlayStream(const std::string& filename, int channel);
bool PlayMusic(const std::string& filename);
bool PlaySample(const std::string& filename, int channel);
void Update();
private:
SoundManager();
SoundManager(const SoundManager&);
SoundManager& operator=(const SoundManager&);
};
#endif
cpp file
CODE
#include "SoundManager.h"
#include <string>
SoundManager* SoundManager::Instance()
{
static SoundManager sm;
return &sm;
}
// Use streams for mp3s and other compressed audio
bool SoundManager::PlayStream(const std::string& filename, int channel)
{
FSOUND_STREAM* stream = FSOUND_Stream_Open(filename.c_str(), 0, 0, 0);
FSOUND_Stream_Play(channel,stream);
return true;
}
// Use samples for sound effects and such
bool SoundManager::PlaySample(const std::string& filename, int channel)
{
FSOUND_SAMPLE* sample = FSOUND_Sample_Load(0,filename.c_str(), 0, 0, 0);
FSOUND_PlaySound(channel,sample);
return true;
}
// Use music for things such as midi files, not very useful streams are better
bool SoundManager::PlayMusic(const std::string& filename)
{
FMUSIC_MODULE* music = FMUSIC_LoadSong(filename.c_str());
FMUSIC_PlaySong(music);
return true;
}
void SoundManager::Update()
{
FSOUND_Update();
}
SoundManager::SoundManager()
{
FSOUND_Init(44100,32,0);
}
SoundManager::~SoundManager()
{
FSOUND_Close();
}
example usage
CODE
SoundManager::Instance()->PlayStream("MetalMusic.mp3", 1);
choose stream to play music files and the other functions for sound effects

the int is the channel you want the sound to play on, with a total of 32 channels i think, FMOD is not for commercial projects
any questions?
quick link if you dont know what FMOD is
http://www.gamedev.net/reference/articles/article2098.aspgotta love singletons
This post has been edited by stayscrisp: 18 Aug, 2008 - 04:31 PM