2009-08-26 04:55:02 +02:00
|
|
|
//****************************************************************
|
|
|
|
//cAudio 1.7.1 Tutorial 3
|
|
|
|
//Basic Memory Playback *Virtual file systems*
|
|
|
|
//bling.h created with bin2h http://deadnode.org/sw/bin2h/
|
|
|
|
//****************************************************************
|
|
|
|
|
2009-06-21 05:24:30 +02:00
|
|
|
#include <iostream>
|
2009-08-26 04:55:02 +02:00
|
|
|
//Include IAudioManager so we can easily work with cAudio
|
|
|
|
#include "../../include/IAudioManager.h"
|
2009-06-21 05:24:30 +02:00
|
|
|
//Include IAudio so we can create cAudio objects
|
2009-08-26 04:55:02 +02:00
|
|
|
#include "../../include/IAudio.h"
|
|
|
|
//Include The cAudio vector class
|
|
|
|
#include "../../include/cVector3.h"
|
2009-08-29 13:24:31 +02:00
|
|
|
//Include our version of Sleep to free CPU usage
|
|
|
|
#include "../../include/cAudioSleep.h"
|
2009-08-26 04:55:02 +02:00
|
|
|
//Our Bling sound
|
2009-06-21 05:24:30 +02:00
|
|
|
#include "bling.h"
|
|
|
|
|
2009-08-26 04:55:02 +02:00
|
|
|
using namespace std;
|
2009-06-21 05:24:30 +02:00
|
|
|
|
|
|
|
|
|
|
|
int main(int argc, char* argv[])
|
|
|
|
{
|
|
|
|
//Make visual studio happy
|
2009-08-08 07:51:32 +02:00
|
|
|
cAudio::IAudio* mysound = 0x0;
|
2009-08-26 04:55:02 +02:00
|
|
|
//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->getListener()->setPosition(cAudio::cVector3(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.
|
|
|
|
|
2009-08-08 07:51:32 +02:00
|
|
|
mysound = manager->createFromMemory("bling",(const char*)bling,bling_size,"wav");
|
2009-06-21 05:24:30 +02:00
|
|
|
|
2009-08-08 07:51:32 +02:00
|
|
|
if(mysound)
|
|
|
|
{
|
2009-08-26 04:55:02 +02:00
|
|
|
//Set the IAudio Sound to play2d and loop
|
|
|
|
mysound->play2d(true);
|
|
|
|
|
|
|
|
while(mysound->playing())
|
|
|
|
{
|
2009-08-29 13:24:31 +02:00
|
|
|
//Sleep for 10 ms to free some CPU
|
|
|
|
cAudio::cAudioSleep(10);
|
2009-08-08 07:51:32 +02:00
|
|
|
}
|
|
|
|
}
|
2009-08-26 04:55:02 +02:00
|
|
|
|
2009-06-21 05:24:30 +02:00
|
|
|
//Delete all IAudio sounds
|
2009-08-26 04:55:02 +02:00
|
|
|
manager->release();
|
2009-06-21 05:24:30 +02:00
|
|
|
//Shutdown cAudio
|
|
|
|
manager->shutDown();
|
|
|
|
return 0;
|
|
|
|
}
|