billthefarmer / mididriver

Android midi driver using Sonivox EAS library
176 stars 52 forks source link

App close at initialize a new fragment with midi #42

Closed fernandoavf7 closed 3 years ago

fernandoavf7 commented 3 years ago

If I use midiDriver only in one fragment all works fine, but if I add another midi driver in a new fragment app crash and close inmediately, only give this error message:

A/libc: Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0xb4 in tid 25002 (AudioTrack), pid 24942

test devices: Emulator Pixel 2 api 28, phisical device Galaxy note 8

billthefarmer commented 3 years ago

Although the synthesizer itself can handle concurrency, I didn't design this wrapper to handle multiple instances. That would require a redesign of the API to use handles. Use one instance per app, start it and stop it in an Activity and use the instance in the fragments. Or use a static singleton.

billthefarmer commented 3 years ago

I have updated the driver so it is not possible to have more than one instance of the driver in an app and added getInstance() methods. This is a change to the API, the constructor is now private.