let's try this resyncing again
This commit is contained in:
parent
e4dd359de7
commit
1880c27213
|
@ -96,9 +96,7 @@ namespace HeavenStudio
|
||||||
private float timelineVolume = 1f;
|
private float timelineVolume = 1f;
|
||||||
private float minigameVolume = 1f;
|
private float minigameVolume = 1f;
|
||||||
|
|
||||||
const bool doPitchResync = false;
|
public void SetTimelinePitch(float pitch)
|
||||||
|
|
||||||
public void SetTimelinePitch(float pitch, bool resync = false)
|
|
||||||
{
|
{
|
||||||
if (isPaused || deferTimeKeeping) return;
|
if (isPaused || deferTimeKeeping) return;
|
||||||
if (pitch != 0 && pitch != timelinePitch)
|
if (pitch != 0 && pitch != timelinePitch)
|
||||||
|
@ -111,17 +109,17 @@ namespace HeavenStudio
|
||||||
if (musicSource != null && musicSource.clip != null)
|
if (musicSource != null && musicSource.clip != null)
|
||||||
{
|
{
|
||||||
musicSource.pitch = SongPitch;
|
musicSource.pitch = SongPitch;
|
||||||
if (doPitchResync && isPlaying && resync && !deferTimeKeeping)
|
if (isPlaying && !(isPaused || deferTimeKeeping))
|
||||||
{
|
{
|
||||||
time = MapTimeToPitchChanges(absTime + absTimeAdjust);
|
time = MapTimeToPitchChanges(absTime + absTimeAdjust);
|
||||||
songPos = startPos + time;
|
songPos = startPos + time;
|
||||||
songPosBeat = GetBeatFromSongPos(songPos);
|
songPosBeat = GetBeatFromSongPos(songPos);
|
||||||
SeekMusicToTime(songPos, firstBeatOffset);
|
songPositionInBeatsAsDouble = GetSwungBeat(songPosBeat);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetMinigamePitch(float pitch, bool resync = false)
|
public void SetMinigamePitch(float pitch)
|
||||||
{
|
{
|
||||||
if (isPaused || deferTimeKeeping || !isPlaying) return;
|
if (isPaused || deferTimeKeeping || !isPlaying) return;
|
||||||
if (pitch != 0 && pitch != minigamePitch)
|
if (pitch != 0 && pitch != minigamePitch)
|
||||||
|
@ -134,12 +132,12 @@ namespace HeavenStudio
|
||||||
if (musicSource != null && musicSource.clip != null)
|
if (musicSource != null && musicSource.clip != null)
|
||||||
{
|
{
|
||||||
musicSource.pitch = SongPitch;
|
musicSource.pitch = SongPitch;
|
||||||
if (doPitchResync && isPlaying && resync && !deferTimeKeeping)
|
if (isPlaying && !(isPaused || deferTimeKeeping))
|
||||||
{
|
{
|
||||||
time = MapTimeToPitchChanges(absTime + absTimeAdjust);
|
time = MapTimeToPitchChanges(absTime + absTimeAdjust);
|
||||||
songPos = startPos + time;
|
songPos = startPos + time;
|
||||||
songPosBeat = GetBeatFromSongPos(songPos);
|
songPosBeat = GetBeatFromSongPos(songPos);
|
||||||
SeekMusicToTime(songPos, firstBeatOffset);
|
songPositionInBeatsAsDouble = GetSwungBeat(songPosBeat);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -102,7 +102,7 @@ namespace HeavenStudio.Games
|
||||||
}
|
}
|
||||||
if (Conductor.instance.isPlaying)
|
if (Conductor.instance.isPlaying)
|
||||||
{
|
{
|
||||||
Conductor.instance.SetMinigamePitch(1f, true);
|
Conductor.instance.SetMinigamePitch(1f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue