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
5 +/* findpilot.h: ROM loader state handling the search for the pilot pulses
6 + Copyright (c) 2008 Fredrick Meunier
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.
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.
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.
24 + Author contact information:
26 + E-mail: fredm@spamcop.net
33 +#include "romloader.h"
34 +#include "romloaderstate.h"
36 +class findpilot : public romloaderstate {
38 + static findpilot* instance();
39 + void handle_pulse( romloader* loader, double tstates,
40 + unsigned int pulse_length );
43 + static findpilot* unique_instance;
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
51 +/* findsync1.h: ROM loader state searching for the sync1 pulse following
52 + the initial pilot pulses
53 + Copyright (c) 2008 Fredrick Meunier
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.
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.
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.
71 + Author contact information:
73 + E-mail: fredm@spamcop.net
80 +#include "romloader.h"
81 +#include "romloaderstate.h"
83 +class findsync1 : public romloaderstate {
85 + static findsync1* instance();
86 + void handle_pulse( romloader* loader, double tstates,
87 + unsigned int pulse_length );
90 + static findsync1* unique_instance;
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
98 +/* getpulse1.h: ROM loader state looking for the first part of a data
100 + Copyright (c) 2008 Fredrick Meunier
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.
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.
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.
118 + Author contact information:
120 + E-mail: fredm@spamcop.net
127 +#include "romloader.h"
128 +#include "romloaderstate.h"
130 +class getpulse1 : public romloaderstate {
132 + static getpulse1* instance();
133 + void handle_pulse( romloader* loader, double tstates,
134 + unsigned int pulse_length );
137 + static getpulse1* unique_instance;
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
145 +/* getpulse2.h: ROM loader state looking for the second part of a data
147 + Copyright (c) 2008 Fredrick Meunier
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.
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.
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.
165 + Author contact information:
167 + E-mail: fredm@spamcop.net
174 +#include "romloader.h"
175 +#include "romloaderstate.h"
177 +class getpulse2 : public romloaderstate {
179 + static getpulse2* instance();
180 + void handle_pulse( romloader* loader, double tstates,
181 + unsigned int pulse_length );
183 + void set_first_pulse( double tstates, int pulse );
187 + double first_tstates;
189 + static getpulse2* unique_instance;
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
197 +/* getsync2.h: ROM loader state looking for the sync2 pulse following the
199 + Copyright (c) 2008 Fredrick Meunier
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.
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.
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.
217 + Author contact information:
219 + E-mail: fredm@spamcop.net
226 +#include "romloader.h"
227 +#include "romloaderstate.h"
229 +class getsync2 : public romloaderstate {
231 + static getsync2* instance();
232 + void handle_pulse( romloader* loader, double tstates,
233 + unsigned int pulse_length );
235 + void set_first_pulse( double tstates, int pulse );
239 + double first_tstates;
241 + static getsync2* unique_instance;
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
249 +/* romloaderstate.h: Abstract base class for ROM loader states cf the GoF
251 + Copyright (c) 2008 Fredrick Meunier
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.
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.
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.
269 + Author contact information:
271 + E-mail: fredm@spamcop.net
275 +#ifndef ROMLOADERSTATE_H
276 +#define ROMLOADERSTATE_H
280 +class romloaderstate {
282 + virtual ~romloaderstate();
283 + virtual void handle_pulse( romloader* loader, double tstates,
284 + unsigned int pulse_length ) = 0;
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
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
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.
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.
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.
312 + Author contact information:
314 + E-mail: fredm@spamcop.net
318 +#ifndef INTERPOLATOR_H
319 +#define INTERPOLATOR_H
323 +#include <libspectrum.h>
325 +#include "importer/soundfile.h"
327 +class interpolator {
329 + interpolator( libspectrum_byte *samples, size_t samples_length, double rate,
330 + double source_rate ) :
331 + source_sample_rate(source_rate),
334 + source_length(samples_length) {
335 + length = floor( source_length * source_sample_rate/sample_rate );
338 + double get_length() { return length; }
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);
346 + double distance = tstate_offset - offset1;
349 + libspectrum_byte sample1 = pulses[offset1];
350 + if( offset2 >= source_length ) offset2 = source_length - 1;
351 + libspectrum_byte sample2 = pulses[offset2];
353 + // if we have two samples, allocate final value based on
354 + // distance between both samples
355 + int difference = sample2 - sample1;
357 + return (libspectrum_byte) (sample1 + (difference * distance));
361 + double source_sample_rate;
362 + double sample_rate;
364 + libspectrum_byte *pulses;
365 + size_t source_length;
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
373 +/* trigger.h: Abstract class for detecting the transition between a level 0
375 + Copyright (c) 2008 Fredrick Meunier
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.
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.
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.
393 + Author contact information:
395 + E-mail: fredm@spamcop.net
402 +#include <libspectrum.h>
407 + virtual ~trigger();
409 + virtual libspectrum_byte get_level(libspectrum_byte b) = 0;
412 +#endif /* #ifndef TRIGGER_H */