From 37a32c92ded14e1b22556f29ef0273d9c07ede62 Mon Sep 17 00:00:00 2001 From: Leonid Golouz Date: Wed, 20 Oct 2021 10:44:35 +0300 Subject: [PATCH 1/2] Fixed [ZXTR-24] It is unable to read some WAV files --- ZXTapeReviver.pro | 2 ++ qml/main.qml | 4 ++-- sources/core/waveformparser.cpp | 2 +- sources/core/wavreader.cpp | 3 +++ 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/ZXTapeReviver.pro b/ZXTapeReviver.pro index afb6c6f..2489a89 100644 --- a/ZXTapeReviver.pro +++ b/ZXTapeReviver.pro @@ -26,6 +26,7 @@ DEFINES += QT_DEPRECATED_WARNINGS CONFIG += c++14 SOURCES += \ + sources/actions/actionbase.cpp \ sources/main.cpp \ sources/models/fileworkermodel.cpp \ sources/controls/waveformcontrol.cpp \ @@ -35,6 +36,7 @@ SOURCES += \ sources/models/suspiciouspointsmodel.cpp HEADERS += \ + sources/actions/actionbase.h \ sources/defines.h \ sources/models/fileworkermodel.h \ sources/controls/waveformcontrol.h \ diff --git a/qml/main.qml b/qml/main.qml index 274ced8..e132f97 100644 --- a/qml/main.qml +++ b/qml/main.qml @@ -663,14 +663,14 @@ ApplicationWindow { Text { anchors.centerIn: parent color: parent.parent.blkSelected ? "white" : "black" - text: blkNumber + text: blkNumber + 1 } } MouseArea { anchors.fill: parent onClicked: { - WaveformParser.toggleBlockSelection(blkNumber - 1); + WaveformParser.toggleBlockSelection(blkNumber); } } } diff --git a/sources/core/waveformparser.cpp b/sources/core/waveformparser.cpp index 3f3a2bc..cd20767 100644 --- a/sources/core/waveformparser.cpp +++ b/sources/core/waveformparser.cpp @@ -325,7 +325,7 @@ QVariantList WaveformParser::getParsedChannelData(uint chNum) const for (const auto& i: ch) { QVariantMap m; - m.insert("block", QVariantMap { {"blockSelected", blockNumber < (unsigned) mSelectedBlocks.size() ? mSelectedBlocks[blockNumber] : (mSelectedBlocks.append(true), true)}, {"blockNumber", (++blockNumber, blockNumber)} }); + m.insert("block", QVariantMap { {"blockSelected", blockNumber < (unsigned) mSelectedBlocks.size() ? mSelectedBlocks[blockNumber] : (mSelectedBlocks.append(true), true)}, {"blockNumber", blockNumber++} }); if (i.data.size() > 0) { auto d = i.data.at(0); int blockType = -1; diff --git a/sources/core/wavreader.cpp b/sources/core/wavreader.cpp index d123ff0..c510fb5 100644 --- a/sources/core/wavreader.cpp +++ b/sources/core/wavreader.cpp @@ -68,6 +68,9 @@ WavReader::ErrorCodesEnum WavReader::open() } mWavFormatHeader = *fmtHeader; + + //File pos aligning according to header data + mWavFile.seek(mWavFile.pos() + (fmtHeader->chunk.chunkDataSize - (sizeof (WavFmt) - sizeof (WavChunk)))); } { From 3ecc604be34c8a57db68c617afb34477e9444bce Mon Sep 17 00:00:00 2001 From: Leonid Golouz Date: Wed, 20 Oct 2021 10:46:51 +0300 Subject: [PATCH 2/2] project fix --- ZXTapeReviver.pro | 2 -- 1 file changed, 2 deletions(-) diff --git a/ZXTapeReviver.pro b/ZXTapeReviver.pro index 2489a89..afb6c6f 100644 --- a/ZXTapeReviver.pro +++ b/ZXTapeReviver.pro @@ -26,7 +26,6 @@ DEFINES += QT_DEPRECATED_WARNINGS CONFIG += c++14 SOURCES += \ - sources/actions/actionbase.cpp \ sources/main.cpp \ sources/models/fileworkermodel.cpp \ sources/controls/waveformcontrol.cpp \ @@ -36,7 +35,6 @@ SOURCES += \ sources/models/suspiciouspointsmodel.cpp HEADERS += \ - sources/actions/actionbase.h \ sources/defines.h \ sources/models/fileworkermodel.h \ sources/controls/waveformcontrol.h \