Skip to content

Commit d6ea540

Browse files
authored
Merge pull request #99 from Project-Funk-Engine/loop-fix-attempts
Loop fix
2 parents f984030 + 6635486 commit d6ea540

File tree

11 files changed

+11
-27
lines changed

11 files changed

+11
-27
lines changed

Audio/Song1.ogg

143 KB
Binary file not shown.

Audio/Song1.ogg.import

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
importer="oggvorbisstr"
44
type="AudioStreamOggVorbis"
5-
uid="uid://iq0xxe5cggs8"
5+
uid="uid://be5ial13ynf3o"
66
path="res://.godot/imported/Song1.ogg-1d785b9ae3fbaa8393048e39af66ed86.oggvorbisstr"
77

88
[deps]

Audio/Song2.ogg

58 KB
Binary file not shown.

Audio/Song2.ogg.import

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
importer="oggvorbisstr"
44
type="AudioStreamOggVorbis"
5-
uid="uid://ckis6k6vuums"
5+
uid="uid://dxp7blovqh1ba"
66
path="res://.godot/imported/Song2.ogg-b95c04f3512de6fa42e0f9c35aba831f.oggvorbisstr"
77

88
[deps]

Audio/Song3.ogg

12.8 KB
Binary file not shown.

Audio/Song3.ogg.import

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
importer="oggvorbisstr"
44
type="AudioStreamOggVorbis"
5-
uid="uid://ceyw5mjkem2pi"
5+
uid="uid://d4nmixdl8xoic"
66
path="res://.godot/imported/Song3.ogg-d4e6a5f1a550561df18989fb495ba591.oggvorbisstr"
77

88
[deps]

Audio/midi/Song2.mid

-10 Bytes
Binary file not shown.

Classes/MidiMaestro/MidiMaestro.cs

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ public partial class MidiMaestro : Resource
1818

1919
//private MidiFile strippedSong;
2020

21-
private SongData songData;
22-
2321
//The path relative to the Audio folder. Will change later
2422
public MidiMaestro(string filePath)
2523
{
@@ -60,19 +58,6 @@ public MidiMaestro(string filePath)
6058
break;
6159
}
6260
}
63-
64-
//Populate the song data
65-
songData = new SongData
66-
{
67-
//TODO: Allow for changes in this data
68-
Bpm = 120,
69-
//Fudge the numbers a bit if we have a really short song
70-
SongLength =
71-
_midiFile.GetDuration<MetricTimeSpan>().Seconds < 20
72-
? 20
73-
: _midiFile.GetDuration<MetricTimeSpan>().Seconds,
74-
NumLoops = 1,
75-
};
7661
}
7762

7863
public midiNoteInfo[] GetNotes(ArrowType arrowType)
@@ -86,11 +71,6 @@ public midiNoteInfo[] GetNotes(ArrowType arrowType)
8671
_ => throw new ArgumentOutOfRangeException(nameof(arrowType), arrowType, null),
8772
};
8873
}
89-
90-
public SongData GetSongData()
91-
{
92-
return songData;
93-
}
9474
}
9575

9676
//A facade to wrap the midi notes. This is a simple class that wraps a Note object from the DryWetMidi library.

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ Current team members include:
1818
#### Attributions:
1919
Music:
2020
- Title Screen: [Crystal Cave - Cynicmusic](https://opengameart.org/content/crystal-cave-song18)
21-
- Battle Song 1: [gameMusic - Magntron](https://freesound.org/people/Magntron/sounds/335571/)
21+
- Boss Song 1: [gameMusic - Magntron](https://freesound.org/people/Magntron/sounds/335571/)
22+
- Battle Song 1: [Piano loops 181 - josefpres](https://freesound.org/people/josefpres/sounds/789998/)
23+
- Battle Song 2: [Dark loops 220 - josefpres](https://freesound.org/people/josefpres/sounds/620230/)
2224

2325
Images:
2426
- Input Buttons: [inputKeys - Nicolae (Xelu) Berbece](https://thoseawesomeguys.com/prompts/)

scenes/ChartViewport/scripts/ChartManager.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ public partial class ChartManager : SubViewportContainer
2828
//Might move this to be song specific? For now, should never go below ~2000, else visual break because there isn't enough room to loop.
2929
private double ChartLength = 5000;
3030
private double _loopLen; //secs
31+
public double TrueBeatsPerLoop;
3132
public int BeatsPerLoop;
3233

3334
public void OnNotePressed(ArrowType type)
@@ -44,7 +45,8 @@ public void PrepChart(SongData songData)
4445
{
4546
_loopLen = songData.SongLength / songData.NumLoops;
4647
TimeKeeper.LoopLength = (float)_loopLen;
47-
BeatsPerLoop = (int)(_loopLen / (60f / songData.Bpm));
48+
TrueBeatsPerLoop = (_loopLen / (60f / songData.Bpm));
49+
BeatsPerLoop = (int)TrueBeatsPerLoop;
4850
ChartLength = (float)_loopLen * (float)Math.Floor(ChartLength / _loopLen);
4951
TimeKeeper.ChartLength = (float)ChartLength;
5052
TimeKeeper.Bpm = songData.Bpm;
@@ -112,7 +114,7 @@ private NoteArrow CreateNote(ArrowType arrow, Note note, int beat = 0)
112114
newArrow.OutlineSprite.Modulate = IH.Arrows[(int)arrow].Color;
113115

114116
_arrowGroup.AddChild(newArrow);
115-
newArrow.Bounds = (float)((double)beat / BeatsPerLoop * (ChartLength / 2));
117+
newArrow.Bounds = (float)(beat / TrueBeatsPerLoop * (ChartLength / 2));
116118
newArrow.Position += Vector2.Right * newArrow.Bounds * 10; //temporary fix for notes spawning and instantly calling loop from originating at 0,0
117119
return newArrow;
118120
}

0 commit comments

Comments
 (0)