diff --git a/m10/M10.cpp b/m10/M10.cpp index 1e579a5..ec6348b 100644 --- a/m10/M10.cpp +++ b/m10/M10.cpp @@ -22,16 +22,18 @@ int main(int argc, char** argv) { ++argv; while (*argv) { if ((strcmp(*argv, "-h") == 0) || (strcmp(*argv, "--help") == 0)) { - fprintf(stderr, "%s [options] audio.wav\n", fpname); + fprintf(stderr, "%s [options] filename\n", fpname); + fprintf(stderr, " filename needs to be in wav format and blank or - for stdin\n"); fprintf(stderr, " options:\n"); - //fprintf(stderr, " -v, --verbose\n"); - fprintf(stderr, " -r, --raw\n"); - fprintf(stderr, " -c, --color\n"); - //fprintf(stderr, " -o, --offset\n"); + fprintf(stderr, " -v, --verbose Display even when CRC is wrong\n"); + fprintf(stderr, " -R Show result at the end decoded/total\n"); + fprintf(stderr, " -b Try alternative method after main method if it failed\n"); + fprintf(stderr, " --ch2 Decode the second channel\n"); + return 0; } else if ((strcmp(*argv, "-r") == 0) || (strcmp(*argv, "--raw") == 0)) { decoder.setRaw(true); - } else if (strcmp(*argv, "-v") == 0) { + } else if (strcmp(*argv, "-v") == 0 || strcmp(*argv, "--verbose") == 0) { decoder.setVerboseLevel(1); } else if (strcmp(*argv, "-b") == 0) { decoder.setTryMethodSign(true); diff --git a/m10/M10Decoder.cpp b/m10/M10Decoder.cpp index e2c55bb..50b25ac 100644 --- a/m10/M10Decoder.cpp +++ b/m10/M10Decoder.cpp @@ -21,12 +21,13 @@ M10Decoder::~M10Decoder() { delete m10GTop; delete m10Ptu; - delete frameSamples; + if (samplesPerBit != 0) + delete frameSamples; } int M10Decoder::startDecode(std::string fname) { filename = fname; - if (filename == "") + if (filename == "" || filename == "-") fp = stdin; else fp = fopen(filename.c_str(), "rb"); @@ -155,7 +156,7 @@ double M10Decoder::findFrameStart() { int tmpIndex = 0; valIndex--; valIndex %= smallBufLen; - if(j - (int) pos > smallBufLen) // If absurdly long way back + if (j - (int) pos > smallBufLen) // If absurdly long way back continue; // Store the previous values in the buffer for (curIndex = 0; curIndex < (j - (int) pos); ++curIndex) {