sfztools / sfizz

SFZ parser and synth c++ library, providing a JACK standalone client
https://sfz.tools/sfizz/
BSD 2-Clause "Simplified" License
408 stars 56 forks source link

Accept negative numbers for group and off_by #909

Closed kinwie closed 3 years ago

kinwie commented 3 years ago

The specs didn't mention it but negative numbers for group and off_by works in rgc sfz, Cakewalk DropZone, DimPro, Rapture, sforzando and BassMidi.

Example:

<region>
sample=*sine
key=60
group=218
off_by=-218

<region>
sample=*silence
key=62
group=-218
alcomposer commented 3 years ago

After some testing- Sforzando allows text to be entered as well:

<region>
sample=*sine
key=60
group=218
off_by=text

<region>
sample=*silence
key=62
group=text
paulfd commented 3 years ago

It's actually nice to have text. Could we cheat by hashing whatever is given in here? This would probably be too weird for users in case of a collision.

alcomposer commented 3 years ago

Yeah, I don't think there is an issue to use chars. I wonder if there are any other opcodes that have similar behaviour?

My tests so far: Player off_by format
Sforzando Char -> atof() (invalid input = 0.0)
DropZone Signed Integer
alcomposer commented 3 years ago

After more testing- Sforzando does use Char, but as @jpcima suggested in PM, atof().

This example switches off each C independently:

<region>
sample=*sine
key=60
group=20
off_by=1
<region>
sample=*silence
key=62
group=1

<region>
sample=*saw
key=48
group=10
off_by=2
<region>
sample=*silence
key=50
group=2 

While in this example- both C's get switched off by either D:

<region>
sample=*sine
key=60
group= 218
off_by=hello_world   //atof() makes this string 0.0
<region>
sample=*silence
key=62
group=hello_world   //atof() makes this string 0.0

<region>
sample=*saw
key=48
group= 200
off_by=hello_world_2   //atof() makes this string 0.0
<region>
sample=*silence
key=50
group=hello_world_2   //atof() makes this string 0.0