AudioStream
Go to the documentation of this file.
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#ifndef OSG_AUDIOSTREAM
#define OSG_AUDIOSTREAM 1
#include <osg/Image>
#include <stdlib.h>
namespace osg {
class OSG_EXPORT AudioSink : public osg::Object
{
public:
AudioSink();
virtual const char * libraryName() const { return "osg"; }
virtual const char * className() const { return "AudioSinkInterface"; }
virtual void play() = 0;
virtual void pause() = 0;
virtual void stop() = 0;
virtual bool playing() const = 0;
virtual double getDelay() const { return _delay; }
virtual void setDelay(const double delay) { _delay = delay; }
virtual void setVolume(float) {}
virtual float getVolume() const { return 0.0f; }
private:
virtual Object* cloneType() const { return 0; }
virtual Object* clone(const osg::CopyOp &) const { return 0; }
double _delay;
};
class OSG_EXPORT AudioStream : public osg::Object
{
public:
AudioStream();
AudioStream(const AudioStream& audio,const CopyOp& copyop=CopyOp::SHALLOW_COPY);
virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast<const AudioStream*>(obj)!=0; }
virtual const char* libraryName() const { return "osg"; }
virtual const char* className() const { return "AudioStream"; }
virtual void setAudioSink(osg::AudioSink* audio_sink) = 0;
virtual void consumeAudioBuffer(void * const buffer, const size_t size) = 0;
virtual int audioFrequency() const = 0;
virtual int audioNbChannels() const = 0;
enum SampleFormat
{
SAMPLE_FORMAT_U8,
SAMPLE_FORMAT_S16,
SAMPLE_FORMAT_S24,
SAMPLE_FORMAT_S32,
SAMPLE_FORMAT_F32
};
virtual SampleFormat audioSampleFormat() const = 0;
};
} // namespace
#endif
Image
osg::AudioSink
Definition AudioStream:24
osg::AudioSink::libraryName
virtual const char * libraryName() const
Definition AudioStream:29
osg::AudioSink::setVolume
virtual void setVolume(float)
Definition AudioStream:41
osg::AudioSink::stop
virtual void stop()=0
osg::AudioSink::setDelay
virtual void setDelay(const double delay)
Definition AudioStream:39
osg::AudioSink::getDelay
virtual double getDelay() const
Definition AudioStream:38
osg::AudioSink::playing
virtual bool playing() const =0
osg::AudioSink::AudioSink
AudioSink()
osg::AudioSink::pause
virtual void pause()=0
osg::AudioSink::play
virtual void play()=0
osg::AudioSink::getVolume
virtual float getVolume() const
Definition AudioStream:42
osg::AudioSink::className
virtual const char * className() const
Definition AudioStream:30
osg::AudioStream::AudioStream
AudioStream()
osg::AudioStream::audioNbChannels
virtual int audioNbChannels() const =0
osg::AudioStream::audioFrequency
virtual int audioFrequency() const =0
osg::AudioStream::audioSampleFormat
virtual SampleFormat audioSampleFormat() const =0
osg::AudioStream::setAudioSink
virtual void setAudioSink(osg::AudioSink *audio_sink)=0
osg::AudioStream::consumeAudioBuffer
virtual void consumeAudioBuffer(void *const buffer, const size_t size)=0
osg::AudioStream::className
virtual const char * className() const
Definition AudioStream:63
osg::AudioStream::libraryName
virtual const char * libraryName() const
Definition AudioStream:62
osg::AudioStream::isSameKindAs
virtual bool isSameKindAs(const Object *obj) const
Definition AudioStream:61
osg::AudioStream::AudioStream
AudioStream(const AudioStream &audio, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
osg::AudioStream::SampleFormat
SampleFormat
Definition AudioStream:73
osg::AudioStream::SAMPLE_FORMAT_F32
@ SAMPLE_FORMAT_F32
Definition AudioStream:78
osg::AudioStream::SAMPLE_FORMAT_U8
@ SAMPLE_FORMAT_U8
Definition AudioStream:74
osg::AudioStream::SAMPLE_FORMAT_S24
@ SAMPLE_FORMAT_S24
Definition AudioStream:76
osg::AudioStream::SAMPLE_FORMAT_S32
@ SAMPLE_FORMAT_S32
Definition AudioStream:77
osg::AudioStream::SAMPLE_FORMAT_S16
@ SAMPLE_FORMAT_S16
Definition AudioStream:75
osg::CopyOp
Definition CopyOp:41
osg::CopyOp::SHALLOW_COPY
@ SHALLOW_COPY
Definition CopyOp:47
osg::Object
Definition Object:61
osg::Object::Object
Object()
Definition Object:69
osg
Definition AlphaFunc:19
osg::cloneType
T * cloneType(const T *t)
Definition Object:357
OSG_EXPORT
#define OSG_EXPORT
Definition osg/Export:39