Welcome to %s forums

BrainModular Users Forum

Login Register

onGetChunkLen called twice

Create your own modules in C++
Post Reply
sm_jamieson
Member
Posts: 551
Contact:

Unread post by sm_jamieson » 09 Sep 2018, 17:39

I put some debug in the Chunk routines, as follows

on Module load
onGetChunkLen called, is_preset = 0, size calculated as 604
onGetChunkLen called, is_preset = 0, size calculated as 604
onSetChunk called (loading), size 612, is_preset = 0

on Module save
onGetChunkLen called, is_preset = -1, size calculated as 620
onGetChunk called (saving), is_preset = 1
onGetChunkLen called, is_preset = 0, size calculated as 620
onGetChunk called (saving), is_preset = 0

on Preset load
onGetChunkLen called, is_preset = -1, size calculated as 612
onGetChunkLen called, is_preset = 1, size calculated as 612
onSetChunk called (loading), size 620, is_preset = 1

onPreset save
onGetChunkLen called, is_preset = -1, size calculated as 620
onGetChunk called (saving), is_preset = 1

OK, got to go, I'll expand on this later !

sm_jamieson
Member
Posts: 551
Contact:

Unread post by sm_jamieson » 09 Sep 2018, 23:10

There appears to be the following issues:

Preset value of -1:
It is clear that the Preset -1 value is supposed to be a true value, but surely this is a bug, as if it is compared to the LongBool TRUE value then the check will fail. If it is checked using the C "if (value)" syntax of course it will be OK, as in C any non-zero value is "true".

onGetChunkLen called twice when a patch or preset is being recalled:
I don't know why if should be called at all when something is being loaded. However, this might be the type of routine that Usine may call whenever it wants (like the onPaint routines, etc).

The reason onGetChunkLen being called when it is not required is a pain in my modules is that I have a dynamically created data to be stored, so I have to create the data in the OnGetChunkLen in order to know what the length will be, which uses up some processing power, so I don't want to do this unnecessarily.

Anyway, I just thought I'd point this out in case it catches anyone out. But I'll probably raise the -1 as a bug.

Simon.

Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests