Page MenuHomePhorge

AudioTests.cpp
No OneTemporary

Size
1 KB
Referenced Files
None
Subscribers
None

AudioTests.cpp

/*
* File: AudioTests.cpp
* Author: sean
*
* Created on 13-Sep-2014, 20:26:33
*/
#include <stdlib.h>
#include <iostream>
#include <echo/Kernel/Kernel.h>
#include <echo/Platform.h>
#include <echo/FileSystem/FileSystem.h>
#include <echo/Chrono/CountDownTimer.h>
#include <echo/Audio/Audio.h>
#include <echo/Audio/AudioPlayer.h>
#include <echo/Audio/AudioBuffer.h>
#include <echo/Audio/AudioStream.h>
#include <echo/Resource/WavAudioSource.h>
#include <echo/Resource/OggAudioSource.h>
#include <echo/Resource/XMAudioSource.h>
#include <boost/bind.hpp>
using namespace Echo;
void AudioTest()
{
//We will create a kernel which will manage the main program loop.
Kernel kernel;
//Create a default a FileSystem object.
shared_ptr<FileSystem> fileSystem = Platform::CreateDefaultFileSystem("RenderTests");
//The demo will timeout automatically.
CountDownTimer timeout(Seconds(30.0),boost::bind(&TaskManager::RemoveAllTasks,&kernel),"RemoveAllTasks");
kernel.AddTask(timeout);
shared_ptr<Audio> audio = Platform::CreateDefaultAudioSystem();
shared_ptr<ExecutionModel> model = Platform::CreateExecutionModel();
model->SetModelToUse(ExecutionModel::Models::NONE);
kernel.SetExecutionModel(model);
AudioPlayer audioPlayer(audio,fileSystem);
audioPlayer.AddMusic("MyTrack","data/TestTrack.ogg");
audioPlayer.AddSound("MySound","data/TestSample.wav");
audioPlayer.PlayMusic("MyTrack");
CountDownTimer timeout2(Seconds(10.0),boost::bind(&AudioPlayer::PlaySound,&audioPlayer,"MySound"),"MySound");
kernel.AddTask(timeout2);
kernel.AddTask(*audio);
kernel.Execute();
}
int main(int argc, char** argv)
{
std::cout << "%SUITE_STARTING% RenderTest" << std::endl;
std::cout << "%SUITE_STARTED%" << std::endl;
std::cout << "%TEST_STARTED% MultipleViewportTest (RenderTest)" << std::endl;
AudioTest();
std::cout << "%TEST_FINISHED% time=0 MultipleViewportTest (RenderTest)" << std::endl;
std::cout << "%SUITE_FINISHED% time=0" << std::endl;
return(EXIT_SUCCESS);
}

File Metadata

Mime Type
text/x-c
Expires
Thu, Jan 16, 1:22 AM (14 h, 3 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
72119
Default Alt Text
AudioTests.cpp (1 KB)

Event Timeline