LinuxSampler::AudioChannel Class Reference

Audio Channel (always mono). More...

#include <AudioChannel.h>

List of all members.

Classes

class  ParameterIsMixChannel
class  ParameterMixChannelDestination
class  ParameterName

Public Member Functions

float * Buffer ()
 Audio signal buffer.
void SetBuffer (float *pBuffer)
AudioChannelMixChannel ()
 In case this channel is a mix channel, then it will return a pointer to the real channel this channel refers to, NULL otherwise.
void Clear ()
 Reset audio buffer with silence.
void Clear (uint Samples)
 Reset audio buffer with silence.
void CopyTo (AudioChannel *pDst, const uint Samples)
 Copies audio data (unmodified) from this AudioChannel to the given destination AudioChannel.
void CopyTo (AudioChannel *pDst, const uint Samples, const float fLevel)
 Copies audio data from this AudioChannel to the given destination AudioChannel and applies the given volume coefficient to the destination audio signal.
void MixTo (AudioChannel *pDst, const uint Samples)
 Copies audio data (unmodified) from this AudioChannel and mixes it to the given destination AudioChannel.
void MixTo (AudioChannel *pDst, const uint Samples, const float fLevel)
 Copies audio data from this AudioChannel, applies the given volume coefficient to the audio signal and mixes it to the given destination channel.
std::map< String,
DeviceRuntimeParameter * > 
ChannelParameters ()
 AudioChannel (uint ChannelNr, uint BufferSize)
 Create real channel.
 AudioChannel (uint ChannelNr, float *pBuffer, uint BufferSize)
 Create channel with external (already existing) audio buffer.
 AudioChannel (uint ChannelNr, AudioChannel *pMixChannelDestination)
 Create mix channel.
virtual ~AudioChannel ()
 Destructor.

Protected Attributes

uint ChannelNr
std::map< String,
DeviceRuntimeParameter * > 
Parameters

Detailed Description

Audio Channel (always mono).

This class is used for routing audio signals between arbitrary sources and destinations. You can either create a normal channel like:

        AudioChannel c1(512); // create unnamed channel
        AudioChannel c2(512, "Effect send mono channel"); // create named channel
Or you can create a mix channel, e.g. the following would create a normal channel first, and the second channel is just a copy of the first channel:
        AudioChannel mono_chan(512, "Effect send channel"); // real channel
        AudioChannel mix_chan(&mono_chan, "Effect send mono channel"); // mix channel
So in the last example, when writing to 'mix_chan' the signal will actually be mixed to the 'mono_chan' channel, so this is an easy way to downmix a signal source which has more audio channels than the signal destination can offer.

Definition at line 55 of file AudioChannel.h.


Constructor & Destructor Documentation

LinuxSampler::AudioChannel::AudioChannel ( uint  ChannelNr,
uint  BufferSize 
)

Create real channel.

Parameters:
ChannelNr - channel number of this new channel
Parameters:
BufferSize - desired audio data buffer size

Definition at line 36 of file AudioChannel.cpp.

References LinuxSampler::Thread::allocAlignedMem(), Clear(), and Parameters.

LinuxSampler::AudioChannel::AudioChannel ( uint  ChannelNr,
float *  pBuffer,
uint  BufferSize 
)

Create channel with external (already existing) audio buffer.

Parameters:
ChannelNr - channel number of this new channel
Parameters:
pBuffer - external audio buffer
Parameters:
BufferSize - size of the external buffer

Definition at line 56 of file AudioChannel.cpp.

References Clear(), and Parameters.

LinuxSampler::AudioChannel::AudioChannel ( uint  ChannelNr,
AudioChannel pMixChannelDestination 
)

Create mix channel.

Parameters:
ChannelNr - channel number of this new channel
Parameters:
pMixChannelDestination - a real audio channel this new mix channel refers to

Definition at line 76 of file AudioChannel.cpp.

References Buffer(), and Parameters.

LinuxSampler::AudioChannel::~AudioChannel (  )  [virtual]

Destructor.

Definition at line 93 of file AudioChannel.cpp.


Member Function Documentation

float* LinuxSampler::AudioChannel::Buffer (  )  [inline]

Audio signal buffer.

Definition at line 67 of file AudioChannel.h.

Referenced by AudioChannel(), and MixTo().

std::map< String, DeviceRuntimeParameter * > LinuxSampler::AudioChannel::ChannelParameters (  ) 

Definition at line 206 of file AudioChannel.cpp.

void LinuxSampler::AudioChannel::Clear ( uint  Samples  )  [inline]

Reset audio buffer with silence.

Definition at line 71 of file AudioChannel.h.

void LinuxSampler::AudioChannel::Clear (  )  [inline]

Reset audio buffer with silence.

Definition at line 70 of file AudioChannel.h.

Referenced by AudioChannel().

void LinuxSampler::AudioChannel::CopyTo ( AudioChannel pDst,
const uint  Samples,
const float  fLevel 
)

Copies audio data from this AudioChannel to the given destination AudioChannel and applies the given volume coefficient to the destination audio signal.

Caution: This method will overwrite the content in the destination channel buffer.

Parameters:
pDst - destination channel
Parameters:
Samples - amount of sample points to be copied
Parameters:
fLevel - volume coefficient to be applied

Definition at line 125 of file AudioChannel.cpp.

void LinuxSampler::AudioChannel::CopyTo ( AudioChannel pDst,
const uint  Samples 
)

Copies audio data (unmodified) from this AudioChannel to the given destination AudioChannel.

Caution: This method will overwrite the content in the destination channel buffer.

Parameters:
pDst - destination channel
Parameters:
Samples - amount of sample points to be copied

Definition at line 109 of file AudioChannel.cpp.

AudioChannel* LinuxSampler::AudioChannel::MixChannel (  )  [inline]

In case this channel is a mix channel, then it will return a pointer to the real channel this channel refers to, NULL otherwise.

Definition at line 69 of file AudioChannel.h.

void LinuxSampler::AudioChannel::MixTo ( AudioChannel pDst,
const uint  Samples,
const float  fLevel 
)

Copies audio data from this AudioChannel, applies the given volume coefficient to the audio signal and mixes it to the given destination channel.

Parameters:
pDst - destination channel
Parameters:
Samples - amount of sample points to be mixed over
Parameters:
fLevel - volume coefficient to be applied

Definition at line 183 of file AudioChannel.cpp.

void LinuxSampler::AudioChannel::MixTo ( AudioChannel pDst,
const uint  Samples 
)

Copies audio data (unmodified) from this AudioChannel and mixes it to the given destination AudioChannel.

Parameters:
pDst - destination channel
Parameters:
Samples - amount of sample points to be mixed over

Definition at line 155 of file AudioChannel.cpp.

References Buffer().

void LinuxSampler::AudioChannel::SetBuffer ( float *  pBuffer  )  [inline]

Definition at line 68 of file AudioChannel.h.


Member Data Documentation

Definition at line 84 of file AudioChannel.h.

Definition at line 85 of file AudioChannel.h.

Referenced by AudioChannel().


The documentation for this class was generated from the following files:
Generated on Sat Jan 28 11:44:02 2012 for linuxsampler by  doxygen 1.6.3