TinyModem
Header-only software audio modem library
Loading...
Searching...
No Matches
tinymodem::ToneOutput Class Reference

Writes tones of a SoundGenerator as 16 bit PCM with the requested number of channels and volume to a Print. More...

#include <ModemBase.h>

Collaboration diagram for tinymodem::ToneOutput:

Public Member Functions

void setOutput (Print &out)
void setGenerator (audio_tools::SoundGenerator< int16_t > &generator)
audio_tools::SoundGenerator< int16_t > & generator ()
bool begin (audio_tools::AudioInfo info, float volume)
 Starts the generator: volume is the amplitude (0.0 - 1.0).
void tone (float freq, size_t nsamples)

Static Public Member Functions

static int32_t amplitude (float volume)
 minimodem's conversion of the volume to a 16 bit amplitude

Protected Member Functions

int16_t scale (int16_t sample)

Protected Attributes

Print * p_print = nullptr
FSKToneGenerator< int16_t > default_generator
audio_tools::SoundGenerator< int16_t > * p_generator = &default_generator
int32_t gain = 32767
int channels = 1
int16_t buffer [BUFFER_FRAMES *2]

Static Protected Attributes

static constexpr int BUFFER_FRAMES = 64

Detailed Description

Writes tones of a SoundGenerator as 16 bit PCM with the requested number of channels and volume to a Print.

Member Function Documentation

◆ amplitude()

int32_t tinymodem::ToneOutput::amplitude ( float volume)
inlinestatic

minimodem's conversion of the volume to a 16 bit amplitude

◆ begin()

bool tinymodem::ToneOutput::begin ( audio_tools::AudioInfo info,
float volume )
inline

Starts the generator: volume is the amplitude (0.0 - 1.0).

◆ generator()

audio_tools::SoundGenerator< int16_t > & tinymodem::ToneOutput::generator ( )
inline

◆ scale()

int16_t tinymodem::ToneOutput::scale ( int16_t sample)
inlineprotected

◆ setGenerator()

void tinymodem::ToneOutput::setGenerator ( audio_tools::SoundGenerator< int16_t > & generator)
inline

◆ setOutput()

void tinymodem::ToneOutput::setOutput ( Print & out)
inline

◆ tone()

void tinymodem::ToneOutput::tone ( float freq,
size_t nsamples )
inline

Writes a tone (frequency 0 = silence) for the indicated number of samples (frames)

Member Data Documentation

◆ buffer

int16_t tinymodem::ToneOutput::buffer[BUFFER_FRAMES *2]
protected

◆ BUFFER_FRAMES

int tinymodem::ToneOutput::BUFFER_FRAMES = 64
staticconstexprprotected

◆ channels

int tinymodem::ToneOutput::channels = 1
protected

◆ default_generator

FSKToneGenerator<int16_t> tinymodem::ToneOutput::default_generator
protected

◆ gain

int32_t tinymodem::ToneOutput::gain = 32767
protected

◆ p_generator

audio_tools::SoundGenerator<int16_t>* tinymodem::ToneOutput::p_generator = &default_generator
protected

◆ p_print

Print* tinymodem::ToneOutput::p_print = nullptr
protected

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