Ring Daemon 16.0.0
Loading...
Searching...
No Matches
jami::Tone Class Reference

#include <tone.h>

Inheritance diagram for jami::Tone:
Inheritance graph
Collaboration diagram for jami::Tone:
Collaboration graph

Public Types

enum class  ToneId {
  DIALTONE = 0 , BUSY , RINGTONE , CONGESTION ,
  TONE_NULL
}
 The different kind of tones. More...
 

Public Member Functions

 Tone (std::string_view definition, unsigned int sampleRate, AVSampleFormat sampleFormat)
 Constructor.
 
- Public Member Functions inherited from jami::AudioLoop
 AudioLoop (AudioFormat format)
 
AudioFormat getFormat () const
 
void getNext (AVFrame *output, bool mute)
 Get the next fragment of the tone the function change the intern position, and will loop.
 
std::unique_ptr< AudioFramegetNext (size_t samples=0, bool mute=false)
 
size_t getSize () const
 Accessor to the size of the buffer.
 
AudioLoopoperator= (AudioLoop &&o) noexcept
 
void reset ()
 Reset the pointer position.
 
void seek (double relative_position)
 
virtual ~AudioLoop ()
 

Static Public Member Functions

static void genSin (AVFrame *buffer, size_t outPos, unsigned nb_samples, unsigned frequency1, unsigned frequency2)
 Add a simple or double sin to the buffer, it double the sin in stereo.
 

Additional Inherited Members

- Protected Attributes inherited from jami::AudioLoop
libjami::FrameBuffer buffer_ {}
 The data buffer.
 
AudioFormat format_
 
size_t pos_ {0}
 current position, set to 0, when initialize
 

Detailed Description

Definition at line 32 of file tone.h.

Member Enumeration Documentation

◆ ToneId

The different kind of tones.

Enumerator
DIALTONE 
BUSY 
RINGTONE 
CONGESTION 
TONE_NULL 

Definition at line 43 of file tone.h.

Constructor & Destructor Documentation

◆ Tone()

jami::Tone::Tone ( std::string_view  definition,
unsigned int  sampleRate,
AVSampleFormat  sampleFormat 
)

Constructor.

Parameters
definitionString that contain frequency/time of the tone
sampleRateSampleRating of audio tone

Definition at line 32 of file tone.cpp.

References jami::emitSignal().

Here is the call graph for this function:

Member Function Documentation

◆ genSin()

void jami::Tone::genSin ( AVFrame buffer,
size_t  outPos,
unsigned  nb_samples,
unsigned  frequency1,
unsigned  frequency2 
)
static

Add a simple or double sin to the buffer, it double the sin in stereo.

Parameters
bufferThe data
frequency1The first frequency
frequency2The second frequency
nbthe number of samples to generate

Definition at line 111 of file tone.cpp.

References jami::emitSignal(), and JAMI_ERROR.

Here is the call graph for this function:

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