caudio/Examples/Tutorial3_MemoryPlayback/main.cpp

50 lines
1.4 KiB
C++

//****************************************************************
//cAudio 1.7.1 Tutorial 3
//Basic Memory Playback *Virtual file systems*
//bling.h created with bin2h http://deadnode.org/sw/bin2h/
//****************************************************************
#include <iostream>
//Include IAudioManager so we can easily work with cAudio
#include "../../include/IAudioManager.h"
//Include IAudio so we can create cAudio objects
#include "../../include/IAudio.h"
//Our Bling sound
#include "bling.h"
using namespace std;
int main(int argc, char* argv[])
{
//Make visual studio happy
cAudio::IAudio* mysound = 0x0;
//Some fancy text
cout << "cAudio 1.7.1 Tutorial 3: MemoryPlayback \n";
//Grap the cAudioManager
cAudio::IAudioManager* manager = cAudio::getAudioManager();
//Init the cAudio Engine
manager->init(argc,argv);
manager->setListenerPos(0.0,0.0,0.0);
//Create a IAudio object and load a sound from memory. using the bling array and bling size generated by bin2h.
mysound = manager->createFromMemory("bling",(const char*)bling,bling_size,"wav");
if(mysound)
{
//Set the IAudio Sound to play2d and loop
mysound->play2d(true);
while(mysound->playing())
{
//Playback sound
manager->update();
}
}
//Delete all IAudio sounds
manager->release();
//Shutdown cAudio
manager->shutDown();
return 0;
}