Commit d4184b5

Nick committed on
Merge pull request #12 from RichardULZ/hUGETracker
Skip through song while playing, Envelope improvements, Scopes on/off
commit d4184b5e45cedc41ba4f7262139a5c17743030f5 parent 3e8ad4cparent 00be538
4 changed files Diffed against the first of 2 parents. +108−55
Modifiedoptions.lfm +32−19
@@ -1,38 +1,51 @@
1 object frmOptions: TfrmOptions 1 object frmOptions: TfrmOptions
2 Left = 1762 2 Left = 660
3 Height = 849 3 Height = 485
4 Top = 212 4 Top = 573
5 Width = 762 5 Width = 435
6 BorderStyle = bsDialog 6 BorderStyle = bsDialog
7 Caption = 'Options' 7 Caption = 'Options'
8 ClientHeight = 849 8 ClientHeight = 485
9 ClientWidth = 762 9 ClientWidth = 435
10 DesignTimePPI = 168
11 Position = poMainFormCenter 10 Position = poMainFormCenter
12 LCLVersion = '2.0.6.0' 11 LCLVersion = '2.0.6.0'
13 object Label1: TLabel 12 object Label1: TLabel
14 Left = 24 13 Left = 14
15 Height = 30 14 Height = 15
16 Top = 24 15 Top = 14
17 Width = 211 16 Width = 119
18 Caption = 'Pattern editor font size' 17 Caption = 'Pattern editor font size'
19 ParentColor = False 18 ParentColor = False
19 ParentFont = False
20 end 20 end
21 object Button1: TButton 21 object Button1: TButton
22 Left = 520 22 Left = 297
23 Height = 44 23 Height = 25
24 Top = 784 24 Top = 448
25 Width = 216 25 Width = 123
26 Caption = 'OK' 26 Caption = 'OK'
27 OnClick = Button1Click 27 OnClick = Button1Click
28 ParentFont = False
28 TabOrder = 0 29 TabOrder = 0
29 end 30 end
30 object FontSizeSpinner: TSpinEdit 31 object FontSizeSpinner: TSpinEdit
31 Left = 272 32 Left = 155
32 Height = 38 33 Height = 23
33 Top = 16 34 Top = 9
34 Width = 216 35 Width = 123
36 ParentFont = False
35 TabOrder = 1 37 TabOrder = 1
36 Value = 12 38 Value = 12
37 end 39 end
40 object ScopesCheck: TCheckBox
41 Left = 14
42 Height = 19
43 Top = 40
44 Width = 149
45 Alignment = taLeftJustify
46 Caption = 'Scopes (Uses More CPU)'
47 Checked = True
48 State = cbChecked
49 TabOrder = 2
50 end
38 end 51 end
Modifiedoptions.pas +1−0
@@ -13,6 +13,7 @@ type
13 13
14 TfrmOptions = class(TForm) 14 TfrmOptions = class(TForm)
15 Button1: TButton; 15 Button1: TButton;
16 ScopesCheck: TCheckBox;
16 Label1: TLabel; 17 Label1: TLabel;
17 FontSizeSpinner: TSpinEdit; 18 FontSizeSpinner: TSpinEdit;
18 procedure Button1Click(Sender: TObject); 19 procedure Button1Click(Sender: TObject);
Modifiedtracker.lfm +28−27
@@ -1,11 +1,11 @@
1 object frmTracker: TfrmTracker 1 object frmTracker: TfrmTracker
2 Left = 434 2 Left = 453
3 Height = 661 3 Height = 701
4 Top = 645 4 Top = 598
5 Width = 1145 5 Width = 1145
6 AllowDropFiles = True 6 AllowDropFiles = True
7 Caption = 'hUGETracker' 7 Caption = 'hUGETracker'
8 ClientHeight = 641 8 ClientHeight = 681
9 ClientWidth = 1145 9 ClientWidth = 1145
10 KeyPreview = True 10 KeyPreview = True
11 Menu = MainMenu1 11 Menu = MainMenu1
@@ -21,8 +21,8 @@ object frmTracker: TfrmTracker
21 LCLVersion = '2.0.6.0' 21 LCLVersion = '2.0.6.0'
22 object TreeView1: TTreeView 22 object TreeView1: TTreeView
23 Left = 0 23 Left = 0
24 Height = 530 24 Height = 569
25 Top = 88 25 Top = 89
26 Width = 193 26 Width = 193
27 Align = alLeft 27 Align = alLeft
28 ParentFont = False 28 ParentFont = False
@@ -42,30 +42,30 @@ object frmTracker: TfrmTracker
42 end 42 end
43 object Splitter1: TSplitter 43 object Splitter1: TSplitter
44 Left = 193 44 Left = 193
45 Height = 530 45 Height = 569
46 Top = 88 46 Top = 89
47 Width = 5 47 Width = 5
48 end 48 end
49 object Panel1: TPanel 49 object Panel1: TPanel
50 Left = 198 50 Left = 198
51 Height = 530 51 Height = 569
52 Top = 88 52 Top = 89
53 Width = 947 53 Width = 947
54 Align = alClient 54 Align = alClient
55 BevelOuter = bvNone 55 BevelOuter = bvNone
56 ClientHeight = 530 56 ClientHeight = 569
57 ClientWidth = 947 57 ClientWidth = 947
58 ParentFont = False 58 ParentFont = False
59 TabOrder = 2 59 TabOrder = 2
60 object PageControl1: TPageControl 60 object PageControl1: TPageControl
61 Left = 0 61 Left = 0
62 Height = 530 62 Height = 569
63 Top = 0 63 Top = 0
64 Width = 947 64 Width = 947
65 ActivePage = CommentsTabSheet 65 ActivePage = PatternTabSheet
66 Align = alClient 66 Align = alClient
67 ParentFont = False 67 ParentFont = False
68 TabIndex = 4 68 TabIndex = 1
69 TabOrder = 0 69 TabOrder = 0
70 object GeneralTabSheet: TTabSheet 70 object GeneralTabSheet: TTabSheet
71 Caption = 'General' 71 Caption = 'General'
@@ -146,16 +146,16 @@ object frmTracker: TfrmTracker
146 end 146 end
147 object PatternTabSheet: TTabSheet 147 object PatternTabSheet: TTabSheet
148 Caption = 'Patterns' 148 Caption = 'Patterns'
149 ClientHeight = 502 149 ClientHeight = 541
150 ClientWidth = 939 150 ClientWidth = 939
151 ParentFont = False 151 ParentFont = False
152 object Panel3: TPanel 152 object Panel3: TPanel
153 Left = 224 153 Left = 224
154 Height = 502 154 Height = 541
155 Top = 0 155 Top = 0
156 Width = 715 156 Width = 715
157 Align = alClient 157 Align = alClient
158 ClientHeight = 502 158 ClientHeight = 541
159 ClientWidth = 715 159 ClientWidth = 715
160 ParentFont = False 160 ParentFont = False
161 TabOrder = 0 161 TabOrder = 0
@@ -204,7 +204,7 @@ object frmTracker: TfrmTracker
204 end 204 end
205 object ScrollBox1: TScrollBox 205 object ScrollBox1: TScrollBox
206 Left = 1 206 Left = 1
207 Height = 470 207 Height = 509
208 Top = 31 208 Top = 31
209 Width = 713 209 Width = 713
210 HorzScrollBar.Increment = 1 210 HorzScrollBar.Increment = 1
@@ -225,7 +225,7 @@ object frmTracker: TfrmTracker
225 end 225 end
226 object OrderEditStringGrid: TStringGrid 226 object OrderEditStringGrid: TStringGrid
227 Left = 0 227 Left = 0
228 Height = 502 228 Height = 541
229 Top = 0 229 Top = 0
230 Width = 224 230 Width = 224
231 Align = alLeft 231 Align = alLeft
@@ -1589,19 +1589,20 @@ object frmTracker: TfrmTracker
1589 end 1589 end
1590 object Panel2: TPanel 1590 object Panel2: TPanel
1591 Left = 0 1591 Left = 0
1592 Height = 63 1592 Height = 64
1593 Top = 25 1593 Top = 25
1594 Width = 1145 1594 Width = 1145
1595 Align = alTop 1595 Align = alTop
1596 BevelOuter = bvNone 1596 BevelOuter = bvNone
1597 ClientHeight = 63 1597 Caption = 'Hides if Scopes Off'
1598 ClientHeight = 64
1598 ClientWidth = 1145 1599 ClientWidth = 1145
1599 ParentFont = False 1600 ParentFont = False
1600 TabOrder = 3 1601 TabOrder = 3
1601 object LEDMeter1: TLEDMeter 1602 object LEDMeter1: TLEDMeter
1602 AnchorSideRight.Control = Duty1Visualizer 1603 AnchorSideRight.Control = Duty1Visualizer
1603 Left = 0 1604 Left = 0
1604 Height = 31 1605 Height = 32
1605 Top = 32 1606 Top = 32
1606 Width = 357 1607 Width = 357
1607 Anchors = [akTop, akLeft, akRight] 1608 Anchors = [akTop, akLeft, akRight]
@@ -1646,7 +1647,7 @@ object frmTracker: TfrmTracker
1646 end 1647 end
1647 object Duty1Visualizer: TPaintBox 1648 object Duty1Visualizer: TPaintBox
1648 Left = 357 1649 Left = 357
1649 Height = 63 1650 Height = 64
1650 Top = 0 1651 Top = 0
1651 Width = 197 1652 Width = 197
1652 Align = alRight 1653 Align = alRight
@@ -1656,7 +1657,7 @@ object frmTracker: TfrmTracker
1656 end 1657 end
1657 object Duty2Visualizer: TPaintBox 1658 object Duty2Visualizer: TPaintBox
1658 Left = 554 1659 Left = 554
1659 Height = 63 1660 Height = 64
1660 Top = 0 1661 Top = 0
1661 Width = 197 1662 Width = 197
1662 Align = alRight 1663 Align = alRight
@@ -1666,7 +1667,7 @@ object frmTracker: TfrmTracker
1666 end 1667 end
1667 object WaveVisualizer: TPaintBox 1668 object WaveVisualizer: TPaintBox
1668 Left = 751 1669 Left = 751
1669 Height = 63 1670 Height = 64
1670 Top = 0 1671 Top = 0
1671 Width = 197 1672 Width = 197
1672 Align = alRight 1673 Align = alRight
@@ -1676,7 +1677,7 @@ object frmTracker: TfrmTracker
1676 end 1677 end
1677 object NoiseVisualizer: TPaintBox 1678 object NoiseVisualizer: TPaintBox
1678 Left = 948 1679 Left = 948
1679 Height = 63 1680 Height = 64
1680 Top = 0 1681 Top = 0
1681 Width = 197 1682 Width = 197
1682 Align = alRight 1683 Align = alRight
@@ -1688,7 +1689,7 @@ object frmTracker: TfrmTracker
1688 object StatusBar1: TStatusBar 1689 object StatusBar1: TStatusBar
1689 Left = 0 1690 Left = 0
1690 Height = 23 1691 Height = 23
1691 Top = 618 1692 Top = 658
1692 Width = 1145 1693 Width = 1145
1693 AutoHint = True 1694 AutoHint = True
1694 Panels = < 1695 Panels = <
Modifiedtracker.pas +47−9
@@ -376,6 +376,7 @@ type
376 Playing: Boolean; 376 Playing: Boolean;
377 LoadingFile: Boolean; 377 LoadingFile: Boolean;
378 SaveSucceeded: Boolean; 378 SaveSucceeded: Boolean;
379 ScopesOn: Boolean;
379 380
380 {PatternsNode, } 381 {PatternsNode, }
381 WaveInstrumentsNode, 382 WaveInstrumentsNode,
@@ -544,8 +545,8 @@ var
544 begin 545 begin
545 W := PB.Width; 546 W := PB.Width;
546 H := PB.Height-3; 547 H := PB.Height-3;
547 V := CurrentInstrument^.InitialVolume; 548 V := Min(CurrentInstrument^.InitialVolume,15);
548 S := CurrentInstrument^.VolSweepAmount*2; 549 S := Min(CurrentInstrument^.VolSweepAmount,7)*2;
549 case CurrentInstrument^.LengthEnabled of 550 case CurrentInstrument^.LengthEnabled of
550 True: L := (64-CurrentInstrument^.Length) div 2; 551 True: L := (64-CurrentInstrument^.Length) div 2;
551 False: L := 400; 552 False: L := 400;
@@ -564,6 +565,7 @@ begin
564 LineTo(L*Interval, H-V*HInterval); // no sweep 565 LineTo(L*Interval, H-V*HInterval); // no sweep
565 MoveTo(L*Interval, H-(V*HInterval)); 566 MoveTo(L*Interval, H-(V*HInterval));
566 LineTo(L*Interval, H); 567 LineTo(L*Interval, H);
568 LineTo(W, H);
567 end 569 end
568 else begin 570 else begin
569 case CurrentInstrument^.VolSweepDirection of 571 case CurrentInstrument^.VolSweepDirection of
@@ -571,15 +573,14 @@ begin
571 For I := 0 to V do 573 For I := 0 to V do
572 LineTo( Min(I*S,L)*Interval, H-(V-I)*HInterval); 574 LineTo( Min(I*S,L)*Interval, H-(V-I)*HInterval);
573 LineTo(W, H); 575 LineTo(W, H);
574 MoveTo(Trunc(L*Interval), 0);
575 LineTo(Trunc(L*Interval), H); 576 LineTo(Trunc(L*Interval), H);
576 end; 577 end;
577 Up: begin // Envelope up, check length cut 578 Up: begin // Envelope up, check length cut
578 For I := 0 to 15-V do 579 For I := 0 to 15-V do
579 LineTo( Min(I*S,L)*Interval, (15-V-I)*HInterval+9); 580 LineTo( Min(I*S,L)*Interval, (15-V-I)*HInterval+9);
580 LineTo(L*Interval, H-15*HInterval); 581 LineTo(L*Interval, H-15*HInterval);
581 MoveTo(L*Interval, 0);
582 LineTo(L*Interval, H); 582 LineTo(L*Interval, H);
583 LineTo(W, H);
583 end; 584 end;
584 end; 585 end;
585 end; 586 end;
@@ -904,6 +905,7 @@ begin
904 TrackerGrid.OnResize:=@OnTrackerGridResize; 905 TrackerGrid.OnResize:=@OnTrackerGridResize;
905 906
906 TrackerGrid.FontSize := OptionsFile.ReadInteger('hUGETracker', 'fontsize', 12); 907 TrackerGrid.FontSize := OptionsFile.ReadInteger('hUGETracker', 'fontsize', 12);
908 ScopesOn := OptionsFile.ReadBool('hUGETracker', 'ScopesOn', True);
907 909
908 // Fix the size of the channel headers 910 // Fix the size of the channel headers
909 for Section in HeaderControl1.Sections do 911 for Section in HeaderControl1.Sections do
@@ -1182,7 +1184,8 @@ begin
1182 ResetEmulationThread; //TODO: remove this hack 1184 ResetEmulationThread; //TODO: remove this hack
1183 1185
1184 // Start the Oscilloscope repaint timer 1186 // Start the Oscilloscope repaint timer
1185 OscilloscopeUpdateTimer.Enabled := True; 1187 OscilloscopeUpdateTimer.Enabled := ScopesOn;
1188 Panel2.height := IfThen(ScopesOn, 64, 0);
1186 1189
1187 // Switch to general tab sheet 1190 // Switch to general tab sheet
1188 PageControl1.ActivePageIndex := 0; 1191 PageControl1.ActivePageIndex := 0;
@@ -1621,6 +1624,7 @@ end;
1621 procedure TfrmTracker.InstrumentNumberSpinnerChange(Sender: TObject); 1624 procedure TfrmTracker.InstrumentNumberSpinnerChange(Sender: TObject);
1622 begin 1625 begin
1623 LoadInstrument(CurrentInstrumentBank, InstrumentNumberSpinner.Value); 1626 LoadInstrument(CurrentInstrumentBank, InstrumentNumberSpinner.Value);
1627 DrawEnvelope(EnvelopePaintBox);
1624 end; 1628 end;
1625 1629
1626 procedure TfrmTracker.LengthSpinnerChange(Sender: TObject); 1630 procedure TfrmTracker.LengthSpinnerChange(Sender: TObject);
@@ -1799,10 +1803,16 @@ end;
1799 procedure TfrmTracker.MenuItem26Click(Sender: TObject); 1803 procedure TfrmTracker.MenuItem26Click(Sender: TObject);
1800 begin 1804 begin
1801 frmOptions.FontSizeSpinner.Value := TrackerGrid.FontSize; 1805 frmOptions.FontSizeSpinner.Value := TrackerGrid.FontSize;
1806 frmOptions.ScopesCheck.Checked := ScopesOn;
1802 frmOptions.ShowModal; 1807 frmOptions.ShowModal;
1803 TrackerGrid.FontSize := frmOptions.FontSizeSpinner.Value; 1808 TrackerGrid.FontSize := frmOptions.FontSizeSpinner.Value;
1809 ScopesOn := frmOptions.ScopesCheck.Checked;
1804 1810
1805 OptionsFile.WriteInteger('hUGETracker', 'fontsize', TrackerGrid.FontSize); 1811 OptionsFile.WriteInteger('hUGETracker', 'fontsize', TrackerGrid.FontSize);
1812 OptionsFile.WriteBool('hUGETracker', 'ScopesOn', ScopesOn);
1813 OscilloscopeUpdateTimer.Enabled := ScopesOn;
1814 Panel2.height := IfThen(ScopesOn, 64, 0);
1815
1806 end; 1816 end;
1807 1817
1808 procedure TfrmTracker.MenuItem31Click(Sender: TObject); 1818 procedure TfrmTracker.MenuItem31Click(Sender: TObject);
@@ -1887,6 +1897,20 @@ procedure TfrmTracker.OrderEditStringGridAfterSelection(Sender: TObject; aCol,
1887 begin 1897 begin
1888 if OrderEditStringGrid.Row > -1 then 1898 if OrderEditStringGrid.Row > -1 then
1889 ReloadPatterns; 1899 ReloadPatterns;
1900
1901 if Playing = True then begin
1902 if TrackerGrid.HighlightedRow <> 0 then begin
1903 if OrderEditStringGrid.Row = 1 then begin
1904 if PreparePreview then
1905 Playing := True;
1906 end
1907 else begin
1908 PokeSymbol(SYM_CURRENT_ORDER, 2*(OrderEditStringGrid.Row-2));
1909 PokeSymbol(SYM_ROW, 63);
1910 end;
1911 end;
1912 EmulationThread.Start;
1913 end
1890 end; 1914 end;
1891 1915
1892 procedure TfrmTracker.OrderEditStringGridColRowDeleted(Sender: TObject; 1916 procedure TfrmTracker.OrderEditStringGridColRowDeleted(Sender: TObject;
@@ -1922,11 +1946,25 @@ procedure TfrmTracker.OrderEditStringGridDblClick(Sender: TObject);
1922 var 1946 var
1923 Highest: Integer; 1947 Highest: Integer;
1924 begin 1948 begin
1925 Highest := Song.Patterns.MaxKey; 1949 if Playing = True then begin
1950 if OrderEditStringGrid.Row = 1 then begin
1951 if PreparePreview then begin
1952 Playing := True;
1953 end;
1954 end
1955 else begin
1956 PokeSymbol(SYM_CURRENT_ORDER, 2*(OrderEditStringGrid.Row-2));
1957 PokeSymbol(SYM_ROW, 63);
1958 end;
1959 EmulationThread.Start;
1960 end
1961 else begin
1962 Highest := Song.Patterns.MaxKey;
1926 1963
1927 with OrderEditStringGrid do begin 1964 with OrderEditStringGrid do begin
1928 Cells[Col, Row] := IntToStr(Highest); 1965 Cells[Col, Row] := IntToStr(Highest);
1929 TrackerGrid.LoadPattern(Col - 1, Highest); 1966 TrackerGrid.LoadPattern(Col - 1, Highest);
1967 end;
1930 end; 1968 end;
1931 end; 1969 end;
1932 1970