예제 #1
0
파일: MidiSynth.cs 프로젝트: DotLab/Midif
            public Envelope(EnvelopeConfig config)
            {
                this.config = config;

                isOff      = false;
                isFinished = false;

                stage          = 0;
                time           = 0;
                duration       = 0;
                gainsPerSecond = 0;
                gain           = 0;
            }
예제 #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();
        }