OALplus (0.52.0) a C++ wrapper for OpenAL

oalplus/001_hello.cpp

Shows the basic usage of OALplus by playing a soundCopyright 2008-2014 Matus Chochlik. Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

#include <oalplus/al.hpp>
#include <oalplus/all.hpp>
#include <oalplus/alut.hpp>
#include <chrono>
#include <thread>
int main(int argc, char** argv)
{
// open the default device
// create a context using the device and make it current
oalplus::CurrentContext context(device);
// create an instance of ALUT
oalplus::ALUtilityToolkit alut(false, argc, argv);
// create a listener and set its position, velocity and orientation
listener.Position(0.0f, 0.0f, 0.0f);
listener.Velocity(0.0f, 0.0f, 0.0f);
listener.Orientation(0.0f, 0.0f,-1.0f, 0.0f, 1.0f, 0.0f);
// create a Hello World sound and store it into a buffer
// create a source from the data in buffer and set its position
source.Buffer(buffer);
source.Position(0.0f, 0.0f,-1.0f);
// let the source play the sound
source.Play();
// wait for a while
std::chrono::seconds duration(2);
std::this_thread::sleep_for(duration);
//
return 0;
}

Copyright © 2010-2014 Matúš Chochlík, University of Žilina, Žilina, Slovakia.
<matus.chochlik -at- fri.uniza.sk>
<chochlik -at -gmail.com>
Documentation generated on Mon Sep 22 2014 by Doxygen (version 1.8.6).