diff --git a/src/sj/Game.d b/src/sj/Game.d index 4dc77f9..ac4fa60 100644 --- a/src/sj/Game.d +++ b/src/sj/Game.d @@ -51,7 +51,8 @@ class Game : AbstractGame { if (args.debug_music_index >= 0) { enforce(args.debug_music_index < music_list.length); - load_.Initialize(music_list_[args.debug_music_index]); + load_.Initialize( + music_list_[args.debug_music_index], args.debug_music_offset_beat); super(load_); } else { diff --git a/src/sj/LoadingScene.d b/src/sj/LoadingScene.d index 5f4abc0..bfc5789 100644 --- a/src/sj/LoadingScene.d +++ b/src/sj/LoadingScene.d @@ -35,7 +35,7 @@ class LoadingScene : SceneInterface { } /// - void Initialize(Music music, float offset_beat = 0) { + void Initialize(Music music, float offset_beat) { music_ = music; offset_beat_ = offset_beat; diff --git a/src/sj/Music.d b/src/sj/Music.d index f763c12..902a855 100644 --- a/src/sj/Music.d +++ b/src/sj/Music.d @@ -66,7 +66,7 @@ class Music { /// void PlayForGame(float offset_beat) { sfMusic_setPlayingOffset(music_, - sfMilliseconds((offset_beat*bpm_ / 60f / 1e-6f).to!int)); + sfMilliseconds((offset_beat / bpm_ * 60f * 1000f).to!int)); sfMusic_play(music_); } /// diff --git a/src/sj/PlayScene.d b/src/sj/PlayScene.d index 150d18f..3049aa6 100644 --- a/src/sj/PlayScene.d +++ b/src/sj/PlayScene.d @@ -35,7 +35,7 @@ class PlayScene : SceneInterface { } /// - void Initialize(Music music, sjplayer.Context context, float offset_beat = 0) { + void Initialize(Music music, sjplayer.Context context, float offset_beat) { music_ = music; context_ = context; diff --git a/src/sj/SelectScene.d b/src/sj/SelectScene.d index 8a789ed..9ad3ffc 100644 --- a/src/sj/SelectScene.d +++ b/src/sj/SelectScene.d @@ -389,7 +389,7 @@ private class MusicPlayState : AbstractSceneState { if (anime_.isFinished) { music_.StopPlaying(); - owner.load_scene_.Initialize(music_); + owner.load_scene_.Initialize(music_, 0); return CreateResult(owner.load_scene_); } return CreateResult(this);