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; } }
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; } }
private void beginHold() { holdStartTime = Math.Max(Time.Current, HitObject.StartTime); Colour = Color4.White; if (!holdSample.IsPlaying) holdSample.Play(); holdSample.VolumeTo(1, 300); }
private void updateSlidingSample(ValueChangedEvent <bool> tracking) { if (tracking.NewValue) { slidingSample?.Play(); } else { slidingSample?.Stop(); } }
private void updateSpinningSample(ValueChangedEvent <bool> tracking) { if (tracking.NewValue) { spinningSample?.Play(); spinningSample?.VolumeTo(1, 200); } else { spinningSample?.VolumeTo(0, 200).Finally(_ => spinningSample.Stop()); } }
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()); } }
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); } }
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(); }
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(); }