1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
3 * This library is open source and may be redistributed and/or modified under
4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
5 * (at your option) any later version. The full license is in LICENSE file
6 * included with this distribution, and on the openscenegraph.org website.
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * OpenSceneGraph Public License for more details.
14#ifndef OSG_AUDIOSTREAM
15#define OSG_AUDIOSTREAM 1
22/** Pure virtual AudioSink bass class that is used to connect the audio system with AudioStreams. */
23class OSG_EXPORT AudioSink : public osg::Object
29 virtual const char * libraryName() const { return "osg"; }
30 virtual const char * className() const { return "AudioSinkInterface"; }
32 virtual void play() = 0;
33 virtual void pause() = 0;
34 virtual void stop() = 0;
36 virtual bool playing() const = 0;
38 virtual double getDelay() const { return _delay; }
39 virtual void setDelay(const double delay) { _delay = delay; }
41 virtual void setVolume(float) {}
42 virtual float getVolume() const { return 0.0f; }
46 virtual Object* cloneType() const { return 0; }
47 virtual Object* clone(const osg::CopyOp &) const { return 0; }
52/** Pure virtual AudioStream base class. Subclasses provide mechanism for reading/generating audio data*/
53class OSG_EXPORT AudioStream : public osg::Object
58 /** Copy constructor using CopyOp to manage deep vs shallow copy. */
59 AudioStream(const AudioStream& audio,const CopyOp& copyop=CopyOp::SHALLOW_COPY);
61 virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast<const AudioStream*>(obj)!=0; }
62 virtual const char* libraryName() const { return "osg"; }
63 virtual const char* className() const { return "AudioStream"; }
65 virtual void setAudioSink(osg::AudioSink* audio_sink) = 0;
67 virtual void consumeAudioBuffer(void * const buffer, const size_t size) = 0;
69 virtual int audioFrequency() const = 0;
70 virtual int audioNbChannels() const = 0;
81 virtual SampleFormat audioSampleFormat() const = 0;