// Token: 0x060032AE RID: 12974 RVA: 0x00147B04 File Offset: 0x00145D04 protected sealed override MidiEvent CloneEvent() { ChannelEvent channelEvent = (ChannelEvent)Activator.CreateInstance(base.GetType()); channelEvent.Channel = this.Channel; Array.Copy(this._parameters, channelEvent._parameters, this._parameters.Length); return(channelEvent); }
// Token: 0x06003252 RID: 12882 RVA: 0x00147588 File Offset: 0x00145788 public IEnumerable <MidiChunk> Convert(IEnumerable <MidiChunk> chunks) { TrackChunk[] array = chunks.OfType <TrackChunk>().ToArray <TrackChunk>(); if (array.Length != 1) { return(chunks); } MultiTrackChunksConverter.TrackChunkDescriptor[] array2 = (from i in Enumerable.Range(0, 17) select new MultiTrackChunksConverter.TrackChunkDescriptor()).ToArray <MultiTrackChunksConverter.TrackChunkDescriptor>(); FourBitNumber?fourBitNumber = null; using (IEnumerator <MidiEvent> enumerator = (from m in array.First <TrackChunk>().Events select m.Clone()).GetEnumerator()) { while (enumerator.MoveNext()) { MidiEvent midiEvent = enumerator.Current; Array.ForEach <MultiTrackChunksConverter.TrackChunkDescriptor>(array2, delegate(MultiTrackChunksConverter.TrackChunkDescriptor d) { d.DeltaTime += midiEvent.DeltaTime; }); ChannelEvent channelEvent = midiEvent as ChannelEvent; if (channelEvent != null) { array2[(int)(channelEvent.Channel + 1)].AddEvent(midiEvent.Clone()); fourBitNumber = null; } else { if (!(midiEvent is MetaEvent)) { fourBitNumber = null; } ChannelPrefixEvent channelPrefixEvent = midiEvent as ChannelPrefixEvent; if (channelPrefixEvent != null) { fourBitNumber = new FourBitNumber?((FourBitNumber)channelPrefixEvent.Channel); } if (fourBitNumber != null) { array2[(int)(fourBitNumber.Value + 1)].AddEvent(midiEvent); } else { array2[0].AddEvent(midiEvent); } } } } return((from d in array2 select d.Chunk into c where c.Events.Any <MidiEvent>() select c).Concat(from c in chunks where !(c is TrackChunk) select c)); }
/// <summary> /// Determines whether the specified event is equal to the current one. /// </summary> /// <param name="channelEvent">The event to compare with the current one.</param> /// <param name="respectDeltaTime">If true the <see cref="MidiEvent.DeltaTime"/> will be taken into an account /// while comparing events; if false - delta-times will be ignored.</param> /// <returns>true if the specified event is equal to the current one; otherwise, false.</returns> public bool Equals(ChannelEvent channelEvent, bool respectDeltaTime) { if (ReferenceEquals(null, channelEvent)) { return(false); } if (ReferenceEquals(this, channelEvent)) { return(true); } return(base.Equals(channelEvent, respectDeltaTime) && _parameters.SequenceEqual(channelEvent._parameters)); }
// Token: 0x0600339D RID: 13213 RVA: 0x001481BC File Offset: 0x001463BC public MidiEvent Read(MidiReader reader, ReadingSettings settings, byte currentStatusByte) { FourBitNumber head = currentStatusByte.GetHead(); FourBitNumber tail = currentStatusByte.GetTail(); string typeName; if (!StandardEventTypes.Channel.TryGetType(head, out typeName)) { throw new UnknownChannelEventException(head, tail); } ChannelEvent @event = this.GetEvent(typeName); @event.Read(reader, settings, -1); @event.Channel = tail; return(@event); }
/// <summary> /// Determines whether the specified event is equal to the current one. /// </summary> /// <param name="channelEvent">The event to compare with the current one.</param> /// <returns>true if the specified event is equal to the current one; otherwise, false.</returns> public bool Equals(ChannelEvent channelEvent) { return(Equals(channelEvent, true)); }