Commit 96fccea

Nick committed on
WIP Playback improvements
commit 96fccea67286ead375ed5d142884b757b699c9ce parent a6b4472
6 changed files +38−37
Modifiedconstants.pas +1−0
@@ -16,6 +16,7 @@ type
16 const 16 const
17 SYM_ROW = 'row'; 17 SYM_ROW = 'row';
18 SYM_CURRENT_ORDER = 'current_order'; 18 SYM_CURRENT_ORDER = 'current_order';
19 SYM_TICKS_PER_ROW = 'ticks_per_row';
19 20
20 // Sound controller registers 21 // Sound controller registers
21 NR10 = $FF10; 22 NR10 = $FF10;
Modifiedemulationthread.pas +5−13
@@ -11,19 +11,19 @@ type
11 { TEmulationThread } 11 { TEmulationThread }
12 12
13 TEmulationThread = class(TThread) 13 TEmulationThread = class(TThread)
14 private
15 ET: TEpikTimer;
16 protected 14 protected
17 procedure Execute; override; 15 procedure Execute; override;
18 public 16 public
19 Constructor Create(ROM: String); 17 Constructor Create(ROM: String);
20 destructor Destroy; override;
21 end; 18 end;
22 19
23 implementation 20 implementation
24 21
25 uses sound, mainloop, vars, machine; 22 uses sound, mainloop, vars, machine;
26 23
24 var
25 ET: TEpikTimer;
26
27 const 27 const
28 CyclesPerFrame : Integer = 70224; 28 CyclesPerFrame : Integer = 70224;
29 TimePerFrame: Double = 1.0 / 60.0; 29 TimePerFrame: Double = 1.0 / 60.0;
@@ -38,8 +38,6 @@ begin
38 Result := Trunc(ET.Elapsed*1000000); // Convert to microseconds 38 Result := Trunc(ET.Elapsed*1000000); // Convert to microseconds
39 end; 39 end;
40 begin 40 begin
41 ET.Start;
42
43 lastTime := 0; 41 lastTime := 0;
44 42
45 cycles := 0; 43 cycles := 0;
@@ -70,17 +68,11 @@ begin
70 ResetSound; 68 ResetSound;
71 enablesound; 69 enablesound;
72 70
73 ET := TEpikTimer.Create(nil);
74
75 load(ROM); 71 load(ROM);
76 end; 72 end;
77 73
78 destructor TEmulationThread.Destroy;
79 begin 74 begin
80 inherited Destroy; 75 ET := TEpikTimer.Create(nil);
81 76 ET.Start;
82 ET.Free;
83 end;
84
85 end. 77 end.
86 78
Modifiedsymparser.pas +0−2
@@ -28,8 +28,6 @@ begin
28 // Drop the first two lines 28 // Drop the first two lines
29 SL.Delete(0); 29 SL.Delete(0);
30 SL.Delete(0); 30 SL.Delete(0);
31 // Drop the last line
32 SL.Delete(SL.Count-1);
33 31
34 for S in SL do begin 32 for S in SL do begin
35 SA := S.Split(' '); 33 SA := S.Split(' ');
Modifiedtracker.lfm +20−20
@@ -1,7 +1,7 @@
1 object frmTracker: TfrmTracker 1 object frmTracker: TfrmTracker
2 Left = 1206 2 Left = 798
3 Height = 1376 3 Height = 1376
4 Top = 306 4 Top = 193
5 Width = 2212 5 Width = 2212
6 Caption = 'hUGETracker' 6 Caption = 'hUGETracker'
7 ClientHeight = 1342 7 ClientHeight = 1342
@@ -127,11 +127,11 @@ object frmTracker: TfrmTracker
127 Top = 128 127 Top = 128
128 Width = 88 128 Width = 88
129 MaxValue = 20 129 MaxValue = 20
130 MinValue = 1 130 MinValue = 7
131 OnChange = TicksPerRowSpinEditChange 131 OnChange = TicksPerRowSpinEditChange
132 ParentFont = False 132 ParentFont = False
133 TabOrder = 2 133 TabOrder = 2
134 Value = 1 134 Value = 7
135 end 135 end
136 end 136 end
137 end 137 end
@@ -1806,7 +1806,7 @@ object frmTracker: TfrmTracker
1806 ParentShowHint = False 1806 ParentShowHint = False
1807 end 1807 end
1808 object PanicToolButton: TToolButton 1808 object PanicToolButton: TToolButton
1809 Left = 551 1809 Left = 428
1810 Hint = 'Stops all sound output' 1810 Hint = 'Stops all sound output'
1811 Top = 0 1811 Top = 0
1812 AutoSize = True 1812 AutoSize = True
@@ -1817,21 +1817,21 @@ object frmTracker: TfrmTracker
1817 ShowHint = True 1817 ShowHint = True
1818 end 1818 end
1819 object ToolButton2: TToolButton 1819 object ToolButton2: TToolButton
1820 Left = 171 1820 Left = 169
1821 Top = 0 1821 Top = 0
1822 Caption = 'Pause/Resume' 1822 Caption = '⏯'
1823 ImageIndex = 75 1823 ImageIndex = 75
1824 OnClick = ToolButton2Click 1824 OnClick = ToolButton2Click
1825 end 1825 end
1826 object ToolButton4: TToolButton 1826 object ToolButton4: TToolButton
1827 Left = 334 1827 Left = 224
1828 Top = 0 1828 Top = 0
1829 Caption = 'Stop' 1829 Caption = '⏹️'
1830 ImageIndex = 73 1830 ImageIndex = 73
1831 OnClick = ToolButton4Click 1831 OnClick = ToolButton4Click
1832 end 1832 end
1833 object ToolButton5: TToolButton 1833 object ToolButton5: TToolButton
1834 Left = 407 1834 Left = 284
1835 Top = 0 1835 Top = 0
1836 AutoSize = True 1836 AutoSize = True
1837 Caption = 'Export song' 1837 Caption = 'Export song'
@@ -1846,21 +1846,21 @@ object frmTracker: TfrmTracker
1846 Style = tbsDivider 1846 Style = tbsDivider
1847 end 1847 end
1848 object ToolButton6: TToolButton 1848 object ToolButton6: TToolButton
1849 Left = 402 1849 Left = 279
1850 Height = 39 1850 Height = 39
1851 Top = 0 1851 Top = 0
1852 Caption = 'ToolButton6' 1852 Caption = 'ToolButton6'
1853 Style = tbsDivider 1853 Style = tbsDivider
1854 end 1854 end
1855 object ToolButton7: TToolButton 1855 object ToolButton7: TToolButton
1856 Left = 543 1856 Left = 420
1857 Height = 39 1857 Height = 39
1858 Top = 0 1858 Top = 0
1859 Caption = 'ToolButton7' 1859 Caption = 'ToolButton7'
1860 Style = tbsSeparator 1860 Style = tbsSeparator
1861 end 1861 end
1862 object SpinEdit1: TSpinEdit 1862 object SpinEdit1: TSpinEdit
1863 Left = 712 1863 Left = 589
1864 Height = 38 1864 Height = 38
1865 Top = 0 1865 Top = 0
1866 Width = 158 1866 Width = 158
@@ -1869,14 +1869,14 @@ object frmTracker: TfrmTracker
1869 TabOrder = 0 1869 TabOrder = 0
1870 end 1870 end
1871 object ToolButton9: TToolButton 1871 object ToolButton9: TToolButton
1872 Left = 627 1872 Left = 504
1873 Height = 39 1873 Height = 39
1874 Top = 0 1874 Top = 0
1875 Caption = 'ToolButton9' 1875 Caption = 'ToolButton9'
1876 Style = tbsSeparator 1876 Style = tbsSeparator
1877 end 1877 end
1878 object Label22: TLabel 1878 object Label22: TLabel
1879 Left = 635 1879 Left = 512
1880 Height = 30 1880 Height = 30
1881 Top = 0 1881 Top = 0
1882 Width = 77 1882 Width = 77
@@ -1884,7 +1884,7 @@ object frmTracker: TfrmTracker
1884 ParentColor = False 1884 ParentColor = False
1885 end 1885 end
1886 object Label23: TLabel 1886 object Label23: TLabel
1887 Left = 870 1887 Left = 747
1888 Height = 30 1888 Height = 30
1889 Top = 0 1889 Top = 0
1890 Width = 125 1890 Width = 125
@@ -1892,7 +1892,7 @@ object frmTracker: TfrmTracker
1892 ParentColor = False 1892 ParentColor = False
1893 end 1893 end
1894 object ComboBox1: TComboBox 1894 object ComboBox1: TComboBox
1895 Left = 995 1895 Left = 872
1896 Height = 38 1896 Height = 38
1897 Top = 0 1897 Top = 0
1898 Width = 375 1898 Width = 375
@@ -1922,7 +1922,7 @@ object frmTracker: TfrmTracker
1922 Text = '(no instrument)' 1922 Text = '(no instrument)'
1923 end 1923 end
1924 object Label24: TLabel 1924 object Label24: TLabel
1925 Left = 1370 1925 Left = 1247
1926 Height = 30 1926 Height = 30
1927 Top = 0 1927 Top = 0
1928 Width = 64 1928 Width = 64
@@ -1930,7 +1930,7 @@ object frmTracker: TfrmTracker
1930 ParentColor = False 1930 ParentColor = False
1931 end 1931 end
1932 object SpinEdit2: TSpinEdit 1932 object SpinEdit2: TSpinEdit
1933 Left = 1434 1933 Left = 1311
1934 Height = 38 1934 Height = 38
1935 Top = 0 1935 Top = 0
1936 Width = 88 1936 Width = 88
@@ -1941,7 +1941,7 @@ object frmTracker: TfrmTracker
1941 object ToolButton3: TToolButton 1941 object ToolButton3: TToolButton
1942 Left = 125 1942 Left = 125
1943 Top = 0 1943 Top = 0
1944 Caption = 'Play' 1944 Caption = '▶️'
1945 ImageIndex = 74 1945 ImageIndex = 74
1946 OnClick = ToolButton3Click 1946 OnClick = ToolButton3Click
1947 end 1947 end
Modifiedtracker.pas +9−0
@@ -515,6 +515,7 @@ begin
515 EmulationThread.WaitFor; 515 EmulationThread.WaitFor;
516 EmulationThread.Free; 516 EmulationThread.Free;
517 EmulationThread := TEmulationThread.Create('hUGEDriver/preview.gb'); 517 EmulationThread := TEmulationThread.Create('hUGEDriver/preview.gb');
518 PokeSymbol(SYM_TICKS_PER_ROW, Song.TicksPerRow);
518 519
519 Result := True; 520 Result := True;
520 end 521 end
@@ -540,6 +541,7 @@ end;
540 procedure TfrmTracker.OnFD; 541 procedure TfrmTracker.OnFD;
541 begin 542 begin
542 TrackerGrid.HighlightedRow:=PeekSymbol(SYM_ROW); 543 TrackerGrid.HighlightedRow:=PeekSymbol(SYM_ROW);
544
543 end; 545 end;
544 546
545 procedure TfrmTracker.RecreateTrackerGrid; 547 procedure TfrmTracker.RecreateTrackerGrid;
@@ -748,6 +750,9 @@ begin
748 Song.Patterns := TPatternMap.Create; 750 Song.Patterns := TPatternMap.Create;
749 RecreateTrackerGrid; 751 RecreateTrackerGrid;
750 752
753 // Initialize ticks per row
754 Song.TicksPerRow := TicksPerRowSpinEdit.Value;
755
751 // Fix the size of the channel headers 756 // Fix the size of the channel headers
752 for Section in HeaderControl1.Sections do 757 for Section in HeaderControl1.Sections do
753 (Section as THeaderSection).Width := TrackerGrid.ColumnWidth; 758 (Section as THeaderSection).Width := TrackerGrid.ColumnWidth;
@@ -1181,6 +1186,10 @@ procedure TfrmTracker.ToolButton3Click(Sender: TObject);
1181 begin 1186 begin
1182 if PreparePreview then begin 1187 if PreparePreview then begin
1183 Playing := True; 1188 Playing := True;
1189
1190 PokeSymbol(SYM_CURRENT_ORDER, 2*(OrderEditStringGrid.Row-1));
1191 PokeSymbol(SYM_ROW, TrackerGrid.Cursor.Y);
1192
1184 EmulationThread.Start; 1193 EmulationThread.Start;
1185 end; 1194 end;
1186 end; 1195 end;
Modifiedtrackergrid.pas +3−2
@@ -614,8 +614,9 @@ begin
614 614
615 for R := Cursor.Y to Other.Y do 615 for R := Cursor.Y to Other.Y do
616 for C := Cursor.X to Other.X do 616 for C := Cursor.X to Other.X do
617 Patterns[C]^[R].Note := 617 if Patterns[C]^[R].Note <> NO_NOTE then
618 Max(LOWEST_NOTE, Min(HIGHEST_NOTE, Patterns[C]^[R].Note + Semitones)); 618 Patterns[C]^[R].Note :=
619 Max(LOWEST_NOTE, Min(HIGHEST_NOTE, Patterns[C]^[R].Note + Semitones));
619 620
620 Invalidate; 621 Invalidate;
621 SaveUndoState; 622 SaveUndoState;