Пример #1
0
 public Player()
 {
     _speed           = 128;
     _parameterFaders = new ParameterFader[4];
     for (int i = 0; i < _parameterFaders.Length; i++)
     {
         _parameterFaders[i] = new ParameterFader();
     }
     _active_notes = new ushort[128];
     _hook         = new HookDatas();
 }
Пример #2
0
 public Player()
 {
     _speed = 128;
     _parameterFaders = new ParameterFader[4];
     for (int i = 0; i < _parameterFaders.Length; i++)
     {
         _parameterFaders[i] = new ParameterFader();
     }
     _active_notes = new ushort[128];
     _hook = new HookDatas();
 }
Пример #3
0
        public int AddParameterFader(ParameterFaderType param, int target, int time)
        {
            int start;

            switch (param)
            {
            case ParameterFaderType.Volume:
                // HACK: If volume is set to 0 with 0 time,
                // set it so immediately but DON'T clear
                // the player. This fixes a problem with
                // music being cleared inappropriately
                // in S&M when playing with the Dinosaur.
                if (target == 0 && time == 0)
                {
                    SetVolume(0);
                    return(0);
                }

                // Volume fades are handled differently.
                start = _volume;
                break;

            case ParameterFaderType.Transpose:
                // FIXME: Is this transpose? And what's the scale?
                // It's set to fade to -2400 in the tunnel of love.
                //      debug(0, "parameterTransition(3) outside Tunnel of Love?");
                start = _transpose;
                //      target /= 200;
                break;

            case ParameterFaderType.Speed:     // impSpeed
                // FIXME: Is the speed from 0-100?
                // Right now I convert it to 0-128.
                start = _speed;
                //      target = target * 128 / 100;
                break;

            case ParameterFaderType.ClearAll:
            {
                // FIXME? I *think* this clears all parameter faders.
                foreach (var pf in _parameterFaders)
                {
                    pf.Param = ParameterFaderType.None;
                }
                return(0);
            }

            default:
                Debug.WriteLine("Player.AddParameterFader({0}, {1}, {2}): Unknown parameter", param, target, time);
                return(0);    // Should be -1, but we'll let the script think it worked.
            }

            ParameterFader best = null;

            for (var i = _parameterFaders.Length - 1; i != 0; --i)
            {
                var ptr = _parameterFaders[i];
                if (ptr.Param == param)
                {
                    best  = ptr;
                    start = ptr.End;
                    break;
                }
                else if (ptr.Param == ParameterFaderType.None)
                {
                    best = ptr;
                }
            }

            if (best != null)
            {
                best.Param = param;
                best.Start = start;
                best.End   = target;
                if (time == 0)
                {
                    best.TotalTime = 1;
                }
                else
                {
                    best.TotalTime = (uint)time * 10000;
                }
                best.CurrentTime = 0;
            }
            else
            {
                Debug.WriteLine("IMuse Player {0}: Out of parameter faders", _id);
                return(-1);
            }

            return(0);
        }