Inheritance: Table, IInputListener, IGamepadFocusable
Beispiel #1
0
        public void Load(Nez.UI.Button btn)
        {
            sequencer1.Stop();
            sequencer1.clock.Stop();

            LoadMidiFile();
        }
Beispiel #2
0
		void onButtonClicked( Button button )
		{
			if( _parameterType == null )
			{
				( _memberInfo as MethodInfo ).Invoke( _target, new object[] { } );
			}
			else
			{
				// extract the param and properly cast it
				var parameters = new object[1];

				try
				{
					if( _parameterType == typeof( float ) )
						parameters[0] = float.Parse( _textField.getText() );
					else if( _parameterType == typeof( int ) )
						parameters[0] = int.Parse( _textField.getText() );
					else if( _parameterType == typeof( bool ) )
						parameters[0] = bool.Parse( _textField.getText() );
					else
						parameters[0] = _textField.getText();

					( _memberInfo as MethodInfo ).Invoke( _target, parameters );
				}
				catch( Exception e )
				{
					Debug.error( e.ToString() );
				}
			}
		}
Beispiel #3
0
		public void add( Button button )
		{
			button._buttonGroup = null;
			var shouldCheck = button.isChecked || buttons.Count < minCheckCount;
			button.isChecked = false;
			button._buttonGroup = this;
			buttons.Add( button );
			button.isChecked = shouldCheck;
		}
Beispiel #4
0
        private void StepBtn_OnClicked(Nez.UI.Button btn)
        {
            sequencer1.Continue();

            //if (!sequencer1.clock.IsRunning)
            //{
            //    sequencer1.clock.Start();
            //}
        }
Beispiel #5
0
        public void Play(Nez.UI.Button btn)
        {
            //sequencer1.Start();
            sequencer1.Continue();

            if (!sequencer1.clock.IsRunning)
            {
                sequencer1.clock.Start();
            }
        }
Beispiel #6
0
 public void TrackBtn_OnClicked(Nez.UI.Button btn)
 {
     //
     // Track number button (on bottom of slider)
     //
     if (TrackChanl[btn.Tag] < 0)
     {
         ChnlMsg.SetText("Channel:  ");
     }
     else
     {
         ChnlMsg.SetText("Channel: " + TrackChanl[btn.Tag].ToString("00"));
     }
     //
     // Give channel number/instrument name
     //
     TrackMsg.SetText("Track: " + btn.Tag.ToString("00"));
     InstrumentMsg.SetText("Description: " + TrackInstrument[btn.Tag]);
 }
Beispiel #7
0
        public void Track_Selection(Nez.UI.Button btn)
        {
            //
            // Track selection check mark (on top of slider)
            // Mute also comes here for each track
            //
            if (TrackChanl[btn.Tag] < 0)
            {
                return;
            }


            TracksPlaying[btn.Tag] = !TracksPlaying[btn.Tag];
            ChannelsPlaying[TrackChanl[btn.Tag]] = !ChannelsPlaying[TrackChanl[btn.Tag]];

            AllChannels = 0;
            sequencer1.Stop();
            sequencer1.Continue();
        }
Beispiel #8
0
		public void remove( Button button )
		{
			button._buttonGroup = null;
			buttons.Remove( button );
			checkedButtons.Remove( button );
		}
Beispiel #9
0
		/// <summary>
		/// Called when a button is checked or unchecked. If overridden, generally changing button checked states should not be done
		/// from within this method.
		/// </summary>
		/// <returns>True if the new state should be allowed</returns>
		/// <param name="button">Button.</param>
		/// <param name="newState">New state.</param>
		public bool canCheck( Button button, bool newState )
		{
			if( button.isChecked == newState )
				return false;

			if( !newState )
			{
				// Keep button checked to enforce minCheckCount.
				if( checkedButtons.Count <= minCheckCount )
					return false;
				checkedButtons.Remove( button );
			}
			else
			{
				// Keep button unchecked to enforce maxCheckCount.
				if( maxCheckCount != -1 && checkedButtons.Count >= maxCheckCount )
				{
					if( uncheckLast )
					{
						int old = minCheckCount;
						minCheckCount = 0;
						lastChecked.isChecked = false;
						minCheckCount = old;
					}
					else
						return false;
				}
				checkedButtons.Add( button );
				lastChecked = button;
			}

			return true;
		}
Beispiel #10
0
		/** Adds the given button to the button table.
	 * @param object The object that will be passed to {@link #result(Object)} if this button is clicked. May be null. */
		public Button addButton( Button button )
		{
			buttonTable.add( button );
			return button;
		}
Beispiel #11
0
 public void Stop(Nez.UI.Button btn)
 {
     sequencer1.Stop();
     sequencer1.clock.Stop();
 }
Beispiel #12
0
 private void PBtn_OnClicked(Nez.UI.Button btn)
 {
     AllChannels = -1;
     ChnlMsg.SetText("All Channels");
 }
Beispiel #13
0
        public void SoloBtn_OnClicked(Nez.UI.Button btn)
        {
            SoloPushedOn = btn.IsChecked;           //toggle on/off
            //
            // Solo comes here for each track
            //
            if (TrackChanl[btn.Tag] < 0)
            {
                return;
            }
            if (SoloPushedOn)
            {
                //
                // all tracks are turned off except this one
                //
                for (int i = 0; i < 16; i++)
                {
                    if (TracksInMidi[i])            //valid track
                    {
                        //
                        // turn off all tracks
                        //
                        if (TrackChanl[i] >= 0)
                        {
                            TracksPlaying[i] = false;
                            ChannelsPlaying[TrackChanl[i]] = false;
                        }
                        Nez.UI.CheckBox tmpCB = SoloBtnGroup[i];
                        tmpCB.IsChecked = false;
                    }
                }
                //
                // turn on this track (btn)
                //
                btn.IsChecked = true;
            }
            else
            {
                //
                // all tracks are back on
                //
                for (int i = 0; i < 16; i++)
                {
                    if (TracksInMidi[i])            //valid track
                    {
                        //
                        // turn on all tracks
                        //
                        if (TrackChanl[i] >= 0)
                        {
                            TracksPlaying[i] = true;
                            ChannelsPlaying[TrackChanl[i]] = true;
                        }
                    }
                }
                //
                // turn off this track (btn)
                //
                btn.IsChecked = false;
            }
            TracksPlaying[btn.Tag] = true;
            ChannelsPlaying[TrackChanl[btn.Tag]] = true;
            //
            // give info about the track
            //
            TrackBtn_OnClicked(btn);

            AllChannels = 0;
            sequencer1.Stop();
            sequencer1.Continue();
        }