arduino-audio-tools
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
STKInstrument< StkCls, T > Class Template Reference

STK Stream for Instrument. More...

#include <AudioSTK.h>

Inheritance diagram for STKInstrument< StkCls, T >:
STKGenerator< StkCls, T > SoundGenerator< T >

Public Member Functions

 STKInstrument (StkCls &instrument)
 
virtual AudioInfo audioInfo ()
 Provides the AudioInfo.
 
virtual bool begin ()
 
bool begin (AudioInfo cfg)
 Starts the processing.
 
AudioInfo defaultConfig ()
 provides the default configuration
 
virtual void end ()
 ends the processing
 
virtual bool isActive ()
 
void noteOff ()
 
void noteOn (float freq, float vol)
 
virtual size_t readBytes (uint8_t *data, size_t len)
 Provides the data as byte array with the requested number of channels.
 
readSample ()
 Provides a single sample.
 
void setAmplitude (float amplitude)
 Defines the amplitude (0.0 ... 1.0)
 
virtual void setAudioInfo (AudioInfo info)
 Defines/updates the AudioInfo.
 
void setFrequency (float frequency) override
 sets the frequency
 
void setInput (StkCls &instrument)
 

Protected Member Functions

size_t readBytesFrames (uint8_t *buffer, size_t lengthBytes, int frames, int channels)
 
size_t readBytesFromBuffer (uint8_t *buffer, size_t lengthBytes, int frame_size, int channels)
 

Protected Attributes

bool active = false
 
bool activeWarningIssued = false
 
float amplitude = 1.0
 
AudioInfo info
 
max_value
 
StkCls * p_instrument = nullptr
 
RingBuffer< uint8_t > ring_buffer {0}
 

Detailed Description

template<class StkCls = stk::Instrmnt, class T = int16_t>
class audio_tools::STKInstrument< StkCls, T >

STK Stream for Instrument.

Member Function Documentation

◆ begin() [1/2]

template<class T = int16_t>
virtual bool begin ( )
inlinevirtualinherited

◆ begin() [2/2]

template<class StkCls = stk::Generator, class T = int16_t>
bool begin ( AudioInfo  cfg)
inlinevirtualinherited

Starts the processing.

Reimplemented from SoundGenerator< T >.

◆ defaultConfig()

template<class StkCls = stk::Generator, class T = int16_t>
AudioInfo defaultConfig ( )
inlinevirtualinherited

provides the default configuration

Reimplemented from SoundGenerator< T >.

◆ end()

template<class T = int16_t>
virtual void end ( )
inlinevirtualinherited

ends the processing

Reimplemented in GeneratorFromArray< T >.

◆ isActive()

template<class T = int16_t>
virtual bool isActive ( )
inlinevirtualinherited

Checks if the begin method has been called - after end() isActive returns false

◆ readSample()

template<class StkCls = stk::Generator, class T = int16_t>
T readSample ( )
inlinevirtualinherited

Provides a single sample.

Implements SoundGenerator< T >.

◆ setAudioInfo()

template<class T = int16_t>
virtual void setAudioInfo ( AudioInfo  info)
inlinevirtualinherited

Defines/updates the AudioInfo.

Reimplemented in SineWaveGenerator< T >, and SineWaveGenerator< int16_t >.

◆ setFrequency()

template<class StkCls = stk::Instrmnt, class T = int16_t>
void setFrequency ( float  frequency)
inlineoverridevirtual

sets the frequency

Reimplemented from SoundGenerator< T >.


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