Skip to content

Commit

Permalink
Make SVZ reading / writing more generic, not relying on specific chun…
Browse files Browse the repository at this point in the history
…k order and layout.
  • Loading branch information
sagamusix committed Jan 4, 2024
1 parent 6e81876 commit d3716f4
Show file tree
Hide file tree
Showing 17 changed files with 283 additions and 165 deletions.
2 changes: 1 addition & 1 deletion JDTools/Convert800to990.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// JDTools - Patch conversion utility for Roland JD-800 / JD-990
// 2022 by Johannes Schultz
// 2022 - 2024 by Johannes Schultz
// License: BSD 3-clause

#include "JD-800.hpp"
Expand Down
2 changes: 1 addition & 1 deletion JDTools/Convert800toVST.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// JDTools - Patch conversion utility for Roland JD-800 / JD-990
// 2022 by Johannes Schultz
// 2022 - 2024 by Johannes Schultz
// License: BSD 3-clause

#include "JD-800.hpp"
Expand Down
2 changes: 1 addition & 1 deletion JDTools/Convert990to800.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// JDTools - Patch conversion utility for Roland JD-800 / JD-990
// 2022 by Johannes Schultz
// 2022 - 2024 by Johannes Schultz
// License: BSD 3-clause

#include "JD-800.hpp"
Expand Down
2 changes: 1 addition & 1 deletion JDTools/ConvertVSTto800.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// JDTools - Patch conversion utility for Roland JD-800 / JD-990
// 2022 by Johannes Schultz
// 2022 - 2024 by Johannes Schultz
// License: BSD 3-clause

#include "JD-800.hpp"
Expand Down
26 changes: 19 additions & 7 deletions JDTools/InputFile.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// JDTools - Patch conversion utility for Roland JD-800 / JD-990
// 2022 by Johannes Schultz
// 2022 - 2024 by Johannes Schultz
// License: BSD 3-clause

#include "InputFile.hpp"
Expand All @@ -17,13 +17,25 @@ InputFile::InputFile(std::istream &file)
}
else if (CompareMagic(magic, "SVZa"))
{
uint8_t numChunks = 0;
Read(m_file, numChunks);
m_file.seekg(16);
std::array<char, 4> type{};
Read(m_file, type);
if (CompareMagic(type, "EXTa"))
m_type = Type::SVZplugin;
else if (CompareMagic(type, "DIFa"))
m_type = Type::SVZhardware;
for (uint32_t chunk = 0; chunk < numChunks; chunk++)
{
std::array<char, 4> type{};
Read(m_file, type);
if (CompareMagic(type, "EXTa"))
{
m_type = Type::SVZplugin;
break;
}
else if (CompareMagic(type, "MDLa"))
{
m_type = Type::SVZhardware;
break;
}
m_file.seekg(12, std::ios::cur);
}
}
else if (magic[2] == 'S' && magic[3] == 'V')
{
Expand Down
4 changes: 2 additions & 2 deletions JDTools/InputFile.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// JDTools - Patch conversion utility for Roland JD-800 / JD-990
// 2022 by Johannes Schultz
// 2022 - 2024 by Johannes Schultz
// License: BSD 3-clause

#pragma once
Expand All @@ -20,7 +20,7 @@ class InputFile
SVD,
};

InputFile(std::istream& file);
InputFile(std::istream &file);

std::vector<uint8_t> NextSysExMessage();

Expand Down
2 changes: 1 addition & 1 deletion JDTools/JD-08.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// JDTools - Patch conversion utility for Roland JD-800 / JD-990
// 2022 by Johannes Schultz
// 2022 - 2024 by Johannes Schultz
// License: BSD 3-clause

#pragma once
Expand Down
2 changes: 1 addition & 1 deletion JDTools/JD-800.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// JDTools - Patch conversion utility for Roland JD-800 / JD-990
// 2022 by Johannes Schultz
// 2022 - 2024 by Johannes Schultz
// License: BSD 3-clause

#pragma once
Expand Down
2 changes: 1 addition & 1 deletion JDTools/JD-990.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// JDTools - Patch conversion utility for Roland JD-800 / JD-990
// 2022 by Johannes Schultz
// 2022 - 2024 by Johannes Schultz
// License: BSD 3-clause

#pragma once
Expand Down
8 changes: 4 additions & 4 deletions JDTools/JDTools.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// JDTools - Patch conversion utility for Roland JD-800 / JD-990
// 2022 by Johannes Schultz
// 2022 - 2024 by Johannes Schultz
// License: BSD 3-clause

#include "JDTools.hpp"
Expand Down Expand Up @@ -246,14 +246,14 @@ int main(const int argc, char *argv[])
InputFile inputFile{inFile};
if (inputFile.GetType() == InputFile::Type::SVZplugin)
{
vstPatches = ReadSVZforPlugin(inFile);
vstPatches = ReadSVZ(inFile);
if (vstPatches.empty())
return 2;
sourceDeviceType = DeviceType::JD800VST;
}
else if (inputFile.GetType() == InputFile::Type::SVZhardware)
{
vstPatches = ReadSVZforHardware(inFile);
vstPatches = ReadSVZ(inFile);
if (vstPatches.empty())
return 2;
sourceDeviceType = DeviceType::JD800VST;
Expand Down Expand Up @@ -488,7 +488,7 @@ int main(const int argc, char *argv[])
if (pVST.zenHeader.modelID1 != 3 || pVST.zenHeader.modelID2 != 5)
{
std::cerr << "Ignoring patch" << GetPatchIndex(sourcePatch, numPatches) << ", appears to be for another synth model!" << std::endl;
memset(&pVST, 0, sizeof(pVST));
Reconstruct(pVST);
pVST.zenHeader = PatchVST::DEFAULT_ZEN_HEADER;
pVST.name.fill(' ');
}
Expand Down
2 changes: 1 addition & 1 deletion JDTools/JDTools.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// JDTools - Patch conversion utility for Roland JD-800 / JD-990
// 2022 by Johannes Schultz
// 2022 - 2024 by Johannes Schultz
// License: BSD 3-clause

#pragma once
Expand Down
4 changes: 2 additions & 2 deletions JDTools/JDTools.rc
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@ BEGIN
BLOCK "040004b0"
BEGIN
VALUE "CompanyName", "Johannes Schultz"
VALUE "FileDescription", "JDTools - Patch conversion utility for Roland JD-800 / JD-990"
VALUE "FileDescription", "JDTools - Patch conversion utility for Roland JD-800 / JD-990 and compatibles"
VALUE "FileVersion", VER_FILEVERSION_STR
VALUE "InternalName", "JDTools.exe"
VALUE "LegalCopyright", "Copyright (C) 2022 Johannes Schultz"
VALUE "LegalCopyright", "Copyright (C) 2022 - 2004 Johannes Schultz"
VALUE "OriginalFilename", "JDTools.exe"
VALUE "ProductName", "JDTools"
VALUE "ProductVersion", VER_FILEVERSION_STR
Expand Down
2 changes: 1 addition & 1 deletion JDTools/PrecomputedTablesVST.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// JDTools - Patch conversion utility for Roland JD-800 / JD-990
// 2022 by Johannes Schultz
// 2022 - 2024 by Johannes Schultz
// License: BSD 3-clause

#include <cstdint>
Expand Down
Loading

0 comments on commit d3716f4

Please sign in to comment.