SID Player
All Classes Functions Pages
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
audio_tools::SIDStream Class Reference

Provides SID audio data. More...

#include <SIDStream.h>

Inheritance diagram for audio_tools::SIDStream:

Public Member Functions

 SIDStream ()=default
 Construct a new SIDStream object To play a song call begin() and then setSID()
 
 SIDStream (const unsigned char *tunedata, int tunedatalen, int subtune=0)
 Construct a new SIDStream object To play a song just call begin() More...
 
SIDStreamConfig defaultConfig ()
 Provides the default configuration.
 
bool begin (SIDStreamConfig config)
 
void end () override
 Stops processing and releases the memory.
 
void setSID (const unsigned char *tunedata, int tunedatalen, int subtune=0)
 Loads the tune to be played and starts generating audio. More...
 
void setTune (int subtune=0)
 
size_t readBytes (uint8_t *buffer, size_t bytes) override
 fill the data with 2 channels
 
SIDMetadata getMetadata ()
 Provide the metadata for the sid.
 
SIDStreamConfig getStreamConfigdata ()
 
bool isActive (int timeoutMs=2000)
 

Protected Member Functions

int16_t readSample ()
 Provides a single sample.
 
void updateTimeOfLastSound (int16_t *data, int len)
 

Protected Attributes

SIDStreamConfig cfg
 
SIDMetadata meta
 
bool active = false
 
uint8_t frame_size
 
uint64_t time_of_last_sound = 0
 

Detailed Description

Provides SID audio data.

Author
Gunnar Larsen

Constructor & Destructor Documentation

◆ SIDStream()

audio_tools::SIDStream::SIDStream ( const unsigned char *  tunedata,
int  tunedatalen,
int  subtune = 0 
)
inline

Construct a new SIDStream object To play a song just call begin()

Parameters
tunedata
tunedatalen
subtune

Member Function Documentation

◆ isActive()

bool audio_tools::SIDStream::isActive ( int  timeoutMs = 2000)
inline

Detects if we still produce any sound: Some submodule play endlessly, others only for a short period of time This method can detect the ones that have ended and produce 0 as output. Warning: you need to call readBytes while using this method.

◆ setSID()

void audio_tools::SIDStream::setSID ( const unsigned char *  tunedata,
int  tunedatalen,
int  subtune = 0 
)
inline

Loads the tune to be played and starts generating audio.

Parameters
tunedata
tunedatalen
subtune

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