@@ -19,13 +19,13 @@ type |
| 19 |
ComboBox1: TComboBox; |
19 |
ComboBox1: TComboBox; |
| 20 |
Label2: TLabel; |
20 |
Label2: TLabel; |
| 21 |
Label3: TLabel; |
21 |
Label3: TLabel; |
|
|
22 |
Panel1: TPanel; |
| 22 |
PlayEntireSongRadioButton: TRadioButton; |
23 |
PlayEntireSongRadioButton: TRadioButton; |
| 23 |
FromPositionRadioButton: TRadioButton; |
24 |
FromPositionRadioButton: TRadioButton; |
| 24 |
RenderButton: TButton; |
25 |
RenderButton: TButton; |
| 25 |
CancelButton: TButton; |
26 |
CancelButton: TButton; |
| 26 |
FileNameEdit1: TFileNameEdit; |
27 |
FileNameEdit1: TFileNameEdit; |
| 27 |
Label1: TLabel; |
28 |
Label1: TLabel; |
| 28 |
ProgressBar1: TProgressBar; |
|
|
| 29 |
PlayEntireSongSpinEdit: TSpinEdit; |
29 |
PlayEntireSongSpinEdit: TSpinEdit; |
| 30 |
FromPositionLowerSpinEdit: TSpinEdit; |
30 |
FromPositionLowerSpinEdit: TSpinEdit; |
| 31 |
FromPositionUpperSpinEdit: TSpinEdit; |
31 |
FromPositionUpperSpinEdit: TSpinEdit; |
@@ -42,7 +42,7 @@ type |
| 42 |
|
42 |
|
| 43 |
function FilenameToFormatIndex: Integer; |
43 |
function FilenameToFormatIndex: Integer; |
| 44 |
function GetFFMPEGFormat: String; |
44 |
function GetFFMPEGFormat: String; |
| 45 |
procedure UpdateButtonEnabledStates; |
45 |
procedure UpdateUI; |
| 46 |
|
46 |
|
| 47 |
procedure ExportWaveToFile(Filename: String); |
47 |
procedure ExportWaveToFile(Filename: String); |
| 48 |
|
48 |
|
@@ -65,10 +65,9 @@ uses sound, machine, mainloop, vars, symparser; |
| 65 |
|
65 |
|
| 66 |
procedure TfrmRenderToWave.RenderButtonClick(Sender: TObject); |
66 |
procedure TfrmRenderToWave.RenderButtonClick(Sender: TObject); |
| 67 |
begin |
67 |
begin |
| 68 |
ProgressBar1.Position := 0; |
|
|
| 69 |
Rendering := True; |
68 |
Rendering := True; |
| 70 |
CancelRequested := False; |
69 |
CancelRequested := False; |
| 71 |
UpdateButtonEnabledStates; |
70 |
UpdateUI; |
| 72 |
|
71 |
|
| 73 |
try |
72 |
try |
| 74 |
ExportWaveToFile(FileNameEdit1.FileName); |
73 |
ExportWaveToFile(FileNameEdit1.FileName); |
@@ -79,30 +78,28 @@ begin |
| 79 |
end; |
78 |
end; |
| 80 |
end; |
79 |
end; |
| 81 |
|
80 |
|
| 82 |
ProgressBar1.Position := 0; |
|
|
| 83 |
Rendering := False; |
81 |
Rendering := False; |
| 84 |
CancelRequested := False; |
82 |
CancelRequested := False; |
| 85 |
UpdateButtonEnabledStates; |
83 |
UpdateUI; |
| 86 |
end; |
84 |
end; |
| 87 |
|
85 |
|
| 88 |
procedure TfrmRenderToWave.CancelButtonClick(Sender: TObject); |
86 |
procedure TfrmRenderToWave.CancelButtonClick(Sender: TObject); |
| 89 |
begin |
87 |
begin |
| 90 |
CancelRequested := True; |
88 |
CancelRequested := True; |
| 91 |
UpdateButtonEnabledStates; |
89 |
UpdateUI; |
| 92 |
end; |
90 |
end; |
| 93 |
|
91 |
|
| 94 |
procedure TfrmRenderToWave.FileNameEdit1Change(Sender: TObject); |
92 |
procedure TfrmRenderToWave.FileNameEdit1Change(Sender: TObject); |
| 95 |
begin |
93 |
begin |
| 96 |
ComboBox1.ItemIndex := FilenameToFormatIndex; |
94 |
ComboBox1.ItemIndex := FilenameToFormatIndex; |
| 97 |
UpdateButtonEnabledStates; |
95 |
UpdateUI; |
| 98 |
end; |
96 |
end; |
| 99 |
|
97 |
|
| 100 |
procedure TfrmRenderToWave.FormShow(Sender: TObject); |
98 |
procedure TfrmRenderToWave.FormShow(Sender: TObject); |
| 101 |
begin |
99 |
begin |
| 102 |
ProgressBar1.Position:=0; |
|
|
| 103 |
FileNameEdit1.FileName:=''; |
100 |
FileNameEdit1.FileName:=''; |
| 104 |
PlayEntireSongRadioButton.Checked:=True; |
101 |
PlayEntireSongRadioButton.Checked:=True; |
| 105 |
PlayEntireSongSpinEdit.Value:=0; |
102 |
PlayEntireSongSpinEdit.Value:=1; |
| 106 |
FromPositionLowerSpinEdit.Value:=0; |
103 |
FromPositionLowerSpinEdit.Value:=0; |
| 107 |
FromPositionUpperSpinEdit.Value:=0; |
104 |
FromPositionUpperSpinEdit.Value:=0; |
| 108 |
end; |
105 |
end; |
@@ -127,7 +124,7 @@ begin |
| 127 |
end; |
124 |
end; |
| 128 |
end; |
125 |
end; |
| 129 |
|
126 |
|
| 130 |
procedure TfrmRenderToWave.UpdateButtonEnabledStates; |
127 |
procedure TfrmRenderToWave.UpdateUI; |
| 131 |
begin |
128 |
begin |
| 132 |
RenderButton.Enabled := (FileNameEdit1.FileName <> '') and not Rendering; |
129 |
RenderButton.Enabled := (FileNameEdit1.FileName <> '') and not Rendering; |
| 133 |
CancelButton.Enabled := Rendering and not CancelRequested; |
130 |
CancelButton.Enabled := Rendering and not CancelRequested; |
@@ -137,8 +134,6 @@ procedure TfrmRenderToWave.ExportWaveToFile(Filename: String); |
| 137 |
var |
134 |
var |
| 138 |
Proc: TProcess; |
135 |
Proc: TProcess; |
| 139 |
begin |
136 |
begin |
| 140 |
ProgressBar1.Position := 0; |
|
|
| 141 |
|
|
|
| 142 |
z80_reset; |
137 |
z80_reset; |
| 143 |
ResetSound; |
138 |
ResetSound; |
| 144 |
enablesound; |
139 |
enablesound; |
@@ -186,6 +181,8 @@ begin |
| 186 |
Proc.CloseInput; |
181 |
Proc.CloseInput; |
| 187 |
Proc.WaitOnExit; |
182 |
Proc.WaitOnExit; |
| 188 |
Proc.Free; |
183 |
Proc.Free; |
|
|
184 |
|
|
|
185 |
Panel1.Caption := 'Ready'; |
| 189 |
end; |
186 |
end; |
| 190 |
end; |
187 |
end; |
| 191 |
|
188 |
|
@@ -263,6 +260,7 @@ begin |
| 263 |
|
260 |
|
| 264 |
Inc(SeenPatterns[Pat]); |
261 |
Inc(SeenPatterns[Pat]); |
| 265 |
CurrentPattern := Pat; |
262 |
CurrentPattern := Pat; |
|
|
263 |
Panel1.Caption := 'Rendering order '+IntToStr(CurrentPattern+1); |
| 266 |
end; |
264 |
end; |
| 267 |
|
265 |
|
| 268 |
end. |
266 |
end. |