Hi.

This is my second approach to handling polyphony. I'm not submitting
it into bugzilla, since I'm not sure if that's the way it should be
resolved. It works for me, but it's not thoroughly tested even for my
needs.

These are my concerns.

1. It can't be implemented in AbstractEngineChannel, because it needs
an access to voice pool, so it's in template EngineChannelBase.

2. It implements self-masking for sfz and gig (not sure how the
sustain pedal issue should be resolved, so I left it intact) and
handles group conflict in a different way (turned on by default only
for sfz). If you want to test it with gig and sf2 (I haven't), just
change the default value of NewAlgorithm to true.

3. It creates an interface for Voice classes to return KeyGroup (or
off_by for sfz with an argument set to true). I don't like this
solution. Maybe it should have two separate functions like
GetKeyGroup, GetOffBy returning same values for gig and sf2 and
different for sfz.

4. [premature optimization alert] It creates a separate Event for each
voice and processGroupEvents iterates over all events. I think the
complexity of this solution is O(n^2). It would be better with one
event containing a std::set of VoiceIDs to check against, but it's not
possible inside Event's union.

5. The function is huge. I don't like it.

6. signed/unsigned mismatch for sfz opcodes
These are declared as int, even though most of them (according to
http://www.sfzformat.com/legacy/) are unsigned with values from 0 to 4
Gb (4294967296), and the "end" opcode can even take values from -1 to
4 Gb. This spec is weird, since 32 bit ULONG_MAX is 4294967295. It's
not such a big deal, but the patch depends on off_by default value to
be -1, since AbstractVoice requires iKeyGroup to be non-zero to
processGroupEvents()

7. My reference sfz engine is ARIA 1.933 with sforzando VST plugin.
Unfortunately it behaves differently with note_polyphony opcode. My
patch releases oldest voices first. ARIA releases most recent ones. I
think it's a bug, not a feature, because if there are two regions
triggered at the same time the first one is suppressed and only the
second one is played. I've attached an example file to reproduce this
ARIA bug (you must provide a Crash.wav file which is long enough to
test polyphony).

I've sent it here to get your opinion, but I suppose I'm not going to
develop my concerns further, only bugfixing.

Attachment: polyphony2.patch
Description: Binary data

Attachment: test.sfz
Description: Binary data

_______________________________________________
Linuxsampler-devel mailing list
Linuxsampler-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxsampler-devel

Reply via email to