ModPlug Central

OpenMPT => Development Corner => Topic started by: Really Weird Person on October 20, 2015, 13:32:47

Title: 128-channel Revision
Post by: Really Weird Person on October 20, 2015, 13:32:47
I would like to do some tests with channels, but the revision that I actively use breaks / crashes upon using more than 127 channels. Does anyone know what the last revision to use 128 channels was and if it would allow using more than 128 channels without breaking / crashing? Based on revisions that I looked at, it seems that the 128-channel revisions might have been around the same timeframe as the 255-channel "wild" release (2,004-2,005). If that is the case, then I will be unable to compile those source codes anyway, as they are too old. In that case, I might be out of luck on this one.
Title: Re: 128-channel Revision
Post by: Saga Musix on October 20, 2015, 13:42:35
The IT / MPTM format is technically incapable of storing more than 127 channels. The claim for "up to 255 channels" in ModPlug Wild was untested, any IT files written with more than 127 channels would have had channels 128 to 255 be mapped to channels 1 to 127 - in fact, all channels > 64 were wrapped around in that version. So even if the SVN history went back that far (I think it doesn't), there would be no point in using that revision because it would simply not work at all.
In addition to that, "ModPlug Wild" only supported up to 255 mixing channels, meaning that trying to play a note in the pattern or sample editor would crash the program because no free NNA voice could be allocated (the first n channels of an n-channel module are reserved for non-NNA notes). These days the maximum limit for mixing channels is 256, meaning that you'd get a total of one NNA channel, which is simply not enough. Both MAX_BASECHANNELS and MAX_CHANNELS would have to be increased in this case, but as said, it doesn't matter because the file format doesn't allow for more than 127 channels to be stored anyway.
Title: Re: 128-channel Revision
Post by: Really Weird Person on October 21, 2015, 02:12:42
Thank you for the information regarding the wrapping. I was unaware that the channels did that. I have seen it with row quantities > 65,536 in later revisions, but I was unaware that the channels also exhibited that behavior. I think that you have confirmed that I am at a loss on this one. Upon testing the code, revision 4283 allows viewing patterns with channel quantities up to 384. But, if channels beyond channel 127 are visible, the application crashes.
Title: Re: 128-channel Revision
Post by: Saga Musix on October 21, 2015, 13:22:17
It wouldn't actually crash if you read what I said and adjusted both MAX_BASECHANNELS and MAX_CHANNELS. If you don't adjust them, any channel quantity larger than 127 will of course crash. This has nothing to do with the revision number you tried, if you managed to make an earlier revision not crash without adjusting these two constants, you were just lucky enough that you didn't trigger a page fault. But again, it doesn't matter because the IT / MPTM format is incapable of storing more than 127 channels, and as you observed they also cannot store patterns longer than 65536 rows.
Title: Re: 128-channel Revision
Post by: Really Weird Person on October 22, 2015, 07:50:06
I am sorry about the failure to read that. I will look at that. Thank you for the catching of my error there.
With regard to the pattern rows, I also discovered that the code must have a -100 somewhere with respect to pattern and order quantities. Modules will not load if they contain more than 65,435 (65,535 - 100) patterns.
Title: Re: 128-channel Revision
Post by: Really Weird Person on October 23, 2015, 20:29:42
Modifying those lines worked. Thank you for your help, Saga Musix.
Title: Re: 128-channel Revision
Post by: Saga Musix on October 23, 2015, 20:35:46
And what are you going to do with this now? Design your own file format that can actually make use of it?
Title: Re: 128-channel Revision
Post by: Really Weird Person on October 24, 2015, 18:27:52
The primary purpose was to see how many channels displayed with different screen resolutions. However, I did indeed modify the IT section of the code to accept 1,024 channels. By doing that, I found that: 1) The Impulse Tracker (it) format truncates modules down to 127 channels, but the Impulse Tracker project (itp) format supports all 1,024. I also found that, by making the channel quantity greater than 1,024, module channels wrap around. Utilizing all 1,024 channels won't be a small task. I found a way to do it, however, I was informed that "ITP projects need to have a path set for each instrument..." upon attempting to save a module in preparation for completing it. As a result, the file was not written to the disk. I assume that the message indicates that the module's instruments must be loaded from files on the local disk. If that is the case, that isn't a big deal. Although, I don't remember seeing that behavior with other formats that exhibit that behavior, making it peculiar. Thus far, I have a single module that utilizes 666 channels. It took a long time to adjust the panning on those. 😊
Title: Re: 128-channel Revision
Post by: phanoo on September 17, 2016, 10:02:29
I'm curious, why do you need so many channels ? I mostly never use more than 25 "real" channels end not exceed 50 virtual channels while playing.