Пример #1
0
        /*
         * hexter_instance_handle_monophonic
         */
        public void hexter_instance_handle_monophonic(string value)
        {
            int mode = -1;

            if (value == "on")
            {
                mode = Constants.DSSP_MONO_MODE_ON;
            }
            else if (value == "once")
            {
                mode = Constants.DSSP_MONO_MODE_ONCE;
            }
            else if (value == "both")
            {
                mode = Constants.DSSP_MONO_MODE_BOTH;
            }
            else if (value == "off")
            {
                mode = Constants.DSSP_MONO_MODE_OFF;
            }

            if (mode == -1)
            {
                throw new Exception("Error: monophonic value not recognized");
            }

            if (mode == Constants.DSSP_MONO_MODE_OFF)
            {  /* polyphonic mode */
                this.monophonic = 0;
                this.max_voices = this.polyphony;
            }
            else
            {  /* one of the monophonic modes */
                if (!(this.monophonic != 0))
                {
                    //dssp_voicelist_mutex_lock();

                    hexter_instance_all_voices_off();
                    this.max_voices = 1;
                    this.mono_voice = null;
                    hexter_instance_clear_held_keys();
                    //dssp_voicelist_mutex_unlock();
                }
                this.monophonic = mode;
            }
        }
Пример #2
0
        /*
         * hexter_instance_note_on
         */
        public void hexter_instance_note_on(byte key,
                                            byte velocity)
        {
            dx7_voice voice;

            if (key > 127 || velocity > 127)
            {
                return;  /* MidiKeys 1.6b3 sends bad notes.... */
            }
            if (this.monophonic != 0)
            {
                if (this.mono_voice != null)
                {
                    voice = this.mono_voice;
                    //DEBUG_MESSAGE(DB_NOTE, " hexter_instance_note_on: retriggering mono voice on new key %d\n", key);
                }
                else
                {
                    voice = hexter_synth_alloc_voice(key);
                    if (voice == null)
                    {
                        return;
                    }
                    this.mono_voice = voice;
                }
            }
            else
            { /* polyphonic mode */
                voice = hexter_synth_alloc_voice(key);
                if (voice == null)
                {
                    return;
                }
            }

            voice.instance = this;
            voice.note_id  = hexter_synth.Instance.note_id++;

            voice.dx7_voice_note_on(this, key, velocity);
        }