Hi again, I have another question related to what you explained previously:
Every channel has a parent channel field (which is just 0 for master channels). The other way around you just have to walk through all virtual channels to find all of them belonging to a specific master channel.
So I guess each channel (let's say you have a maximum of 256) can be of the logical or virtual variant? Also, you would keep a table that translate a maximum of 64 logical channels to one of the virtual channels (in the 0..255 range)? So that you know which channel should have its state changed from logical to virtual when a new note event happens for that logical channel?
Example. Situation:
- We are processing logical (master) channel #1
- NNA is set to "Continue" for the selected instrument
- Note is already playing in virtual channel #5, which is known by logical channel #1 as its primary (master) channel
- New note event happens
---> Mixer sets "channel-is-virtual" flag for channel #5 (was not set before as it was a master channel)
---> Mixer looks for a free virtual channel, finds inactive virtual channel #23
---> Mixer plays note in virtual channel #23. Channel #23 is now the new master channel for logical channel #1
---> Player is now updated with the information: "the master mixer channel for logical channel #1 is now virtual channel #23"
I'm not sure how you would keep control over each channel otherwise while processing effects (vibrato, volume change etc).
Or is it just so that, if a channel is a master channel, it takes all its info from the logical channel it is derived from (volume, frequency, etc, new note flag / retrig flag...), whereas a virtual channel only takes it own data into account (envelope positions, source instrument, current volume, panning, index in sample data and so on)?
I'm used to logical channels "being in charge". Meaning there is a 1:1 relation between each logical and virtual channel (Like an .IT in sample mode).
It is my impression that in the instrument based .IT system you first update a pattern row, set all kinds of flags (new note event, retrig sample event, etc) and then go through all channels, virtual or not, and update them based on this information. Is that accurate?