// $Header: /cvs/gled-1.2/Audio1/Glasses/AlContext.cxx,v 1.2 2005/05/30 13:15:10 matevz Exp $
// Copyright (C) 1999-2005, Matevz Tadel. All rights reserved.
// This file is part of GLED, released under GNU General Public License version 2.
// For the licensing terms see $GLEDSYS/LICENSE or http://www.gnu.org/.
//__________________________________________________________________________
// AlContext
//
//
#include "AlContext.h"
#include "AlContext.c7"
#include <AL/al.h>
#include <AL/alc.h>
#include <AL/alut.h>
ClassImp(AlContext)
/**************************************************************************/
void AlContext::_init()
{
// *** Set all links to 0 ***
mDevice = 0;
mContext = 0;
}
/**************************************************************************/
void AlContext::Open()
{
static const string _eh("AlContext::Open ");
if(mDevice != 0) {
ISerr(_eh + "device already opened.");
return;
}
mDevice = alcOpenDevice(0);
if(mDevice == 0)
throw(_eh + "can't open device.");
mContext = alcCreateContext(mDevice, 0);
if(mContext == 0) {
alcCloseDevice(mDevice);
mDevice = 0;
throw(_eh + "can't create context.");
}
alcMakeContextCurrent(mContext);
}
void AlContext::Close()
{
static const string _eh("AlContext::Close ");
if(mContext == 0) return;
if (alcGetCurrentContext() == mContext)
alcMakeContextCurrent(0);
alcDestroyContext(mContext); mContext = 0;
alcCloseDevice(mDevice); mDevice = 0;
}
ROOT page - Home page - Class index - Class Hierarchy - Top of the page
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.