Exemplo n.º 1
0
            private void playBeatFor(int beatIndex, TimeSignature signature)
            {
                if (beatIndex == 0)
                {
                    finishSample?.Play();
                }

                switch (signature.Numerator)
                {
                case 3:
                    switch (beatIndex % 6)
                    {
                    case 0:
                        kickSample?.Play();
                        break;

                    case 3:
                        clapSample?.Play();
                        break;

                    default:
                        hatSample?.Play();
                        break;
                    }

                    break;

                case 4:
                    switch (beatIndex % 4)
                    {
                    case 0:
                        kickSample?.Play();
                        break;

                    case 2:
                        clapSample?.Play();
                        break;

                    default:
                        hatSample?.Play();
                        break;
                    }

                    break;
                }
            }
Exemplo n.º 2
0
            private void playBeatFor(int beatIndex, TimeSignatures signature)
            {
                if (beatIndex == 0)
                {
                    finishSample?.Play();
                }

                switch (signature)
                {
                case TimeSignatures.SimpleTriple:
                    switch (beatIndex % 6)
                    {
                    case 0:
                        kickSample?.Play();
                        break;

                    case 3:
                        clapSample?.Play();
                        break;

                    default:
                        hatSample?.Play();
                        break;
                    }

                    break;

                case TimeSignatures.SimpleQuadruple:
                    switch (beatIndex % 4)
                    {
                    case 0:
                        kickSample?.Play();
                        break;

                    case 2:
                        clapSample?.Play();
                        break;

                    default:
                        hatSample?.Play();
                        break;
                    }

                    break;
                }
            }
Exemplo n.º 3
0
 private void beginHold()
 {
     holdStartTime = Math.Max(Time.Current, HitObject.StartTime);
     Colour = Color4.White;
     if (!holdSample.IsPlaying)
         holdSample.Play();
     holdSample.VolumeTo(1, 300);
 }
Exemplo n.º 4
0
 private void updateSlidingSample(ValueChangedEvent <bool> tracking)
 {
     if (tracking.NewValue)
     {
         slidingSample?.Play();
     }
     else
     {
         slidingSample?.Stop();
     }
 }
Exemplo n.º 5
0
 private void updateSpinningSample(ValueChangedEvent <bool> tracking)
 {
     if (tracking.NewValue)
     {
         spinningSample?.Play();
         spinningSample?.VolumeTo(1, 200);
     }
     else
     {
         spinningSample?.VolumeTo(0, 200).Finally(_ => spinningSample.Stop());
     }
 }
Exemplo n.º 6
0
 private void updateSpinningSample(ValueChangedEvent <bool> tracking)
 {
     if (tracking.NewValue)
     {
         spinningSample?.Play(!spinningSample.IsPlaying);
         spinningSample?.VolumeTo(1, 300);
     }
     else
     {
         spinningSample?.VolumeTo(0, 300).OnComplete(_ => spinningSample.Stop());
     }
 }
Exemplo n.º 7
0
        private void updateSpinningSample(ValueChangedEvent <bool> tracking)
        {
            if (tracking.NewValue)
            {
                if (!spinningSample.IsPlaying)
                {
                    spinningSample.Play();
                }

                spinningSample.VolumeTo(1, 300);
            }
            else
            {
                spinningSample.VolumeTo(0, fade_out_duration);
            }
        }
Exemplo n.º 8
0
        protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, ChannelAmplitudes amplitudes)
        {
            base.OnNewBeat(beatIndex, timingPoint, effectPoint, amplitudes);

            if (!IsBeatSyncedWithTrack)
            {
                return;
            }

            int timeSignature = timingPoint.TimeSignature.Numerator;

            // play metronome from one measure before the first object.
            if (BeatSyncClock.CurrentTime < firstHitTime - timingPoint.BeatLength * timeSignature)
            {
                return;
            }

            sample.Frequency.Value = beatIndex % timeSignature == 0 ? 1 : 0.5f;
            sample.Play();
        }
Exemplo n.º 9
0
            protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, ChannelAmplitudes amplitudes)
            {
                base.OnNewBeat(beatIndex, timingPoint, effectPoint, amplitudes);

                if (!IsBeatSyncedWithTrack)
                {
                    return;
                }

                int timeSignature = (int)timingPoint.TimeSignature;

                // play metronome from one measure before the first object.
                // TODO: Use BeatSyncClock from https://github.com/ppy/osu/pull/13894.
                if (Clock.CurrentTime < firstHitTime - timingPoint.BeatLength * timeSignature)
                {
                    return;
                }

                sample.Frequency.Value = beatIndex % timeSignature == 0 ? 1 : 0.5f;
                sample.Play();
            }