diff options
Diffstat (limited to 'src/lib/formats/ace_tap.cpp')
-rw-r--r-- | src/lib/formats/ace_tap.cpp | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/src/lib/formats/ace_tap.cpp b/src/lib/formats/ace_tap.cpp index 56b4bd877c8..9613450e59e 100644 --- a/src/lib/formats/ace_tap.cpp +++ b/src/lib/formats/ace_tap.cpp @@ -10,10 +10,10 @@ For more information see: ********************************************************************/ -#include <assert.h> - #include "ace_tap.h" +#include "multibyte.h" + #define SMPLO -32768 #define SILENCE 0 @@ -97,11 +97,8 @@ static int ace_handle_tap(int16_t *buffer, const uint8_t *casdata) while( data_pos < cas_size ) { - uint16_t block_size; - int i; - /* Handle a block of tape data */ - block_size = casdata[data_pos] + ( casdata[data_pos + 1] << 8 ); + uint16_t block_size = get_u16le( &casdata[data_pos] ); data_pos += 2; /* Make sure there are enough bytes left */ @@ -112,7 +109,7 @@ static int ace_handle_tap(int16_t *buffer, const uint8_t *casdata) sample_count += ace_tap_silence( buffer, sample_count, 2 * 44100 ); /* Add pilot tone samples: 4096 for header, 512 for data */ - for( i = ( block_size == 0x001A ) ? 4096 : 512; i; i-- ) + for( int i = ( block_size == 0x001A ) ? 4096 : 512; i; i-- ) sample_count += ace_tap_cycle( buffer, sample_count, 27, 27 ); /* Sync samples */ @@ -138,7 +135,7 @@ static int ace_handle_tap(int16_t *buffer, const uint8_t *casdata) /******************************************************************* Generate samples for the tape image ********************************************************************/ -static int ace_tap_fill_wave(int16_t *buffer, int sample_count, uint8_t *bytes) +static int ace_tap_fill_wave(int16_t *buffer, int sample_count, const uint8_t *bytes, int) { return ace_handle_tap( buffer, bytes ); } @@ -155,7 +152,7 @@ static int ace_tap_to_wav_size(const uint8_t *casdata, int caslen) } -static const struct CassetteLegacyWaveFiller ace_legacy_fill_wave = +static const cassette_image::LegacyWaveFiller ace_legacy_fill_wave = { ace_tap_fill_wave, /* fill_wave */ -1, /* chunk_size */ @@ -167,19 +164,19 @@ static const struct CassetteLegacyWaveFiller ace_legacy_fill_wave = }; -static cassette_image::error ace_tap_identify(cassette_image *cassette, struct CassetteOptions *opts) +static cassette_image::error ace_tap_identify(cassette_image *cassette, cassette_image::Options *opts) { - return cassette_legacy_identify(cassette, opts, &ace_legacy_fill_wave); + return cassette->legacy_identify(opts, &ace_legacy_fill_wave); } static cassette_image::error ace_tap_load(cassette_image *cassette) { - return cassette_legacy_construct(cassette, &ace_legacy_fill_wave); + return cassette->legacy_construct(&ace_legacy_fill_wave); } -static const struct CassetteFormat ace_tap_format = +static const cassette_image::Format ace_tap_format = { "tap", ace_tap_identify, |