Пример #1
0
	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();
		}
	}
Пример #2
0
	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 );
	}
Пример #3
0
	Envelope::Envelope( IO::File &file ) {
		u8 FLG = file.Read8();
		Enabled = !!(FLG & 1);
		Loop = !!(FLG & 2);
		Sustain = !!(FLG & 4);
		IsFilter = !!(FLG & 128);

		Length = file.Read8();
		
		LoopStart = file.Read8();
		LoopEnd = file.Read8();
		
		SustainStart = file.Read8();
		SustainEnd = file.Read8();

		for( int i = 0; i < 25; i++ ) {
			Nodes[i].y = file.Read8();
			Nodes[i].x = file.Read16();
		}
	}
Пример #4
0
	void Sample::LoadData( IO::File &file ) {
		if( !Compressed ) {

			// subtract offset for unsigned samples
			int offset = (Convert&1) ? 0 : (Data.Bits16 ? -32768 : -128);

			// signed samples
			if( Data.Bits16 ) {
				Data.Data16 = new s16[ Data.Length ];
				for( int i = 0; i < Data.Length; i++ ) {
					Data.Data16[i] = file.Read16() + offset;
				}
			} else {
				Data.Data8 = new s8[ Data.Length ];
				for( int i = 0; i < Data.Length; i++ ) {
					Data.Data8[i] = file.Read8() + offset;
				}
			}
		} else {
			// TODO : accept compressed samples.
		}
	}