Exemple #1
0
 public void OnPulse(IGATPulseInfo pulseInfo)
 {
     if (up)
     {
         if (moveInd == movePoints.Count - 1)
         {
             up = false;
             moveInd--;
         }
         else
         {
             moveInd++;
         }
     }
     else
     {
         if (moveInd == 0)
         {
             up = true;
             moveInd++;
         }
         else
         {
             moveInd--;
         }
     }
     transform.position = movePoints[moveInd];
 }
Exemple #2
0
        // Monitor pulse to handle recording and playback in time
        public override void OnPulse( IGATPulseInfo pulseInfo )
        {
            if( pulseInfo.StepIndex == 0 ) // We're about to start the loop
            {
                int i;

                for( i = 0; i < _recs.Length; i++ )
                {
                    if( _recs[ i ].shouldPlay ) // if there's some recorded data, play it
                    {
                        if( !streamToCache.Overdub && _recState == RecState.WillRec && _currentRecIndex == i ) // but don't if we are recording this very track, except when overdubbing
                            continue;

                        _recs[ i ].Play( pulseInfo.PulseDspTime ); // Play the cached data
                    }
                }

                // If the user clicked record, we set the appropriate cache in the streamToCache module and fire
                if( _recState == RecState.WillRec )
                {
                    streamToCache.Caches = _recs[ _currentRecIndex ].data;
                    streamToCache.StartCaching( pulseInfo.PulseDspTime, RecAtEnd ); // RecAtEnd will be called when the cache is full
                    _recState = RecState.InRec;
                    _recs[ _currentRecIndex ].shouldPlay = true; // next time setp 0 pulses, we'll have data that we should play
                }
            }

            _lastPulseIndex 	= pulseInfo.StepIndex; // store the pulse index for a rec count down
        }
Exemple #3
0
 public void OnPulse(IGATPulseInfo pulseInfo)
 {
     if (PlayNotesEvent != null)
     {
         PlayNotesEvent(pulseInfo.StepIndex);
     }
 }
Exemple #4
0
        public override void OnPulse(IGATPulseInfo pulseInfo) // Monitor pulse to handle recording and playback in time
        {
            if (pulseInfo.StepIndex == 0)                     // We're about to start the loop
            {
                int i;

                for (i = 0; i < _recs.Length; i++)
                {
                    if (_recs[i].shouldPlay)                                                                  // if there's some recorded data, play it
                    {
                        if (!streamToCache.Overdub && _recState == RecState.WillRec && _currentRecIndex == i) // but don't if we are recording this very track, except when overdubbing
                        {
                            continue;
                        }

                        _recs[i].Play(pulseInfo.PulseDspTime);                             // Play the cached data
                    }
                }

                // If the user clicked record, we set the appropriate cache in the streamToCache module and fire
                if (_recState == RecState.WillRec)
                {
                    streamToCache.Caches = _recs[_currentRecIndex].data;
                    streamToCache.StartCaching(pulseInfo.PulseDspTime, RecAtEnd);    // RecAtEnd will be called when the cache is full
                    _recState = RecState.InRec;
                    _recs[_currentRecIndex].shouldPlay = true;                       // next time setp 0 pulses, we'll have data that we should play
                }
            }

            _lastPulseIndex = pulseInfo.StepIndex;                     // store the pulse index for a rec count down
        }
Exemple #5
0
        public void OnPulse(IGATPulseInfo pulseInfo)
        {
            if (_SubPulseMode != PeriodMode.AbsolutePeriod)              // don't update period if mode is AbsolutePeriod
            {
                if (pulseInfo.PulseDidChange || _shouldUpdatePeriod)
                {
                    UpdatePeriod();
                }
            }

            bool doBypass = _Bypass;

            if (!doBypass)
            {
                if (_SubscribedSteps[pulseInfo.StepIndex] == false)
                {
                    doBypass = true;
                }
                else if (_oneShot == false && _RandomBypassParentPulse)
                {
                    if (Random.value < _ParentPulseBypassChance)
                    {
                        doBypass = true;
                    }
                }
            }

            if (doBypass)
            {
                return;
            }

            _pulseInfo.SetStart(pulseInfo.PulseDspTime, 0);
            _doSubPulse = true;
        }
Exemple #6
0
 public void OnPulse(IGATPulseInfo pulseInfo)
 {
     if (PlayNotesEvent != null)
     {
         PlayNotesEvent(NoteQue, note);
     }
     NoteQue.Clear();
 }
Exemple #7
0
 /// <summary>
 /// Pulse callback called by
 /// the PulseModule if mapLengthToPulse is true
 /// </summary>
 public void OnWillPulse(IGATPulseInfo pulseInfo)
 {
     if (pulseInfo.PulseDidChange || _ratioDidChange)
     {
         if (_mapLengthToPulse)
         {
             MapLength(pulseInfo.PulseDuration);
             _ratioDidChange = false;
         }
     }
 }
Exemple #8
0
    public void OnPulse(IGATPulseInfo pulseInfo)
    {
        //index = pulseInfo.StepIndex;
        if (pulseInfo.StepIndex == 0)
        {
            unitCache.Clear();
            switch (team)
            {
            case 0:
                transform.position = new Vector3(ArenaGrid.playLX, intervals[0].transform.position.y);
                break;

            case 1:
                transform.position = new Vector3(ArenaGrid.playRX, intervals[0].transform.position.y);
                break;
            }
        }
    }
Exemple #9
0
        void UpdateIndex(IGATPulseInfo pulseInfo)
        {
            switch (_playingOrder)
            {
            case PlayingOrder.MapToPulseIndex:
                _sampleIndex = pulseInfo.StepIndex % _sampleCount;
                break;

            case PlayingOrder.Sequential:
                _sampleIndex = (_sampleIndex + 1) % _sampleCount;
                break;

            case PlayingOrder.Randomized:
                _sampleIndex = Random.Range(0, _sampleCount);
                break;

            case PlayingOrder.MapToMasterPulseIndex:
                _sampleIndex = pulseInfo.PulseSender.MasterPulseInfo.StepIndex;
                break;
            }
        }
Exemple #10
0
        public override void OnPulse(IGATPulseInfo pulseInfo)
        {
            if (_subscribedSteps[pulseInfo.StepIndex] == false)
            {
                return;
            }

            if (_randomBypass)
            {
                if (Random.value < _randomBypassChance)
                {
                    return;
                }
            }

            UpdateIndex(pulseInfo);

            double dspTime = pulseInfo.PulseDspTime;

            if (_randomDelay)
            {
                dspTime += ( double )Random.Range(0f, _randomDelayMaxRatio) * pulseInfo.PulseDuration;
            }

            if (_playingOrder != PlayingOrder.Together)
            {
                PlaySample(_sampleIndex, dspTime);
            }
            else
            {
                int i;

                for (i = 0; i < _sampleCount; i++)                  //ToDo : Update sample count
                {
                    PlaySample(i, dspTime);
                }
            }
        }
Exemple #11
0
        //The pulse control callback: we get information regarding the previous pulse, and a chance to change the next one.
        void IGATPulseController.OnPulseControl(IGATPulseInfo prevPulseInfo)
        {
            if (_shouldEnterDoubleTime)            // the user clicked the button since the last pulse
            {
                pulse.Period /= 2;                 //double bpm
                _counter      = 0;                 // set the double time counter to 0

                _shouldEnterDoubleTime = false;
                _inDoubleTime          = true;
                patternLine.enabled    = true;                  //Enabling the patternLine will make it subscribe to onPatternWillPlay delegates for A and B patterns.

                if (prevPulseInfo.StepIndex % 2 == 0)           // if the previous step index was even, we'll double time for 7 beats
                {                                               // ( we want the double time streak to end on a Pattern A note, and pattern A plays on even steps )
                    _nbOfDoubleTimePulses = 7;
                }
                else
                {
                    _nbOfDoubleTimePulses = 6;                        // else for 6
                    patternLine.SetFirstVertexIndex(1);               // and notify the line that we'll start at index 1 ( the line is setup to draw 7 steps, not 6 )
                }

                //Start the color tween: it should start at prev pulse dspTime + new period and last new period * double time pulses
                StartCoroutine(LerpFFTLineColorRoutine(prevPulseInfo.PulseDspTime + pulse.Period, ( float )pulse.Period * _nbOfDoubleTimePulses));
            }
            else if (_inDoubleTime)              // we're in the double time streak
            {
                _counter++;

                if (_counter == _nbOfDoubleTimePulses)       // end of the streak
                {
                    pulse.Period *= 2;                       //bpm back to where it was
                    _inDoubleTime = false;
                    _endOfStreak  = true;
                }
            }
        }
Exemple #12
0
        //The pulse control callback: we get information regarding the previous pulse, and a chance to change the next one.
        void IGATPulseController.OnPulseControl( IGATPulseInfo prevPulseInfo )
        {
            if( _shouldEnterDoubleTime ) // the user clicked the button since the last pulse
            {
                pulse.Period /= 2; //double bpm
                _counter	  = 0; // set the double time counter to 0

                _shouldEnterDoubleTime = false;
                _inDoubleTime 			= true;
                patternLine.enabled 	= true; //Enabling the patternLine will make it subscribe to onPatternWillPlay delegates for A and B patterns.

                if( prevPulseInfo.StepIndex % 2 == 0 ) // if the previous step index was even, we'll double time for 7 beats
                {									   // ( we want the double time streak to end on a Pattern A note, and pattern A plays on even steps )
                    _nbOfDoubleTimePulses    = 7;
                }
                else
                {
                    _nbOfDoubleTimePulses    = 6; // else for 6
                    patternLine.SetFirstVertexIndex( 1 ); // and notify the line that we'll start at index 1 ( the line is setup to draw 7 steps, not 6 )
                }

                //Start the color tween: it should start at prev pulse dspTime + new period and last new period * double time pulses
                StartCoroutine( LerpFFTLineColorRoutine( prevPulseInfo.PulseDspTime + pulse.Period, ( float )pulse.Period * _nbOfDoubleTimePulses ) );
            }
            else if( _inDoubleTime ) // we're in the double time streak
            {
                _counter++;

                if( _counter == _nbOfDoubleTimePulses ) // end of the streak
                {
                    pulse.Period   *= 2; //bpm back to where it was
                    _inDoubleTime   = false;
                    _endOfStreak = true;
                }
            }
        }
Exemple #13
0
 /// <summary>
 /// Pulse callback called by 
 /// the PulseModule if mapLengthToPulse is true
 /// </summary>
 public void OnWillPulse( IGATPulseInfo pulseInfo )
 {
     if( pulseInfo.PulseDidChange || _ratioDidChange )
     {
         if( _mapLengthToPulse )
         {
             MapLength( pulseInfo.PulseDuration );
             _ratioDidChange = false;
         }
     }
 }
Exemple #14
0
        public void OnPulse( IGATPulseInfo pulseInfo )
        {
            if( _SubPulseMode != PeriodMode.AbsolutePeriod ) // don't update period if mode is AbsolutePeriod
            {
                if( pulseInfo.PulseDidChange || _shouldUpdatePeriod )
                    UpdatePeriod();
            }

            bool doBypass = _Bypass;

            if( !doBypass )
            {
                if( _SubscribedSteps[ pulseInfo.StepIndex ] == false )
                {
                    doBypass = true;
                }
                else if( _oneShot == false && _RandomBypassParentPulse )
                {
                    if( Random.value < _ParentPulseBypassChance )
                        doBypass = true;
                }
            }

            if( doBypass )
                return;

            _pulseInfo.SetStart( pulseInfo.PulseDspTime, 0 );
            _doSubPulse = true;
        }
Exemple #15
0
 void IGATPulseClient.OnPulse(IGATPulseInfo pulseInfo)
 {
     // Upkeep Tasks.
     curr_beat = pulseInfo.StepIndex;
 }
Exemple #16
0
 /// <summary>
 /// Check if _subscribedSteps[ pulseInfo.StepIndex ] when overriding.
 /// </summary>
 public abstract void OnPulse(IGATPulseInfo pulseInfo);
Exemple #17
0
        void UpdateIndex( IGATPulseInfo pulseInfo )
        {
            switch( _playingOrder )
            {
            case PlayingOrder.MapToPulseIndex:
                _sampleIndex = pulseInfo.StepIndex % _sampleCount;
                break;

            case PlayingOrder.Sequential:
                _sampleIndex = ( _sampleIndex + 1 ) % _sampleCount;
                break;

            case PlayingOrder.Randomized:
                _sampleIndex = Random.Range( 0, _sampleCount );
                break;

            case PlayingOrder.MapToMasterPulseIndex:
                _sampleIndex = pulseInfo.PulseSender.MasterPulseInfo.StepIndex;
                break;
            }
        }
Exemple #18
0
        public override void OnPulse( IGATPulseInfo pulseInfo )
        {
            if( _subscribedSteps[ pulseInfo.StepIndex ] == false )
                return;

            if( _randomBypass )
            {
                if( Random.value < _randomBypassChance )
                    return;
            }

            UpdateIndex( pulseInfo );

            double dspTime = pulseInfo.PulseDspTime;

            if( _randomDelay )
                dspTime += ( double )Random.Range( 0f, _randomDelayMaxRatio ) * pulseInfo.PulseDuration;

            if( _playingOrder != PlayingOrder.Together )
            {
                PlaySample( _sampleIndex, dspTime );
            }
            else
            {
                int i;

                for( i = 0; i < _sampleCount; i++ ) //ToDo : Update sample count
                {
                    PlaySample( i, dspTime );
                }
            }
        }
Exemple #19
0
 /// <summary>
 /// Check if _subscribedSteps[ pulseInfo.StepIndex ] when overriding.
 /// </summary>
 public abstract void OnPulse(  IGATPulseInfo pulseInfo );