예제 #1
0
        /// <summary>
        /// Approximates: PianoCalculator, Key, Count, Quarter and Pulse.
        /// Also acts as storage for LoopPoint (piano-view transport or 
        /// buffer-transport).
        /// </summary>
        /// <param name="clientMouse">(stored); ClientInput</param>
        /// <param name="loopRegion">(stored); LoopRegion</param>
        /// <param name="pxNode">(ref) ignored after usage (only referenced)</param>
        /// <param name="wedge">(stored); Typically (in local terms): pxNode.X * 4 * 4</param>
        /// <param name="multiply">(stored); Typically 4</param>
        /// <param name="division">(stored); From sequencer or midi program</param>
        /// <param name="upper">(stored); Top visible midi key. (Key and Count values are provided from this value in relation to clientMouse)</param>
        public NoteTransport(
			FloatPoint clientMouse,
			LoopPoint loopRegion,
			FloatPoint pxNode,
			double wedge,
			double multiply,
			double division,
			double upper)
        {
            this.ClientInput = clientMouse;
            this.loopRegion = loopRegion;
            this.pianoInfo = PianoCalculator.Create(clientMouse,pxNode.X*4);
            this.wedge = wedge; // nodewidth * 4 * 4
            this.multiply = multiply; // 4
            this.division = division;
            //                           quarter    bar
            //                                  beat    measure
            // wedge * multiply  ==  nodewidth * 4 * 4 * 4
            Quarter = ClientInput.X / wedge * multiply;
            Pulse = GetPulses(division);
            Upper = upper;
            Key = Upper.ToInt32() - Convert.ToDouble(ClientInput.Y/pxNode.Y).FloorMinimum(0).ToInt32();
            Count = Convert.ToDouble(pxNode.Y).FloorMinMax(0,127).ToInt32()-1;
        }
예제 #2
0
 /// <summary>
 /// Approximates: PianoCalculator, Key, Count, Quarter and Pulse.
 /// Also acts as storage for LoopPoint (piano-view transport or
 /// buffer-transport).
 /// </summary>
 /// <param name="clientMouse">(stored); ClientInput</param>
 /// <param name="loopRegion">(stored); LoopRegion</param>
 /// <param name="pxNode">(ref) ignored after usage (only referenced)</param>
 /// <param name="wedge">(stored); Typically (in local terms): pxNode.X * 4 * 4</param>
 /// <param name="multiply">(stored); Typically 4</param>
 /// <param name="division">(stored); From sequencer or midi program</param>
 /// <param name="upper">(stored); Top visible midi key. (Key and Count values are provided from this value in relation to clientMouse)</param>
 public NoteTransport(
     FloatPoint clientMouse,
     LoopPoint loopRegion,
     FloatPoint pxNode,
     double wedge,
     double multiply,
     double division,
     double upper)
 {
     this.ClientInput = clientMouse;
     this.loopRegion  = loopRegion;
     this.pianoInfo   = PianoCalculator.Create(clientMouse, pxNode.X * 4);
     this.wedge       = wedge;       // nodewidth * 4 * 4
     this.multiply    = multiply;    // 4
     this.division    = division;
     //                           quarter    bar
     //                                  beat    measure
     // wedge * multiply  ==  nodewidth * 4 * 4 * 4
     Quarter = ClientInput.X / wedge * multiply;
     Pulse   = GetPulses(division);
     Upper   = upper;
     Key     = Upper.ToInt32() - Convert.ToDouble(ClientInput.Y / pxNode.Y).FloorMinimum(0).ToInt32();
     Count   = Convert.ToDouble(pxNode.Y).FloorMinMax(0, 127).ToInt32() - 1;
 }
예제 #3
0
 void GetForeground_NewBars(Graphics g, Needs n, decimal barA, decimal barB)
 {
     double wedge = Wedge;
       FloatPoint p = ClientMouse;
       FloatRect r = Ren.ui_view_settings.ClientRect;
       foreach (double i in EnumerateX() )
       {
     p.X = (float)(i * wedge);
     calc = PianoCalculator.Create(p, wedge/4);
     string alt = string.Format("{0} {1} {2}",calc.Note,this.numBar.Value,this.numLen.Value);
     bool sw = (i.ToInt32() & 1) == 0;
     g.DrawString(
       sw ? calc.MBQ : alt,
       big, SystemBrushes.WindowText,
       p.X+Ren.ui_view_settings.ClientRect.X ,
       sw ? Ren.ui_view_settings.ClientPadding.Top + 8 : Ren.ui_view_settings.ClientPadding.Top
      );
       }
       drawdot(g,r,wedge.ToInt32());
       draw_bar(g,barA,wedge);
       draw_bar(g,barB,wedge);
 }
예제 #4
0
 IEnumerable<KeyValuePair<double, string>> EnumerateXString()
 {
     foreach ( int i in EnumerateX() )
       {
     PianoCalculator calc = PianoCalculator.Create(ClientMouse, Wedge/4);
     string str = calc.ToString();
     double dbl = (i * Wedge)+Ren.ui_view_settings.ClientRect.X;
     yield return new KeyValuePair<double,string>(dbl,str);
     calc = null;
     //				if ((i.ToInt32() & 1) == 0) g.DrawString(calc.MBQ,big,SystemBrushes.WindowText, p.X+Ren.ui.ClientRect.X ,Ren.ui.ClientPadding.Top+8);
     //				else g.DrawString(string.Format("{0} {1} {2}",calc.Note,this.numBar.Value,this.numLen.Value),big,SystemBrushes.WindowText, p.X+Ren.ui.ClientRect.X ,Ren.ui.ClientPadding.Top);
       }
 }