CSNG (File Format): Difference between revisions

Jump to navigation Jump to search
imported>Jackoalan
imported>Jackoalan
 
(2 intermediate revisions by the same user not shown)
Line 104: Line 104:
| 0x8
| 0x8
| 2
| 2
| '''Region Data Index'''; used to select region data via the ''region data index''; value is negative on a dummy ''region info'' to terminate track regions
| '''Region Data Index'''; used to select region data when positive; -1 value terminates track; -2 value loops jumps to ''Loop Region Index'' at this region's tick
|-
|-
| 0xA
| 0xA
| 2
| 2
| {{unknown|'''Unknown'''}}
| '''Loop Region Index'''; index of region to jump to if ''Region Data Index'' set to -2
|-
|-
| 0xC
| 0xC
Line 147: Line 147:
in SNG: ''note'', ''control change'', and ''program change''.
in SNG: ''note'', ''control change'', and ''program change''.


=====Delta Time RLE=====
=====Delta Time Encoding=====


Just like MIDI, each command starts with a '''delta time''' value telling the sequencer  
Just like MIDI, each command starts with a '''delta time''' value telling the sequencer  
Line 266: Line 266:
(0x80). The decoder must track the absolute time and value, summing each consecutive update
(0x80). The decoder must track the absolute time and value, summing each consecutive update
for the current time/values.
for the current time/values.
The byte sequence 0x80 0x00 is a special case that signals the end of the stream.


Similar to the command stream, when the delta time exceeds 15 bit range (>32767), extra pairs
Similar to the command stream, when the delta time exceeds 15 bit range (>32767), extra pairs
Line 296: Line 298:
     ret = [0,0]
     ret = [0,0]
     while ret[1] == 0:
     while ret[1] == 0:
        if streamIn.PeekU16() == 0x8000:
            # The stream has ended
            break
         ret[0] += DecodeUnsignedValue(streamIn)
         ret[0] += DecodeUnsignedValue(streamIn)
         ret[1] = DecodeSignedValue(streamIn)
         ret[1] = DecodeSignedValue(streamIn)
Anonymous user

Navigation menu