]>
Commit | Line | Data |
---|---|---|
f72e5565 | 1 | diff -Nru fuse-utils-0.10.0.old/converter/findpilot.h fuse-utils-0.10.0/converter/findpilot.h |
2 | --- fuse-utils-0.10.0.old/converter/findpilot.h 1970-01-01 01:00:00.000000000 +0100 | |
3 | +++ fuse-utils-0.10.0/converter/findpilot.h 2008-12-05 21:07:11.000000000 +0100 | |
4 | @@ -0,0 +1,42 @@ | |
5 | +/* findpilot.h: ROM loader state handling the search for the pilot pulses | |
6 | + Copyright (c) 2008 Fredrick Meunier | |
7 | + | |
8 | + $Id$ | |
9 | + | |
10 | + This program is free software; you can redistribute it and/or modify | |
11 | + it under the terms of the GNU General Public License as published by | |
12 | + the Free Software Foundation; either version 2 of the License, or | |
13 | + (at your option) any later version. | |
14 | + | |
15 | + This program is distributed in the hope that it will be useful, | |
16 | + but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 | + GNU General Public License for more details. | |
19 | + | |
20 | + You should have received a copy of the GNU General Public License along | |
21 | + with this program; if not, write to the Free Software Foundation, Inc., | |
22 | + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | |
23 | + | |
24 | + Author contact information: | |
25 | + | |
26 | + E-mail: fredm@spamcop.net | |
27 | + | |
28 | +*/ | |
29 | + | |
30 | +#ifndef FINDPILOT_H | |
31 | +#define FINDPILOT_H | |
32 | + | |
33 | +#include "romloader.h" | |
34 | +#include "romloaderstate.h" | |
35 | + | |
36 | +class findpilot : public romloaderstate { | |
37 | + public: | |
38 | + static findpilot* instance(); | |
39 | + void handle_pulse( romloader* loader, double tstates, | |
40 | + unsigned int pulse_length ); | |
41 | + private: | |
42 | + findpilot() {} | |
43 | + static findpilot* unique_instance; | |
44 | +}; | |
45 | + | |
46 | +#endif /* #define FINDPILOT_H */ | |
47 | diff -Nru fuse-utils-0.10.0.old/converter/findsync1.h fuse-utils-0.10.0/converter/findsync1.h | |
48 | --- fuse-utils-0.10.0.old/converter/findsync1.h 1970-01-01 01:00:00.000000000 +0100 | |
49 | +++ fuse-utils-0.10.0/converter/findsync1.h 2008-12-05 21:07:11.000000000 +0100 | |
50 | @@ -0,0 +1,43 @@ | |
51 | +/* findsync1.h: ROM loader state searching for the sync1 pulse following | |
52 | + the initial pilot pulses | |
53 | + Copyright (c) 2008 Fredrick Meunier | |
54 | + | |
55 | + $Id$ | |
56 | + | |
57 | + This program is free software; you can redistribute it and/or modify | |
58 | + it under the terms of the GNU General Public License as published by | |
59 | + the Free Software Foundation; either version 2 of the License, or | |
60 | + (at your option) any later version. | |
61 | + | |
62 | + This program is distributed in the hope that it will be useful, | |
63 | + but WITHOUT ANY WARRANTY; without even the implied warranty of | |
64 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
65 | + GNU General Public License for more details. | |
66 | + | |
67 | + You should have received a copy of the GNU General Public License along | |
68 | + with this program; if not, write to the Free Software Foundation, Inc., | |
69 | + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | |
70 | + | |
71 | + Author contact information: | |
72 | + | |
73 | + E-mail: fredm@spamcop.net | |
74 | + | |
75 | +*/ | |
76 | + | |
77 | +#ifndef FINDSYNC1_H | |
78 | +#define FINDSYNC1_H | |
79 | + | |
80 | +#include "romloader.h" | |
81 | +#include "romloaderstate.h" | |
82 | + | |
83 | +class findsync1 : public romloaderstate { | |
84 | + public: | |
85 | + static findsync1* instance(); | |
86 | + void handle_pulse( romloader* loader, double tstates, | |
87 | + unsigned int pulse_length ); | |
88 | + private: | |
89 | + findsync1() {} | |
90 | + static findsync1* unique_instance; | |
91 | +}; | |
92 | + | |
93 | +#endif /* #define FINDSYNC1_H */ | |
94 | diff -Nru fuse-utils-0.10.0.old/converter/getpulse1.h fuse-utils-0.10.0/converter/getpulse1.h | |
95 | --- fuse-utils-0.10.0.old/converter/getpulse1.h 1970-01-01 01:00:00.000000000 +0100 | |
96 | +++ fuse-utils-0.10.0/converter/getpulse1.h 2008-12-05 21:07:11.000000000 +0100 | |
97 | @@ -0,0 +1,43 @@ | |
98 | +/* getpulse1.h: ROM loader state looking for the first part of a data | |
99 | + pulse pair | |
100 | + Copyright (c) 2008 Fredrick Meunier | |
101 | + | |
102 | + $Id$ | |
103 | + | |
104 | + This program is free software; you can redistribute it and/or modify | |
105 | + it under the terms of the GNU General Public License as published by | |
106 | + the Free Software Foundation; either version 2 of the License, or | |
107 | + (at your option) any later version. | |
108 | + | |
109 | + This program is distributed in the hope that it will be useful, | |
110 | + but WITHOUT ANY WARRANTY; without even the implied warranty of | |
111 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
112 | + GNU General Public License for more details. | |
113 | + | |
114 | + You should have received a copy of the GNU General Public License along | |
115 | + with this program; if not, write to the Free Software Foundation, Inc., | |
116 | + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | |
117 | + | |
118 | + Author contact information: | |
119 | + | |
120 | + E-mail: fredm@spamcop.net | |
121 | + | |
122 | +*/ | |
123 | + | |
124 | +#ifndef GETPULSE1_H | |
125 | +#define GETPULSE1_H | |
126 | + | |
127 | +#include "romloader.h" | |
128 | +#include "romloaderstate.h" | |
129 | + | |
130 | +class getpulse1 : public romloaderstate { | |
131 | + public: | |
132 | + static getpulse1* instance(); | |
133 | + void handle_pulse( romloader* loader, double tstates, | |
134 | + unsigned int pulse_length ); | |
135 | + private: | |
136 | + getpulse1() {} | |
137 | + static getpulse1* unique_instance; | |
138 | +}; | |
139 | + | |
140 | +#endif /* #define GETPULSE1_H */ | |
141 | diff -Nru fuse-utils-0.10.0.old/converter/getpulse2.h fuse-utils-0.10.0/converter/getpulse2.h | |
142 | --- fuse-utils-0.10.0.old/converter/getpulse2.h 1970-01-01 01:00:00.000000000 +0100 | |
143 | +++ fuse-utils-0.10.0/converter/getpulse2.h 2008-12-05 21:07:11.000000000 +0100 | |
144 | @@ -0,0 +1,48 @@ | |
145 | +/* getpulse2.h: ROM loader state looking for the second part of a data | |
146 | + pulse pair | |
147 | + Copyright (c) 2008 Fredrick Meunier | |
148 | + | |
149 | + $Id$ | |
150 | + | |
151 | + This program is free software; you can redistribute it and/or modify | |
152 | + it under the terms of the GNU General Public License as published by | |
153 | + the Free Software Foundation; either version 2 of the License, or | |
154 | + (at your option) any later version. | |
155 | + | |
156 | + This program is distributed in the hope that it will be useful, | |
157 | + but WITHOUT ANY WARRANTY; without even the implied warranty of | |
158 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
159 | + GNU General Public License for more details. | |
160 | + | |
161 | + You should have received a copy of the GNU General Public License along | |
162 | + with this program; if not, write to the Free Software Foundation, Inc., | |
163 | + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | |
164 | + | |
165 | + Author contact information: | |
166 | + | |
167 | + E-mail: fredm@spamcop.net | |
168 | + | |
169 | +*/ | |
170 | + | |
171 | +#ifndef GETPULSE2_H | |
172 | +#define GETPULSE2_H | |
173 | + | |
174 | +#include "romloader.h" | |
175 | +#include "romloaderstate.h" | |
176 | + | |
177 | +class getpulse2 : public romloaderstate { | |
178 | + public: | |
179 | + static getpulse2* instance(); | |
180 | + void handle_pulse( romloader* loader, double tstates, | |
181 | + unsigned int pulse_length ); | |
182 | + | |
183 | + void set_first_pulse( double tstates, int pulse ); | |
184 | + | |
185 | + private: | |
186 | + int first_pulse; | |
187 | + double first_tstates; | |
188 | + getpulse2(); | |
189 | + static getpulse2* unique_instance; | |
190 | +}; | |
191 | + | |
192 | +#endif /* #define GETPULSE2_H */ | |
193 | diff -Nru fuse-utils-0.10.0.old/converter/getsync2.h fuse-utils-0.10.0/converter/getsync2.h | |
194 | --- fuse-utils-0.10.0.old/converter/getsync2.h 1970-01-01 01:00:00.000000000 +0100 | |
195 | +++ fuse-utils-0.10.0/converter/getsync2.h 2008-12-05 21:07:11.000000000 +0100 | |
196 | @@ -0,0 +1,48 @@ | |
197 | +/* getsync2.h: ROM loader state looking for the sync2 pulse following the | |
198 | + sync1 pulse | |
199 | + Copyright (c) 2008 Fredrick Meunier | |
200 | + | |
201 | + $Id$ | |
202 | + | |
203 | + This program is free software; you can redistribute it and/or modify | |
204 | + it under the terms of the GNU General Public License as published by | |
205 | + the Free Software Foundation; either version 2 of the License, or | |
206 | + (at your option) any later version. | |
207 | + | |
208 | + This program is distributed in the hope that it will be useful, | |
209 | + but WITHOUT ANY WARRANTY; without even the implied warranty of | |
210 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
211 | + GNU General Public License for more details. | |
212 | + | |
213 | + You should have received a copy of the GNU General Public License along | |
214 | + with this program; if not, write to the Free Software Foundation, Inc., | |
215 | + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | |
216 | + | |
217 | + Author contact information: | |
218 | + | |
219 | + E-mail: fredm@spamcop.net | |
220 | + | |
221 | +*/ | |
222 | + | |
223 | +#ifndef FINDSYNC2_H | |
224 | +#define FINDSYNC2_H | |
225 | + | |
226 | +#include "romloader.h" | |
227 | +#include "romloaderstate.h" | |
228 | + | |
229 | +class getsync2 : public romloaderstate { | |
230 | + public: | |
231 | + static getsync2* instance(); | |
232 | + void handle_pulse( romloader* loader, double tstates, | |
233 | + unsigned int pulse_length ); | |
234 | + | |
235 | + void set_first_pulse( double tstates, int pulse ); | |
236 | + | |
237 | + private: | |
238 | + int first_pulse; | |
239 | + double first_tstates; | |
240 | + getsync2(); | |
241 | + static getsync2* unique_instance; | |
242 | +}; | |
243 | + | |
244 | +#endif /* #define FINDSYNC2_H */ | |
245 | diff -Nru fuse-utils-0.10.0.old/converter/romloaderstate.h fuse-utils-0.10.0/converter/romloaderstate.h | |
246 | --- fuse-utils-0.10.0.old/converter/romloaderstate.h 1970-01-01 01:00:00.000000000 +0100 | |
247 | +++ fuse-utils-0.10.0/converter/romloaderstate.h 2008-12-05 21:07:11.000000000 +0100 | |
248 | @@ -0,0 +1,39 @@ | |
249 | +/* romloaderstate.h: Abstract base class for ROM loader states cf the GoF | |
250 | + State Pattern | |
251 | + Copyright (c) 2008 Fredrick Meunier | |
252 | + | |
253 | + $Id$ | |
254 | + | |
255 | + This program is free software; you can redistribute it and/or modify | |
256 | + it under the terms of the GNU General Public License as published by | |
257 | + the Free Software Foundation; either version 2 of the License, or | |
258 | + (at your option) any later version. | |
259 | + | |
260 | + This program is distributed in the hope that it will be useful, | |
261 | + but WITHOUT ANY WARRANTY; without even the implied warranty of | |
262 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
263 | + GNU General Public License for more details. | |
264 | + | |
265 | + You should have received a copy of the GNU General Public License along | |
266 | + with this program; if not, write to the Free Software Foundation, Inc., | |
267 | + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | |
268 | + | |
269 | + Author contact information: | |
270 | + | |
271 | + E-mail: fredm@spamcop.net | |
272 | + | |
273 | +*/ | |
274 | + | |
275 | +#ifndef ROMLOADERSTATE_H | |
276 | +#define ROMLOADERSTATE_H | |
277 | + | |
278 | +class romloader; | |
279 | + | |
280 | +class romloaderstate { | |
281 | + public: | |
282 | + virtual ~romloaderstate(); | |
283 | + virtual void handle_pulse( romloader* loader, double tstates, | |
284 | + unsigned int pulse_length ) = 0; | |
285 | +}; | |
286 | + | |
287 | +#endif /* #ifndef ROMLOADERSTATE_H */ | |
288 | diff -Nru fuse-utils-0.10.0.old/importer/interpolator.h fuse-utils-0.10.0/importer/interpolator.h | |
289 | --- fuse-utils-0.10.0.old/importer/interpolator.h 1970-01-01 01:00:00.000000000 +0100 | |
290 | +++ fuse-utils-0.10.0/importer/interpolator.h 2008-12-05 21:07:11.000000000 +0100 | |
291 | @@ -0,0 +1,77 @@ | |
292 | +/* interpolator.h: Does a linear interpolation between the points in the | |
293 | + supplied samples to a TZX-friendly 3.5MHz | |
294 | + Copyright (c) 2008 Fredrick Meunier | |
295 | + | |
296 | + $Id$ | |
297 | + | |
298 | + This program is free software; you can redistribute it and/or modify | |
299 | + it under the terms of the GNU General Public License as published by | |
300 | + the Free Software Foundation; either version 2 of the License, or | |
301 | + (at your option) any later version. | |
302 | + | |
303 | + This program is distributed in the hope that it will be useful, | |
304 | + but WITHOUT ANY WARRANTY; without even the implied warranty of | |
305 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
306 | + GNU General Public License for more details. | |
307 | + | |
308 | + You should have received a copy of the GNU General Public License along | |
309 | + with this program; if not, write to the Free Software Foundation, Inc., | |
310 | + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | |
311 | + | |
312 | + Author contact information: | |
313 | + | |
314 | + E-mail: fredm@spamcop.net | |
315 | + | |
316 | +*/ | |
317 | + | |
318 | +#ifndef INTERPOLATOR_H | |
319 | +#define INTERPOLATOR_H | |
320 | + | |
321 | +#include <math.h> | |
322 | + | |
323 | +#include <libspectrum.h> | |
324 | + | |
325 | +#include "importer/soundfile.h" | |
326 | + | |
327 | +class interpolator { | |
328 | +public: | |
329 | + interpolator( libspectrum_byte *samples, size_t samples_length, double rate, | |
330 | + double source_rate ) : | |
331 | + source_sample_rate(source_rate), | |
332 | + sample_rate(rate), | |
333 | + pulses(samples), | |
334 | + source_length(samples_length) { | |
335 | + length = floor( source_length * source_sample_rate/sample_rate ); | |
336 | + } | |
337 | + | |
338 | + double get_length() { return length; } | |
339 | + | |
340 | + libspectrum_byte get_sample( double tstates ) { | |
341 | + // convert tstates to samples offsets | |
342 | + double tstate_offset = tstates * sample_rate/source_sample_rate; | |
343 | + size_t offset1 = (size_t)floor(tstate_offset); | |
344 | + size_t offset2 = (size_t)ceil(tstate_offset); | |
345 | + | |
346 | + double distance = tstate_offset - offset1; | |
347 | + | |
348 | + // get samples | |
349 | + libspectrum_byte sample1 = pulses[offset1]; | |
350 | + if( offset2 >= source_length ) offset2 = source_length - 1; | |
351 | + libspectrum_byte sample2 = pulses[offset2]; | |
352 | + | |
353 | + // if we have two samples, allocate final value based on | |
354 | + // distance between both samples | |
355 | + int difference = sample2 - sample1; | |
356 | + | |
357 | + return (libspectrum_byte) (sample1 + (difference * distance)); | |
358 | + } | |
359 | + | |
360 | +private: | |
361 | + double source_sample_rate; | |
362 | + double sample_rate; | |
363 | + double length; | |
364 | + libspectrum_byte *pulses; | |
365 | + size_t source_length; | |
366 | +}; | |
367 | + | |
368 | +#endif /* #define INTERPOLATOR_H */ | |
369 | diff -Nru fuse-utils-0.10.0.old/importer/trigger.h fuse-utils-0.10.0/importer/trigger.h | |
370 | --- fuse-utils-0.10.0.old/importer/trigger.h 1970-01-01 01:00:00.000000000 +0100 | |
371 | +++ fuse-utils-0.10.0/importer/trigger.h 2008-12-05 21:07:11.000000000 +0100 | |
372 | @@ -0,0 +1,40 @@ | |
373 | +/* trigger.h: Abstract class for detecting the transition between a level 0 | |
374 | + and 1 | |
375 | + Copyright (c) 2008 Fredrick Meunier | |
376 | + | |
377 | + $Id$ | |
378 | + | |
379 | + This program is free software; you can redistribute it and/or modify | |
380 | + it under the terms of the GNU General Public License as published by | |
381 | + the Free Software Foundation; either version 2 of the License, or | |
382 | + (at your option) any later version. | |
383 | + | |
384 | + This program is distributed in the hope that it will be useful, | |
385 | + but WITHOUT ANY WARRANTY; without even the implied warranty of | |
386 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
387 | + GNU General Public License for more details. | |
388 | + | |
389 | + You should have received a copy of the GNU General Public License along | |
390 | + with this program; if not, write to the Free Software Foundation, Inc., | |
391 | + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | |
392 | + | |
393 | + Author contact information: | |
394 | + | |
395 | + E-mail: fredm@spamcop.net | |
396 | + | |
397 | +*/ | |
398 | + | |
399 | +#ifndef TRIGGER_H | |
400 | +#define TRIGGER_H | |
401 | + | |
402 | +#include <libspectrum.h> | |
403 | + | |
404 | +class trigger { | |
405 | + public: | |
406 | + trigger() {}; | |
407 | + virtual ~trigger(); | |
408 | + | |
409 | + virtual libspectrum_byte get_level(libspectrum_byte b) = 0; | |
410 | +}; | |
411 | + | |
412 | +#endif /* #ifndef TRIGGER_H */ |