Vegastrike 0.5.1 rc1  1.0
Original sources for Vegastrike Evolved
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Audio::BorrowedOpenALRenderer Class Reference

#include <BorrowedOpenALRenderer.h>

Inheritance diagram for Audio::BorrowedOpenALRenderer:
Audio::OpenALRenderer Audio::Renderer

Public Member Functions

 BorrowedOpenALRenderer (ALCdevice *device=0, ALCcontext *context=0) throw (Exception)
 
 ~BorrowedOpenALRenderer ()
 
virtual void setOutputFormat (const Format &format) throw (Exception)
 
- Public Member Functions inherited from Audio::OpenALRenderer
 OpenALRenderer () throw (Exception)
 
virtual ~OpenALRenderer ()
 
virtual SharedPtr< SoundgetSound (const std::string &name, VSFileSystem::VSFileType type=VSFileSystem::UnknownFile, bool streaming=false) throw (Exception)
 
virtual bool owns (SharedPtr< Sound > sound)
 
virtual void attach (SharedPtr< Source > source) throw (Exception)
 
virtual void attach (SharedPtr< Listener > listener) throw (Exception)
 
virtual void detach (SharedPtr< Source > source) throw ()
 
virtual void detach (SharedPtr< Listener > listener) throw ()
 
virtual void setMeterDistance (Scalar distance) throw ()
 
virtual void setDopplerFactor (Scalar factor) throw ()
 
virtual void beginTransaction () throw (Exception)
 
virtual void commitTransaction () throw (Exception)
 
- Public Member Functions inherited from Audio::Renderer
 Renderer () throw (Exception)
 
virtual ~Renderer ()
 
virtual Scalar getMeterDistance () const throw ()
 
virtual Scalar getDopplerFactor () const throw ()
 
virtual const FormatgetOutputFormat () const throw ()
 

Protected Member Functions

virtual void checkContext () throw (Exception)
 
- Protected Member Functions inherited from Audio::OpenALRenderer
virtual void initContext () throw (Exception)
 
void setupDopplerEffect () throw (Exception)
 

Additional Inherited Members

- Protected Attributes inherited from Audio::OpenALRenderer
AutoPtr
< __impl::OpenAL::RendererData
data
 

Detailed Description

Hooks up the renderer to an already-existing OpenAL context

Remarks
If you're already using OpenAL in a standard fashion, you can still benefit from the scene graph provided by the Audio library by initializing the OpenAL renderer through this method. The default constructor will assume the current OpenAL context has been previously initialized and hook up to that context.

Definition at line 21 of file BorrowedOpenALRenderer.h.

Constructor & Destructor Documentation

Audio::BorrowedOpenALRenderer::BorrowedOpenALRenderer ( ALCdevice *  device = 0,
ALCcontext *  context = 0 
)
throw (Exception
)

Hooks up the renderer to an already-existing OpenAL context

Remarks
If you're already using OpenAL in a standard fashion, you can still benefit from the scene graph provided by the Audio library by initializing the OpenAL renderer through this method. If any parameter was passed as null, it will be retrieved from the current OpenAL context (which must have been previously initialized)
Parameters
deviceThe OpenAL device associated to this context
contextThe OpenAL context associated to this renderer

Definition at line 403 of file OpenALRenderer.cpp.

404  :
406  {
407  if (device)
408  data->alDevice = device;
409  if (context)
410  data->alContext = context;
411  else
412  data->alContext = alcGetCurrentContext();
413  if (!device && data->alContext)
414  data->alDevice = alcGetContextsDevice(data->alContext);
415 
416  initContext();
417  }
Audio::BorrowedOpenALRenderer::~BorrowedOpenALRenderer ( )

Definition at line 419 of file OpenALRenderer.cpp.

420  {
421  data->alDevice = NULL;
422  data->alContext = NULL;
423  }

Member Function Documentation

void Audio::BorrowedOpenALRenderer::checkContext ( )
throw (Exception
)
protectedvirtual

Makes sure the AL context is valid, creating one if necessary

Reimplemented from Audio::OpenALRenderer.

Definition at line 432 of file OpenALRenderer.cpp.

434  {
435  // No-op... context has been borrowed
436  }
void Audio::BorrowedOpenALRenderer::setOutputFormat ( const Format format)
throw (Exception
)
virtual

Sets the (preferred) output format.

Remarks
Renderers are encouraged to set their effective output format to the closest "better" format, where better is defined as either having heigher sampling frequency, bit depth, or number of channels. The effective output format, if known, must be reflected in subsequent calls to getOutputFormat.

Reimplemented from Audio::OpenALRenderer.

Definition at line 425 of file OpenALRenderer.cpp.

References Audio::Renderer::setOutputFormat().

427  {
428  // No-op... format is given by the borrowed context
430  }

The documentation for this class was generated from the following files: