public void addInstrument(Instrument inst, bool isDrum) { if (isDrum == false) { if (Bank.Contains(inst) == false) { //Resample if necessary if (SampleRate_ > 0) inst.enforceSampleRate(SampleRate_); if (inst.SampleList != null) { for (int x = 0; x < inst.SampleList.Length; x++) {//If the instrument contains any new samples get their memory use and add them. if (SampleName.Contains(inst.SampleList[x].Name) == false) { SampleMemUse = SampleMemUse + inst.SampleList[x].getMemoryUseage(); SampleName.Add(inst.SampleList[x].Name); Samples.Add(inst.SampleList[x]); } } } } Bank.Add(inst); } else { if (DrumBank.Contains(inst) == false) { //Resample if necessary if (SampleRate_ > 0) inst.enforceSampleRate(SampleRate_); if (inst.SampleList != null) { for (int x = 0; x < inst.SampleList.Length; x++) { SampleMemUse = SampleMemUse + inst.SampleList[x].getMemoryUseage(); if (SampleName.Contains(inst.SampleList[x].Name) == false) { SampleName.Add(inst.SampleList[x].Name); Samples.Add(inst.SampleList[x]); } } } } DrumBank.Add(inst); } }
public Voice(StreamSynthesizer synth, Instrument inst) { resetVoice(); this.synth = synth; setInstrument(inst); }
public void setInstrument(Instrument inst) { if (this.inst != inst) this.inst = inst; }
//--Public Methods public Voice(StreamSynthesizer synth) { resetVoice(); this.synth = synth; this.inst = null; }