Allolib  1.0
C++ Components For Interactive Multimedia
al::SynthRecorder Class Reference

The SynthRecorder class records the events arriving at a PolySynth. More...

#include <C:/Users/Andres/source/repos/casm_viewer/external/tinc/external/allolib/include/al/scene/al_SynthRecorder.hpp>

Public Types

enum  TextFormat { SEQUENCER_EVENT , SEQUENCER_TRIGGERS , CPP_FORMAT , NONE }
 

Public Member Functions

 SynthRecorder (TextFormat format=SEQUENCER_EVENT)
 
void setDirectory (std::string path)
 
void startRecord (std::string name="", bool overwrite=false, bool startOnEvent=true)
 
void stopRecord ()
 
void setMaxRecordTime (al_sec maxTime)
 
void verbose (bool verbose)
 
bool verbose ()
 
SynthRecorderoperator<< (PolySynth &handler)
 
void registerPolySynth (PolySynth &polySynth)
 

Static Public Member Functions

static bool onTriggerOn (SynthVoice *voice, int offsetFrames, int id, void *userData)
 onTriggerOn callback for trigger on events More...
 
static bool onTriggerOff (int id, void *userData)
 onTriggerOff callback for trigger off events More...
 

Detailed Description

The SynthRecorder class records the events arriving at a PolySynth.

Events are stored in a text file that looks like:

+ 0 72 SineEnv 6.5 523.251 0.5 0.2 1 0
+ 0.149975 74 SineEnv 6.5 587.33 0.5 0.2 1 0
- 0.183213 72
+ 0.283204 76 SineEnv 6.5 659.255 0.5 0.2 1 0
- 0.366428 74
- 0.483025 76

The '+' command triggers the start of an event and the '-' command triggers the end of the event. The first number after the command is the time at which it should happen and the second one is the id of the event, used to connect the 'trigger off' to a previous 'trigger on'.

Alternatively, the sequence can be recorded in CPP_FORMAT that produces C++ code that can be pasted to deliver the sequence.

The sequences stored in the text file can be played back using SynthSequencer You must make sre that the synthesizers referenced in the sequence have enough allocated polyphony for the whole sequence or alternatively that the class has been registered to the PolySynth using registerSynthClass().

SynthSequencer seq;
// Pre allocate voices
seq.synth().allocatePolyphony<SineEnv>(64);
// Register class with PolySynth
seq.synth().registerSynthClass<SineEnv>("SineEnv");

Definition at line 92 of file al_SynthRecorder.hpp.

Member Function Documentation

◆ onTriggerOff()

static bool al::SynthRecorder::onTriggerOff ( int  id,
void *  userData 
)
inlinestatic

onTriggerOff callback for trigger off events

Parameters
id
userData

Definition at line 179 of file al_SynthRecorder.hpp.

◆ onTriggerOn()

static bool al::SynthRecorder::onTriggerOn ( SynthVoice voice,
int  offsetFrames,
int  id,
void *  userData 
)
inlinestatic

onTriggerOn callback for trigger on events

Parameters
voice
offsetFrames
id
userData

Definition at line 144 of file al_SynthRecorder.hpp.


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