Mozzi  version v1.1.0
sound synthesis library for Arduino
StereoOutput Struct Reference

This struct encapsulates one frame of mono audio output. More...

#include <AudioOutput.h>

Public Member Functions

 StereoOutput (AudioOutputStorage_t l, AudioOutputStorage_t r)
 Construct an audio frame from raw values (zero-centered)
 
 StereoOutput ()
 Default contstructor.
 
AudioOutput_t portable () const __attribute__((deprecated("Sketch generates stereo output
 Conversion to int operator: If used in a mono config, returns only the left channel (and gives a compile time warning). More...
 
AudioOutputStorage_t l () const
 
AudioOutputStorage_t r () const
 
StereoOutputclip ()
 

Static Public Member Functions

template<typename T >
static StereoOutput fromNBit (uint8_t bits, T l, T r)
 
static StereoOutput from8Bit (int16_t l, int16_t r)
 
static StereoOutput from16Bit (int16_t l, int16_t r)
 
template<typename A , typename B >
static StereoOutput fromAlmostNBit (A bits, B l, B r)
 

Public Attributes

AudioOutput_t but Mozzi is configured for mono Check mozzi_config h { return _l
 

Detailed Description

This struct encapsulates one frame of mono audio output.

Internally, it really just boils down to two int values, but the struct provides useful API an top of that. For more detail

See also
MonoOutput .

Definition at line 89 of file AudioOutput.h.

Member Function Documentation

◆ clip()

StereoOutput& StereoOutput::clip ( )
inline
See also
MonoOutput::clip(). Clips both channels.

Definition at line 103 of file AudioOutput.h.

◆ from16Bit()

static StereoOutput StereoOutput::from16Bit ( int16_t  l,
int16_t  r 
)
inlinestatic
See also
MonoOutput::from16Bit(), stereo variant

Definition at line 110 of file AudioOutput.h.

◆ from8Bit()

static StereoOutput StereoOutput::from8Bit ( int16_t  l,
int16_t  r 
)
inlinestatic
See also
MonoOutput::from8Bit(), stereo variant

Definition at line 108 of file AudioOutput.h.

◆ fromAlmostNBit()

template<typename A , typename B >
static StereoOutput StereoOutput::fromAlmostNBit ( bits,
l,
r 
)
inlinestatic
See also
MonoOutput::fromAlmostNBit(), stereo variant

Definition at line 112 of file AudioOutput.h.

◆ fromNBit()

template<typename T >
static StereoOutput StereoOutput::fromNBit ( uint8_t  bits,
l,
r 
)
inlinestatic
See also
MonoOutput::fromNBit(), stereo variant

Definition at line 106 of file AudioOutput.h.

◆ portable()

AudioOutput_t StereoOutput::portable ( ) const
inline

Conversion to int operator: If used in a mono config, returns only the left channel (and gives a compile time warning).

This could be turned into an operator for implicit conversion in this case. For now we chose to apply conversion on demand, only, as most of the time using StereoOutput in a mono config, is not intended.