Nsound  0.9.4
Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
Nsound::AudioBackend Class Referenceabstract

#include <Nsound/AudioBackend.h>

Inheritance diagram for Nsound::AudioBackend:
Inheritance graph
[legend]

Public Types

enum  State { BACKEND_NOT_INITIALIZED, BACKEND_READY, BACKEND_ERROR }
 

Public Member Functions

 AudioBackend (uint32 sample_rate=44100, uint32 channels=1, uint32 bits_per_sample=16)
 
virtual ~AudioBackend ()
 
virtual AudioBackendType getBackendType ()=0
 
uint32 getBitsPerSample ()
 
uint32 getChannels ()
 
virtual std::string getError ()=0
 
virtual std::string getInfo ()=0
 
uint32 getSampleRate ()
 
State getState ()
 
std::string getStateString ()
 Returns the backend state. More...
 
virtual void initialize ()=0
 
virtual void play (void *data, uint32 n_bytes)=0
 
virtual void scanDevices (AudioPlayback &pb, const AudioStream &test_clip)=0
 
virtual void setOption (const std::string &key, const std::string &value)=0
 
virtual void shutdown ()=0
 

Static Public Member Functions

static std::string getStateString (const AudioBackend::State &state)
 Returns the backend state string. More...
 

Protected Attributes

uint32 sample_rate_
 
uint32 channels_
 
uint32 bits_per_sample_
 
State state_
 

Detailed Description

Definition at line 48 of file AudioBackend.h.

Member Enumeration Documentation

Enumerator
BACKEND_NOT_INITIALIZED 
BACKEND_READY 
BACKEND_ERROR 

Definition at line 52 of file AudioBackend.h.

Constructor & Destructor Documentation

Nsound::AudioBackend::AudioBackend ( uint32  sample_rate = 44100,
uint32  channels = 1,
uint32  bits_per_sample = 16 
)
inline

Definition at line 59 of file AudioBackend.h.

virtual Nsound::AudioBackend::~AudioBackend ( )
inlinevirtual

Definition at line 70 of file AudioBackend.h.

70 {};

Member Function Documentation

virtual AudioBackendType Nsound::AudioBackend::getBackendType ( )
pure virtual
uint32 Nsound::AudioBackend::getBitsPerSample ( )
inline

Definition at line 77 of file AudioBackend.h.

References bits_per_sample_.

Referenced by Nsound::AudioPlayback::getBitsPerSample().

77 {return bits_per_sample_;};
uint32 Nsound::AudioBackend::getChannels ( )
inline

Definition at line 80 of file AudioBackend.h.

References channels_.

Referenced by Nsound::AudioPlayback::getChannels(), and play_int().

80 {return channels_;};
virtual std::string Nsound::AudioBackend::getError ( )
pure virtual
virtual std::string Nsound::AudioBackend::getInfo ( )
pure virtual
uint32 Nsound::AudioBackend::getSampleRate ( )
inline

Definition at line 91 of file AudioBackend.h.

References sample_rate_.

Referenced by Nsound::AudioPlayback::getSampleRate().

91 {return sample_rate_;};
State Nsound::AudioBackend::getState ( )
inline
std::string AudioBackend::getStateString ( )

Returns the backend state.

Definition at line 43 of file AudioBackend.cc.

References state_, and state_strings.

Referenced by Nsound::AudioPlayback::getStateString().

44 {
45  return state_strings[state_];
46 }
std::string state_strings[3]
Definition: AudioBackend.cc:33
std::string AudioBackend::getStateString ( const AudioBackend::State state)
static

Returns the backend state string.

Definition at line 51 of file AudioBackend.cc.

References BACKEND_ERROR, BACKEND_NOT_INITIALIZED, and state_strings.

52 {
53  if( state >= BACKEND_NOT_INITIALIZED &&
54  state <= BACKEND_ERROR)
55  {
56  return state_strings[state];
57  }
58 
59  return "Unknown Backend State";
60 }
std::string state_strings[3]
Definition: AudioBackend.cc:33
virtual void Nsound::AudioBackend::initialize ( )
pure virtual
virtual void Nsound::AudioBackend::play ( void *  data,
uint32  n_bytes 
)
pure virtual
virtual void Nsound::AudioBackend::scanDevices ( AudioPlayback pb,
const AudioStream test_clip 
)
pure virtual
virtual void Nsound::AudioBackend::setOption ( const std::string &  key,
const std::string &  value 
)
pure virtual
virtual void Nsound::AudioBackend::shutdown ( )
pure virtual

Member Data Documentation

uint32 Nsound::AudioBackend::sample_rate_
protected
uint32 Nsound::AudioBackend::channels_
protected
uint32 Nsound::AudioBackend::bits_per_sample_
protected
State Nsound::AudioBackend::state_
protected

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