igorski / MWEngine

Audio engine and DSP library for Android, written in C++ providing low latency performance within a musical context, while providing a Java/Kotlin API. Supports both OpenSL and AAudio.
MIT License
257 stars 45 forks source link

Different behavior on shared methods (SynthEvent/SampleEvent) #146

Closed vustav closed 2 years ago

vustav commented 2 years ago

event.positionEvent(pos) works as intended on SampleEvents but on SynthEvents they play at full steps, ex. a SynthEvent set to play at 3 1/4 will play at 3 etc.

vustav commented 2 years ago

Noticed now that after using synthEvent.setEventStart(posInSamples) they will play at the right position one time, then settling at the nearest full step before. This means I can get around this by updating positions every time the sequencer is at 0.

Still strange and as I said it works fine on SampleEvents so I don't think I'm using it the wrong way.

igorski commented 2 years ago

Hi @vustav thanks for pointing this out, looks like a bug in the synthesis routine and has indeed to do with first time playback. Will address this shortly.

igorski commented 2 years ago

This has been addressed in f592455cb26921d952abb737094f28f75102a9cf

Can you verify whether this addresses the issue in the context of your application ? If all is correct, you no longer need to update the event positions whenever the sequencer reaches the zero offset any longer. Additionally, if you were using BaseSynthEvent.invalidateProperties() before, there is no need to do so any longer as the engine handles this internally. If you were using that method to reposition the event, you can use the setPosition|setEventStart-methods from the (Base)AudioEvent API instead.

vustav commented 2 years ago

Works perfect now!

igorski commented 2 years ago

Excellent! Thanks so much for pointing out the issue.