ModPlug Central

OpenMPT => Development Corner => Topic started by: bass on March 11, 2016, 21:27:23

Title: virtual channels
Post by: bass on March 11, 2016, 21:27:23
Hi, my hobby project developing a mod player is still going on, when I have some time  :)
I saw the NNAs of the IT format and I wonder if I should use a new virtual channel every time when a new note is played whether there is a nna or not.
is this clever?  ???
What about sliding notes or other effects which need the old note values then? Copy the current channel data to the new channel data every time?
I could use these virtual channels for declicking also when I fade them fast out, right?
I just need some thoughts about this. Does this make things too complicated again?
Title: Re: virtual channels
Post by: Saga Musix on March 12, 2016, 01:25:44
Well, you certainly need to keep a channel structure for the past channels just like for regular channels. OpenMPT just has a huge (well, 256 entries) array of channel structures, the first N channels are always for regular channels, and if a channel needs to go virtual, a free channel from the remaining 256 - N channel structs is selected and the original data is copied over.
OpenMPT essentially uses virtual channels for anti-click as you describe it, but anything like that is probably not the best solution because, well, the channel keeps playing for longer than it should, which can lead to bleeding notes.
Keep in mind that your channel structures should always be pre-allocated (so you need a maximum number of allowed virtual channels), because allocating memory during mix time is always a bad idea if you want realtime playback.
Title: Re: virtual channels
Post by: bass on March 13, 2016, 12:41:22
OK, thank you. I want to try a solution with a virtual channel manager and a virtual channel for each note. Of course, I would allocate all virtual channels frst. It's a just for fun project 8)