diff options
Diffstat (limited to 'src/lib/formats/vt_cas.cpp')
-rw-r--r-- | src/lib/formats/vt_cas.cpp | 42 |
1 files changed, 20 insertions, 22 deletions
diff --git a/src/lib/formats/vt_cas.cpp b/src/lib/formats/vt_cas.cpp index 9dbc68f8074..2052647bfd8 100644 --- a/src/lib/formats/vt_cas.cpp +++ b/src/lib/formats/vt_cas.cpp @@ -1,7 +1,5 @@ // license:GPL-2.0+ // copyright-holders:Juergen Buchmueller -#include <assert.h> - #include "formats/vt_cas.h" /********************************************************************* @@ -10,7 +8,7 @@ #define SILENCE 8000 -static int generic_fill_wave(int16_t *buffer, int length, uint8_t *code, int bitsamples, int bytesamples, int lo, int16_t *(*fill_wave_byte)(int16_t *buffer, int byte)) +static int generic_fill_wave(int16_t *buffer, int length, const uint8_t *code, int bitsamples, int bytesamples, int lo, int16_t *(*fill_wave_byte)(int16_t *buffer, int byte)) { static int nullbyte; @@ -92,33 +90,33 @@ static int16_t *vtech1_fill_wave_byte(int16_t *buffer, int byte) return buffer; } -static int vtech1_cassette_fill_wave(int16_t *buffer, int length, uint8_t *code) +static int vtech1_cassette_fill_wave(int16_t *buffer, int length, const uint8_t *code, int) { return generic_fill_wave(buffer, length, code, V1_BITSAMPLES, V1_BYTESAMPLES, V1_LO, vtech1_fill_wave_byte); } -static const struct CassetteLegacyWaveFiller vtech1_legacy_fill_wave = +static const cassette_image::LegacyWaveFiller vtech1_legacy_fill_wave = { - vtech1_cassette_fill_wave, /* fill_wave */ - 1, /* chunk_size */ - V1_BYTESAMPLES, /* chunk_samples */ - nullptr, /* chunk_sample_calc */ - 600*V1_BITSAMPLES, /* sample_frequency */ - 600*V1_BITSAMPLES, /* header_samples */ - 600*V1_BITSAMPLES /* trailer_samples */ + vtech1_cassette_fill_wave, // fill_wave + 1, // chunk_size + V1_BYTESAMPLES, // chunk_samples + nullptr, // chunk_sample_calc + 600*V1_BITSAMPLES, // sample_frequency + 600*V1_BITSAMPLES, // header_samples + 600*V1_BITSAMPLES // trailer_samples }; -static cassette_image::error vtech1_cas_identify(cassette_image *cassette, struct CassetteOptions *opts) +static cassette_image::error vtech1_cas_identify(cassette_image *cassette, cassette_image::Options *opts) { - return cassette_legacy_identify(cassette, opts, &vtech1_legacy_fill_wave); + return cassette->legacy_identify(opts, &vtech1_legacy_fill_wave); } static cassette_image::error vtech1_cas_load(cassette_image *cassette) { - return cassette_legacy_construct(cassette, &vtech1_legacy_fill_wave); + return cassette->legacy_construct(&vtech1_legacy_fill_wave); } -static const struct CassetteFormat vtech1_cas_format = +static const cassette_image::Format vtech1_cas_format = { "cas", vtech1_cas_identify, @@ -187,12 +185,12 @@ static int16_t *vtech2_fill_wave_byte(int16_t *buffer, int byte) return buffer; } -static int vtech2_cassette_fill_wave(int16_t *buffer, int length, uint8_t *code) +static int vtech2_cassette_fill_wave(int16_t *buffer, int length, const uint8_t *code, int) { return generic_fill_wave(buffer, length, code, VT2_BITSAMPLES, VT2_BYTESAMPLES, VT2_LO, vtech2_fill_wave_byte); } -static const struct CassetteLegacyWaveFiller vtech2_legacy_fill_wave = +static const cassette_image::LegacyWaveFiller vtech2_legacy_fill_wave = { vtech2_cassette_fill_wave, /* fill_wave */ 1, /* chunk_size */ @@ -203,17 +201,17 @@ static const struct CassetteLegacyWaveFiller vtech2_legacy_fill_wave = 600*VT2_BITSAMPLES /* trailer_samples */ }; -static cassette_image::error vtech2_cas_identify(cassette_image *cassette, struct CassetteOptions *opts) +static cassette_image::error vtech2_cas_identify(cassette_image *cassette, cassette_image::Options *opts) { - return cassette_legacy_identify(cassette, opts, &vtech2_legacy_fill_wave); + return cassette->legacy_identify(opts, &vtech2_legacy_fill_wave); } static cassette_image::error vtech2_cas_load(cassette_image *cassette) { - return cassette_legacy_construct(cassette, &vtech2_legacy_fill_wave); + return cassette->legacy_construct(&vtech2_legacy_fill_wave); } -static const struct CassetteFormat vtech2_cas_format = +static const cassette_image::Format vtech2_cas_format = { "cas", vtech2_cas_identify, |