コード例 #1
0
    public void Init(LoopPoint point, Vector3 position, bool addbutton = false, LoopPointButton target = null)
    {
        m_addbutton = addbutton;

        m_loopPoint = point;

        m_rect = GetComponent <RectTransform>();

        m_defaultSize = m_rect.sizeDelta.x;
        if (!m_addbutton)
        {
            m_defaultAnchorArrow       = m_rect.GetChild(0).GetComponent <RectTransform>().anchoredPosition.y;
            LoopEditor.inst.pointMove += UpdateAngle;
        }
        else
        {
            m_target = target;
            LoopEditor.inst.pointMove += FindMiddleFromTarget;
        }

        SetPosition(position);
    }
コード例 #2
0
ファイル: LoopEditor.cs プロジェクト: DavEat/LudumDare47
    void SpawnAllButtons()
    {
        LoopPoint       lastPoint   = null;
        LoopPointButton firstButton = null;
        LoopPointButton lastButton  = null;
        int             index       = 0;

        foreach (LoopPoint lp in PlayerLoop.inst.GetLoopPoints())
        {
            LoopPointButton b = Instantiate(m_prefab_loopPointButton, m_LoopPointsButtonContainer);
            b.Init(lp, lp.GetPosition());

            if (lastPoint != null && PlayerLoop.inst.GetSize() < m_maxLoopPoint)
            {
                Vector3 position = (lastPoint.GetPosition() - lp.GetPosition()) * .5f + lp.GetPosition();
                Instantiate(m_prefab_addLoopPointButton, m_LoopPointsButtonContainer).Init(lastPoint, position, true, b);
            }

            if (lastButton != null)
            {
                lastButton.SetAngle(b);
            }
            else
            {
                firstButton = b;
            }

            lastPoint  = lp;
            lastButton = b;
            index++;
        }
        if (PlayerLoop.inst.GetSize() < m_maxLoopPoint)
        {
            Vector3 position0 = (lastPoint.GetPosition() - PlayerLoop.inst.GetPointAt(0).GetPosition()) * .5f + PlayerLoop.inst.GetPointAt(0).GetPosition();
            Instantiate(m_prefab_addLoopPointButton, m_LoopPointsButtonContainer).Init(lastPoint, position0, true, firstButton);
        }
        lastButton.SetAngle(firstButton);
    }
コード例 #3
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;
 }
コード例 #4
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;
        }
コード例 #5
0
ファイル: Sound.cs プロジェクト: minimalism/SupersonicSound
 public bool SetLoopPoints(LoopPoint point, TimeUnit startUnit, TimeUnit endUnit)
 {
     return(_fmodSound.setLoopPoints(point.Start, EquivalentEnum <TimeUnit, TIMEUNIT> .Cast(startUnit), point.End, EquivalentEnum <TimeUnit, TIMEUNIT> .Cast(endUnit)).Check(Suppressions()));
 }