Mozzi  version v2.0
sound synthesis library for Arduino
StereoOutput Struct Reference

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

#include <AudioOutput.h>

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 MonoOutput .

Definition at line 161 of file AudioOutput.h.

Public Member Functions

 StereoOutput (AudioOutputStorage_t l, AudioOutputStorage_t r)
 Construct an audio frame from raw values (zero-centered)
 
 StereoOutput ()
 Default constructor. More...
 
AudioOutput 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 ()
 See MonoOutput::clip(). More...
 

Static Public Member Functions

template<typename T >
static StereoOutput fromNBit (uint8_t bits, T l, T r)
 See MonoOutput::fromNBit(), stereo variant.
 
static StereoOutput from8Bit (int16_t l, int16_t r)
 See MonoOutput::from8Bit(), stereo variant.
 
static StereoOutput from16Bit (int16_t l, int16_t r)
 See MonoOutput::from16Bit(), stereo variant.
 
template<int8_t NI, int8_t NF, uint64_t RANGE, int8_t _NI, int8_t _NF, uint64_t _RANGE>
static StereoOutput fromSFix (SFix< NI, NF, RANGE > l, SFix< _NI, _NF, _RANGE > r)
 See MonoOutput::fromSFix(), stereo variant. More...
 
template<typename A , typename B >
static StereoOutput fromAlmostNBit (A bits, B l, B r)
 See MonoOutput::fromAlmostNBit(), stereo variant.
 

Public Attributes

AudioOutput but Mozzi is configured for mono Check MOZZI_AUDIO_CHANNELS setting
 

Constructor & Destructor Documentation

◆ StereoOutput()

StereoOutput::StereoOutput ( )
inline

Default constructor.

Does not initialize the sample!

Definition at line 165 of file AudioOutput.h.

Member Function Documentation

◆ clip()

StereoOutput& StereoOutput::clip ( )
inline

See MonoOutput::clip().

Clips both channels.

Definition at line 178 of file AudioOutput.h.

◆ fromSFix()

template<int8_t NI, int8_t NF, uint64_t RANGE, int8_t _NI, int8_t _NF, uint64_t _RANGE>
static StereoOutput StereoOutput::fromSFix ( SFix< NI, NF, RANGE >  l,
SFix< _NI, _NF, _RANGE >  r 
)
inlinestatic

See MonoOutput::fromSFix(), stereo variant.

Note that the two channels do not need to have the same number of bits.

Definition at line 188 of file AudioOutput.h.

◆ portable()

AudioOutput 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.