public MidiMessage(MidiMessage messageToCopy) { this.handle = messageToCopy.handle; this.msg = messageToCopy.msg; this.instance = messageToCopy.instance; this.param1 = messageToCopy.param1; this.param2 = messageToCopy.param2; //Logger.Instance.Log(this.ToString()); }
public virtual object Clone(MidiMessage msg) { // SoundRender sr = (SoundRender) this.MemberwiseClone(); // DOES NOT WORK because of shared references Type type = this.GetType(); SoundRender sr = (SoundRender) type.GetConstructor(new Type[0]).Invoke(new object[0]); for(int i=0; i<sr.SoundInputs.Length; i++) { sr.SoundInputs[i] = (ISoundRender) SoundInputs[i].Clone(msg); } return sr; }
public override object Clone(MidiMessage msg) { AdsrSoundRender asr = new AdsrSoundRender(); asr.SoundInputs[0] = (ISoundRender) this.SoundInputs[0].Clone(msg); asr.PreDelay = PreDelay; asr.Attack = Attack; asr.Decay = Decay; asr.Sustain = Sustain; asr.Release = Release; asr.Velocity = ((msg.Velocity + (float)rand.NextDouble()) / 128.0f) * Velocity; asr.Pan = (float) (Pan + ((msg.Frequency - 1000.0)/13000.0) * 0.3 + ((rand.NextDouble()-0.5)*0.1)); return asr; }
public override object Clone(MidiMessage msg) { WaveSoundRender wsr = (WaveSoundRender) base.Clone(msg); wsr.Frequency = msg.Frequency; wsr.OctaveScaling = OctaveScaling; wsr.toneScaling = ToneScaling; wsr.FrequencyScaling = FrequencyScaling; return wsr; }
public void OnMidiMessage(MidiMessage msg) { if (msg.Frequency > 0) { this.freq = NoteToScaledFrequency(msg.Note); } }
public override object Clone(MidiMessage msg) { return this; // No need to clone a NullSoundRender, we can use the same instance. }