Pattern::Pattern( IO::File &file ) { DataLength = file.Read16(); Rows = file.Read16(); file.Skip( 4 ); // reserved Data = new u8[ DataLength ]; for( int i = 0; i < DataLength; i++ ) { Data[i] = file.Read8(); } }
Sample::Sample( IO::File &file ) { file.Skip(4); // IMPS DOSFilename[12] = 0; for( int i = 0; i < 12; i++ ) DOSFilename[i] = file.Read8(); file.Skip(1); // 00h GlobalVolume = file.Read8(); u8 Flags = file.Read8(); HasSample = !!(Flags & 1); Data.Bits16 = !!(Flags & 2); Stereo = !!(Flags & 4); Compressed = !!(Flags & 8); Data.Loop = !!(Flags & 16); Data.Sustain = !!(Flags & 32); Data.BidiLoop = !!(Flags & 64); Data.BidiSustain = !!(Flags & 128); DefaultVolume = file.Read8(); Name[26] = 0; for( int i = 0; i < 26; i++ ) Name[i] = file.Read8(); Convert = file.Read8(); DefaultPanning = file.Read8(); Data.Length = file.Read32(); Data.LoopStart = file.Read32(); Data.LoopEnd = file.Read32(); Data.C5Speed = file.Read32(); Data.SustainStart = file.Read32(); Data.SustainEnd = file.Read32(); u32 SamplePointer = file.Read32(); VibratoSpeed = file.Read8(); VibratoDepth = file.Read8(); VibratoRate = file.Read8(); VibratoForm = file.Read8(); file.Seek( SamplePointer ); LoadData( file ); }
Instrument::Instrument( IO::File &file ) { file.Skip(4); // IMPI DOSFilename[12] = 0; for( int i = 0; i < 12; i++ ) DOSFilename[i] = file.Read8(); file.Skip(1); // 00h NewNoteAction = file.Read8(); DuplicateCheckType = file.Read8(); DuplicateCheckAction = file.Read8(); Fadeout = file.Read16(); PPS = file.Read8(); PPC = file.Read8(); GlobalVolume = file.Read8(); DefaultPan = file.Read8(); RandomVolume = file.Read8(); RandomPanning = file.Read8(); TrackerVersion = file.Read16(); NumberOfSamples = file.Read8(); Name[26] = 0; for( int i = 0; i < 26; i++ ) Name[i] = file.Read8(); InitialFilterCutoff = file.Read8(); InitialFilterResonance = file.Read8(); MidiChannel = file.Read8(); MidiProgram = file.Read8(); MidiBank = file.Read16(); file.Read8(); // reserved for( int i = 0; i < 120; i++ ) { Notemap[i].Note = file.Read8(); Notemap[i].Sample = file.Read8(); } VolumeEnvelope = new Envelope( file ); PanningEnvelope = new Envelope( file ); PitchEnvelope = new Envelope( file ); }