// license:BSD-3-Clause // copyright-holders:Krzysztof Strzecha /* .LVT tape images */ #include #include "lviv_lvt.h" #define WAVEENTRY_LOW -32768 #define WAVEENTRY_HIGH 32767 #define LVIV_LVT_BIT_SAMPLES 60 #define LVIV_LVT_HEADER_PILOT_SAMPLES 5190*60 #define LVIV_LVT_HEADER_DATA_SAMPLES 16*11*60 #define LVIV_LVT_PAUSE_SAMPLES 69370 #define LVIV_LVT_BLOCK_PILOT_SAMPLES 1298*60 #define LVIV_LVT_HEADER_PILOT_LENGTH 5190 #define LVIV_LVT_BLOCK_PILOT_LENGTH 1298 static int16_t *lviv_emit_level(int16_t *p, int count, int level) { int i; for (i=0; i>i) & 0x01); p = lviv_output_bit (p, 1); p = lviv_output_bit (p, 1); return p; } /*************************************************************************************/ static int lviv_cassette_calculate_size_in_samples(const uint8_t *bytes, int length) { int size; size = LVIV_LVT_HEADER_PILOT_SAMPLES + LVIV_LVT_HEADER_DATA_SAMPLES + LVIV_LVT_PAUSE_SAMPLES + LVIV_LVT_BLOCK_PILOT_SAMPLES + (length-0x10)*11*LVIV_LVT_BIT_SAMPLES; return size; } /*************************************************************************************/ 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