Skip to content

Commit

Permalink
Add new command line option "list-verbose" which prints out all patch…
Browse files Browse the repository at this point in the history
… and special setup parameter names.

Closes #17
  • Loading branch information
sagamusix committed Nov 17, 2024
1 parent 086d940 commit 4747113
Show file tree
Hide file tree
Showing 16 changed files with 1,171 additions and 79 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ add_executable(JDTools
JDTools/JD-990.hpp
JDTools/JDTools.hpp
JDTools/PrecomputedTablesVST.hpp
JDTools/PrintPatchData.cpp
JDTools/SVZ.hpp
JDTools/Utils.hpp
JDTools/WaveformNames.hpp
JDTools/miniz.c
JDTools/miniz.h
JDTools/resource.h)
Expand Down
2 changes: 1 addition & 1 deletion JDTools/Convert800to990.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ void ConvertSetup800To990(const SpecialSetup800 &s800, SpecialSetup990 &s990)

s990.effect.reverbType = 4;
s990.effect.reverbPreDelay = 0;
s990.effect.reveryEarlyRefLevel = 8;
s990.effect.reverbEarlyRefLevel = 8;
s990.effect.reverbHFDamp = 13;
s990.effect.reverbTime = 44;
s990.effect.reverbLevel = 40;
Expand Down
2 changes: 1 addition & 1 deletion JDTools/ConvertVSTto800.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ static bool MapToArrayIndex(const T value, const T (&values)[N], uint8_t &target
static double IndexToNoteDuration(const uint8_t index)
{
static constexpr uint8_t Divisor[] = { 64, 64, 32, 32, 16, 32, 16, 8, 16, 8, 4, 8, 4, 2, 4, 2, 1, 2, 1, 1, 1, 1, 1 };
static constexpr uint8_t NoteType[] = { 3, 1, 3, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 1 };
static constexpr uint8_t NoteType[] = { 3, 1, 3, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 1 };
double length = 1.0;
if(index == 19 || index == 21)
length = 2.0;
Expand Down
29 changes: 19 additions & 10 deletions JDTools/JD-08.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -334,9 +334,12 @@ struct ToneVST
filterMode,
cutoffFreq,
resonance,
keyFollow,
aTouchSens, // +50
lfoSelect,
keyFollow;
int8_t
aTouchSens; // +50
uint8_t
lfoSelect;
int8_t
lfoDepth, // +50
envDepth; // +50
};
Expand All @@ -362,20 +365,26 @@ struct ToneVST
{
uint8_t
biasDirection,
biasPoint,
biasLevel, // +10
level,
aTouchSens, // +50
lfoSelect,
biasPoint;
int8_t
biasLevel; // +10
uint8_t
level;
int8_t
aTouchSens; // +50
uint8_t
lfoSelect;
int8_t
lfoDepth; // +50
};

struct TVAEnv
{
uint8_t
int8_t
velo, // +50
timeVelo, // +50
timeKF, // +10
timeKF; // +10
uint8_t
level1,
level2,
sustainLevel,
Expand Down
40 changes: 14 additions & 26 deletions JDTools/JD-800.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,18 @@ struct Tone800
TVAEnv tvaEnv;
};

struct EQ800
{
uint8_t
lowFreq,
lowGain,
midFreq,
midQ,
midGain,
highFreq,
highGain;
};

struct Patch800
{
struct Common
Expand Down Expand Up @@ -153,18 +165,6 @@ struct Patch800
activeTone;
};

struct EQ
{
uint8_t
lowFreq,
lowGain,
midFreq,
midQ,
midGain,
highFreq,
highGain;
};

struct MidiTx
{
uint8_t
Expand Down Expand Up @@ -237,7 +237,7 @@ struct Patch800
};

Common common;
EQ eq;
EQ800 eq;
MidiTx midiTx;
Effect effect;
Tone800 toneA;
Expand All @@ -248,18 +248,6 @@ struct Patch800

struct SpecialSetup800
{
struct EQ
{
uint8_t
lowFreq,
lowGain,
midFreq,
midQ,
midGain,
highFreq,
highGain;
};

struct Common
{
uint8_t
Expand All @@ -281,7 +269,7 @@ struct SpecialSetup800
Tone800 tone;
};

EQ eq;
EQ800 eq;
Common common;
std::array<Key, 61> keys;
};
42 changes: 15 additions & 27 deletions JDTools/JD-990.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,18 @@ struct Tone990
ControlSource cs2;
};

struct EQ990
{
uint8_t
lowFreq,
lowGain,
midFreq,
midQ,
midGain,
highFreq,
highGain;
};

struct Patch990
{
struct Common
Expand Down Expand Up @@ -173,18 +185,6 @@ struct Patch990
soloSyncMaster; // 990 only
};

struct EQ
{
uint8_t
lowFreq,
lowGain,
midFreq,
midQ,
midGain,
highFreq,
highGain;
};

struct StructureType
{
uint8_t
Expand Down Expand Up @@ -294,7 +294,7 @@ struct Patch990

Common common;
KeyEffects keyEffects;
EQ eq;
EQ990 eq;
StructureType structureType;
KeyRanges keyRanges;
Velocity velocity; // 990 only
Expand Down Expand Up @@ -322,18 +322,6 @@ struct SpecialSetup990
toneControlSource2;
};

struct EQ
{
uint8_t
lowFreq,
lowGain,
midFreq,
midQ,
midGain,
highFreq,
highGain;
};

struct Effect
{
uint8_t
Expand Down Expand Up @@ -364,7 +352,7 @@ struct SpecialSetup990

reverbType,
reverbPreDelay,
reveryEarlyRefLevel,
reverbEarlyRefLevel,
reverbHFDamp,
reverbTime,
reverbLevel;
Expand All @@ -382,7 +370,7 @@ struct SpecialSetup990
};

Common common;
EQ eq;
EQ990 eq;
Effect effect;
std::array<Key, 61> keys;
};
49 changes: 37 additions & 12 deletions JDTools/JDTools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,6 @@ namespace
};
}

template<size_t Size>
static std::string_view ToString(const std::array<char, Size> &arr)
{
return std::string_view{ arr.data(), arr.size() };
}

static void PrintUsage()
{
std::cout <<
Expand Down Expand Up @@ -117,7 +111,10 @@ JDTools merge <input1.syx> <input2.syx> <input3.syx> ... <output.syx>
JDTools list <input.syx>
Lists all SysEx / BIN / SVD / SVZ contents
JDTools verify <input.syx>
JDTools list-verbose <input.syx>
Lists all SysEx / BIN / SVD / SVZ contents, including all patch or special setup parameters
JDTools verify <input1.syx> <input2.syx> <input3.syx> ...
Verifies checksum of SySex dumps without doing any conversion
)" << std::endl;
}
Expand Down Expand Up @@ -208,17 +205,21 @@ int main(const int argc, char *argv[])
int numInputFiles = 1, firstFileParam = 2;
bool verifyOnly = (verb == "verify"), verifyFailed = false;
int numVerifiedSysExMessages = 0;
if (verb != "convert" && verb != "list" && verb != "verify" && verb != "merge")
if (verb != "convert" && verb != "list" && verb != "list-verbose" && verb != "verify" && verb != "merge")
{
PrintUsage();
return 1;
}
if ((verb == "list" && argc != 3) || (verb == "verify" && argc != 3) || (verb == "merge" && argc < 4))
if ((verb == "list" && argc != 3) || (verb == "list-verbose" && argc != 3) || (verb == "verify" && argc < 3) || (verb == "merge" && argc < 4))
{
PrintUsage();
return 1;
}
if (verb == "merge")
if (verb == "verify")
{
numInputFiles = argc - 2;
}
else if (verb == "merge")
{
numInputFiles = argc - 3;
}
Expand Down Expand Up @@ -300,6 +301,11 @@ int main(const int argc, char *argv[])
}
else
{
if (verifyOnly)
{
std::cout << "Verifying " << inFilename << "..." << std::endl;
}

do
{
message = inputFile.NextSysExMessage();
Expand Down Expand Up @@ -415,7 +421,6 @@ int main(const int argc, char *argv[])
{
if (verifyFailed)
{

std::cout << "SysEx dumps contained errors!" << std::endl;
return 3;
}
Expand Down Expand Up @@ -765,8 +770,10 @@ int main(const int argc, char *argv[])
}

}
else if (verb == "list")
else if (verb == "list" || verb == "list-verbose")
{
const bool verbose = verb == "list-verbose";

if (sourceDeviceType == DeviceType::JD800)
{
std::cout << "Format: JD-800" << std::endl;
Expand Down Expand Up @@ -816,17 +823,23 @@ int main(const int argc, char *argv[])
continue;
const Patch800 &p800 = *reinterpret_cast<const Patch800 *>(memory.data() + address800);
std::cout << GetPatchIndex(patch, numPatches) << ": " << ToString(p800.common.name) << std::endl;
if (verbose)
PrintPatch(p800);
}
else if (sourceDeviceType == DeviceType::JD990)
{
if (memory[address990] == UNDEFINED_MEMORY)
continue;
const Patch990 &p990 = *reinterpret_cast<const Patch990 *>(memory.data() + address990);
std::cout << GetPatchIndex(patch, numPatches) << ": " << ToString(p990.common.name) << std::endl;
if (verbose)
PrintPatch(p990);
}
else if (sourceDeviceType == DeviceType::JD800VST)
{
std::cout << GetPatchIndex(patch, numPatches) << ": " << ToString(vstPatches[patch].name) << std::endl;
if (verbose)
PrintPatch(vstPatches[patch]);
}
}
for (uint32_t patch = 0; patch < 64; patch++)
Expand All @@ -853,11 +866,17 @@ int main(const int argc, char *argv[])
{
if (memory[BASE_ADDR_800_SETUP_INTERNAL] != UNDEFINED_MEMORY)
{
const SpecialSetup800 &s800 = *reinterpret_cast<const SpecialSetup800 *>(memory.data() + BASE_ADDR_800_SETUP_INTERNAL);
std::cout << "Special setup (internal): JD-800 Drum Set" << std::endl;
if (verbose)
PrintSetup(s800);
}
if (memory[BASE_ADDR_800_SETUP_TEMPORARY] != UNDEFINED_MEMORY)
{
const SpecialSetup800 &s800 = *reinterpret_cast<const SpecialSetup800 *>(memory.data() + BASE_ADDR_800_SETUP_TEMPORARY);
std::cout << "Special setup (temporary): JD-800 Drum Set" << std::endl;
if (verbose)
PrintSetup(s800);
}
}
else if (sourceDeviceType == DeviceType::JD990)
Expand All @@ -866,16 +885,22 @@ int main(const int argc, char *argv[])
{
const SpecialSetup990 &s990 = *reinterpret_cast<const SpecialSetup990 *>(memory.data() + BASE_ADDR_990_SETUP_INTERNAL);
std::cout << "Special setup (internal): " << ToString(s990.common.name) << std::endl;
if (verbose)
PrintSetup(s990);
}
if (memory[BASE_ADDR_990_SETUP_CARD] != UNDEFINED_MEMORY)
{
const SpecialSetup990 &s990 = *reinterpret_cast<const SpecialSetup990 *>(memory.data() + BASE_ADDR_990_SETUP_CARD);
std::cout << "Special setup (card): " << ToString(s990.common.name) << std::endl;
if (verbose)
PrintSetup(s990);
}
if (memory[BASE_ADDR_990_SETUP_TEMPORARY] != UNDEFINED_MEMORY)
{
const SpecialSetup990 &s990 = *reinterpret_cast<const SpecialSetup990 *>(memory.data() + BASE_ADDR_990_SETUP_TEMPORARY);
std::cout << "Special setup (temporary): " << ToString(s990.common.name) << std::endl;
if (verbose)
PrintSetup(s990);
}
}
}
Expand Down
Loading

0 comments on commit 4747113

Please sign in to comment.