예제 #1
0
 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);
     }
 }
예제 #2
0
파일: Voice.cs 프로젝트: YJh2046/BlockFun
 public Voice(StreamSynthesizer synth, Instrument inst)
 {
     resetVoice();
     this.synth = synth;
     setInstrument(inst);
 }
예제 #3
0
파일: Voice.cs 프로젝트: YJh2046/BlockFun
 public void setInstrument(Instrument inst)
 {
     if (this.inst != inst)
         this.inst = inst;
 }
예제 #4
0
파일: Voice.cs 프로젝트: YJh2046/BlockFun
 //--Public Methods
 public Voice(StreamSynthesizer synth)
 {
     resetVoice();
     this.synth = synth;
     this.inst = null;
 }