public MidiEventControlChange(int aDelta, byte aState, AByteArray aByteArray) : base(aDelta, aState, aByteArray.ReadByte(), aByteArray.ReadByte()) { if (data1 == 0) { data = ( UInt16 )(data2 << 8); } else if (data1 == 32) { data |= ( UInt16 )data2; } }
public MidiEventKeyPressure(int aDelta, byte aState, AByteArray aByteArray) : base(aDelta, aState, 0, 0) { int length = aByteArray.ReadByte(); aByteArray.AddPosition(length); }
public MetaEventPort(int aDelta, byte aType, AByteArray byteArray) : base(aDelta, aType) { int length = byteArray.ReadByte(); byteArray.AddPosition(length); }
private void ReadChunk(AByteArray aByteArray) { string lId = aByteArray.ReadString(4); UInt32 lSize = aByteArray.ReadUInt32(); int lPositionStart = aByteArray.Position; // Check Padding. if (lSize % 2 == 1) { if (lPositionStart + lSize <= aByteArray.Length && aByteArray.ReadByte(( int )(lPositionStart + lSize)) == 0x00) { lSize++; Logger.Debug("Padding:" + lSize); } else { Logger.Debug("No Padding:" + lSize); } aByteArray.SetPosition(lPositionStart); } FormChunk lRiffWave = Construct(lId, lSize, aByteArray, this); chunkList.Add(lRiffWave); if (aByteArray.Position != lPositionStart + lSize) { Logger.Debug("Modify Position:" + aByteArray.Position + "->" + (lPositionStart + lSize)); aByteArray.SetPosition(( int )(lPositionStart + lSize)); } }
public KeySignature(int aDelta, byte aType, AByteArray byteArray) : base(aDelta, aType) { int length = byteArray.ReadByte(); byteArray.AddPosition(length); }
public ShdrData(AByteArray aByteArray, List <string> aInformationList) { sampleName = aByteArray.ReadString(20); start = aByteArray.ReadUInt32(); end = aByteArray.ReadUInt32(); startLoop = aByteArray.ReadUInt32(); endLoop = aByteArray.ReadUInt32(); sampleRate = aByteArray.ReadUInt32(); originalPitch = aByteArray.ReadByte(); pitchCorrection = aByteArray.ReadSByte(); sampleLink = aByteArray.ReadUInt16(); sampleType = ( SampleType )aByteArray.ReadUInt16(); aInformationList.Add("Sample Name:" + sampleName); aInformationList.Add("Start:" + start); aInformationList.Add("End:" + end); aInformationList.Add("Start Loop:" + startLoop); aInformationList.Add("End Loop:" + endLoop); aInformationList.Add("Sample Rate:" + sampleRate); aInformationList.Add("Original Pitch:" + originalPitch); aInformationList.Add("Pitch Correction:" + pitchCorrection); aInformationList.Add("Sample Link:" + sampleLink); aInformationList.Add("Sample Type:" + sampleType); if (sampleType != SampleType.monoSample) { Logger.Warning(sampleName + "/" + "Not Mono Sample:" + sampleType); } }
// 可変長バイトを取得する. public static int GetVariableLengthByte(AByteArray aByteArray) { byte temp = aByteArray.ReadByte(); int length = ( int )(temp & 0x7F); // 最上位ビットが1であれば読み込みを続ける. while ((temp & 0x80) == 0x80) { temp = aByteArray.ReadByte(); length <<= 7; length |= ( int )(temp & 0x7F); } return(length); }
public RiffWaveInst(string aId, UInt32 aSize, AByteArray aByteArray, RiffChunkList aParent) : base(aId, aSize, aByteArray, aParent) { unshiftedNote = aByteArray.ReadByte(); fineTune = aByteArray.ReadSByte(); gain = aByteArray.ReadSByte(); lowNote = aByteArray.ReadByte(); highNote = aByteArray.ReadByte(); lowVelocity = aByteArray.ReadByte(); highVelocity = aByteArray.ReadByte(); informationList.Add(" Unshifted Note:" + unshiftedNote); informationList.Add(" Fine Tune:" + fineTune); informationList.Add(" Gain:" + gain); informationList.Add(" Low Note:" + lowNote); informationList.Add(" High Note:" + highNote); informationList.Add(" Low Velocity:" + lowVelocity); informationList.Add(" High Velocity:" + highVelocity); }
public MetaEventTempo(int aDelta, byte aType, AByteArray byteArray) : base(aDelta, aType) { int length = byteArray.ReadByte(); if (length == 3) { byte data1 = byteArray.ReadByte(); byte data2 = byteArray.ReadByte(); byte data3 = byteArray.ReadByte(); tempo = (( int )data1 << 16) | (( int )data2 << 8) | data3; } else { byteArray.AddPosition(3); Logger.Exception(new Exception()); } }
public MidiEventSystemExclusive(int aDelta, byte aState, AByteArray aByteArray) : base(aDelta, aState, 0, 0) { length = MtrkChunk.GetVariableLengthByte(aByteArray); dataArray = new byte[length]; for (int i = 0; i < length; i++) { dataArray[i] = aByteArray.ReadByte(); } }
private Byte bb; // 32分レベルビートサブディビジョンの状況、⇒4分音符1個の内部にある32分音符の個数 public MetaEventTimeSignature(int aDelta, Byte aType, AByteArray byteArray) : base(aDelta, aType) { int length = byteArray.ReadByte(); if (length == 4) { nn = byteArray.ReadByte(); Byte shift = byteArray.ReadByte(); cc = byteArray.ReadByte(); bb = byteArray.ReadByte(); for (int i = 0; i < shift; i++) { dd *= 2; } } else { byteArray.AddPosition(3); Logger.Exception(new Exception()); } }
// トラックのイベントを読み込む. private void ReadTrack(AByteArray aByteArray) { int lDelta = 0; byte lStatePre = 0; int lPositionPre = aByteArray.Position; // トラック終了まで読み込む. while (aByteArray.Position < lPositionPre + size) { lDelta += GetVariableLengthByte(aByteArray); byte lState = aByteArray.ReadByte(); // ランニングステータス対応. if (lState < 0x80) { lState = lStatePre; aByteArray.SubPosition(1); } lStatePre = lState; if (lState != 0xFF) { // MIDIイベント読み込み. MidiEventBase lMidiEvent = MidiEventReader.Execute(lDelta, lState, aByteArray); midiEventList.Add(lMidiEvent); } else { // メタイベント読み込み. MetaEventBase lMetaEvent = MetaEventReader.Execute(lDelta, aByteArray); metaEventList.Add(lMetaEvent); } } }
public MidiEventProgramChange(int aDelta, byte aState, AByteArray aByteArray) : base(aDelta, aState, aByteArray.ReadByte(), 0) { }
public static MetaEventBase Execute(int aDelta, AByteArray aByteArray) { MetaEventBase lMetaEvent; byte lType = aByteArray.ReadByte(); switch (lType) { case 0x01: // Text. lMetaEvent = new MetaEventText(aDelta, lType, aByteArray); break; case 0x02: // Copyright Notice. lMetaEvent = new MetaEventText(aDelta, lType, aByteArray); break; case 0x03: // Sequense/Track Name. lMetaEvent = new MetaEventText(aDelta, lType, aByteArray); break; case 0x04: // Instrument Name. lMetaEvent = new MetaEventText(aDelta, lType, aByteArray); break; case 0x05: // Lylics. lMetaEvent = new MetaEventText(aDelta, lType, aByteArray); break; case 0x06: // Marker. lMetaEvent = new MetaEventText(aDelta, lType, aByteArray); break; case 0x07: // Queue Point. lMetaEvent = new MetaEventText(aDelta, lType, aByteArray); break; case 0x20: lMetaEvent = new MetaEventChannel(aDelta, lType, aByteArray); break; case 0x21: lMetaEvent = new MetaEventPort(aDelta, lType, aByteArray); break; case 0x2F: lMetaEvent = new MetaEventTrackEnd(aDelta, lType, aByteArray); break; case 0x51: lMetaEvent = new MetaEventTempo(aDelta, lType, aByteArray); break; case 0x54: lMetaEvent = new MetaEventSmpteOffset(aDelta, lType, aByteArray); break; case 0x58: lMetaEvent = new MetaEventTimeSignature(aDelta, lType, aByteArray); break; case 0x59: lMetaEvent = new KeySignature(aDelta, lType, aByteArray); break; case 0x7F: // Sequencer Meta Event. lMetaEvent = new MetaEventText(aDelta, lType, aByteArray); break; default: // �����`�̃��^�C�x���g���b�Z�[�W. Logger.Error("Undefined Meta Event"); throw new Exception(); } return(lMetaEvent); }
public Generator(AByteArray aByteArray) { byte1 = aByteArray.ReadByte(); byte2 = aByteArray.ReadByte(); }
public MidiEventPitchWheelChange(int aDelta, byte aState, AByteArray aByteArray) : base(aDelta, aState, aByteArray.ReadByte(), aByteArray.ReadByte()) { }
public MidiEventNoteOn(int aDelta, byte aState, AByteArray aByteArray) : base(aDelta, aState, aByteArray.ReadByte(), aByteArray.ReadByte()) { }
public MidiEventChannelPressure(int aDelta, byte aState, AByteArray aByteArray) : base(aDelta, aState, aByteArray.ReadByte(), 0) { }