Page 1 of 1

Adding extra data to the bmx

Posted: Wed Feb 01, 2017 2:48 pm
by chahur
Hello !

I'm looking for a way to add some extra data to a song.
The data should be available from every instance of PatternXP, that is why I don't want to save the data as a part of the machine.

The only solution I can think of is to create another machine, a dummy one, to act as a server of this extra data.
But it seems a lot of work ...

If anyone have a very clever idea for my problem, that would be great :-)

Re: Adding extra data to the bmx

Posted: Wed Feb 01, 2017 9:57 pm
by UNZ
use an atomic global boolean to check in every save() callback if the data was already written.
for loading do something similar. the instance that actually holds the data fills the shared data.

should work, unless someone has a better idea.

Re: Adding extra data to the bmx

Posted: Thu Feb 02, 2017 11:16 am
by chahur
UNZ wrote:use an atomic global boolean to check in every save() callback if the data was already written.
for loading do something similar. the instance that actually holds the data fills the shared data.

should work, unless someone has a better idea.
That could be. I thought about that, but if this instance is removed, I have to send the data to another.
That's probably not impossible.

I had also the idea to use the "Info View" to save the data, I don't know if a lot of people use it ?

Re: Adding extra data to the bmx

Posted: Fri Feb 03, 2017 11:25 pm
by UNZ
remember that there is only one instance of "data". so since the data would be shared (either global or static inside your class) you dont really have to "send the data to another", instead whatever instance gets to save first just does the real save and the others dont save anything. the pointer to the data is the same in every instance.

Re: Adding extra data to the bmx

Posted: Mon Feb 06, 2017 11:11 am
by chahur
UNZ wrote:remember that there is only one instance of "data". so since the data would be shared (either global or static inside your class) you dont really have to "send the data to another", instead whatever instance gets to save first just does the real save and the others dont save anything. the pointer to the data is the same in every instance.
You are right, that's what I'll do, thanks