http://github.com/dahnielson/libsfz/tree/master
The only thing that I'm happy with is the parsing of opcodes in the SFZ definition file (the File class). One big flaw in my first attempt was the lack of statelessness. I'm also making it a read-only implementation, as SFZ definition files can easily be authored in a text editor or generated by a simple script for batch processing.
My idea for the API so far...
Parse the SFZ definition file:
Code: Select all
std::ifstream SfzStream("instrument.sfz");
sfz::File pFile = sfz::File(SfzStream);
Code: Select all
sfz::Instrument* pInstrument = pFile->GetInstrument();
Code: Select all
pRegion->OnKey(chan, key, vel, bend, bpm, chanaft, polyaft, prog, rand, trig, cc, timer, seq, sw, last_sw_key, prev_sw_key);
Code: Select all
pRegion->OnControl(chan, cont, val, bend, bpm, chanaft, polyaft, prog, rand, trig, cc, timer, seq, sw, last_sw_key, prev_sw_key);
Get an articulation for the current state:
Code: Select all
sfz::Articulation* pArticulation = pRegion->GetArticulation(bend, bpm, chanaft, polyaft, cc);
Work in progress...