Commit a6b4472

Nick committed on
WIP cursor position playing
commit a6b44725662ee33b2346b8ffdf5e7800b4c760a0 parent 6828e42
5 changed files +319−122
ModifiedGBEmu.lpi +15−12
@@ -43,40 +43,43 @@
43 </Mode0> 43 </Mode0>
44 </Modes> 44 </Modes>
45 </RunParams> 45 </RunParams>
46 <RequiredPackages Count="11"> 46 <RequiredPackages Count="12">
47 <Item1> 47 <Item1>
48 <PackageName Value="etpackage"/> 48 <PackageName Value="laz_acs_lib"/>
49 </Item1> 49 </Item1>
50 <Item2> 50 <Item2>
51 <PackageName Value="LazColorPalette"/> 51 <PackageName Value="etpackage"/>
52 </Item2> 52 </Item2>
53 <Item3> 53 <Item3>
54 <PackageName Value="RackCtlsPkg"/> 54 <PackageName Value="LazColorPalette"/>
55 </Item3> 55 </Item3>
56 <Item4> 56 <Item4>
57 <PackageName Value="laz_fpspreadsheet_visual"/> 57 <PackageName Value="RackCtlsPkg"/>
58 </Item4> 58 </Item4>
59 <Item5> 59 <Item5>
60 <PackageName Value="RunTimeTypeInfoControls"/> 60 <PackageName Value="laz_fpspreadsheet_visual"/>
61 </Item5> 61 </Item5>
62 <Item6> 62 <Item6>
63 <PackageName Value="virtualtreeview_package"/> 63 <PackageName Value="RunTimeTypeInfoControls"/>
64 </Item6> 64 </Item6>
65 <Item7> 65 <Item7>
66 <PackageName Value="SynEdit"/> 66 <PackageName Value="virtualtreeview_package"/>
67 </Item7> 67 </Item7>
68 <Item8> 68 <Item8>
69 <PackageName Value="eccontrols"/> 69 <PackageName Value="SynEdit"/>
70 </Item8> 70 </Item8>
71 <Item9> 71 <Item9>
72 <PackageName Value="LazControls"/> 72 <PackageName Value="eccontrols"/>
73 </Item9> 73 </Item9>
74 <Item10> 74 <Item10>
75 <PackageName Value="BGRABitmapPack"/> 75 <PackageName Value="LazControls"/>
76 </Item10> 76 </Item10>
77 <Item11> 77 <Item11>
78 <PackageName Value="LCL"/> 78 <PackageName Value="BGRABitmapPack"/>
79 </Item11> 79 </Item11>
80 <Item12>
81 <PackageName Value="LCL"/>
82 </Item12>
80 </RequiredPackages> 83 </RequiredPackages>
81 <Units Count="22"> 84 <Units Count="22">
82 <Unit0> 85 <Unit0>
Modifiedconstants.pas +37−34
@@ -15,6 +15,7 @@ type
15 15
16 const 16 const
17 SYM_ROW = 'row'; 17 SYM_ROW = 'row';
18 SYM_CURRENT_ORDER = 'current_order';
18 19
19 // Sound controller registers 20 // Sound controller registers
20 NR10 = $FF10; 21 NR10 = $FF10;
@@ -36,6 +37,7 @@ const
36 NR43 = $FF22; 37 NR43 = $FF22;
37 NR44 = $FF23; 38 NR44 = $FF23;
38 39
40 LOWEST_NOTE = 0;
39 C_3 = 0; 41 C_3 = 0;
40 Cs3 = 1; 42 Cs3 = 1;
41 D_3 = 2; 43 D_3 = 2;
@@ -108,6 +110,7 @@ const
108 A_8 = 69; 110 A_8 = 69;
109 As8 = 70; 111 As8 = 70;
110 B_8 = 71; 112 B_8 = 71;
113 HIGHEST_NOTE = 71;
111 LAST_NOTE = 72; 114 LAST_NOTE = 72;
112 NO_NOTE = 90; 115 NO_NOTE = 90;
113 116
@@ -212,40 +215,40 @@ begin
212 NotesToFreqs := TNoteToFreqMap.Create; 215 NotesToFreqs := TNoteToFreqMap.Create;
213 NoteToCodeMap := TNoteToCodeMap.Create; 216 NoteToCodeMap := TNoteToCodeMap.Create;
214 217
215 Keybindings.Add(VK_Q, C_4); 218 Keybindings.Add(VK_Q, C_3);
216 Keybindings.Add(VK_W, CS4); 219 Keybindings.Add(VK_W, CS3);
217 Keybindings.Add(VK_E, D_4); 220 Keybindings.Add(VK_E, D_3);
218 Keybindings.Add(VK_R, DS4); 221 Keybindings.Add(VK_R, DS3);
219 Keybindings.Add(VK_T, E_4); 222 Keybindings.Add(VK_T, E_3);
220 Keybindings.Add(VK_Y, F_4); 223 Keybindings.Add(VK_Y, F_3);
221 Keybindings.Add(VK_U, FS4); 224 Keybindings.Add(VK_U, FS3);
222 Keybindings.Add(VK_I, G_4); 225 Keybindings.Add(VK_I, G_3);
223 Keybindings.Add(VK_O, GS4); 226 Keybindings.Add(VK_O, GS3);
224 Keybindings.Add(VK_P, A_4); 227 Keybindings.Add(VK_P, A_3);
225 Keybindings.Add(VK_OEM_4, AS4); 228 Keybindings.Add(VK_OEM_4, AS3);
226 Keybindings.Add(VK_OEM_6, B_4); 229 Keybindings.Add(VK_OEM_6, B_3);
227 Keybindings.Add(VK_OEM_5, B_5); 230 Keybindings.Add(VK_OEM_5, B_4);
228 Keybindings.Add(VK_A, C_5); 231 Keybindings.Add(VK_A, C_4);
229 Keybindings.Add(VK_S, CS5); 232 Keybindings.Add(VK_S, CS4);
230 Keybindings.Add(VK_D, D_5); 233 Keybindings.Add(VK_D, D_4);
231 Keybindings.Add(VK_F, DS5); 234 Keybindings.Add(VK_F, DS4);
232 Keybindings.Add(VK_G, E_5); 235 Keybindings.Add(VK_G, E_4);
233 Keybindings.Add(VK_H, F_5); 236 Keybindings.Add(VK_H, F_4);
234 Keybindings.Add(VK_J, FS5); 237 Keybindings.Add(VK_J, FS4);
235 Keybindings.Add(VK_K, G_5); 238 Keybindings.Add(VK_K, G_4);
236 Keybindings.Add(VK_L, GS5); 239 Keybindings.Add(VK_L, GS4);
237 Keybindings.Add(VK_OEM_1, A_5); 240 Keybindings.Add(VK_OEM_1, A_4);
238 Keybindings.Add(VK_OEM_7, AS5); 241 Keybindings.Add(VK_OEM_7, AS4);
239 Keybindings.Add(VK_Z, C_6); 242 Keybindings.Add(VK_Z, C_5);
240 Keybindings.Add(VK_X, CS6); 243 Keybindings.Add(VK_X, CS5);
241 Keybindings.Add(VK_C, D_6); 244 Keybindings.Add(VK_C, D_5);
242 Keybindings.Add(VK_V, DS6); 245 Keybindings.Add(VK_V, DS5);
243 Keybindings.Add(VK_B, E_6); 246 Keybindings.Add(VK_B, E_5);
244 Keybindings.Add(VK_N, F_6); 247 Keybindings.Add(VK_N, F_5);
245 Keybindings.Add(VK_M, FS6); 248 Keybindings.Add(VK_M, FS5);
246 Keybindings.Add(VK_OEM_COMMA, G_6); 249 Keybindings.Add(VK_OEM_COMMA, G_5);
247 Keybindings.Add(VK_OEM_PERIOD, GS6); 250 Keybindings.Add(VK_OEM_PERIOD, GS5);
248 Keybindings.Add(VK_OEM_2, A_6); 251 Keybindings.Add(VK_OEM_2, A_5);
249 252
250 NoteToCodeMap.add('C-3', C_3); 253 NoteToCodeMap.add('C-3', C_3);
251 NoteToCodeMap.add('C#3', Cs3); 254 NoteToCodeMap.add('C#3', Cs3);
Modifiedtracker.lfm +129−42
@@ -1,10 +1,10 @@
1 object frmTracker: TfrmTracker 1 object frmTracker: TfrmTracker
2 Left = 802 2 Left = 1206
3 Height = 1396 3 Height = 1376
4 Top = 180 4 Top = 306
5 Width = 2212 5 Width = 2212
6 Caption = 'hUGETracker' 6 Caption = 'hUGETracker'
7 ClientHeight = 1362 7 ClientHeight = 1342
8 ClientWidth = 2212 8 ClientWidth = 2212
9 DesignTimePPI = 168 9 DesignTimePPI = 168
10 Menu = MainMenu1 10 Menu = MainMenu1
@@ -15,7 +15,7 @@ object frmTracker: TfrmTracker
15 LCLVersion = '2.0.6.0' 15 LCLVersion = '2.0.6.0'
16 object TreeView1: TTreeView 16 object TreeView1: TTreeView
17 Left = 0 17 Left = 0
18 Height = 966 18 Height = 946
19 Top = 353 19 Top = 353
20 Width = 338 20 Width = 338
21 Align = alLeft 21 Align = alLeft
@@ -33,34 +33,34 @@ object frmTracker: TfrmTracker
33 end 33 end
34 object Splitter1: TSplitter 34 object Splitter1: TSplitter
35 Left = 338 35 Left = 338
36 Height = 966 36 Height = 946
37 Top = 353 37 Top = 353
38 Width = 9 38 Width = 9
39 end 39 end
40 object Panel1: TPanel 40 object Panel1: TPanel
41 Left = 347 41 Left = 347
42 Height = 966 42 Height = 946
43 Top = 353 43 Top = 353
44 Width = 1865 44 Width = 1865
45 Align = alClient 45 Align = alClient
46 BevelOuter = bvNone 46 BevelOuter = bvNone
47 ClientHeight = 966 47 ClientHeight = 946
48 ClientWidth = 1865 48 ClientWidth = 1865
49 ParentFont = False 49 ParentFont = False
50 TabOrder = 2 50 TabOrder = 2
51 object PageControl1: TPageControl 51 object PageControl1: TPageControl
52 Left = 0 52 Left = 0
53 Height = 966 53 Height = 946
54 Top = 0 54 Top = 0
55 Width = 1865 55 Width = 1865
56 ActivePage = InstrumentTabSheet 56 ActivePage = PatternTabSheet
57 Align = alClient 57 Align = alClient
58 ParentFont = False 58 ParentFont = False
59 TabIndex = 2 59 TabIndex = 1
60 TabOrder = 0 60 TabOrder = 0
61 object GeneralTabSheet: TTabSheet 61 object GeneralTabSheet: TTabSheet
62 Caption = 'General' 62 Caption = 'General'
63 ClientHeight = 923 63 ClientHeight = 903
64 ClientWidth = 1857 64 ClientWidth = 1857
65 ParentFont = False 65 ParentFont = False
66 object SongInformationGroupbox: TGroupBox 66 object SongInformationGroupbox: TGroupBox
@@ -137,16 +137,16 @@ object frmTracker: TfrmTracker
137 end 137 end
138 object PatternTabSheet: TTabSheet 138 object PatternTabSheet: TTabSheet
139 Caption = 'Patterns' 139 Caption = 'Patterns'
140 ClientHeight = 923 140 ClientHeight = 903
141 ClientWidth = 1857 141 ClientWidth = 1857
142 ParentFont = False 142 ParentFont = False
143 object Panel3: TPanel 143 object Panel3: TPanel
144 Left = 392 144 Left = 392
145 Height = 923 145 Height = 903
146 Top = 0 146 Top = 0
147 Width = 1465 147 Width = 1465
148 Align = alClient 148 Align = alClient
149 ClientHeight = 923 149 ClientHeight = 903
150 ClientWidth = 1465 150 ClientWidth = 1465
151 ParentFont = False 151 ParentFont = False
152 TabOrder = 0 152 TabOrder = 0
@@ -195,7 +195,7 @@ object frmTracker: TfrmTracker
195 end 195 end
196 object ScrollBox1: TScrollBox 196 object ScrollBox1: TScrollBox
197 Left = 1 197 Left = 1
198 Height = 869 198 Height = 849
199 Top = 53 199 Top = 53
200 Width = 1463 200 Width = 1463
201 HorzScrollBar.Increment = 1 201 HorzScrollBar.Increment = 1
@@ -214,7 +214,7 @@ object frmTracker: TfrmTracker
214 end 214 end
215 object OrderEditStringGrid: TStringGrid 215 object OrderEditStringGrid: TStringGrid
216 Left = 0 216 Left = 0
217 Height = 923 217 Height = 903
218 Top = 0 218 Top = 0
219 Width = 392 219 Width = 392
220 Align = alLeft 220 Align = alLeft
@@ -279,7 +279,7 @@ object frmTracker: TfrmTracker
279 end 279 end
280 object InstrumentTabSheet: TTabSheet 280 object InstrumentTabSheet: TTabSheet
281 Caption = 'Instruments' 281 Caption = 'Instruments'
282 ClientHeight = 923 282 ClientHeight = 903
283 ClientWidth = 1857 283 ClientWidth = 1857
284 ParentFont = False 284 ParentFont = False
285 object PaintBox1: TPaintBox 285 object PaintBox1: TPaintBox
@@ -287,7 +287,7 @@ object frmTracker: TfrmTracker
287 AnchorSideTop.Side = asrBottom 287 AnchorSideTop.Side = asrBottom
288 AnchorSideBottom.Side = asrBottom 288 AnchorSideBottom.Side = asrBottom
289 Left = 0 289 Left = 0
290 Height = 341 290 Height = 321
291 Hint = 'Preview of how the resulting waveform will look with envelope applied' 291 Hint = 'Preview of how the resulting waveform will look with envelope applied'
292 Top = 582 292 Top = 582
293 Width = 1857 293 Width = 1857
@@ -1071,14 +1071,14 @@ object frmTracker: TfrmTracker
1071 end 1071 end
1072 object WavesTabSheet: TTabSheet 1072 object WavesTabSheet: TTabSheet
1073 Caption = 'Waves' 1073 Caption = 'Waves'
1074 ClientHeight = 923 1074 ClientHeight = 903
1075 ClientWidth = 1857 1075 ClientWidth = 1857
1076 ParentFont = False 1076 ParentFont = False
1077 object WaveEditPaintBox: TPaintBox 1077 object WaveEditPaintBox: TPaintBox
1078 AnchorSideTop.Control = WaveEditGroupBox 1078 AnchorSideTop.Control = WaveEditGroupBox
1079 AnchorSideTop.Side = asrBottom 1079 AnchorSideTop.Side = asrBottom
1080 Left = 0 1080 Left = 0
1081 Height = 643 1081 Height = 623
1082 Top = 280 1082 Top = 280
1083 Width = 1857 1083 Width = 1857
1084 Align = alBottom 1084 Align = alBottom
@@ -1143,14 +1143,14 @@ object frmTracker: TfrmTracker
1143 end 1143 end
1144 object CommentsTabSheet: TTabSheet 1144 object CommentsTabSheet: TTabSheet
1145 Caption = 'Comments' 1145 Caption = 'Comments'
1146 ClientHeight = 923 1146 ClientHeight = 903
1147 ClientWidth = 1857 1147 ClientWidth = 1857
1148 ParentFont = False 1148 ParentFont = False
1149 object CommentMemo: TMemo 1149 object CommentMemo: TMemo
1150 AnchorSideTop.Control = Label17 1150 AnchorSideTop.Control = Label17
1151 AnchorSideTop.Side = asrBottom 1151 AnchorSideTop.Side = asrBottom
1152 Left = 0 1152 Left = 0
1153 Height = 856 1153 Height = 836
1154 Top = 67 1154 Top = 67
1155 Width = 1857 1155 Width = 1857
1156 Align = alBottom 1156 Align = alBottom
@@ -1172,16 +1172,16 @@ object frmTracker: TfrmTracker
1172 end 1172 end
1173 object RoutinesTabSheet: TTabSheet 1173 object RoutinesTabSheet: TTabSheet
1174 Caption = 'Routines' 1174 Caption = 'Routines'
1175 ClientHeight = 892 1175 ClientHeight = 903
1176 ClientWidth = 1587 1176 ClientWidth = 1857
1177 ParentFont = False 1177 ParentFont = False
1178 inline RoutineSynedit: TSynEdit 1178 inline RoutineSynedit: TSynEdit
1179 AnchorSideTop.Control = Label19 1179 AnchorSideTop.Control = Label19
1180 AnchorSideTop.Side = asrBottom 1180 AnchorSideTop.Side = asrBottom
1181 Left = 0 1181 Left = 0
1182 Height = 687 1182 Height = 660
1183 Top = 205 1183 Top = 243
1184 Width = 1587 1184 Width = 1857
1185 Align = alBottom 1185 Align = alBottom
1186 BorderSpacing.Top = 23 1186 BorderSpacing.Top = 23
1187 Anchors = [akTop, akLeft, akRight, akBottom] 1187 Anchors = [akTop, akLeft, akRight, akBottom]
@@ -1681,16 +1681,16 @@ object frmTracker: TfrmTracker
1681 end 1681 end
1682 object Label18: TLabel 1682 object Label18: TLabel
1683 Left = 14 1683 Left = 14
1684 Height = 25 1684 Height = 30
1685 Top = 28 1685 Top = 28
1686 Width = 60 1686 Width = 71
1687 Caption = 'Routine' 1687 Caption = 'Routine'
1688 ParentColor = False 1688 ParentColor = False
1689 ParentFont = False 1689 ParentFont = False
1690 end 1690 end
1691 object RoutineNumberSpinner: TSpinEdit 1691 object RoutineNumberSpinner: TSpinEdit
1692 Left = 112 1692 Left = 112
1693 Height = 33 1693 Height = 38
1694 Top = 14 1694 Top = 14
1695 Width = 308 1695 Width = 308
1696 MaxValue = 15 1696 MaxValue = 15
@@ -1702,9 +1702,9 @@ object frmTracker: TfrmTracker
1702 end 1702 end
1703 object Label19: TLabel 1703 object Label19: TLabel
1704 Left = 14 1704 Left = 14
1705 Height = 125 1705 Height = 150
1706 Top = 70 1706 Top = 70
1707 Width = 758 1707 Width = 891
1708 Caption = 'Routines are an advanced feature of hUGETracker, and you likely won''t need them at all'#13#10'if you are only interested in composing music. If you want to create a custom effect, or interface'#13#10'with game code that you''re writing a soundtrack for, then routines will come in handy.'#13#10#13#10'Refer to the user manual for more information!' 1708 Caption = 'Routines are an advanced feature of hUGETracker, and you likely won''t need them at all'#13#10'if you are only interested in composing music. If you want to create a custom effect, or interface'#13#10'with game code that you''re writing a soundtrack for, then routines will come in handy.'#13#10#13#10'Refer to the user manual for more information!'
1709 ParentColor = False 1709 ParentColor = False
1710 ParentFont = False 1710 ParentFont = False
@@ -1719,6 +1719,7 @@ object frmTracker: TfrmTracker
1719 Width = 2212 1719 Width = 2212
1720 Align = alTop 1720 Align = alTop
1721 BevelOuter = bvNone 1721 BevelOuter = bvNone
1722 ChildSizing.HorizontalSpacing = 10
1722 ClientHeight = 312 1723 ClientHeight = 312
1723 ClientWidth = 2212 1724 ClientWidth = 2212
1724 ParentFont = False 1725 ParentFont = False
@@ -1766,7 +1767,7 @@ object frmTracker: TfrmTracker
1766 object StatusBar1: TStatusBar 1767 object StatusBar1: TStatusBar
1767 Left = 0 1768 Left = 0
1768 Height = 43 1769 Height = 43
1769 Top = 1319 1770 Top = 1299
1770 Width = 2212 1771 Width = 2212
1771 AutoHint = True 1772 AutoHint = True
1772 Panels = < 1773 Panels = <
@@ -1805,7 +1806,7 @@ object frmTracker: TfrmTracker
1805 ParentShowHint = False 1806 ParentShowHint = False
1806 end 1807 end
1807 object PanicToolButton: TToolButton 1808 object PanicToolButton: TToolButton
1808 Left = 406 1809 Left = 551
1809 Hint = 'Stops all sound output' 1810 Hint = 'Stops all sound output'
1810 Top = 0 1811 Top = 0
1811 AutoSize = True 1812 AutoSize = True
@@ -1816,21 +1817,21 @@ object frmTracker: TfrmTracker
1816 ShowHint = True 1817 ShowHint = True
1817 end 1818 end
1818 object ToolButton2: TToolButton 1819 object ToolButton2: TToolButton
1819 Left = 125 1820 Left = 171
1820 Top = 0 1821 Top = 0
1821 Caption = 'Play' 1822 Caption = 'Pause/Resume'
1822 ImageIndex = 74 1823 ImageIndex = 75
1823 OnClick = ToolButton2Click 1824 OnClick = ToolButton2Click
1824 end 1825 end
1825 object ToolButton4: TToolButton 1826 object ToolButton4: TToolButton
1826 Left = 189 1827 Left = 334
1827 Top = 0 1828 Top = 0
1828 Caption = 'Stop' 1829 Caption = 'Stop'
1829 ImageIndex = 73 1830 ImageIndex = 73
1830 OnClick = ToolButton4Click 1831 OnClick = ToolButton4Click
1831 end 1832 end
1832 object ToolButton5: TToolButton 1833 object ToolButton5: TToolButton
1833 Left = 262 1834 Left = 407
1834 Top = 0 1835 Top = 0
1835 AutoSize = True 1836 AutoSize = True
1836 Caption = 'Export song' 1837 Caption = 'Export song'
@@ -1845,19 +1846,105 @@ object frmTracker: TfrmTracker
1845 Style = tbsDivider 1846 Style = tbsDivider
1846 end 1847 end
1847 object ToolButton6: TToolButton 1848 object ToolButton6: TToolButton
1848 Left = 257 1849 Left = 402
1849 Height = 39 1850 Height = 39
1850 Top = 0 1851 Top = 0
1851 Caption = 'ToolButton6' 1852 Caption = 'ToolButton6'
1852 Style = tbsDivider 1853 Style = tbsDivider
1853 end 1854 end
1854 object ToolButton7: TToolButton 1855 object ToolButton7: TToolButton
1855 Left = 398 1856 Left = 543
1856 Height = 39 1857 Height = 39
1857 Top = 0 1858 Top = 0
1858 Caption = 'ToolButton7' 1859 Caption = 'ToolButton7'
1859 Style = tbsSeparator 1860 Style = tbsSeparator
1860 end 1861 end
1862 object SpinEdit1: TSpinEdit
1863 Left = 712
1864 Height = 38
1865 Top = 0
1866 Width = 158
1867 MaxValue = 5
1868 OnChange = SpinEdit1Change
1869 TabOrder = 0
1870 end
1871 object ToolButton9: TToolButton
1872 Left = 627
1873 Height = 39
1874 Top = 0
1875 Caption = 'ToolButton9'
1876 Style = tbsSeparator
1877 end
1878 object Label22: TLabel
1879 Left = 635
1880 Height = 30
1881 Top = 0
1882 Width = 77
1883 Caption = 'Octave '
1884 ParentColor = False
1885 end
1886 object Label23: TLabel
1887 Left = 870
1888 Height = 30
1889 Top = 0
1890 Width = 125
1891 Caption = ' Instrument '
1892 ParentColor = False
1893 end
1894 object ComboBox1: TComboBox
1895 Left = 995
1896 Height = 38
1897 Top = 0
1898 Width = 375
1899 ItemHeight = 30
1900 ItemIndex = 0
1901 Items.Strings = (
1902 '(no instrument)'
1903 '1:'
1904 '2:'
1905 '3:'
1906 '4:'
1907 '5:'
1908 '6:'
1909 '7:'
1910 '8:'
1911 '9:'
1912 '10:'
1913 '11:'
1914 '12:'
1915 '13:'
1916 '14:'
1917 '15:'
1918 )
1919 OnChange = ComboBox1Change
1920 Style = csDropDownList
1921 TabOrder = 1
1922 Text = '(no instrument)'
1923 end
1924 object Label24: TLabel
1925 Left = 1370
1926 Height = 30
1927 Top = 0
1928 Width = 64
1929 Caption = ' Step '
1930 ParentColor = False
1931 end
1932 object SpinEdit2: TSpinEdit
1933 Left = 1434
1934 Height = 38
1935 Top = 0
1936 Width = 88
1937 MaxValue = 63
1938 OnChange = SpinEdit2Change
1939 TabOrder = 2
1940 end
1941 object ToolButton3: TToolButton
1942 Left = 125
1943 Top = 0
1944 Caption = 'Play'
1945 ImageIndex = 74
1946 OnClick = ToolButton3Click
1947 end
1861 end 1948 end
1862 object MainMenu1: TMainMenu 1949 object MainMenu1: TMainMenu
1863 Images = ImageList1 1950 Images = ImageList1
Modifiedtracker.pas +84−20
@@ -9,14 +9,19 @@ uses
9 Menus, Spin, StdCtrls, ActnList, StdActns, SynEdit, math, Instruments, Waves, 9 Menus, Spin, StdCtrls, ActnList, StdActns, SynEdit, math, Instruments, Waves,
10 Song, EmulationThread, Utils, Constants, sound, vars, machine, 10 Song, EmulationThread, Utils, Constants, sound, vars, machine,
11 about_hugetracker, TrackerGrid, lclintf, lmessages, Buttons, Grids, DBCtrls, 11 about_hugetracker, TrackerGrid, lclintf, lmessages, Buttons, Grids, DBCtrls,
12 ECProgressBar, HugeDatatypes, LCLType, RackCtls, Codegen, SymParser; 12 ECProgressBar, HugeDatatypes, LCLType, Codegen,
13 SymParser;
13 14
14 type 15 type
15 { TfrmTracker } 16 { TfrmTracker }
16 17
17 TfrmTracker = class(TForm) 18 TfrmTracker = class(TForm)
19 ComboBox1: TComboBox;
18 CutAction: TAction; 20 CutAction: TAction;
19 ImageList2: TImageList; 21 ImageList2: TImageList;
22 Label22: TLabel;
23 Label23: TLabel;
24 Label24: TLabel;
20 OrderEditStringGrid: TStringGrid; 25 OrderEditStringGrid: TStringGrid;
21 EditCut1: TEditCut; 26 EditCut1: TEditCut;
22 HeaderControl1: THeaderControl; 27 HeaderControl1: THeaderControl;
@@ -25,6 +30,10 @@ type
25 MenuItem19: TMenuItem; 30 MenuItem19: TMenuItem;
26 MenuItem20: TMenuItem; 31 MenuItem20: TMenuItem;
27 Duty1Visualizer: TPaintBox; 32 Duty1Visualizer: TPaintBox;
33 SpinEdit1: TSpinEdit;
34 SpinEdit2: TSpinEdit;
35 ToolButton3: TToolButton;
36 ToolButton9: TToolButton;
28 WaveVisualizer: TPaintBox; 37 WaveVisualizer: TPaintBox;
29 Duty2Visualizer: TPaintBox; 38 Duty2Visualizer: TPaintBox;
30 NoiseVisualizer: TPaintBox; 39 NoiseVisualizer: TPaintBox;
@@ -152,6 +161,7 @@ type
152 DivRatioSpinner: TECSpinPosition; 161 DivRatioSpinner: TECSpinPosition;
153 TreeView1: TTreeView; 162 TreeView1: TTreeView;
154 TrackerGrid: TTrackerGrid; 163 TrackerGrid: TTrackerGrid;
164 procedure ComboBox1Change(Sender: TObject);
155 procedure CopyActionExecute(Sender: TObject); 165 procedure CopyActionExecute(Sender: TObject);
156 procedure CutActionExecute(Sender: TObject); 166 procedure CutActionExecute(Sender: TObject);
157 procedure Duty1VisualizerPaint(Sender: TObject); 167 procedure Duty1VisualizerPaint(Sender: TObject);
@@ -204,8 +214,11 @@ type
204 Shift: TShiftState); 214 Shift: TShiftState);
205 procedure PanicToolButtonClick(Sender: TObject); 215 procedure PanicToolButtonClick(Sender: TObject);
206 procedure PasteActionExecute(Sender: TObject); 216 procedure PasteActionExecute(Sender: TObject);
217 procedure SpinEdit1Change(Sender: TObject);
218 procedure SpinEdit2Change(Sender: TObject);
207 procedure TicksPerRowSpinEditChange(Sender: TObject); 219 procedure TicksPerRowSpinEditChange(Sender: TObject);
208 procedure ToolButton2Click(Sender: TObject); 220 procedure ToolButton2Click(Sender: TObject);
221 procedure ToolButton3Click(Sender: TObject);
209 procedure ToolButton4Click(Sender: TObject); 222 procedure ToolButton4Click(Sender: TObject);
210 procedure ToolButton5Click(Sender: TObject); 223 procedure ToolButton5Click(Sender: TObject);
211 procedure WaveEditNumberSpinnerChange(Sender: TObject); 224 procedure WaveEditNumberSpinnerChange(Sender: TObject);
@@ -254,8 +267,13 @@ type
254 procedure ReloadPatterns; 267 procedure ReloadPatterns;
255 procedure CopyOrderGridToOrderMatrix; 268 procedure CopyOrderGridToOrderMatrix;
256 procedure CopyOrderMatrixToOrderGrid; 269 procedure CopyOrderMatrixToOrderGrid;
257 function PeekSymbol(Symbol: String): Integer; 270 function PreparePreview: Boolean;
258 procedure ResetEmulationThread; 271 procedure ResetEmulationThread;
272
273 function WordPeekSymbol(Symbol: String): Integer;
274 procedure WordPokeSymbol(Symbol: String; Value: Word);
275 function PeekSymbol(Symbol: String): Integer;
276 procedure PokeSymbol(Symbol: String; Value: Byte);
259 procedure OnFD; 277 procedure OnFD;
260 278
261 procedure RecreateTrackerGrid; 279 procedure RecreateTrackerGrid;
@@ -468,6 +486,41 @@ begin
468 Result := speekb(SymbolTable.KeyData[Symbol]); 486 Result := speekb(SymbolTable.KeyData[Symbol]);
469 end; 487 end;
470 488
489 procedure TfrmTracker.PokeSymbol(Symbol: String; Value: Byte);
490 begin
491 if SymbolTable = nil then exit;
492 spokeb(SymbolTable.KeyData[Symbol], Value);
493 end;
494
495 function TfrmTracker.WordPeekSymbol(Symbol: String): Integer;
496 begin
497 if SymbolTable = nil then exit;
498 Result := wordpeek(SymbolTable.KeyData[Symbol]);
499 end;
500
501 procedure TfrmTracker.WordPokeSymbol(Symbol: String; Value: Word);
502 begin
503 if SymbolTable = nil then exit;
504 wordpoke(SymbolTable.KeyData[Symbol], Value);
505 end;
506
507 function TfrmTracker.PreparePreview: Boolean;
508 begin
509 if RenderPreviewROM(Song) then begin
510 // Load the new symbol table
511 SymbolTable := ParseSymFile('hUGEDriver/preview.sym');
512
513 // Start emulation on the rendered preview binary
514 EmulationThread.Terminate;
515 EmulationThread.WaitFor;
516 EmulationThread.Free;
517 EmulationThread := TEmulationThread.Create('hUGEDriver/preview.gb');
518
519 Result := True;
520 end
521 else Result := False;
522 end;
523
471 procedure TfrmTracker.ResetEmulationThread; 524 procedure TfrmTracker.ResetEmulationThread;
472 begin 525 begin
473 Playing := False; 526 Playing := False;
@@ -896,11 +949,26 @@ begin
896 PostMessage(Screen.ActiveControl.Handle, LM_COPY, 0, 0); 949 PostMessage(Screen.ActiveControl.Handle, LM_COPY, 0, 0);
897 end; 950 end;
898 951
952 procedure TfrmTracker.ComboBox1Change(Sender: TObject);
953 begin
954 TrackerGrid.SelectedInstrument := ComboBox1.ItemIndex;
955 end;
956
899 procedure TfrmTracker.PasteActionExecute(Sender: TObject); 957 procedure TfrmTracker.PasteActionExecute(Sender: TObject);
900 begin 958 begin
901 PostMessage(Screen.ActiveControl.Handle, LM_PASTE, 0, 0); 959 PostMessage(Screen.ActiveControl.Handle, LM_PASTE, 0, 0);
902 end; 960 end;
903 961
962 procedure TfrmTracker.SpinEdit1Change(Sender: TObject);
963 begin
964 TrackerGrid.SelectedOctave := SpinEdit1.Value;
965 end;
966
967 procedure TfrmTracker.SpinEdit2Change(Sender: TObject);
968 begin
969 TrackerGrid.Step := SpinEdit2.Value;
970 end;
971
904 procedure TfrmTracker.DivRatioSpinnerChange(Sender: TObject); 972 procedure TfrmTracker.DivRatioSpinnerChange(Sender: TObject);
905 begin 973 begin
906 CurrentInstrument^.DividingRatio := Round(DivRatioSpinner.Position); 974 CurrentInstrument^.DividingRatio := Round(DivRatioSpinner.Position);
@@ -1101,24 +1169,20 @@ end;
1101 1169
1102 procedure TfrmTracker.ToolButton2Click(Sender: TObject); 1170 procedure TfrmTracker.ToolButton2Click(Sender: TObject);
1103 begin 1171 begin
1104 if not Playing then begin 1172 if Playing then ResetEmulationThread;
1105 if RenderPreviewROM(Song) then begin 1173
1106 Playing := True; 1174 if PreparePreview then begin
1107 ToolButton2.ImageIndex := 75; 1175 Playing := True;
1108 1176 EmulationThread.Start;
1109 // Load the new symbol table 1177 end;
1110 SymbolTable := ParseSymFile('hUGEDriver/preview.sym'); 1178 end;
1111 1179
1112 // Start emulation on the rendered preview binary 1180 procedure TfrmTracker.ToolButton3Click(Sender: TObject);
1113 EmulationThread.Terminate; 1181 begin
1114 EmulationThread.WaitFor; 1182 if PreparePreview then begin
1115 EmulationThread.Free; 1183 Playing := True;
1116 EmulationThread := TEmulationThread.Create('hUGEDriver/preview.gb'); 1184 EmulationThread.Start;
1117 EmulationThread.Start; 1185 end;
1118 end
1119 else ResetEmulationThread;
1120 end
1121 else ResetEmulationThread;
1122 end; 1186 end;
1123 1187
1124 procedure TfrmTracker.ToolButton4Click(Sender: TObject); 1188 procedure TfrmTracker.ToolButton4Click(Sender: TObject);
Modifiedtrackergrid.pas +54−14
@@ -82,6 +82,7 @@ type
82 procedure ClampCursors; 82 procedure ClampCursors;
83 procedure NormalizeCursors; 83 procedure NormalizeCursors;
84 84
85 procedure TransposeSelection(Semitones: Integer);
85 procedure EraseSelection; 86 procedure EraseSelection;
86 procedure InputNote(Key: Word); 87 procedure InputNote(Key: Word);
87 procedure InputInstrument(Key: Word); 88 procedure InputInstrument(Key: Word);
@@ -122,6 +123,8 @@ type
122 Cursor, Other: TSelectionPos; 123 Cursor, Other: TSelectionPos;
123 ColumnWidth, RowHeight: Integer; 124 ColumnWidth, RowHeight: Integer;
124 125
126 SelectedInstrument, SelectedOctave, Step: Integer;
127
125 property HighlightedRow: Integer read FHighlightedRow write SetHighlightedRow; 128 property HighlightedRow: Integer read FHighlightedRow write SetHighlightedRow;
126 property SelectionGridRect: TRect read GetSelectionGridRect write SetSelectionGridRect; 129 property SelectionGridRect: TRect read GetSelectionGridRect write SetSelectionGridRect;
127 procedure LoadPattern(Idx: Integer; PatternNumber: Integer); 130 procedure LoadPattern(Idx: Integer; PatternNumber: Integer);
@@ -219,6 +222,10 @@ begin
219 222
220 Width := ColumnWidth*4; 223 Width := ColumnWidth*4;
221 Height := RowHeight*64; 224 Height := RowHeight*64;
225
226 SelectedInstrument := 0;
227 SelectedOctave := 0;
228 Step := 0;
222 end; 229 end;
223 230
224 destructor TTrackerGrid.Destroy; 231 destructor TTrackerGrid.Destroy;
@@ -324,22 +331,31 @@ begin
324 331
325 if Key in [VK_CONTROL, VK_SHIFT] then Exit; 332 if Key in [VK_CONTROL, VK_SHIFT] then Exit;
326 333
327 if ssCtrl in Shift then 334 if [ssCtrl, ssShift] <= Shift then
328 case Key of 335 case Key of
329 VK_Z: DoUndo; 336 VK_Q: TransposeSelection(12);
330 VK_Y: DoRedo; 337 VK_A: TransposeSelection(-12);
331 VK_L: begin 338 end
332 Cursor.Y := 0; 339 else begin
333 Other.Y := High(TPattern); 340 if ssCtrl in Shift then
334 Cursor.SelectedPart := Low(TCellPart); 341 case Key of
335 Other.SelectedPart := High(TCellPart); 342 VK_Q: TransposeSelection(1);
343 VK_A: TransposeSelection(-1);
344 VK_Z: DoUndo;
345 VK_Y: DoRedo;
346 VK_L: begin
347 Cursor.Y := 0;
348 Other.Y := High(TPattern);
349 Cursor.SelectedPart := Low(TCellPart);
350 Other.SelectedPart := High(TCellPart);
351 end;
336 end; 352 end;
337 end;
338 353
339 if ssShift in Shift then 354 if ssShift in Shift then
340 case Key of 355 case Key of
341 VK_V: DoRepeatPaste; 356 VK_V: DoRepeatPaste;
342 end; 357 end;
358 end;
343 359
344 case Key of 360 case Key of
345 VK_DELETE: begin 361 VK_DELETE: begin
@@ -590,6 +606,21 @@ begin
590 end; 606 end;
591 end; 607 end;
592 608
609 procedure TTrackerGrid.TransposeSelection(Semitones: Integer);
610 var
611 C, R: Integer;
612 begin
613 NormalizeCursors;
614
615 for R := Cursor.Y to Other.Y do
616 for C := Cursor.X to Other.X do
617 Patterns[C]^[R].Note :=
618 Max(LOWEST_NOTE, Min(HIGHEST_NOTE, Patterns[C]^[R].Note + Semitones));
619
620 Invalidate;
621 SaveUndoState;
622 end;
623
593 procedure TTrackerGrid.EraseSelection; 624 procedure TTrackerGrid.EraseSelection;
594 var 625 var
595 X: TSelectionPos; 626 X: TSelectionPos;
@@ -614,12 +645,21 @@ procedure TTrackerGrid.InputNote(Key: Word);
614 var 645 var
615 Temp: Integer; 646 Temp: Integer;
616 begin 647 begin
648 Temp := -1;
649
617 with Patterns[Cursor.X]^[Cursor.Y] do 650 with Patterns[Cursor.X]^[Cursor.Y] do
618 if Key = VK_DELETE then 651 if Key = VK_DELETE then
619 Note := NO_NOTE 652 Note := NO_NOTE
620 else begin 653 else begin
621 Keybindings.TryGetData(Key, Temp); 654 Keybindings.TryGetData(Key, Temp);
622 if Temp <> 0 then Note := Temp; 655 if Temp <> -1 then begin
656 Note := Min(HIGHEST_NOTE, Temp+(SelectedOctave*12));
657 if Instrument = 0 then
658 Instrument := SelectedInstrument;
659
660 Inc(Cursor.Y, Step);
661 ClampCursors;
662 end;
623 end; 663 end;
624 664
625 Invalidate; 665 Invalidate;