예제 #1
0
파일: Sf2Synth.cs 프로젝트: DotLab/Midif
        public Sf2Synth(Sf2File file, Table table, int voiceCount)
        {
            this.file  = file;
            this.table = table;

            masterGain = 1;

            this.voiceCount = voiceCount;
            voices          = new Voice[voiceCount];
            for (int i = 0; i < voiceCount; i += 1)
            {
                voices[i].Init(i, file.data, table);
            }

                        #if MIDIF_DEBUG_VISUALIZER
            WaveVisualizer.Request(0, 1024);
            WaveVisualizer.Request(1, 1024);
            WaveVisualizer.Request(2, 1024);
            WaveVisualizer.Request(3, 1024);
            WaveVisualizer.Request(4, 1024);
            WaveVisualizer.Request(5, 1024);
                        #endif

            Reset();
        }
예제 #2
0
파일: MidiSynth.cs 프로젝트: DotLab/Midif
        public MidiSynth(Table table, float sampleRate, int voiceCount)
        {
                        #if MIDIF_DEBUG_VISUALIZER
            WaveVisualizer.Request(0, 1024);
                        #endif

            this.table = table;

            this.sampleRate = sampleRate;
            sampleRateRecip = 1f / sampleRate;

            masterGain = 1;

            envelopeConfig = new EnvelopeConfig(table, 120, .01f, 60, .1f, 100, .5f, 0, .01f);

            this.voiceCount = voiceCount;
            voices          = new Voice[voiceCount];
            for (int i = 0; i < voiceCount; i += 1)
            {
                voices[i].envelope = new Envelope(envelopeConfig);
            }

            Reset();
        }