Commit dd1d5eb

Richard Ziegler committed on
DrawEnvelope function and GB colored scopes.
Also centered some text, and scopes are a tad smaller so the uv meters are less big, welcome to change that back.
commit dd1d5eb49dc32866755a9969d6288144ceba4a8c parent 944419d
2 changed files +173−103
Modifiedtracker.lfm +108−101
@@ -1,12 +1,12 @@
1 object frmTracker: TfrmTracker 1 object frmTracker: TfrmTracker
2 Left = 1872 2 Left = 434
3 Height = 726 3 Height = 661
4 Top = 301 4 Top = 645
5 Width = 1180 5 Width = 1145
6 AllowDropFiles = True 6 AllowDropFiles = True
7 Caption = 'hUGETracker' 7 Caption = 'hUGETracker'
8 ClientHeight = 706 8 ClientHeight = 641
9 ClientWidth = 1180 9 ClientWidth = 1145
10 KeyPreview = True 10 KeyPreview = True
11 Menu = MainMenu1 11 Menu = MainMenu1
12 OnClose = FormClose 12 OnClose = FormClose
@@ -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 = 563 24 Height = 530
25 Top = 120 25 Top = 88
26 Width = 193 26 Width = 193
27 Align = alLeft 27 Align = alLeft
28 ParentFont = False 28 ParentFont = False
@@ -42,35 +42,35 @@ object frmTracker: TfrmTracker
42 end 42 end
43 object Splitter1: TSplitter 43 object Splitter1: TSplitter
44 Left = 193 44 Left = 193
45 Height = 563 45 Height = 530
46 Top = 120 46 Top = 88
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 = 563 51 Height = 530
52 Top = 120 52 Top = 88
53 Width = 982 53 Width = 947
54 Align = alClient 54 Align = alClient
55 BevelOuter = bvNone 55 BevelOuter = bvNone
56 ClientHeight = 563 56 ClientHeight = 530
57 ClientWidth = 982 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 = 563 62 Height = 530
63 Top = 0 63 Top = 0
64 Width = 982 64 Width = 947
65 ActivePage = InstrumentTabSheet 65 ActivePage = CommentsTabSheet
66 Align = alClient 66 Align = alClient
67 ParentFont = False 67 ParentFont = False
68 TabIndex = 2 68 TabIndex = 4
69 TabOrder = 0 69 TabOrder = 0
70 object GeneralTabSheet: TTabSheet 70 object GeneralTabSheet: TTabSheet
71 Caption = 'General' 71 Caption = 'General'
72 ClientHeight = 452 72 ClientHeight = 502
73 ClientWidth = 974 73 ClientWidth = 939
74 ParentFont = False 74 ParentFont = False
75 object SongInformationGroupbox: TGroupBox 75 object SongInformationGroupbox: TGroupBox
76 Left = 8 76 Left = 8
@@ -146,17 +146,17 @@ object frmTracker: TfrmTracker
146 end 146 end
147 object PatternTabSheet: TTabSheet 147 object PatternTabSheet: TTabSheet
148 Caption = 'Patterns' 148 Caption = 'Patterns'
149 ClientHeight = 535 149 ClientHeight = 502
150 ClientWidth = 974 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 = 535 154 Height = 502
155 Top = 0 155 Top = 0
156 Width = 750 156 Width = 715
157 Align = alClient 157 Align = alClient
158 ClientHeight = 535 158 ClientHeight = 502
159 ClientWidth = 750 159 ClientWidth = 715
160 ParentFont = False 160 ParentFont = False
161 TabOrder = 0 161 TabOrder = 0
162 object HeaderControl1: THeaderControl 162 object HeaderControl1: THeaderControl
@@ -164,7 +164,7 @@ object frmTracker: TfrmTracker
164 Height = 30 164 Height = 30
165 Hint = 'Left click to mute, right click to solo' 165 Hint = 'Left click to mute, right click to solo'
166 Top = 1 166 Top = 1
167 Width = 748 167 Width = 713
168 DragReorder = False 168 DragReorder = False
169 Images = ImageList2 169 Images = ImageList2
170 Sections = < 170 Sections = <
@@ -204,9 +204,9 @@ object frmTracker: TfrmTracker
204 end 204 end
205 object ScrollBox1: TScrollBox 205 object ScrollBox1: TScrollBox
206 Left = 1 206 Left = 1
207 Height = 503 207 Height = 470
208 Top = 31 208 Top = 31
209 Width = 748 209 Width = 713
210 HorzScrollBar.Increment = 1 210 HorzScrollBar.Increment = 1
211 HorzScrollBar.Page = 1 211 HorzScrollBar.Page = 1
212 HorzScrollBar.Smooth = True 212 HorzScrollBar.Smooth = True
@@ -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 = 535 228 Height = 502
229 Top = 0 229 Top = 0
230 Width = 224 230 Width = 224
231 Align = alLeft 231 Align = alLeft
@@ -290,18 +290,18 @@ object frmTracker: TfrmTracker
290 end 290 end
291 object InstrumentTabSheet: TTabSheet 291 object InstrumentTabSheet: TTabSheet
292 Caption = 'Instruments' 292 Caption = 'Instruments'
293 ClientHeight = 535 293 ClientHeight = 502
294 ClientWidth = 974 294 ClientWidth = 939
295 ParentFont = False 295 ParentFont = False
296 object PaintBox1: TPaintBox 296 object PaintBox1: TPaintBox
297 AnchorSideTop.Control = FlowPanel1 297 AnchorSideTop.Control = FlowPanel1
298 AnchorSideTop.Side = asrBottom 298 AnchorSideTop.Side = asrBottom
299 AnchorSideBottom.Side = asrBottom 299 AnchorSideBottom.Side = asrBottom
300 Left = 0 300 Left = 0
301 Height = 97 301 Height = 64
302 Hint = 'Preview of how the resulting waveform will look with envelope applied' 302 Hint = 'Preview of how the resulting waveform will look with envelope applied'
303 Top = 438 303 Top = 438
304 Width = 974 304 Width = 939
305 Align = alClient 305 Align = alClient
306 Color = clBlack 306 Color = clBlack
307 ParentColor = False 307 ParentColor = False
@@ -313,7 +313,7 @@ object frmTracker: TfrmTracker
313 Left = 0 313 Left = 0
314 Height = 438 314 Height = 438
315 Top = 0 315 Top = 0
316 Width = 974 316 Width = 939
317 Align = alTop 317 Align = alTop
318 AutoSize = True 318 AutoSize = True
319 BevelOuter = bvNone 319 BevelOuter = bvNone
@@ -482,6 +482,7 @@ object frmTracker: TfrmTracker
482 Max = 63 482 Max = 63
483 OnChange = LengthSpinnerChange 483 OnChange = LengthSpinnerChange
484 Position = 0 484 Position = 0
485 Enabled = False
485 ParentFont = False 486 ParentFont = False
486 TabOrder = 7 487 TabOrder = 7
487 end 488 end
@@ -490,7 +491,7 @@ object frmTracker: TfrmTracker
490 Left = 292 491 Left = 292
491 Height = 136 492 Height = 136
492 Top = 7 493 Top = 7
493 Width = 659 494 Width = 582
494 Anchors = [] 495 Anchors = []
495 BorderSpacing.Left = 7 496 BorderSpacing.Left = 7
496 BorderSpacing.Top = 7 497 BorderSpacing.Top = 7
@@ -498,7 +499,7 @@ object frmTracker: TfrmTracker
498 BorderSpacing.Bottom = 7 499 BorderSpacing.Bottom = 7
499 Caption = 'Envelope' 500 Caption = 'Envelope'
500 ClientHeight = 116 501 ClientHeight = 116
501 ClientWidth = 655 502 ClientWidth = 578
502 ParentFont = False 503 ParentFont = False
503 TabOrder = 1 504 TabOrder = 1
504 object Label4: TLabel 505 object Label4: TLabel
@@ -548,20 +549,20 @@ object frmTracker: TfrmTracker
548 end 549 end
549 object Panel5: TPanel 550 object Panel5: TPanel
550 Left = 300 551 Left = 300
551 Height = 105 552 Height = 104
552 Top = 0 553 Top = 0
553 Width = 346 554 Width = 270
554 BevelOuter = bvLowered 555 BevelOuter = bvLowered
555 ClientHeight = 105 556 ClientHeight = 104
556 ClientWidth = 346 557 ClientWidth = 270
557 ParentFont = False 558 ParentFont = False
558 TabOrder = 1 559 TabOrder = 1
559 object EnvelopePaintbox: TPaintBox 560 object EnvelopePaintbox: TPaintBox
560 Left = 1 561 Left = 1
561 Height = 103 562 Height = 102
562 Hint = 'Preview of the volume envelope' 563 Hint = 'Preview of the volume envelope'
563 Top = 1 564 Top = 1
564 Width = 344 565 Width = 268
565 Align = alClient 566 Align = alClient
566 ParentFont = False 567 ParentFont = False
567 OnPaint = EnvelopePaintboxPaint 568 OnPaint = EnvelopePaintboxPaint
@@ -913,16 +914,16 @@ object frmTracker: TfrmTracker
913 end 914 end
914 object WavesTabSheet: TTabSheet 915 object WavesTabSheet: TTabSheet
915 Caption = 'Waves' 916 Caption = 'Waves'
916 ClientHeight = 452 917 ClientHeight = 502
917 ClientWidth = 974 918 ClientWidth = 939
918 ParentFont = False 919 ParentFont = False
919 object WaveEditPaintBox: TPaintBox 920 object WaveEditPaintBox: TPaintBox
920 AnchorSideTop.Control = WaveEditGroupBox 921 AnchorSideTop.Control = WaveEditGroupBox
921 AnchorSideTop.Side = asrBottom 922 AnchorSideTop.Side = asrBottom
922 Left = 0 923 Left = 0
923 Height = 292 924 Height = 342
924 Top = 160 925 Top = 160
925 Width = 974 926 Width = 939
926 Align = alBottom 927 Align = alBottom
927 Anchors = [akTop, akLeft, akRight, akBottom] 928 Anchors = [akTop, akLeft, akRight, akBottom]
928 BorderSpacing.Top = 13 929 BorderSpacing.Top = 13
@@ -1014,17 +1015,17 @@ object frmTracker: TfrmTracker
1014 end 1015 end
1015 object CommentsTabSheet: TTabSheet 1016 object CommentsTabSheet: TTabSheet
1016 Caption = 'Comments' 1017 Caption = 'Comments'
1017 ClientHeight = 414 1018 ClientHeight = 502
1018 ClientWidth = 960 1019 ClientWidth = 939
1019 ParentFont = False 1020 ParentFont = False
1020 object CommentMemo: TMemo 1021 object CommentMemo: TMemo
1021 AnchorSideTop.Control = Label17 1022 AnchorSideTop.Control = Label17
1022 AnchorSideTop.Side = asrBottom 1023 AnchorSideTop.Side = asrBottom
1023 Left = 0 1024 Left = 0
1024 Height = 378 1025 Height = 466
1025 Hint = 'The comments section for your song. Greetings/links/etc' 1026 Hint = 'The comments section for your song. Greetings/links/etc'
1026 Top = 36 1027 Top = 36
1027 Width = 960 1028 Width = 939
1028 Align = alBottom 1029 Align = alBottom
1029 Anchors = [akTop, akLeft, akRight, akBottom] 1030 Anchors = [akTop, akLeft, akRight, akBottom]
1030 BorderSpacing.Top = 13 1031 BorderSpacing.Top = 13
@@ -1045,16 +1046,16 @@ object frmTracker: TfrmTracker
1045 end 1046 end
1046 object RoutinesTabSheet: TTabSheet 1047 object RoutinesTabSheet: TTabSheet
1047 Caption = 'Routines' 1048 Caption = 'Routines'
1048 ClientHeight = 414 1049 ClientHeight = 502
1049 ClientWidth = 960 1050 ClientWidth = 939
1050 ParentFont = False 1051 ParentFont = False
1051 inline RoutineSynedit: TSynEdit 1052 inline RoutineSynedit: TSynEdit
1052 AnchorSideTop.Control = Label19 1053 AnchorSideTop.Control = Label19
1053 AnchorSideTop.Side = asrBottom 1054 AnchorSideTop.Side = asrBottom
1054 Left = 0 1055 Left = 0
1055 Height = 286 1056 Height = 374
1056 Top = 128 1057 Top = 128
1057 Width = 960 1058 Width = 939
1058 Align = alBottom 1059 Align = alBottom
1059 BorderSpacing.Top = 13 1060 BorderSpacing.Top = 13
1060 Anchors = [akTop, akLeft, akRight, akBottom] 1061 Anchors = [akTop, akLeft, akRight, akBottom]
@@ -1588,64 +1589,64 @@ object frmTracker: TfrmTracker
1588 end 1589 end
1589 object Panel2: TPanel 1590 object Panel2: TPanel
1590 Left = 0 1591 Left = 0
1591 Height = 95 1592 Height = 63
1592 Top = 25 1593 Top = 25
1593 Width = 1180 1594 Width = 1145
1594 Align = alTop 1595 Align = alTop
1595 BevelOuter = bvNone 1596 BevelOuter = bvNone
1596 ClientHeight = 95 1597 ClientHeight = 63
1597 ClientWidth = 1180 1598 ClientWidth = 1145
1598 ParentFont = False 1599 ParentFont = False
1599 TabOrder = 3 1600 TabOrder = 3
1600 object LEDMeter1: TLEDMeter 1601 object LEDMeter1: TLEDMeter
1601 AnchorSideRight.Control = Duty1Visualizer 1602 AnchorSideRight.Control = Duty1Visualizer
1602 Left = 0 1603 Left = 0
1603 Height = 47 1604 Height = 31
1604 Top = 48 1605 Top = 32
1605 Width = 392 1606 Width = 357
1606 Anchors = [akTop, akLeft, akRight] 1607 Anchors = [akTop, akLeft, akRight]
1607 BevelStyle = bvLowered 1608 BevelStyle = bvLowered
1608 Colors.Border = clBlack 1609 Colors.Border = 2168839
1609 Colors.Section1 = clLime 1610 Colors.Section1 = 5269552
1610 Colors.Section2 = clYellow 1611 Colors.Section2 = 7127174
1611 Colors.Section3 = clRed 1612 Colors.Section3 = 13629664
1612 FallbackDelay = 0 1613 FallbackDelay = 0
1613 LEDContrast = 9 1614 LEDContrast = 9
1614 Max = 100 1615 Max = 50
1615 Min = 0 1616 Min = 0
1616 NumDigits = 30 1617 NumDigits = 32
1617 PeakHoldTime = 0 1618 PeakHoldTime = 0
1618 Position = 0 1619 Position = 0
1619 SingleLED = False 1620 SingleLED = False
1620 Section2Value = 60 1621 Section2Value = 3
1621 Section3Value = 80 1622 Section3Value = 48
1622 end 1623 end
1623 object LEDMeter2: TLEDMeter 1624 object LEDMeter2: TLEDMeter
1624 AnchorSideRight.Control = Duty1Visualizer 1625 AnchorSideRight.Control = Duty1Visualizer
1625 Left = 0 1626 Left = 0
1626 Height = 48 1627 Height = 32
1627 Top = 0 1628 Top = 0
1628 Width = 392 1629 Width = 357
1629 Anchors = [akTop, akLeft, akRight] 1630 Anchors = [akTop, akLeft, akRight]
1630 BevelStyle = bvLowered 1631 BevelStyle = bvLowered
1631 Colors.Border = clBlack 1632 Colors.Border = 2168839
1632 Colors.Section1 = clLime 1633 Colors.Section1 = 5269552
1633 Colors.Section2 = clYellow 1634 Colors.Section2 = 7127174
1634 Colors.Section3 = clRed 1635 Colors.Section3 = 13629664
1635 FallbackDelay = 0 1636 FallbackDelay = 0
1636 LEDContrast = 9 1637 LEDContrast = 9
1637 Max = 100 1638 Max = 50
1638 Min = 0 1639 Min = 0
1639 NumDigits = 30 1640 NumDigits = 32
1640 PeakHoldTime = 0 1641 PeakHoldTime = 0
1641 Position = 0 1642 Position = 0
1642 SingleLED = False 1643 SingleLED = False
1643 Section2Value = 60 1644 Section2Value = 3
1644 Section3Value = 80 1645 Section3Value = 48
1645 end 1646 end
1646 object Duty1Visualizer: TPaintBox 1647 object Duty1Visualizer: TPaintBox
1647 Left = 392 1648 Left = 357
1648 Height = 95 1649 Height = 63
1649 Top = 0 1650 Top = 0
1650 Width = 197 1651 Width = 197
1651 Align = alRight 1652 Align = alRight
@@ -1654,8 +1655,8 @@ object frmTracker: TfrmTracker
1654 OnPaint = Duty1VisualizerPaint 1655 OnPaint = Duty1VisualizerPaint
1655 end 1656 end
1656 object Duty2Visualizer: TPaintBox 1657 object Duty2Visualizer: TPaintBox
1657 Left = 589 1658 Left = 554
1658 Height = 95 1659 Height = 63
1659 Top = 0 1660 Top = 0
1660 Width = 197 1661 Width = 197
1661 Align = alRight 1662 Align = alRight
@@ -1664,8 +1665,8 @@ object frmTracker: TfrmTracker
1664 OnPaint = Duty2VisualizerPaint 1665 OnPaint = Duty2VisualizerPaint
1665 end 1666 end
1666 object WaveVisualizer: TPaintBox 1667 object WaveVisualizer: TPaintBox
1667 Left = 786 1668 Left = 751
1668 Height = 95 1669 Height = 63
1669 Top = 0 1670 Top = 0
1670 Width = 197 1671 Width = 197
1671 Align = alRight 1672 Align = alRight
@@ -1674,8 +1675,8 @@ object frmTracker: TfrmTracker
1674 OnPaint = WaveVisualizerPaint 1675 OnPaint = WaveVisualizerPaint
1675 end 1676 end
1676 object NoiseVisualizer: TPaintBox 1677 object NoiseVisualizer: TPaintBox
1677 Left = 983 1678 Left = 948
1678 Height = 95 1679 Height = 63
1679 Top = 0 1680 Top = 0
1680 Width = 197 1681 Width = 197
1681 Align = alRight 1682 Align = alRight
@@ -1687,8 +1688,8 @@ object frmTracker: TfrmTracker
1687 object StatusBar1: TStatusBar 1688 object StatusBar1: TStatusBar
1688 Left = 0 1689 Left = 0
1689 Height = 23 1690 Height = 23
1690 Top = 683 1691 Top = 618
1691 Width = 1180 1692 Width = 1145
1692 AutoHint = True 1693 AutoHint = True
1693 Panels = < 1694 Panels = <
1694 item 1695 item
@@ -1709,7 +1710,7 @@ object frmTracker: TfrmTracker
1709 Left = 0 1710 Left = 0
1710 Height = 25 1711 Height = 25
1711 Top = 0 1712 Top = 0
1712 Width = 1180 1713 Width = 1145
1713 AutoSize = True 1714 AutoSize = True
1714 Caption = 'ToolBar1' 1715 Caption = 'ToolBar1'
1715 EdgeBorders = [ebBottom] 1716 EdgeBorders = [ebBottom]
@@ -1776,7 +1777,7 @@ object frmTracker: TfrmTracker
1776 Style = tbsDivider 1777 Style = tbsDivider
1777 end 1778 end
1778 object ToolButton7: TToolButton 1779 object ToolButton7: TToolButton
1779 Left = 1122 1780 Left = 1097
1780 Height = 22 1781 Height = 22
1781 Top = 0 1782 Top = 0
1782 Caption = 'ToolButton7' 1783 Caption = 'ToolButton7'
@@ -1787,7 +1788,7 @@ object frmTracker: TfrmTracker
1787 Height = 23 1788 Height = 23
1788 Hint = 'The octave offset for entering new notes' 1789 Hint = 'The octave offset for entering new notes'
1789 Top = 0 1790 Top = 0
1790 Width = 90 1791 Width = 65
1791 MaxValue = 5 1792 MaxValue = 5
1792 OnChange = OctaveSpinEditChange 1793 OnChange = OctaveSpinEditChange
1793 ParentFont = False 1794 ParentFont = False
@@ -1802,24 +1803,28 @@ object frmTracker: TfrmTracker
1802 end 1803 end
1803 object Label22: TLabel 1804 object Label22: TLabel
1804 Left = 620 1805 Left = 620
1805 Height = 15 1806 Height = 22
1806 Top = 0 1807 Top = 0
1807 Width = 43 1808 Width = 43
1809 AutoSize = False
1808 Caption = 'Octave ' 1810 Caption = 'Octave '
1811 Layout = tlCenter
1809 ParentColor = False 1812 ParentColor = False
1810 ParentFont = False 1813 ParentFont = False
1811 end 1814 end
1812 object Label23: TLabel 1815 object Label23: TLabel
1813 Left = 753 1816 Left = 728
1814 Height = 15 1817 Height = 22
1815 Top = 0 1818 Top = 0
1816 Width = 70 1819 Width = 70
1820 AutoSize = False
1817 Caption = ' Instrument ' 1821 Caption = ' Instrument '
1822 Layout = tlCenter
1818 ParentColor = False 1823 ParentColor = False
1819 ParentFont = False 1824 ParentFont = False
1820 end 1825 end
1821 object InstrumentComboBox: TComboBox 1826 object InstrumentComboBox: TComboBox
1822 Left = 823 1827 Left = 798
1823 Height = 23 1828 Height = 23
1824 Hint = 'The selected instrument for new notes' 1829 Hint = 'The selected instrument for new notes'
1825 Top = 0 1830 Top = 0
@@ -1837,16 +1842,18 @@ object frmTracker: TfrmTracker
1837 Text = '(no instrument)' 1842 Text = '(no instrument)'
1838 end 1843 end
1839 object Label24: TLabel 1844 object Label24: TLabel
1840 Left = 1037 1845 Left = 1012
1841 Height = 15 1846 Height = 22
1842 Top = 0 1847 Top = 0
1843 Width = 35 1848 Width = 35
1849 AutoSize = False
1844 Caption = ' Step ' 1850 Caption = ' Step '
1851 Layout = tlCenter
1845 ParentColor = False 1852 ParentColor = False
1846 ParentFont = False 1853 ParentFont = False
1847 end 1854 end
1848 object StepSpinEdit: TSpinEdit 1855 object StepSpinEdit: TSpinEdit
1849 Left = 1072 1856 Left = 1047
1850 Height = 23 1857 Height = 23
1851 Hint = 'How many rows to step down after entering a new note' 1858 Hint = 'How many rows to step down after entering a new note'
1852 Top = 0 1859 Top = 0
Modifiedtracker.pas +65−2
@@ -413,6 +413,7 @@ type
413 function CheckUnsavedChanges: Boolean; 413 function CheckUnsavedChanges: Boolean;
414 414
415 procedure DrawWaveform(PB: TPaintBox; Wave: TWave); 415 procedure DrawWaveform(PB: TPaintBox; Wave: TWave);
416 procedure DrawEnvelope(PB: TPaintBox);
416 procedure DrawVizualizer(PB: TPaintBox; Channel: Integer); 417 procedure DrawVizualizer(PB: TPaintBox; Channel: Integer);
417 418
418 procedure PreviewInstrument(Freq: Integer; Instr: Integer; SquareOnCh2: Boolean = False); overload; 419 procedure PreviewInstrument(Freq: Integer; Instr: Integer; SquareOnCh2: Boolean = False); overload;
@@ -534,6 +535,61 @@ begin
534 end; 535 end;
535 end; 536 end;
536 537
538
539 procedure TfrmTracker.DrawEnvelope(PB: TPaintBox);
540 var
541 Interval, HInterval: Integer;
542 I: Integer;
543 W, H, V, S, L: Integer;
544 begin
545 W := PB.Width;
546 H := PB.Height-3;
547 V := CurrentInstrument^.InitialVolume;
548 S := CurrentInstrument^.VolSweepAmount*2;
549 case CurrentInstrument^.LengthEnabled of
550 True: L := (64-CurrentInstrument^.Length) div 2;
551 False: L := 400;
552 end;
553 Interval := 1 {W div 260};
554 HInterval := H div 15;
555
556 With PB.Canvas do begin
557 Brush.Color := TColor($211807); // Gameboy Black
558 Clear;
559 Pen.Color := TColor($6CC086); // Gameboy Mid Green
560 Pen.Width := 3;
561 MoveTo(0, H-V*HInterval); // Start volume
562
563 if S{weep} = 0 then begin
564 LineTo(L*Interval, H-V*HInterval); // no sweep
565 MoveTo(L*Interval, H-(V*HInterval));
566 LineTo(L*Interval, H);
567 end
568 else begin
569 case CurrentInstrument^.VolSweepDirection of
570 Down: begin // Envelope down, check length cut
571 For I := 0 to V do
572 LineTo( Min(I*S,L)*Interval, H-(V-I)*HInterval);
573 LineTo(W, H);
574 MoveTo(Trunc(L*Interval), 0);
575 LineTo(Trunc(L*Interval), H);
576 end;
577 Up: begin // Envelope up, check length cut
578 For I := 0 to 15-V do
579 LineTo( Min(I*S,L)*Interval, (15-V-I)*HInterval+9);
580 LineTo(L*Interval, H-15*HInterval);
581 MoveTo(L*Interval, 0);
582 LineTo(L*Interval, H);
583 end;
584 end;
585 end;
586 // Width = 64th/sec sweep or 256th/sec length,
587 // Envelope = sweep length(0-7 * volume(0-15) * 1/64. max 105 (1.64 sec)
588 // Length = Length(0-63) / 1/256, max .25 sec.
589 // for simplicity, Sweep is mult 2, length is div 2, both 1/128 sec.
590 end;
591 end;
592
537 procedure TfrmTracker.DrawVizualizer(PB: TPaintBox; Channel: Integer); 593 procedure TfrmTracker.DrawVizualizer(PB: TPaintBox; Channel: Integer);
538 var 594 var
539 I, J, X: Integer; 595 I, J, X: Integer;
@@ -543,7 +599,7 @@ begin
543 with VisualizerBuffer.Canvas do begin 599 with VisualizerBuffer.Canvas do begin
544 MoveTo(0, PB.Height div 2); 600 MoveTo(0, PB.Height div 2);
545 601
546 Brush.Color := clBlack; 602 Brush.Color := TColor($211807); // Gameboy Black
547 Clear; 603 Clear;
548 604
549 Pen.Color := clGray; 605 Pen.Color := clGray;
@@ -552,7 +608,7 @@ begin
552 Pen.Width := 2; 608 Pen.Width := 2;
553 609
554 if not snd[Channel].ChannelOFF then begin 610 if not snd[Channel].ChannelOFF then begin
555 Pen.Color := clLime; 611 Pen.Color := TColor($6CC086); // Gameboy Mid Green
556 612
557 X := 0; 613 X := 0;
558 I := 0; 614 I := 0;
@@ -999,6 +1055,7 @@ end;
999 procedure TfrmTracker.StartVolSpinnerChange(Sender: TObject); 1055 procedure TfrmTracker.StartVolSpinnerChange(Sender: TObject);
1000 begin 1056 begin
1001 CurrentInstrument^.InitialVolume := Round(StartVolTrackbar.Position); 1057 CurrentInstrument^.InitialVolume := Round(StartVolTrackbar.Position);
1058 DrawEnvelope(EnvelopePaintBox);
1002 end; 1059 end;
1003 1060
1004 procedure TfrmTracker.SweepDirectionComboboxChange(Sender: TObject); 1061 procedure TfrmTracker.SweepDirectionComboboxChange(Sender: TObject);
@@ -1007,6 +1064,7 @@ begin
1007 'Up': CurrentInstrument^.SweepIncDec := Up; 1064 'Up': CurrentInstrument^.SweepIncDec := Up;
1008 'Down': CurrentInstrument^.SweepIncDec := Down; 1065 'Down': CurrentInstrument^.SweepIncDec := Down;
1009 end; 1066 end;
1067 DrawEnvelope(EnvelopePaintBox);
1010 end; 1068 end;
1011 1069
1012 procedure TfrmTracker.SweepSizeSpinnerChange(Sender: TObject); 1070 procedure TfrmTracker.SweepSizeSpinnerChange(Sender: TObject);
@@ -1255,6 +1313,7 @@ begin
1255 'Up': CurrentInstrument^.VolSweepDirection := Up; 1313 'Up': CurrentInstrument^.VolSweepDirection := Up;
1256 'Down': CurrentInstrument^.VolSweepDirection := Down; 1314 'Down': CurrentInstrument^.VolSweepDirection := Down;
1257 end; 1315 end;
1316 DrawEnvelope(EnvelopePaintBox);
1258 end; 1317 end;
1259 1318
1260 procedure TfrmTracker.CommentMemoChange(Sender: TObject); 1319 procedure TfrmTracker.CommentMemoChange(Sender: TObject);
@@ -1525,6 +1584,7 @@ end;
1525 procedure TfrmTracker.EnvChangeSpinnerChange(Sender: TObject); 1584 procedure TfrmTracker.EnvChangeSpinnerChange(Sender: TObject);
1526 begin 1585 begin
1527 CurrentInstrument^.VolSweepAmount := Round(EnvChangeTrackbar.Position); 1586 CurrentInstrument^.VolSweepAmount := Round(EnvChangeTrackbar.Position);
1587 DrawEnvelope(EnvelopePaintBox);
1528 end; 1588 end;
1529 1589
1530 procedure TfrmTracker.EnvelopePaintboxPaint(Sender: TObject); 1590 procedure TfrmTracker.EnvelopePaintboxPaint(Sender: TObject);
@@ -1533,6 +1593,7 @@ begin
1533 Brush.Color := clBlack; 1593 Brush.Color := clBlack;
1534 Clear; 1594 Clear;
1535 end; 1595 end;
1596 DrawEnvelope(EnvelopePaintBox);
1536 end; 1597 end;
1537 1598
1538 procedure TfrmTracker.InstrumentNameEditChange(Sender: TObject); 1599 procedure TfrmTracker.InstrumentNameEditChange(Sender: TObject);
@@ -1565,6 +1626,7 @@ end;
1565 procedure TfrmTracker.LengthSpinnerChange(Sender: TObject); 1626 procedure TfrmTracker.LengthSpinnerChange(Sender: TObject);
1566 begin 1627 begin
1567 CurrentInstrument^.Length := Round(LengthTrackbar.Position); 1628 CurrentInstrument^.Length := Round(LengthTrackbar.Position);
1629 DrawEnvelope(EnvelopePaintBox);
1568 end; 1630 end;
1569 1631
1570 procedure TfrmTracker.DebugPlayNoteButtonClick(Sender: TObject); 1632 procedure TfrmTracker.DebugPlayNoteButtonClick(Sender: TObject);
@@ -2149,6 +2211,7 @@ procedure TfrmTracker.LengthEnabledCheckboxChange(Sender: TObject);
2149 begin 2211 begin
2150 LengthTrackbar.Enabled := LengthEnabledCheckbox.Checked; 2212 LengthTrackbar.Enabled := LengthEnabledCheckbox.Checked;
2151 CurrentInstrument^.LengthEnabled := LengthEnabledCheckbox.Checked; 2213 CurrentInstrument^.LengthEnabled := LengthEnabledCheckbox.Checked;
2214 DrawEnvelope(EnvelopePaintBox);
2152 end; 2215 end;
2153 2216
2154 end. 2217 end.