summaryrefslogtreecommitdiffstatshomepage
path: root/src/lib/formats/lviv_lvt.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/formats/lviv_lvt.cpp')
-rw-r--r--src/lib/formats/lviv_lvt.cpp33
1 files changed, 14 insertions, 19 deletions
diff --git a/src/lib/formats/lviv_lvt.cpp b/src/lib/formats/lviv_lvt.cpp
index 3a94114d421..3725c181f3c 100644
--- a/src/lib/formats/lviv_lvt.cpp
+++ b/src/lib/formats/lviv_lvt.cpp
@@ -1,10 +1,10 @@
// license:BSD-3-Clause
// copyright-holders:Krzysztof Strzecha
/* .LVT tape images */
-#include <cassert>
-
#include "lviv_lvt.h"
+#include <cassert>
+
#define WAVEENTRY_LOW -32768
#define WAVEENTRY_HIGH 32767
@@ -19,9 +19,7 @@
static int16_t *lviv_emit_level(int16_t *p, int count, int level)
{
- int i;
-
- for (i=0; i<count; i++)
+ for (int i=0; i<count; i++)
{
*(p++) = level;
}
@@ -47,11 +45,9 @@ static int16_t* lviv_output_bit(int16_t *p, uint8_t b)
static int16_t* lviv_output_byte(int16_t *p, uint8_t byte)
{
- int i;
-
p = lviv_output_bit (p, 0);
- for (i=0; i<8; i++)
+ for (int i=0; i<8; i++)
p = lviv_output_bit(p,(byte>>i) & 0x01);
p = lviv_output_bit (p, 1);
@@ -78,23 +74,22 @@ static int lviv_cassette_calculate_size_in_samples(const uint8_t *bytes, int len
static int lviv_cassette_fill_wave(int16_t *buffer, int length, uint8_t *bytes)
{
- int i;
int16_t * p = buffer;
int data_size;
- for (i=0; i<LVIV_LVT_HEADER_PILOT_LENGTH; i++)
+ for (int i=0; i<LVIV_LVT_HEADER_PILOT_LENGTH; i++)
p = lviv_output_bit (p, 1);
- for (i=0; i<10; i++)
+ for (int i=0; i<10; i++)
p = lviv_output_byte (p, bytes[0x09]);
- for (i=0; i<6; i++)
+ for (int i=0; i<6; i++)
p = lviv_output_byte (p, bytes[0x0a+i]);
p = lviv_emit_level (p, LVIV_LVT_PAUSE_SAMPLES, WAVEENTRY_HIGH);
- for (i=0; i<LVIV_LVT_BLOCK_PILOT_LENGTH; i++)
+ for (int i=0; i<LVIV_LVT_BLOCK_PILOT_LENGTH; i++)
p = lviv_output_bit (p, 1);
data_size = length - ( LVIV_LVT_HEADER_PILOT_SAMPLES +
@@ -103,7 +98,7 @@ static int lviv_cassette_fill_wave(int16_t *buffer, int length, uint8_t *bytes)
LVIV_LVT_BLOCK_PILOT_SAMPLES );
data_size/=660;
- for (i=0; i<data_size; i++)
+ for (int i=0; i<data_size; i++)
p = lviv_output_byte (p, bytes[0x10+i]);
return p - buffer;
@@ -111,7 +106,7 @@ static int lviv_cassette_fill_wave(int16_t *buffer, int length, uint8_t *bytes)
-static const struct CassetteLegacyWaveFiller lviv_legacy_fill_wave =
+static const cassette_image::LegacyWaveFiller lviv_legacy_fill_wave =
{
lviv_cassette_fill_wave, /* fill_wave */
-1, /* chunk_size */
@@ -124,21 +119,21 @@ static const struct CassetteLegacyWaveFiller lviv_legacy_fill_wave =
-static cassette_image::error lviv_lvt_identify(cassette_image *cassette, struct CassetteOptions *opts)
+static cassette_image::error lviv_lvt_identify(cassette_image *cassette, cassette_image::Options *opts)
{
- return cassette_legacy_identify(cassette, opts, &lviv_legacy_fill_wave);
+ return cassette->legacy_identify(opts, &lviv_legacy_fill_wave);
}
static cassette_image::error lviv_lvt_load(cassette_image *cassette)
{
- return cassette_legacy_construct(cassette, &lviv_legacy_fill_wave);
+ return cassette->legacy_construct(&lviv_legacy_fill_wave);
}
-static const struct CassetteFormat lviv_lvt_image_format =
+static const cassette_image::Format lviv_lvt_image_format =
{
"lvt,lvr,lv0,lv1,lv2,lv3",
lviv_lvt_identify,