From: Steinar H. Gunderson Date: Sat, 4 May 2013 20:16:58 +0000 (+0200) Subject: Make a debug.raw with detected pulses. X-Git-Url: https://git.sesse.net/?p=c64tapwav;a=commitdiff_plain;h=2d875bfb4e11cea397aeb88d9781d8a36079c9a1 Make a debug.raw with detected pulses. --- diff --git a/decode.cpp b/decode.cpp index 1a5ee74..fdc1347 100644 --- a/decode.cpp +++ b/decode.cpp @@ -3,6 +3,7 @@ #include #include #include +#include #include #include @@ -189,4 +190,20 @@ int main(int argc, char **argv) fwrite(&hdr, sizeof(hdr), 1, stdout); fwrite(tap_data.data(), tap_data.size(), 1, stdout); + + // Output a debug raw file with pulse detection points. + fp = fopen("debug.raw", "wb"); + short one = 32767; + short zero = 0; + unsigned pulsenum = 0; + for (unsigned i = 0; i < pcm.size(); ++i) { + unsigned next_pulse = (pulsenum >= pulses.size()) ? INT_MAX : int(pulses[pulsenum].time * SAMPLE_RATE); + if (i >= next_pulse) { + fwrite(&one, sizeof(one), 1, fp); + ++pulsenum; + } else { + fwrite(&zero, sizeof(zero), 1, fp); + } + } + fclose(fp); }