Commit 4463842

Nick committed on
Implement preview while bumping feature
commit 446384241c12abbf337229bb050e9153f026aa6e parent 1988693
3 changed files +135−86
Modifiedoptions.pas +2−0
@@ -88,6 +88,7 @@ begin
88 TrackerSettings.PatternEditorFontSize := FontSizeSpinner.Value; 88 TrackerSettings.PatternEditorFontSize := FontSizeSpinner.Value;
89 TrackerSettings.UseScopes := ScopesCheck.Checked; 89 TrackerSettings.UseScopes := ScopesCheck.Checked;
90 TrackerSettings.UseCustomKeymap := KeymapCheckbox.Checked; 90 TrackerSettings.UseCustomKeymap := KeymapCheckbox.Checked;
91 TrackerSettings.PreviewWhenPlacing := PreviewWhenPlacingCheck.Checked;
91 TrackerSettings.PreviewWhenBumping := PreviewWhenBumpingCheck.Checked; 92 TrackerSettings.PreviewWhenBumping := PreviewWhenBumpingCheck.Checked;
92 TrackerSettings.DisplayRowNumbersAsHex := DisplayHexRowNumbersCheck.Checked; 93 TrackerSettings.DisplayRowNumbersAsHex := DisplayHexRowNumbersCheck.Checked;
93 end; 94 end;
@@ -102,6 +103,7 @@ begin
102 FontSizeSpinner.Value := TrackerSettings.PatternEditorFontSize; 103 FontSizeSpinner.Value := TrackerSettings.PatternEditorFontSize;
103 ScopesCheck.Checked := TrackerSettings.UseScopes; 104 ScopesCheck.Checked := TrackerSettings.UseScopes;
104 KeymapCheckbox.Checked := TrackerSettings.UseCustomKeymap; 105 KeymapCheckbox.Checked := TrackerSettings.UseCustomKeymap;
106 PreviewWhenPlacingCheck.Checked := TrackerSettings.PreviewWhenPlacing;
105 PreviewWhenBumpingCheck.Checked := TrackerSettings.PreviewWhenBumping; 107 PreviewWhenBumpingCheck.Checked := TrackerSettings.PreviewWhenBumping;
106 DisplayHexRowNumbersCheck.Checked := TrackerSettings.DisplayRowNumbersAsHex; 108 DisplayHexRowNumbersCheck.Checked := TrackerSettings.DisplayRowNumbersAsHex;
107 end; 109 end;
Modifiedtracker.lfm +80−80
@@ -5,8 +5,8 @@ object frmTracker: TfrmTracker
5 Width = 1232 5 Width = 1232
6 AllowDropFiles = True 6 AllowDropFiles = True
7 Caption = 'hUGETracker' 7 Caption = 'hUGETracker'
8 ClientHeight = 633 8 ClientHeight = 0
9 ClientWidth = 1232 9 ClientWidth = 0
10 KeyPreview = True 10 KeyPreview = True
11 Menu = MainMenu1 11 Menu = MainMenu1
12 OnCloseQuery = FormCloseQuery 12 OnCloseQuery = FormCloseQuery
@@ -20,8 +20,8 @@ object frmTracker: TfrmTracker
20 LCLVersion = '2.0.11.0' 20 LCLVersion = '2.0.11.0'
21 object TreeView1: TTreeView 21 object TreeView1: TTreeView
22 Left = 0 22 Left = 0
23 Height = 521 23 Height = 0
24 Top = 89 24 Top = 0
25 Width = 193 25 Width = 193
26 Align = alLeft 26 Align = alLeft
27 ParentFont = False 27 ParentFont = False
@@ -40,36 +40,36 @@ object frmTracker: TfrmTracker
40 } 40 }
41 end 41 end
42 object Splitter1: TSplitter 42 object Splitter1: TSplitter
43 Left = 193 43 Left = 0
44 Height = 521 44 Height = 0
45 Top = 89 45 Top = 0
46 Width = 5 46 Width = 5
47 end 47 end
48 object Panel1: TPanel 48 object Panel1: TPanel
49 Left = 198 49 Left = 0
50 Height = 521 50 Height = 0
51 Top = 89 51 Top = 0
52 Width = 1034 52 Width = 0
53 Align = alClient 53 Align = alClient
54 BevelOuter = bvNone 54 BevelOuter = bvNone
55 ClientHeight = 521 55 ClientHeight = 0
56 ClientWidth = 1034 56 ClientWidth = 0
57 ParentFont = False 57 ParentFont = False
58 TabOrder = 2 58 TabOrder = 2
59 object PageControl1: TPageControl 59 object PageControl1: TPageControl
60 Left = 0 60 Left = 0
61 Height = 521 61 Height = 0
62 Top = 0 62 Top = 0
63 Width = 1034 63 Width = 0
64 ActivePage = PatternTabSheet 64 ActivePage = InstrumentTabSheet
65 Align = alClient 65 Align = alClient
66 ParentFont = False 66 ParentFont = False
67 TabIndex = 1 67 TabIndex = 2
68 TabOrder = 0 68 TabOrder = 0
69 object GeneralTabSheet: TTabSheet 69 object GeneralTabSheet: TTabSheet
70 Caption = 'General' 70 Caption = 'General'
71 ClientHeight = 493 71 ClientHeight = 0
72 ClientWidth = 1026 72 ClientWidth = 0
73 ParentFont = False 73 ParentFont = False
74 object SongInformationGroupbox: TGroupBox 74 object SongInformationGroupbox: TGroupBox
75 Left = 8 75 Left = 8
@@ -313,8 +313,8 @@ object frmTracker: TfrmTracker
313 end 313 end
314 object InstrumentTabSheet: TTabSheet 314 object InstrumentTabSheet: TTabSheet
315 Caption = 'Instruments' 315 Caption = 'Instruments'
316 ClientHeight = 493 316 ClientHeight = 0
317 ClientWidth = 1026 317 ClientWidth = 0
318 ParentFont = False 318 ParentFont = False
319 object PaintBox1: TPaintBox 319 object PaintBox1: TPaintBox
320 AnchorSideTop.Control = FlowPanel1 320 AnchorSideTop.Control = FlowPanel1
@@ -323,8 +323,8 @@ object frmTracker: TfrmTracker
323 Left = 0 323 Left = 0
324 Height = 0 324 Height = 0
325 Hint = 'Preview of how the resulting waveform will look with envelope applied' 325 Hint = 'Preview of how the resulting waveform will look with envelope applied'
326 Top = 493 326 Top = 0
327 Width = 1026 327 Width = 0
328 Align = alClient 328 Align = alClient
329 Color = clBlack 329 Color = clBlack
330 ParentColor = False 330 ParentColor = False
@@ -334,9 +334,9 @@ object frmTracker: TfrmTracker
334 end 334 end
335 object FlowPanel1: TFlowPanel 335 object FlowPanel1: TFlowPanel
336 Left = 0 336 Left = 0
337 Height = 675 337 Height = 1008
338 Top = 0 338 Top = 0
339 Width = 1026 339 Width = 0
340 Align = alTop 340 Align = alTop
341 AutoSize = True 341 AutoSize = True
342 BevelOuter = bvNone 342 BevelOuter = bvNone
@@ -512,9 +512,9 @@ object frmTracker: TfrmTracker
512 end 512 end
513 end 513 end
514 object EnvelopeGroupBox: TGroupBox 514 object EnvelopeGroupBox: TGroupBox
515 Left = 292 515 Left = 7
516 Height = 136 516 Height = 136
517 Top = 7 517 Top = 262
518 Width = 582 518 Width = 582
519 Anchors = [] 519 Anchors = []
520 BorderSpacing.Left = 7 520 BorderSpacing.Left = 7
@@ -618,7 +618,7 @@ object frmTracker: TfrmTracker
618 object SquareGroupBox: TGroupBox 618 object SquareGroupBox: TGroupBox
619 Left = 7 619 Left = 7
620 Height = 169 620 Height = 169
621 Top = 262 621 Top = 412
622 Width = 319 622 Width = 319
623 Anchors = [] 623 Anchors = []
624 BorderSpacing.Left = 7 624 BorderSpacing.Left = 7
@@ -747,9 +747,9 @@ object frmTracker: TfrmTracker
747 end 747 end
748 end 748 end
749 object WaveGroupBox: TGroupBox 749 object WaveGroupBox: TGroupBox
750 Left = 340 750 Left = 7
751 Height = 169 751 Height = 169
752 Top = 262 752 Top = 595
753 Width = 297 753 Width = 297
754 Anchors = [] 754 Anchors = []
755 BorderSpacing.Left = 7 755 BorderSpacing.Left = 7
@@ -858,7 +858,7 @@ object frmTracker: TfrmTracker
858 object NoiseGroupBox: TGroupBox 858 object NoiseGroupBox: TGroupBox
859 Left = 7 859 Left = 7
860 Height = 223 860 Height = 223
861 Top = 445 861 Top = 778
862 Width = 397 862 Width = 397
863 Anchors = [] 863 Anchors = []
864 BorderSpacing.Left = 7 864 BorderSpacing.Left = 7
@@ -1588,12 +1588,12 @@ object frmTracker: TfrmTracker
1588 object Panel2: TPanel 1588 object Panel2: TPanel
1589 Left = 0 1589 Left = 0
1590 Height = 64 1590 Height = 64
1591 Top = 25 1591 Top = 0
1592 Width = 1232 1592 Width = 0
1593 Align = alTop 1593 Align = alTop
1594 BevelOuter = bvNone 1594 BevelOuter = bvNone
1595 ClientHeight = 64 1595 ClientHeight = 64
1596 ClientWidth = 1232 1596 ClientWidth = 0
1597 ParentFont = False 1597 ParentFont = False
1598 TabOrder = 3 1598 TabOrder = 3
1599 object LEDMeter1: TLEDMeter 1599 object LEDMeter1: TLEDMeter
@@ -1601,7 +1601,7 @@ object frmTracker: TfrmTracker
1601 Left = 0 1601 Left = 0
1602 Height = 32 1602 Height = 32
1603 Top = 32 1603 Top = 32
1604 Width = 444 1604 Width = 0
1605 Anchors = [akTop, akLeft, akRight] 1605 Anchors = [akTop, akLeft, akRight]
1606 BevelStyle = bvLowered 1606 BevelStyle = bvLowered
1607 Colors.Border = 2168839 1607 Colors.Border = 2168839
@@ -1624,7 +1624,7 @@ object frmTracker: TfrmTracker
1624 Left = 0 1624 Left = 0
1625 Height = 32 1625 Height = 32
1626 Top = 0 1626 Top = 0
1627 Width = 444 1627 Width = 0
1628 Anchors = [akTop, akLeft, akRight] 1628 Anchors = [akTop, akLeft, akRight]
1629 BevelStyle = bvLowered 1629 BevelStyle = bvLowered
1630 Colors.Border = 2168839 1630 Colors.Border = 2168839
@@ -1643,7 +1643,7 @@ object frmTracker: TfrmTracker
1643 Section3Value = 48 1643 Section3Value = 48
1644 end 1644 end
1645 object Duty1Visualizer: TPaintBox 1645 object Duty1Visualizer: TPaintBox
1646 Left = 444 1646 Left = -197
1647 Height = 64 1647 Height = 64
1648 Top = 0 1648 Top = 0
1649 Width = 197 1649 Width = 197
@@ -1653,7 +1653,7 @@ object frmTracker: TfrmTracker
1653 OnPaint = Duty1VisualizerPaint 1653 OnPaint = Duty1VisualizerPaint
1654 end 1654 end
1655 object Duty2Visualizer: TPaintBox 1655 object Duty2Visualizer: TPaintBox
1656 Left = 641 1656 Left = -197
1657 Height = 64 1657 Height = 64
1658 Top = 0 1658 Top = 0
1659 Width = 197 1659 Width = 197
@@ -1663,7 +1663,7 @@ object frmTracker: TfrmTracker
1663 OnPaint = Duty2VisualizerPaint 1663 OnPaint = Duty2VisualizerPaint
1664 end 1664 end
1665 object WaveVisualizer: TPaintBox 1665 object WaveVisualizer: TPaintBox
1666 Left = 838 1666 Left = -197
1667 Height = 64 1667 Height = 64
1668 Top = 0 1668 Top = 0
1669 Width = 197 1669 Width = 197
@@ -1673,7 +1673,7 @@ object frmTracker: TfrmTracker
1673 OnPaint = WaveVisualizerPaint 1673 OnPaint = WaveVisualizerPaint
1674 end 1674 end
1675 object NoiseVisualizer: TPaintBox 1675 object NoiseVisualizer: TPaintBox
1676 Left = 1035 1676 Left = -197
1677 Height = 64 1677 Height = 64
1678 Top = 0 1678 Top = 0
1679 Width = 197 1679 Width = 197
@@ -1686,8 +1686,8 @@ object frmTracker: TfrmTracker
1686 object StatusBar1: TStatusBar 1686 object StatusBar1: TStatusBar
1687 Left = 0 1687 Left = 0
1688 Height = 23 1688 Height = 23
1689 Top = 610 1689 Top = -23
1690 Width = 1232 1690 Width = 0
1691 AutoHint = True 1691 AutoHint = True
1692 Panels = < 1692 Panels = <
1693 item 1693 item
@@ -1706,9 +1706,9 @@ object frmTracker: TfrmTracker
1706 end 1706 end
1707 object ToolBar1: TToolBar 1707 object ToolBar1: TToolBar
1708 Left = 0 1708 Left = 0
1709 Height = 25 1709 Height = 420
1710 Top = 0 1710 Top = 0
1711 Width = 1232 1711 Width = 0
1712 AutoSize = True 1712 AutoSize = True
1713 Caption = 'ToolBar1' 1713 Caption = 'ToolBar1'
1714 EdgeBorders = [ebBottom] 1714 EdgeBorders = [ebBottom]
@@ -1725,9 +1725,9 @@ object frmTracker: TfrmTracker
1725 ParentShowHint = False 1725 ParentShowHint = False
1726 end 1726 end
1727 object PanicToolButton: TToolButton 1727 object PanicToolButton: TToolButton
1728 Left = 557 1728 Left = 1
1729 Hint = 'Stops all sound output' 1729 Hint = 'Stops all sound output'
1730 Top = 0 1730 Top = 220
1731 AutoSize = True 1731 AutoSize = True
1732 Caption = 'Panic' 1732 Caption = 'Panic'
1733 ImageIndex = 72 1733 ImageIndex = 72
@@ -1736,50 +1736,50 @@ object frmTracker: TfrmTracker
1736 ShowHint = True 1736 ShowHint = True
1737 end 1737 end
1738 object ToolButton2: TToolButton 1738 object ToolButton2: TToolButton
1739 Left = 147 1739 Left = 1
1740 Top = 0 1740 Top = 66
1741 Action = PlayCursorAction 1741 Action = PlayCursorAction
1742 end 1742 end
1743 object ToolButton4: TToolButton 1743 object ToolButton4: TToolButton
1744 Left = 221 1744 Left = 1
1745 Top = 0 1745 Top = 88
1746 Action = StopAction 1746 Action = StopAction
1747 end 1747 end
1748 object ExportGBButton: TToolButton 1748 object ExportGBButton: TToolButton
1749 Left = 291 1749 Left = 1
1750 Hint = 'Export the song as a standalone ROM' 1750 Hint = 'Export the song as a standalone ROM'
1751 Top = 0 1751 Top = 132
1752 AutoSize = True 1752 AutoSize = True
1753 Caption = 'Export .GB' 1753 Caption = 'Export .GB'
1754 ImageIndex = 76 1754 ImageIndex = 76
1755 OnClick = ExportGBButtonClick 1755 OnClick = ExportGBButtonClick
1756 end 1756 end
1757 object ToolButton8: TToolButton 1757 object ToolButton8: TToolButton
1758 Left = 79 1758 Left = 1
1759 Height = 22 1759 Height = 22
1760 Top = 0 1760 Top = 22
1761 Caption = 'ToolButton8' 1761 Caption = 'ToolButton8'
1762 Style = tbsDivider 1762 Style = tbsDivider
1763 end 1763 end
1764 object ToolButton6: TToolButton 1764 object ToolButton6: TToolButton
1765 Left = 286 1765 Left = 1
1766 Height = 22 1766 Height = 22
1767 Top = 0 1767 Top = 110
1768 Caption = 'ToolButton6' 1768 Caption = 'ToolButton6'
1769 Style = tbsDivider 1769 Style = tbsDivider
1770 end 1770 end
1771 object ToolButton7: TToolButton 1771 object ToolButton7: TToolButton
1772 Left = 1097 1772 Left = 1
1773 Height = 22 1773 Height = 22
1774 Top = 0 1774 Top = 396
1775 Caption = 'ToolButton7' 1775 Caption = 'ToolButton7'
1776 Style = tbsSeparator 1776 Style = tbsSeparator
1777 end 1777 end
1778 object OctaveSpinEdit: TSpinEdit 1778 object OctaveSpinEdit: TSpinEdit
1779 Left = 663 1779 Left = 1
1780 Height = 23 1780 Height = 23
1781 Hint = 'The octave offset for entering new notes' 1781 Hint = 'The octave offset for entering new notes'
1782 Top = 0 1782 Top = 286
1783 Width = 65 1783 Width = 65
1784 MaxValue = 5 1784 MaxValue = 5
1785 OnChange = OctaveSpinEditChange 1785 OnChange = OctaveSpinEditChange
@@ -1787,16 +1787,16 @@ object frmTracker: TfrmTracker
1787 TabOrder = 0 1787 TabOrder = 0
1788 end 1788 end
1789 object ToolButton9: TToolButton 1789 object ToolButton9: TToolButton
1790 Left = 612 1790 Left = 1
1791 Height = 22 1791 Height = 22
1792 Top = 0 1792 Top = 242
1793 Caption = 'ToolButton9' 1793 Caption = 'ToolButton9'
1794 Style = tbsSeparator 1794 Style = tbsSeparator
1795 end 1795 end
1796 object Label22: TLabel 1796 object Label22: TLabel
1797 Left = 620 1797 Left = 1
1798 Height = 22 1798 Height = 22
1799 Top = 0 1799 Top = 264
1800 Width = 43 1800 Width = 43
1801 AutoSize = False 1801 AutoSize = False
1802 Caption = 'Octave ' 1802 Caption = 'Octave '
@@ -1805,9 +1805,9 @@ object frmTracker: TfrmTracker
1805 ParentFont = False 1805 ParentFont = False
1806 end 1806 end
1807 object Label23: TLabel 1807 object Label23: TLabel
1808 Left = 728 1808 Left = 1
1809 Height = 22 1809 Height = 22
1810 Top = 0 1810 Top = 308
1811 Width = 70 1811 Width = 70
1812 AutoSize = False 1812 AutoSize = False
1813 Caption = ' Instrument ' 1813 Caption = ' Instrument '
@@ -1816,10 +1816,10 @@ object frmTracker: TfrmTracker
1816 ParentFont = False 1816 ParentFont = False
1817 end 1817 end
1818 object InstrumentComboBox: TComboBox 1818 object InstrumentComboBox: TComboBox
1819 Left = 798 1819 Left = 1
1820 Height = 23 1820 Height = 23
1821 Hint = 'The selected instrument for new notes' 1821 Hint = 'The selected instrument for new notes'
1822 Top = 0 1822 Top = 330
1823 Width = 214 1823 Width = 214
1824 DropDownCount = 999 1824 DropDownCount = 999
1825 ItemHeight = 15 1825 ItemHeight = 15
@@ -1834,9 +1834,9 @@ object frmTracker: TfrmTracker
1834 Text = '(no instrument)' 1834 Text = '(no instrument)'
1835 end 1835 end
1836 object Label24: TLabel 1836 object Label24: TLabel
1837 Left = 1012 1837 Left = 1
1838 Height = 22 1838 Height = 22
1839 Top = 0 1839 Top = 352
1840 Width = 35 1840 Width = 35
1841 AutoSize = False 1841 AutoSize = False
1842 Caption = ' Step ' 1842 Caption = ' Step '
@@ -1845,10 +1845,10 @@ object frmTracker: TfrmTracker
1845 ParentFont = False 1845 ParentFont = False
1846 end 1846 end
1847 object StepSpinEdit: TSpinEdit 1847 object StepSpinEdit: TSpinEdit
1848 Left = 1047 1848 Left = 1
1849 Height = 23 1849 Height = 23
1850 Hint = 'How many rows to step down after entering a new note' 1850 Hint = 'How many rows to step down after entering a new note'
1851 Top = 0 1851 Top = 374
1852 Width = 50 1852 Width = 50
1853 MaxValue = 63 1853 MaxValue = 63
1854 OnChange = StepSpinEditChange 1854 OnChange = StepSpinEditChange
@@ -1856,29 +1856,29 @@ object frmTracker: TfrmTracker
1856 TabOrder = 2 1856 TabOrder = 2
1857 end 1857 end
1858 object ToolButton3: TToolButton 1858 object ToolButton3: TToolButton
1859 Left = 84 1859 Left = 1
1860 Top = 0 1860 Top = 44
1861 Action = PlayStartAction 1861 Action = PlayStartAction
1862 end 1862 end
1863 object ExportGBSButton: TToolButton 1863 object ExportGBSButton: TToolButton
1864 Left = 372 1864 Left = 1
1865 Hint = 'Export the song as a GBS soundtrack' 1865 Hint = 'Export the song as a GBS soundtrack'
1866 Top = 0 1866 Top = 154
1867 Caption = 'Export .GBS' 1867 Caption = 'Export .GBS'
1868 ImageIndex = 76 1868 ImageIndex = 76
1869 OnClick = ExportGBSButtonClick 1869 OnClick = ExportGBSButtonClick
1870 end 1870 end
1871 object ToolButton5: TToolButton 1871 object ToolButton5: TToolButton
1872 Left = 552 1872 Left = 1
1873 Height = 22 1873 Height = 22
1874 Top = 0 1874 Top = 198
1875 Caption = 'ToolButton5' 1875 Caption = 'ToolButton5'
1876 Style = tbsDivider 1876 Style = tbsDivider
1877 end 1877 end
1878 object ToolButton10: TToolButton 1878 object ToolButton10: TToolButton
1879 Left = 459 1879 Left = 1
1880 Hint = 'Export the song as WAV or MP3' 1880 Hint = 'Export the song as WAV or MP3'
1881 Top = 0 1881 Top = 176
1882 Caption = 'Render Song' 1882 Caption = 'Render Song'
1883 ImageIndex = 77 1883 ImageIndex = 77
1884 OnClick = ToolButton10Click 1884 OnClick = ToolButton10Click
Modifiedtracker.pas +53−6
@@ -475,6 +475,7 @@ type
475 procedure DrawEnvelope(PB: TPaintBox); 475 procedure DrawEnvelope(PB: TPaintBox);
476 procedure DrawVizualizer(PB: TPaintBox; Channel: Integer); 476 procedure DrawVizualizer(PB: TPaintBox; Channel: Integer);
477 477
478 procedure PreviewNoteUnderCursor;
478 procedure PreviewInstrument(Note: Integer; Instr: Integer; SquareOnCh2: Boolean = False); overload; 479 procedure PreviewInstrument(Note: Integer; Instr: Integer; SquareOnCh2: Boolean = False); overload;
479 procedure PreviewInstrument(Note: Integer; Instr: TInstrument; SquareOnCh2: Boolean = False); overload; 480 procedure PreviewInstrument(Note: Integer; Instr: TInstrument; SquareOnCh2: Boolean = False); overload;
480 procedure PreviewC5; 481 procedure PreviewC5;
@@ -715,6 +716,45 @@ begin
715 VisualizerBuffer.Draw(PB.Canvas, 0, 0, True); 716 VisualizerBuffer.Draw(PB.Canvas, 0, 0, True);
716 end; 717 end;
717 718
719 procedure TfrmTracker.PreviewNoteUnderCursor;
720 var
721 Note: Integer;
722 Instr: Integer;
723 C: TSelectionPos;
724 R: TRect;
725 begin
726 // TODO: Deduplicate this code from the form keydown handler which
727 // plays back the current instrument previews when entering a note
728 if TrackerGrid.Cursor.SelectedPart <> cpNote then Exit;
729 R := TrackerGrid.SelectionGridRect;
730 if (R.Width <> 0) or (R.Height <> 0) then Exit;
731
732 C := TrackerGrid.Cursor;
733 Note := TrackerGrid.GetAt(C);
734 IncSelectionPos(C);
735 Instr := TrackerGrid.GetAt(C);
736
737 if PreviewingInstrument <> Note then
738 PreviewingInstrument := -1;
739
740 if (PreviewingInstrument > -1) or (Instr <= 0) then
741 Exit;
742
743 case TrackerGrid.Cursor.X of
744 0..1: InstrumentComboBox.ItemIndex := UnmodInst(itSquare, Instr);
745 2: InstrumentComboBox.ItemIndex := UnmodInst(itWave, Instr);
746 3: InstrumentComboBox.ItemIndex := UnmodInst(itNoise, Instr);
747 end;
748 TrackerGrid.SelectedInstrument := ModInst(InstrumentComboBox.ItemIndex);
749
750 if TrackerGrid.Cursor.X = 1 then
751 PreviewInstrument(Note, InstrumentComboBox.ItemIndex, True)
752 else
753 PreviewInstrument(Note, InstrumentComboBox.ItemIndex, False);
754
755 PreviewingInstrument := Note;
756 end;
757
718 procedure TfrmTracker.PreviewInstrument(Note: Integer; Instr: Integer; 758 procedure TfrmTracker.PreviewInstrument(Note: Integer; Instr: Integer;
719 SquareOnCh2: Boolean = False); 759 SquareOnCh2: Boolean = False);
720 begin 760 begin
@@ -1461,6 +1501,7 @@ begin
1461 2: InstrumentComboBox.ItemIndex := UnmodInst(itWave, TrackerGrid.SelectedInstrument); 1501 2: InstrumentComboBox.ItemIndex := UnmodInst(itWave, TrackerGrid.SelectedInstrument);
1462 3: InstrumentComboBox.ItemIndex := UnmodInst(itNoise, TrackerGrid.SelectedInstrument); 1502 3: InstrumentComboBox.ItemIndex := UnmodInst(itNoise, TrackerGrid.SelectedInstrument);
1463 end; 1503 end;
1504 TrackerGrid.SelectedInstrument := ModInst(InstrumentComboBox.ItemIndex);
1464 1505
1465 if TrackerGrid.Cursor.X = 1 then 1506 if TrackerGrid.Cursor.X = 1 then
1466 PreviewInstrument(Note, InstrumentComboBox.ItemIndex, True) 1507 PreviewInstrument(Note, InstrumentComboBox.ItemIndex, True)
@@ -2430,24 +2471,30 @@ end;
2430 2471
2431 procedure TfrmTracker.TrackerPopupTransposeOctaveDownClick(Sender: TObject); 2472 procedure TfrmTracker.TrackerPopupTransposeOctaveDownClick(Sender: TObject);
2432 begin 2473 begin
2433 TrackerGrid.TransposeSelection(-12) 2474 TrackerGrid.TransposeSelection(-12);
2434 {if TrackerSettings.PreviewWhenBumping then 2475 if TrackerSettings.PreviewWhenBumping then
2435 ; // TODO: preview the note} 2476 PreviewNoteUnderCursor;
2436 end; 2477 end;
2437 2478
2438 procedure TfrmTracker.TrackerPopupTransposeOctaveUpClick(Sender: TObject); 2479 procedure TfrmTracker.TrackerPopupTransposeOctaveUpClick(Sender: TObject);
2439 begin 2480 begin
2440 TrackerGrid.TransposeSelection(12) 2481 TrackerGrid.TransposeSelection(12);
2482 if TrackerSettings.PreviewWhenBumping then
2483 PreviewNoteUnderCursor;
2441 end; 2484 end;
2442 2485
2443 procedure TfrmTracker.TrackerPopupTransposeSemiDownClick(Sender: TObject); 2486 procedure TfrmTracker.TrackerPopupTransposeSemiDownClick(Sender: TObject);
2444 begin 2487 begin
2445 TrackerGrid.TransposeSelection(-1) 2488 TrackerGrid.TransposeSelection(-1);
2489 if TrackerSettings.PreviewWhenBumping then
2490 PreviewNoteUnderCursor;
2446 end; 2491 end;
2447 2492
2448 procedure TfrmTracker.TrackerPopupTransposeSemiUpClick(Sender: TObject); 2493 procedure TfrmTracker.TrackerPopupTransposeSemiUpClick(Sender: TObject);
2449 begin 2494 begin
2450 TrackerGrid.TransposeSelection(1) 2495 TrackerGrid.TransposeSelection(1);
2496 if TrackerSettings.PreviewWhenBumping then
2497 PreviewNoteUnderCursor;
2451 end; 2498 end;
2452 2499
2453 procedure TfrmTracker.TrackerPopupUndoClick(Sender: TObject); 2500 procedure TfrmTracker.TrackerPopupUndoClick(Sender: TObject);