Bela
Real-time, ultra-low-latency audio and sensor processing system for BeagleBone Black
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
Macros | Functions
Audio level controls

Macros

#define DEFAULT_LINE_OUT_LEVEL   0.0
 
#define DEFAULT_PGA_GAIN   16
 
#define DEFAULT_HP_LEVEL   -6.0
 

Functions

int Bela_setLineOutLevel (int channel, float decibel)
 Set the level of the audio line out. More...
 
int Bela_setDacLevel (int channel, float decibels)
 Set the level of the audio DAC. More...
 
int Bela_setDACLevel (float decibels)
 
int Bela_setAdcLevel (int channel, float decibels)
 Set the level of the audio ADC. More...
 
int Bela_setADCLevel (float decibels)
 
int Bela_setAudioInputGain (int channel, float decibels)
 Set the gain of the audio input preamplifier. More...
 
int Bela_setPgaGain (float decibels, int channel)
 
int Bela_setHpLevel (int channel, float decibels)
 Set the level of the onboard headphone amplifier. More...
 
int Bela_setHeadphoneLevel (float decibels)
 
int Bela_muteSpeakers (int mute)
 Mute or unmute the onboard speaker amplifiers. More...
 

Detailed Description

These functions control the input and output levels for the audio codec. If a Bela program does not call these functions, sensible default levels will be used.

Macro Definition Documentation

#define DEFAULT_LINE_OUT_LEVEL   0.0

Default level of the line out in decibels. See Bela_setLineOutLevel().

#define DEFAULT_PGA_GAIN   16

Default level of the Programmable Gain Amplifier in decibels.

#define DEFAULT_HP_LEVEL   -6.0

Default level of the headphone output in decibels. See Bela_setHeadphoneLevel().

Function Documentation

int Bela_setLineOutLevel ( int  channel,
float  decibel 
)

Set the level of the audio line out.

Important: do not call this function from within render(), as it does not make any guarantees on real-time performance.

Parameters
channelThe channel to set. Use a negative value to set all channels.
decibelsLevel of the line output. Valid values will depend on the codec in use.
Returns
0 on success, or nonzero if an error occurred.
int Bela_setDacLevel ( int  channel,
float  decibels 
)

Set the level of the audio DAC.

DEPRECATED.

Use Bela_setLineOutLevel() instead.

int Bela_setDACLevel ( float  decibels)

DEPRECATED.

Equivalent to Bela_setDacLevel(-1, decibels).

int Bela_setAdcLevel ( int  channel,
float  decibels 
)

Set the level of the audio ADC.

This function sets the level of the audio input. It does not affect the level of the (non-audio) analog inputs.

Important: do not call this function from within render(), as it does not make any guarantees on real-time performance.

Parameters
channelThe channel to set. Use a negative value to set all channels.
decibelsLevel of the ADC input. Valid levels range from -12 (lowest) to 0 (highest) in steps of 1.5dB. Levels between increments of 1.5 will be rounded down.
Returns
0 on success, or nonzero if an error occurred.
int Bela_setADCLevel ( float  decibels)

DEPRECATED.

Equivalent to Bela_setAdcLevel(-1, decibels).

int Bela_setAudioInputGain ( int  channel,
float  decibels 
)

Set the gain of the audio input preamplifier.

This function sets the level of the Programmable Gain Amplifier(PGA), which amplifies the signal before the ADC.

Important: do not call this function from within render(), as it does not make any guarantees on real-time performance.

Parameters
channelThe channel to set. Use a negative value to set all channels.
decibelsLevel of the PGA Valid levels range from 0 (lowest) to 59.5 (highest) in steps of 0.5dB. Levels between increments of 0.5 will be rounded. channel 1 is right
Returns
0 on success, or nonzero if an error occurred.
int Bela_setPgaGain ( float  decibels,
int  channel 
)

DEPRECATED.

Equivalent to Bela_setAudioInputGain(channel, decibels).

int Bela_setHpLevel ( int  channel,
float  decibels 
)

Set the level of the onboard headphone amplifier.

This function sets the level of the headphone output only (3-pin connector on the Bela cape or the output jack on the BeagleBone Audio Cape). It does not affect the level of the speakers or the line out pads on the cape.

Important: do not call this function from within render(), as it does not make any guarantees on real-time performance.

Parameters
channelThe channel to set. Use a negative value to set all channels.
decibelsLevel of the headphone output. Valid levels range from -63.5 (lowest) to 0 (highest) in steps of 0.5dB. Levels between increments of 0.5 will be rounded down.
Returns
0 on success, or nonzero if an error occurred.
int Bela_setHeadphoneLevel ( float  decibels)

DEPRECATED Equivalent to Bela_setHpLevel(-1, decibels);

int Bela_muteSpeakers ( int  mute)

Mute or unmute the onboard speaker amplifiers.

This function mutes or unmutes the amplifiers on the Bela cape. Whether the speakers begin muted or unmuted depends on the BelaInitSettings structure passed to Bela_initAudio().

Important: do not call this function from within render(), as it does not make any guarantees on real-time performance.

Parameters
mute0 to enable the speakers, nonzero to mute the speakers.
Returns
0 on success, or nonzero if an error occurred.