void PlaySound(bool initial, int index, BeatmapObject objectData) { // Filter notes that are too far behind the current beat // (Commonly occurs when Unity freezes for some unrelated f*****g reason) if (objectData._time - container.AudioTimeSyncController.CurrentBeat <= -0.5f) { return; } // bongo cat bongocat.triggerArm(objectData as BeatmapNote, container); //actual ding stuff if (objectData._time == lastCheckedTime || !NoteTypeToDing[((BeatmapNote)objectData)._type]) { return; } /* * As for why we are not using "initial", it is so notes that are not supposed to ding do not prevent notes at * the same time that are supposed to ding from triggering the sound effects. */ lastCheckedTime = objectData._time; int soundListId = Settings.Instance.NoteHitSound; SoundList list = soundLists[soundListId]; switch (soundListId) { case (int)HitSounds.SLICE: callbackController.offset = container.AudioTimeSyncController.GetBeatFromSeconds(0.18f); break; case (int)HitSounds.DISCORD: Instantiate(discordPingPrefab, gameObject.transform, true); break; default: callbackController.offset = 0; break; } bool shortCut = false; if (index - DensityCheckOffset > 0 && index + DensityCheckOffset < container.LoadedContainers.Count) { BeatmapObject first = container.LoadedContainers[index + DensityCheckOffset]?.objectData; BeatmapObject second = container.LoadedContainers[index - DensityCheckOffset]?.objectData; if (first != null && second != null) { if (first._time - objectData._time <= ThresholdInNoteTime && objectData._time - second._time <= ThresholdInNoteTime) { shortCut = true; } } } audioUtil.PlayOneShotSound(list.GetRandomClip(shortCut), Settings.Instance.NoteHitVolume); }
void PlaySound(bool initial, int index, BeatmapObject objectData) { // Filter notes that are too far behind the current beat // (Commonly occurs when Unity freezes for some unrelated f*****g reason) if (objectData._time - container.AudioTimeSyncController.CurrentBeat <= -0.5f) { return; } // bongo cat bongocat.triggerArm(objectData as BeatmapNote, container); //actual ding stuff if (objectData._time == lastCheckedTime || !NoteTypeToDing[(objectData as BeatmapNote)._type]) { return; } /* * As for why we are not using "initial", it is so notes that are not supposed to ding do not prevent notes at * the same time that are supposed to ding from triggering the sound effects. */ lastCheckedTime = objectData._time; SoundList list = soundLists[soundListToUse]; bool shortCut = false; if (index - DensityCheckOffset > 0 && index + DensityCheckOffset < container.LoadedContainers.Count) { BeatmapObject first = container.LoadedContainers[index + DensityCheckOffset]?.objectData; BeatmapObject second = container.LoadedContainers[index - DensityCheckOffset]?.objectData; if (first != null && second != null) { if (first._time - objectData._time <= ThresholdInNoteTime && objectData._time - second._time <= ThresholdInNoteTime) { shortCut = true; } } } audioUtil.PlayOneShotSound(list.GetRandomClip(shortCut), 0.5f); }
void PlaySound(bool initial, int index, BeatmapObject objectData) { // bongo cat bongocat.triggerArm(objectData as BeatmapNote, container); //actual ding stuff if (objectData._time == lastCheckedTime || !NoteTypeToDing[(objectData as BeatmapNote)._type]) { return; } /* * As for why we are not using "initial", it is so notes that are not supposed to ding do not prevent notes at * the same time that are supposed to ding from triggering the sound effects. */ lastCheckedTime = objectData._time; SoundList list = soundLists[soundListToUse]; bool shortCut = false; if (index - DensityCheckOffset < 0 || index + DensityCheckOffset >= container.LoadedContainers.Count) { return; } BeatmapObject first = container.LoadedContainers[index + DensityCheckOffset]?.objectData; BeatmapObject second = container.LoadedContainers[index - DensityCheckOffset]?.objectData; if (first != null && second != null) { if (first._time - objectData._time <= ThresholdInNoteTime && objectData._time - second._time <= ThresholdInNoteTime) { shortCut = true; } } audioUtil.PlayOneShotSound(list.GetRandomClip(shortCut), 0.5f); }