Example #1
0
        public void dx7_pitch_eg_set_phase(hexter_instance instance, int phase)
        {
            this.phase = phase;

            if (phase == 0)
            {
                if (this.level[0] == this.level[1] &&
                    this.level[1] == this.level[2] &&
                    this.level[2] == this.level[3])
                {
                    this.mode  = dx7_eg_mode.DX7_EG_CONSTANT;
                    this.value = Data.dx7_voice_pitch_level_to_shift[this.level[3]];
                }
                else
                {
                    this.mode = dx7_eg_mode.DX7_EG_RUNNING;
                    this.dx7_pitch_eg_set_increment(instance, this.rate[phase], this.level[phase]);
                }
            }
            else
            {
                if (this.mode != dx7_eg_mode.DX7_EG_CONSTANT)
                {
                    this.mode = dx7_eg_mode.DX7_EG_RUNNING;
                    this.dx7_pitch_eg_set_increment(instance, this.rate[phase], this.level[phase]);
                }
            }
        }
Example #2
0
        /*
         * dx7_op_eg_set_next_phase
         *
         * assumes a DX7_EG_RUNNING envelope
         */
        public void dx7_op_eg_set_next_phase(hexter_instance instance)
        {
            switch (this.phase)
            {
            case 0:
            case 1:
                this.phase++;
                dx7_op_eg_set_increment(instance, this.rate[this.phase], this.level[this.phase]);
                if (this.duration == 1 && this.increment == 0)
                {
                    dx7_op_eg_set_next_phase(instance);
                }
                break;

            case 2:
                this.mode      = dx7_eg_mode.DX7_EG_SUSTAINING;
                this.increment = 0;
                this.duration  = -1;
                break;

            case 3:
            default:     /* shouldn't be anything but 0 to 3 */
                this.mode      = dx7_eg_mode.DX7_EG_FINISHED;
                this.increment = 0;
                this.duration  = -1;
                break;
            }
        }
Example #3
0
        /*
         * dx7_pitch_eg_set_next_phase
         *
         * assumes a DX7_EG_RUNNING envelope
         */
        public void dx7_pitch_eg_set_next_phase(hexter_instance instance)
        {
            switch (this.phase)
            {
            case 0:
            case 1:
                this.phase++;
                dx7_pitch_eg_set_increment(instance, this.rate[this.phase],
                                           this.level[this.phase]);
                break;

            case 2:
                this.mode = dx7_eg_mode.DX7_EG_SUSTAINING;
                break;

            case 3:
            default:     /* shouldn't be anything but 0 to 3 */
                this.mode = dx7_eg_mode.DX7_EG_FINISHED;
                break;
            }
        }
Example #4
0
        public void dx7_op_eg_set_phase(hexter_instance instance, int phase)
        {
            this.phase = phase;

            if (phase == 0)
            {
                if (this.level[0] == this.level[1] &&
                    this.level[1] == this.level[2] &&
                    this.level[2] == this.level[3])
                {
                    this.mode      = dx7_eg_mode.DX7_EG_CONSTANT;
                    this.value     = Inline.INT_TO_FP(this.level[3]);
                    this.increment = 0;
                    this.duration  = -1;
                }
                else
                {
                    this.mode = dx7_eg_mode.DX7_EG_RUNNING;
                    this.dx7_op_eg_set_increment(instance, this.rate[phase], this.level[phase]);
                    if (this.duration == 1 && this.increment == 0)
                    {
                        this.dx7_op_eg_set_next_phase(instance);
                    }
                }
            }
            else
            {
                if (this.mode != dx7_eg_mode.DX7_EG_CONSTANT)
                {
                    this.mode = dx7_eg_mode.DX7_EG_RUNNING;
                    this.dx7_op_eg_set_increment(instance, this.rate[phase], this.level[phase]);
                    if (this.duration == 1 && this.increment == 0)
                    {
                        this.dx7_op_eg_set_next_phase(instance);
                    }
                }
            }
        }