Skip to content

Commit dbce582

Browse files
committed
[AlphaDream] Init tracks with proper values
1 parent 038ee72 commit dbce582

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

VG Music Studio/Core/GBA/AlphaDream/Commands.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,10 @@ internal class RestCommand : ICommand
8686

8787
public byte Rest { get; set; }
8888
}
89-
internal class TempoCommand : ICommand
89+
internal class TrackTempoCommand : ICommand
9090
{
9191
public Color Color => Color.DeepSkyBlue;
92-
public string Label => "Tempo";
92+
public string Label => "Track Tempo";
9393
public string Arguments => Tempo.ToString();
9494

9595
public byte Tempo { get; set; }

VG Music Studio/Core/GBA/AlphaDream/Player.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ void AddEvent(ICommand command)
251251
byte tempoArg = _config.Reader.ReadByte();
252252
if (!EventExists(offset))
253253
{
254-
AddEvent(new TempoCommand { Tempo = tempoArg });
254+
AddEvent(new TrackTempoCommand { Tempo = tempoArg });
255255
}
256256
break;
257257
}
@@ -552,7 +552,7 @@ private void ExecuteNext(Track track, ref bool update)
552552
track.DataOffset += ofs;
553553
break;
554554
}
555-
case 0xF9: // Tempo
555+
case 0xF9: // Track Tempo
556556
{
557557
_tempo = _config.ROM[track.DataOffset++];
558558
break;

VG Music Studio/Core/GBA/AlphaDream/Track.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,18 +31,21 @@ public Track(byte i, Mixer mixer)
3131
Type = i >= 8 ? i % 2 == 0 ? "Square 1" : "Square 2" : "PCM8";
3232
Channel = i >= 8 ? (Channel)new SquareChannel(mixer) : new PCMChannel(mixer);
3333
}
34+
// 0x819B040
3435
public void Init()
3536
{
3637
Voice = 0;
37-
Rest = 0;
38+
Rest = 1; // Unsure why Rest starts at 1
3839
PitchBendRange = 2;
3940
NoteDuration = 0;
4041
PitchBend = 0;
41-
Panpot = 0;
42+
Panpot = 0; // Start centered; ROM sets this to 0x7F since it's unsigned there
4243
DataOffset = StartOffset;
4344
Stopped = false;
44-
Volume = 0x7F;
45+
Volume = 200;
4546
PrevCommand = 0xFF;
47+
//Tempo = 120;
48+
//TempoStack = 0;
4649
}
4750
public void Tick()
4851
{

0 commit comments

Comments
 (0)