summaryrefslogtreecommitdiffstatshomepage
path: root/src/lib/formats/kc_cas.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/formats/kc_cas.cpp')
-rw-r--r--src/lib/formats/kc_cas.cpp48
1 files changed, 24 insertions, 24 deletions
diff --git a/src/lib/formats/kc_cas.cpp b/src/lib/formats/kc_cas.cpp
index 713def9ac83..34c52786b9c 100644
--- a/src/lib/formats/kc_cas.cpp
+++ b/src/lib/formats/kc_cas.cpp
@@ -13,10 +13,10 @@
********************************************************************/
-#include <assert.h>
-
#include "kc_cas.h"
+#include <cstring>
+
#define SMPLO -32768
#define SMPHI 32767
#define SILENCE 0
@@ -38,7 +38,7 @@ enum
};
// image size
-static int kc_image_size;
+static int kc_image_size; // FIXME: global variable prevents multiple instances
/*******************************************************************
Generate one high-low cycle of sample data
@@ -232,7 +232,7 @@ static int kc_handle_sss(int16_t *buffer, const uint8_t *casdata)
/*******************************************************************
Generate samples for the tape image
********************************************************************/
-static int kc_kcc_fill_wave(int16_t *buffer, int sample_count, uint8_t *bytes)
+static int kc_kcc_fill_wave(int16_t *buffer, int sample_count, const uint8_t *bytes, int)
{
return kc_handle_kcc(buffer, bytes);
}
@@ -243,13 +243,13 @@ static int kc_kcc_fill_wave(int16_t *buffer, int sample_count, uint8_t *bytes)
********************************************************************/
static int kc_kcc_to_wav_size(const uint8_t *casdata, int caslen)
{
- kc_image_size = caslen ;
+ kc_image_size = caslen;
return kc_handle_kcc( nullptr, casdata );
}
-static const struct CassetteLegacyWaveFiller kc_kcc_legacy_fill_wave =
+static const cassette_image::LegacyWaveFiller kc_kcc_legacy_fill_wave =
{
kc_kcc_fill_wave, /* fill_wave */
-1, /* chunk_size */
@@ -260,19 +260,19 @@ static const struct CassetteLegacyWaveFiller kc_kcc_legacy_fill_wave =
0 /* trailer_samples */
};
-static cassette_image::error kc_kcc_identify(cassette_image *cassette, struct CassetteOptions *opts)
+static cassette_image::error kc_kcc_identify(cassette_image *cassette, cassette_image::Options *opts)
{
- return cassette_legacy_identify(cassette, opts, &kc_kcc_legacy_fill_wave);
+ return cassette->legacy_identify(opts, &kc_kcc_legacy_fill_wave);
}
static cassette_image::error kc_kcc_load(cassette_image *cassette)
{
- return cassette_legacy_construct(cassette, &kc_kcc_legacy_fill_wave);
+ return cassette->legacy_construct(&kc_kcc_legacy_fill_wave);
}
-static const struct CassetteFormat kc_kcc_format =
+static const cassette_image::Format kc_kcc_format =
{
"kcc,kcb",
kc_kcc_identify,
@@ -284,7 +284,7 @@ static const struct CassetteFormat kc_kcc_format =
/*******************************************************************
Generate samples for the tape image
********************************************************************/
-static int kc_tap_fill_wave(int16_t *buffer, int sample_count, uint8_t *bytes)
+static int kc_tap_fill_wave(int16_t *buffer, int sample_count, const uint8_t *bytes, int)
{
return kc_handle_tap(buffer, bytes);
}
@@ -295,13 +295,13 @@ static int kc_tap_fill_wave(int16_t *buffer, int sample_count, uint8_t *bytes)
********************************************************************/
static int kc_tap_to_wav_size(const uint8_t *casdata, int caslen)
{
- kc_image_size = caslen ;
+ kc_image_size = caslen;
return kc_handle_tap( nullptr, casdata );
}
-static const struct CassetteLegacyWaveFiller kc_tap_legacy_fill_wave =
+static const cassette_image::LegacyWaveFiller kc_tap_legacy_fill_wave =
{
kc_tap_fill_wave, /* fill_wave */
-1, /* chunk_size */
@@ -312,19 +312,19 @@ static const struct CassetteLegacyWaveFiller kc_tap_legacy_fill_wave =
0 /* trailer_samples */
};
-static cassette_image::error kc_tap_identify(cassette_image *cassette, struct CassetteOptions *opts)
+static cassette_image::error kc_tap_identify(cassette_image *cassette, cassette_image::Options *opts)
{
- return cassette_legacy_identify(cassette, opts, &kc_tap_legacy_fill_wave);
+ return cassette->legacy_identify(opts, &kc_tap_legacy_fill_wave);
}
static cassette_image::error kc_tap_load(cassette_image *cassette)
{
- return cassette_legacy_construct(cassette, &kc_tap_legacy_fill_wave);
+ return cassette->legacy_construct(&kc_tap_legacy_fill_wave);
}
-static const struct CassetteFormat kc_tap_format =
+static const cassette_image::Format kc_tap_format =
{
"tap,853,854,855,tp2,kcm",
kc_tap_identify,
@@ -336,7 +336,7 @@ static const struct CassetteFormat kc_tap_format =
/*******************************************************************
Generate samples for the tape image
********************************************************************/
-static int kc_sss_fill_wave(int16_t *buffer, int sample_count, uint8_t *bytes)
+static int kc_sss_fill_wave(int16_t *buffer, int sample_count, const uint8_t *bytes, int)
{
return kc_handle_sss(buffer, bytes);
}
@@ -347,13 +347,13 @@ static int kc_sss_fill_wave(int16_t *buffer, int sample_count, uint8_t *bytes)
********************************************************************/
static int kc_sss_to_wav_size(const uint8_t *casdata, int caslen)
{
- kc_image_size = caslen ;
+ kc_image_size = caslen;
return kc_handle_sss( nullptr, casdata );
}
-static const struct CassetteLegacyWaveFiller kc_sss_legacy_fill_wave =
+static const cassette_image::LegacyWaveFiller kc_sss_legacy_fill_wave =
{
kc_sss_fill_wave, /* fill_wave */
-1, /* chunk_size */
@@ -364,18 +364,18 @@ static const struct CassetteLegacyWaveFiller kc_sss_legacy_fill_wave =
0 /* trailer_samples */
};
-static cassette_image::error kc_sss_identify(cassette_image *cassette, struct CassetteOptions *opts)
+static cassette_image::error kc_sss_identify(cassette_image *cassette, cassette_image::Options *opts)
{
- return cassette_legacy_identify(cassette, opts, &kc_sss_legacy_fill_wave);
+ return cassette->legacy_identify(opts, &kc_sss_legacy_fill_wave);
}
static cassette_image::error kc_sss_load(cassette_image *cassette)
{
- return cassette_legacy_construct(cassette, &kc_sss_legacy_fill_wave);
+ return cassette->legacy_construct(&kc_sss_legacy_fill_wave);
}
-static const struct CassetteFormat kc_sss_format =
+static const cassette_image::Format kc_sss_format =
{
"sss",
kc_sss_identify,