mirror of
https://github.com/RHeavenStudio/HeavenStudio.git
synced 2025-06-12 15:27:38 +02:00
Expose Song Pitch to Minigames (#301)
* expose song pitch to minigames * clean up new additions * make new functions actually set music pitch * fix playback speed slider bug
This commit is contained in:
@ -900,11 +900,12 @@ namespace HeavenStudio.Editor.Track
|
||||
return LayersRect.rect.height / 5f;
|
||||
}
|
||||
|
||||
const float SpeedSnap = 0.25f;
|
||||
public void SetPlaybackSpeed(float speed)
|
||||
{
|
||||
float spd = Mathp.Round2Nearest(speed, Timeline.SnapInterval());
|
||||
float spd = Mathp.Round2Nearest(speed, SpeedSnap);
|
||||
PlaybackSpeed.transform.GetChild(3).GetComponent<TMP_Text>().text = $"Playback Speed: {spd}x";
|
||||
Conductor.instance.musicSource.pitch = spd;
|
||||
Conductor.instance.SetTimelinePitch(spd);
|
||||
PlaybackSpeed.value = spd;
|
||||
}
|
||||
|
||||
@ -914,6 +915,7 @@ namespace HeavenStudio.Editor.Track
|
||||
{
|
||||
PlaybackSpeed.transform.GetChild(3).GetComponent<TMP_Text>().text = $"Playback Speed: 1x";
|
||||
PlaybackSpeed.value = 1f;
|
||||
Conductor.instance.SetTimelinePitch(PlaybackSpeed.value);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user