linuxsampler 2.3.1
LinuxSampler::AudioChannel Class Reference

Audio Channel (always mono) More...

#include <AudioChannel.h>

Classes

class  ParameterIsMixChannel
 
class  ParameterMixChannelDestination
 
class  ParameterName
 

Public Member Functions

floatBuffer ()
 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
Audio Channel (always mono)
Wraps as a kind of pointer class some data object shared with other threads, to protect / synchronize...

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 56 of file AudioChannel.h.

Constructor & Destructor Documentation

◆ AudioChannel() [1/3]

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

Create real channel.

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

Definition at line 44 of file AudioChannel.cpp.

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

◆ AudioChannel() [2/3]

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
pBuffer- external audio buffer
BufferSize- size of the external buffer

Definition at line 64 of file AudioChannel.cpp.

References ChannelNr, Clear(), and Parameters.

◆ AudioChannel() [3/3]

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

Create mix channel.

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

Definition at line 84 of file AudioChannel.cpp.

References ChannelNr, Clear(), and Parameters.

◆ ~AudioChannel()

LinuxSampler::AudioChannel::~AudioChannel ( )
virtual

Destructor.

Definition at line 101 of file AudioChannel.cpp.

References LinuxSampler::Thread::freeAlignedMem(), and Parameters.

Member Function Documentation

◆ Buffer()

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

Audio signal buffer.

Definition at line 90 of file AudioChannel.h.

Referenced by CopyTo(), CopyTo(), MixTo(), and MixTo().

◆ ChannelParameters()

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

Definition at line 232 of file AudioChannel.cpp.

References Parameters.

◆ Clear() [1/2]

void LinuxSampler::AudioChannel::Clear ( )
inline

Reset audio buffer with silence.

Definition at line 93 of file AudioChannel.h.

Referenced by AudioChannel(), AudioChannel(), and AudioChannel().

◆ Clear() [2/2]

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

Reset audio buffer with silence.

Definition at line 94 of file AudioChannel.h.

◆ CopyTo() [1/2]

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
Samples- amount of sample points to be copied

Definition at line 117 of file AudioChannel.cpp.

References Buffer().

Referenced by CopyTo().

◆ CopyTo() [2/2]

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
Samples- amount of sample points to be copied
fLevel- volume coefficient to be applied

Definition at line 133 of file AudioChannel.cpp.

References Buffer(), and CopyTo().

◆ MixChannel()

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 92 of file AudioChannel.h.

◆ MixTo() [1/2]

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
Samples- amount of sample points to be mixed over

Definition at line 169 of file AudioChannel.cpp.

References Buffer().

Referenced by MixTo().

◆ MixTo() [2/2]

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
Samples- amount of sample points to be mixed over
fLevel- volume coefficient to be applied

Definition at line 203 of file AudioChannel.cpp.

References Buffer(), and MixTo().

◆ SetBuffer()

void LinuxSampler::AudioChannel::SetBuffer ( float pBuffer)
inline

Definition at line 91 of file AudioChannel.h.

Member Data Documentation

◆ ChannelNr

uint LinuxSampler::AudioChannel::ChannelNr
protected

Definition at line 107 of file AudioChannel.h.

Referenced by AudioChannel(), AudioChannel(), and AudioChannel().

◆ Parameters

std::map<String,DeviceRuntimeParameter*> LinuxSampler::AudioChannel::Parameters
protected

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