Skip to content

Commit 30211cc

Browse files
committed
Added 2x CC mode and adjusted gate time heuristic
1 parent bd3a696 commit 30211cc

File tree

10 files changed

+73
-35
lines changed

10 files changed

+73
-35
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ cmake_minimum_required(VERSION 3.13)
2222
set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "" FORCE)
2323
set(CMAKE_CONFIGURATION_TYPES ${CMAKE_BUILD_TYPE} CACHE STRING "" FORCE)
2424

25-
project(SEQ64 VERSION 2.2.1)
25+
project(SEQ64 VERSION 2.3.0)
2626

2727
if(NOT EXISTS "${CMAKE_SOURCE_DIR}/juce/CMakeLists.txt")
2828
message(FATAL_ERROR "You forgot to get the Git submodules, please run git submodule update --init")

Source/SeqABIEditor.cpp

Lines changed: 41 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
the "//[xyz]" and "//[/xyz]" sections will be retained when the file is loaded
88
and re-saved.
99
10-
Created with Projucer version: 6.0.1
10+
Created with Projucer version: 6.0.7
1111
1212
------------------------------------------------------------------------------
1313
@@ -62,7 +62,7 @@ SeqABIEditor::SeqABIEditor (String abi_name)
6262
TRANS("Audioseq / Nintendo 64 Music Macro Language\n"
6363
"ABI definition file: /foo/bar.xml")));
6464
addAndMakeVisible (lblTitle.get());
65-
lblTitle->setFont (juce::Font (15.00f, juce::Font::plain));
65+
lblTitle->setFont (juce::Font (15.00f, juce::Font::plain).withTypefaceStyle ("Regular"));
6666
lblTitle->setJustificationType (juce::Justification::centredLeft);
6767
lblTitle->setEditable (false, false, false);
6868
lblTitle->setColour (juce::TextEditor::textColourId, juce::Colours::black);
@@ -111,7 +111,7 @@ SeqABIEditor::SeqABIEditor (String abi_name)
111111
lblCmdNameCmm.reset (new juce::Label ("lblCmdNameCmm",
112112
TRANS("Community:")));
113113
addAndMakeVisible (lblCmdNameCmm.get());
114-
lblCmdNameCmm->setFont (juce::Font (15.00f, juce::Font::plain));
114+
lblCmdNameCmm->setFont (juce::Font (15.00f, juce::Font::plain).withTypefaceStyle ("Regular"));
115115
lblCmdNameCmm->setJustificationType (juce::Justification::centredLeft);
116116
lblCmdNameCmm->setEditable (false, false, false);
117117
lblCmdNameCmm->setColour (juce::TextEditor::textColourId, juce::Colours::black);
@@ -128,7 +128,7 @@ SeqABIEditor::SeqABIEditor (String abi_name)
128128
lblCmdNameCanon.reset (new juce::Label ("lblCmdNameCanon",
129129
TRANS("Canon:")));
130130
addAndMakeVisible (lblCmdNameCanon.get());
131-
lblCmdNameCanon->setFont (juce::Font (15.00f, juce::Font::plain));
131+
lblCmdNameCanon->setFont (juce::Font (15.00f, juce::Font::plain).withTypefaceStyle ("Regular"));
132132
lblCmdNameCanon->setJustificationType (juce::Justification::centredLeft);
133133
lblCmdNameCanon->setEditable (false, false, false);
134134
lblCmdNameCanon->setColour (juce::TextEditor::textColourId, juce::Colours::black);
@@ -139,7 +139,7 @@ SeqABIEditor::SeqABIEditor (String abi_name)
139139
lblCmdNameOld.reset (new juce::Label ("lblCmdNameOld",
140140
TRANS("Canon (Old):")));
141141
addAndMakeVisible (lblCmdNameOld.get());
142-
lblCmdNameOld->setFont (juce::Font (15.00f, juce::Font::plain));
142+
lblCmdNameOld->setFont (juce::Font (15.00f, juce::Font::plain).withTypefaceStyle ("Regular"));
143143
lblCmdNameOld->setJustificationType (juce::Justification::centredLeft);
144144
lblCmdNameOld->setEditable (false, false, false);
145145
lblCmdNameOld->setColour (juce::TextEditor::textColourId, juce::Colours::black);
@@ -186,7 +186,7 @@ SeqABIEditor::SeqABIEditor (String abi_name)
186186
lblCmd.reset (new juce::Label ("lblCmd",
187187
TRANS("Cmd:")));
188188
addAndMakeVisible (lblCmd.get());
189-
lblCmd->setFont (juce::Font (15.00f, juce::Font::plain));
189+
lblCmd->setFont (juce::Font (15.00f, juce::Font::plain).withTypefaceStyle ("Regular"));
190190
lblCmd->setJustificationType (juce::Justification::centredLeft);
191191
lblCmd->setEditable (false, false, false);
192192
lblCmd->setColour (juce::TextEditor::textColourId, juce::Colours::black);
@@ -209,7 +209,7 @@ SeqABIEditor::SeqABIEditor (String abi_name)
209209
lblTo.reset (new juce::Label ("lblTo",
210210
TRANS("to")));
211211
addAndMakeVisible (lblTo.get());
212-
lblTo->setFont (juce::Font (15.00f, juce::Font::plain));
212+
lblTo->setFont (juce::Font (15.00f, juce::Font::plain).withTypefaceStyle ("Regular"));
213213
lblTo->setJustificationType (juce::Justification::centredLeft);
214214
lblTo->setEditable (false, false, false);
215215
lblTo->setColour (juce::TextEditor::textColourId, juce::Colours::black);
@@ -300,7 +300,7 @@ SeqABIEditor::SeqABIEditor (String abi_name)
300300
lblAction.reset (new juce::Label ("lblAction",
301301
TRANS("Action:")));
302302
addAndMakeVisible (lblAction.get());
303-
lblAction->setFont (juce::Font (15.00f, juce::Font::plain));
303+
lblAction->setFont (juce::Font (15.00f, juce::Font::plain).withTypefaceStyle ("Regular"));
304304
lblAction->setJustificationType (juce::Justification::centredLeft);
305305
lblAction->setEditable (false, false, false);
306306
lblAction->setColour (juce::TextEditor::textColourId, juce::Colours::black);
@@ -323,7 +323,7 @@ SeqABIEditor::SeqABIEditor (String abi_name)
323323
lblComments.reset (new juce::Label ("lblComments",
324324
TRANS("Comments:")));
325325
addAndMakeVisible (lblComments.get());
326-
lblComments->setFont (juce::Font (15.00f, juce::Font::plain));
326+
lblComments->setFont (juce::Font (15.00f, juce::Font::plain).withTypefaceStyle ("Regular"));
327327
lblComments->setJustificationType (juce::Justification::centredLeft);
328328
lblComments->setEditable (false, false, false);
329329
lblComments->setColour (juce::TextEditor::textColourId, juce::Colours::black);
@@ -334,7 +334,7 @@ SeqABIEditor::SeqABIEditor (String abi_name)
334334
lblParams.reset (new juce::Label ("lblParams",
335335
TRANS("Params:")));
336336
addAndMakeVisible (lblParams.get());
337-
lblParams->setFont (juce::Font (15.00f, juce::Font::plain));
337+
lblParams->setFont (juce::Font (15.00f, juce::Font::plain).withTypefaceStyle ("Regular"));
338338
lblParams->setJustificationType (juce::Justification::centredLeft);
339339
lblParams->setEditable (false, false, false);
340340
lblParams->setColour (juce::TextEditor::textColourId, juce::Colours::black);
@@ -351,7 +351,7 @@ SeqABIEditor::SeqABIEditor (String abi_name)
351351
lblParamName.reset (new juce::Label ("lblParamName",
352352
TRANS("Name:")));
353353
addAndMakeVisible (lblParamName.get());
354-
lblParamName->setFont (juce::Font (15.00f, juce::Font::plain));
354+
lblParamName->setFont (juce::Font (15.00f, juce::Font::plain).withTypefaceStyle ("Regular"));
355355
lblParamName->setJustificationType (juce::Justification::centredLeft);
356356
lblParamName->setEditable (false, false, false);
357357
lblParamName->setColour (juce::TextEditor::textColourId, juce::Colours::black);
@@ -362,7 +362,7 @@ SeqABIEditor::SeqABIEditor (String abi_name)
362362
lblParamMeaning.reset (new juce::Label ("lblParamMeaning",
363363
TRANS("Meaning:")));
364364
addAndMakeVisible (lblParamMeaning.get());
365-
lblParamMeaning->setFont (juce::Font (15.00f, juce::Font::plain));
365+
lblParamMeaning->setFont (juce::Font (15.00f, juce::Font::plain).withTypefaceStyle ("Regular"));
366366
lblParamMeaning->setJustificationType (juce::Justification::centredLeft);
367367
lblParamMeaning->setEditable (false, false, false);
368368
lblParamMeaning->setColour (juce::TextEditor::textColourId, juce::Colours::black);
@@ -459,13 +459,13 @@ SeqABIEditor::SeqABIEditor (String abi_name)
459459
lblDataLen.reset (new juce::Label ("lblDataLen",
460460
TRANS("(none)")));
461461
addAndMakeVisible (lblDataLen.get());
462-
lblDataLen->setFont (juce::Font (15.00f, juce::Font::plain));
462+
lblDataLen->setFont (juce::Font (15.00f, juce::Font::plain).withTypefaceStyle ("Regular"));
463463
lblDataLen->setJustificationType (juce::Justification::centredLeft);
464464
lblDataLen->setEditable (false, false, false);
465465
lblDataLen->setColour (juce::TextEditor::textColourId, juce::Colours::black);
466466
lblDataLen->setColour (juce::TextEditor::backgroundColourId, juce::Colour (0x00000000));
467467

468-
lblDataLen->setBounds (360, 588, 64, 24);
468+
lblDataLen->setBounds (360, 576, 64, 24);
469469

470470
txtDataLen.reset (new juce::TextEditor ("txtDataLen"));
471471
addAndMakeVisible (txtDataLen.get());
@@ -477,7 +477,7 @@ SeqABIEditor::SeqABIEditor (String abi_name)
477477
txtDataLen->setPopupMenuEnabled (true);
478478
txtDataLen->setText (juce::String());
479479

480-
txtDataLen->setBounds (424, 588, 32, 24);
480+
txtDataLen->setBounds (424, 576, 32, 24);
481481

482482
btnSave.reset (new juce::TextButton ("btnSave"));
483483
addAndMakeVisible (btnSave.get());
@@ -501,7 +501,7 @@ SeqABIEditor::SeqABIEditor (String abi_name)
501501
lblCC.reset (new juce::Label ("lblCC",
502502
TRANS("CC:")));
503503
addAndMakeVisible (lblCC.get());
504-
lblCC->setFont (juce::Font (15.00f, juce::Font::plain));
504+
lblCC->setFont (juce::Font (15.00f, juce::Font::plain).withTypefaceStyle ("Regular"));
505505
lblCC->setJustificationType (juce::Justification::centredLeft);
506506
lblCC->setEditable (false, false, false);
507507
lblCC->setColour (juce::TextEditor::textColourId, juce::Colours::black);
@@ -517,6 +517,14 @@ SeqABIEditor::SeqABIEditor (String abi_name)
517517

518518
btnCCHelp->setBounds (448, 552, 22, 24);
519519

520+
chkx2.reset (new juce::ToggleButton ("chkx2"));
521+
addAndMakeVisible (chkx2.get());
522+
chkx2->setTooltip (TRANS("CC value is multiplied by 2 to get MML value, because MIDI is 0-127 whereas MML is 0-255."));
523+
chkx2->setButtonText (TRANS("x2"));
524+
chkx2->addListener (this);
525+
526+
chkx2->setBounds (400, 600, 72, 24);
527+
520528

521529
//[UserPreSize]
522530

@@ -631,6 +639,7 @@ SeqABIEditor::~SeqABIEditor()
631639
txtCC = nullptr;
632640
lblCC = nullptr;
633641
btnCCHelp = nullptr;
642+
chkx2 = nullptr;
634643

635644

636645
//[Destructor]. You can add your own custom destruction code here..
@@ -932,6 +941,14 @@ void SeqABIEditor::buttonClicked (juce::Button* buttonThatWasClicked)
932941
);
933942
//[/UserButtonCode_btnCCHelp]
934943
}
944+
else if (buttonThatWasClicked == chkx2.get())
945+
{
946+
//[UserButtonCode_chkx2] -- add your button handler code here..
947+
if(!selparam.isValid()) return;
948+
selparam.setProperty("x2", chkx2->getToggleState(), nullptr);
949+
needssaving = true;
950+
//[/UserButtonCode_chkx2]
951+
}
935952

936953
//[UserbuttonClicked_Post]
937954
//[/UserbuttonClicked_Post]
@@ -1131,6 +1148,7 @@ void SeqABIEditor::fillParamInfo(){
11311148
lblDataLen->setText("(none)", dontSendNotification);
11321149
txtDataLen->setText("", false);
11331150
txtCC->setText("", false);
1151+
chkx2->setToggleState(false, dontSendNotification);
11341152
return;
11351153
}
11361154
txtParamName->setText(selparam.getProperty("name", ""), false);
@@ -1150,6 +1168,7 @@ void SeqABIEditor::fillParamInfo(){
11501168
txtDataLen->setText(datasrc == "offset" || datasrc == "variable" ? ""
11511169
: selparam.getProperty("datalen", "").toString(), false);
11521170
txtDataLen->setEnabled(datasrc == "fixed" || datasrc == "constant");
1171+
chkx2->setToggleState((bool)selparam.getProperty("x2", false), dontSendNotification);
11531172
}
11541173

11551174
void SeqABIEditor::fillMeaningsBox(String action){
@@ -1390,12 +1409,12 @@ BEGIN_JUCER_METADATA
13901409
virtualName="" explicitFocusOrder="0" pos="96 608 48 24" buttonText="Dn"
13911410
connectedEdges="5" needsCallback="1" radioGroupId="0"/>
13921411
<LABEL name="lblDataLen" id="1e1a075250c48074" memberName="lblDataLen"
1393-
virtualName="" explicitFocusOrder="0" pos="360 588 64 24" edTextCol="ff000000"
1412+
virtualName="" explicitFocusOrder="0" pos="360 576 64 24" edTextCol="ff000000"
13941413
edBkgCol="0" labelText="(none)" editableSingleClick="0" editableDoubleClick="0"
13951414
focusDiscardsChanges="0" fontname="Default font" fontsize="15.0"
13961415
kerning="0.0" bold="0" italic="0" justification="33"/>
13971416
<TEXTEDITOR name="txtDataLen" id="7975a2934104f024" memberName="txtDataLen"
1398-
virtualName="" explicitFocusOrder="0" pos="424 588 32 24" initialText=""
1417+
virtualName="" explicitFocusOrder="0" pos="424 576 32 24" initialText=""
13991418
multiline="0" retKeyStartsLine="0" readonly="0" scrollbars="1"
14001419
caret="1" popupmenu="1"/>
14011420
<TEXTBUTTON name="btnSave" id="f1826d8815459bef" memberName="btnSave" virtualName=""
@@ -1412,6 +1431,10 @@ BEGIN_JUCER_METADATA
14121431
<TEXTBUTTON name="btnCCHelp" id="d5818054c15cd3a3" memberName="btnCCHelp"
14131432
virtualName="" explicitFocusOrder="0" pos="448 552 22 24" buttonText="?"
14141433
connectedEdges="1" needsCallback="1" radioGroupId="0"/>
1434+
<TOGGLEBUTTON name="chkx2" id="a5451667905d26f3" memberName="chkx2" virtualName=""
1435+
explicitFocusOrder="0" pos="400 600 72 24" tooltip="CC value is multiplied by 2 to get MML value, because MIDI is 0-127 whereas MML is 0-255."
1436+
buttonText="x2" connectedEdges="0" needsCallback="1" radioGroupId="0"
1437+
state="0"/>
14151438
</JUCER_COMPONENT>
14161439

14171440
END_JUCER_METADATA

Source/SeqABIEditor.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
the "//[xyz]" and "//[/xyz]" sections will be retained when the file is loaded
88
and re-saved.
99
10-
Created with Projucer version: 6.0.1
10+
Created with Projucer version: 6.0.7
1111
1212
------------------------------------------------------------------------------
1313
@@ -145,6 +145,7 @@ class SeqABIEditor : public Component,
145145
std::unique_ptr<juce::TextEditor> txtCC;
146146
std::unique_ptr<juce::Label> lblCC;
147147
std::unique_ptr<juce::TextButton> btnCCHelp;
148+
std::unique_ptr<juce::ToggleButton> chkx2;
148149

149150

150151
//==============================================================================
@@ -153,3 +154,4 @@ class SeqABIEditor : public Component,
153154

154155
//[EndFile] You can add extra defines here...
155156
//[/EndFile]
157+

Source/SeqFile.cpp

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ Identifier SeqFile::idSType("stype");
4949
Identifier SeqFile::idValidInSeq("validinseq");
5050
Identifier SeqFile::idValidInChn("validinchn");
5151
Identifier SeqFile::idValidInTrk("validintrk");
52+
Identifier SeqFile::idx2("x2");
5253
Identifier SeqFile::idChannel("channel");
5354
Identifier SeqFile::idLayer("layer");
5455
Identifier SeqFile::idShortMode("shortmode");
@@ -174,6 +175,7 @@ ValueTree SeqFile::loadABI(String name){
174175
std::cout << "Error parsing XML of " + abifile.getFullPathName() + "!\n";
175176
return ValueTree();
176177
}
178+
std::cout << "Loading ABI " + abifile.getFullPathName() + "\n";
177179
return ValueTree::fromXml(*xml);
178180
}
179181
bool SeqFile::saveABI(String name, ValueTree abi_){
@@ -398,11 +400,10 @@ ValueTree SeqFile::createCommand(ValueTree want, bool warnIfImpossible){
398400
for(int j=0; j<test.getNumChildren(); j++){
399401
param2 = test.getChild(j);
400402
param = want.getChildWithProperty(idMeaning, param2.getProperty(idMeaning));
401-
if(param.isValid()){
402-
param2.setProperty(idValue, param.getProperty(idValue), nullptr);
403-
}else{
404-
param2.setProperty(idValue, 0, nullptr);
405-
}
403+
int value = 0;
404+
if(param.isValid()) value = (int)param.getProperty(idValue);
405+
if((bool)param2.getProperty(idx2, false)) value *= 2;
406+
param2.setProperty(idValue, value, nullptr);
406407
}
407408
//Hash
408409
test.setProperty(idHash, Random::getSystemRandom().nextInt(), nullptr);
@@ -1436,6 +1437,7 @@ int SeqFile::importMIDI(File midifile, ValueTree midiopts){
14361437
ccstates[paramcc]->lastvalue = value2;
14371438
ccstates[paramcc]->lasttime = timestamp;
14381439
ccstates[paramcc]->lastcmd = cccmd;
1440+
if((bool)tmpparam.getProperty(idx2, false)) value2 *= 2;
14391441
tmpparam.setProperty(idValue, value2, nullptr);
14401442
trk->deleteEvent(i, false);
14411443
if(i == m) --m;
@@ -1589,19 +1591,23 @@ int SeqFile::importMIDI(File midifile, ValueTree midiopts){
15891591
transpose += 12 * (((note - 0x40) / 12) + 1);
15901592
}
15911593
note = msg.getNoteNumber() - transpose - midi_basenote;
1594+
int transpose_unsigned = transpose < 0 ? (0x100 + transpose) : transpose;
15921595
if(transposecmd.isValid()){
1593-
transposecmd.getChildWithProperty(idMeaning, "Value").setProperty(idValue, transpose, nullptr);
1596+
transposecmd.getChildWithProperty(idMeaning, "Value").setProperty(idValue, transpose_unsigned, nullptr);
15941597
}else{
15951598
want2 = wantAction("Layer Transpose", 2);
1596-
wantProperty(want2, "Value", transpose);
1599+
wantProperty(want2, "Value", transpose_unsigned);
15971600
section.addChild(createCommand(want2), cmd, nullptr);
15981601
cmd++;
15991602
}
16001603
}
16011604
wantProperty(want, "Note", note);
16021605
//Delay
16031606
delay = timestamp3 - timestamp;
1604-
if(delay >= 48*2 && ((timestamp2 - timestamp) * 0x100 / delay) < 0x08){
1607+
//Want to make sure there is sufficient resolution to encode the note off
1608+
//time of any note using gate time.
1609+
const int minDelayResolution = 8; //Sixteenth note triplet; 48 ppqn
1610+
if(delay >= minDelayResolution * 0x100){ //10 2/3 measures at 4/4
16051611
//Full note and then timestamp
16061612
wantProperty(want, "Delay", timestamp2 - timestamp);
16071613
wantProperty(want, "Gate Time", 0);
@@ -2528,6 +2534,7 @@ int SeqFile::exportMIDI(File midifile, ValueTree midiopts){
25282534
continue;
25292535
}
25302536
int value = param.getProperty(idValue);
2537+
if((bool)param.getProperty(idx2, false)) value /= 2;
25312538
if(cc != 128 && (value < 0 || value > 0x7F)){
25322539
dbgmsg("CC " + String(cc) + " event with invalid value = " + String(value) + "!");
25332540
importresult |= 1;

Source/SeqFile.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,7 @@ class SeqFile{
291291
static Identifier idValidInSeq;
292292
static Identifier idValidInChn;
293293
static Identifier idValidInTrk;
294+
static Identifier idx2;
294295
static Identifier idChannel;
295296
static Identifier idLayer;
296297
static Identifier idShortMode;

abi/1 - SM64.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,8 @@
228228
</command>
229229
<command cmd="217" name="release" action="CC or CC Group" validinchn="1"
230230
comments="Set envelope release rate." oname="release">
231-
<parameter name="Release" meaning="CC" datasrc="fixed" datalen="1" cc="72"/>
231+
<parameter name="Release" meaning="CC" datasrc="fixed" datalen="1" cc="72"
232+
x2="1"/>
232233
</command>
233234
<command cmd="218" name="cenvelope" action="Ptr Envelope" validinchn="1"
234235
comments="Load channel envelope from sequence data." oname="envelope">

abi/2 - SM64 EU.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,8 @@
233233
</command>
234234
<command cmd="217" name="release" action="CC or CC Group" validinchn="1"
235235
comments="Set envelope release rate." oname="release">
236-
<parameter name="Release" meaning="CC" datasrc="fixed" datalen="1" cc="72"/>
236+
<parameter name="Release" meaning="CC" datasrc="fixed" datalen="1" cc="72"
237+
x2="1"/>
237238
</command>
238239
<command cmd="218" name="cenvelope" action="Ptr Envelope" validinchn="1"
239240
comments="Load channel envelope from sequence data." oname="envelope">

abi/3 - SF64.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,8 @@
246246
</command>
247247
<command cmd="217" name="release" action="CC or CC Group" validinchn="1"
248248
comments="Set envelope release rate." oname="release">
249-
<parameter name="Release" meaning="CC" datasrc="fixed" datalen="1" cc="72"/>
249+
<parameter name="Release" meaning="CC" datasrc="fixed" datalen="1" cc="72"
250+
x2="1"/>
250251
</command>
251252
<command cmd="218" name="cenvelope" action="Ptr Envelope" validinchn="1"
252253
comments="Load channel envelope from sequence data." oname="envelope">

0 commit comments

Comments
 (0)