Skip to content

Commit

Permalink
Fix Kit Builder and other stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
jamiefaye committed Nov 7, 2022
1 parent f3bea5e commit f758583
Show file tree
Hide file tree
Showing 7 changed files with 198 additions and 214 deletions.
17 changes: 14 additions & 3 deletions midian/src/WaveThumb.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,19 @@ class WaveThumb extends React.Component {

if (this.osc) {
this.wave.initialZone = {};
this.wave.initialZone.startMilliseconds = Number(this.osc.zone.startMilliseconds);
this.wave.initialZone.endMilliseconds = Number(this.osc.zone.endMilliseconds);
let startMS;
let endMS;
if (this.osc.zone.hasOwnProperty("startMilliseconds"))
{
startMS = Number(this.wave.initialZone.startMilliseconds);
endMS = Number(this.osc.zone.endMilliseconds);
}
else {
startMS = Number(this.osc.zone.startSamplePos) / 44.1;
endMS = Number(this.osc.zone.endSamplePos) / 44.1;
}
this.wave.initialZone.startMilliseconds = startMS;
this.wave.initialZone.endMilliseconds = endMS;
}
// console.log("aft openWaveSurfer");
}
Expand Down Expand Up @@ -268,4 +279,4 @@ class TinyPlayer {
};


export {WaveThumb};
export {WaveThumb};
2 changes: 0 additions & 2 deletions xmlView/src/JsonXMLUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,5 @@ function jsonToXML3String(root, json) {
let depth = 0;
return jsonToXML3(root, json, depth);
}


export {getXmlDOMFromString, jsonequals, jsonToXMLString, xmlToJson, xml3ToJson, updateJSONfor4, reviveClass,
jsonToXML3String, jsonToTable, forceArray, getClipArray, isArrayLike, nameToClassTab, classReplacer, zonkDNS};
4 changes: 2 additions & 2 deletions xmlView/src/KitList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Dropdown from 'react-dropdown';
import {WaveView, SampleView} from './WaveView.jsx';
import {openFileBrowser} from './FileBrowser.js';
import {forceArray} from "./JsonXMLUtils.js";
import {getXmlDOMFromString, xmlToJson, reviveClass} from './JsonXMLUtils.js';
import {getXmlDOMFromString, xml3ToJson, reviveClass} from './JsonXMLUtils.js';
import shortid from 'shortid';
import {WedgeIndicator, IconPushButton, Icon2PushButton, PushButton, Checkbox, PlayerControl, CopyToClipButton, PasteTarget} from './GUIstuff.jsx';
import {SortableContainer, SortableElement, SortableHandle, arrayMove} from 'react-sortable-hoc';
Expand Down Expand Up @@ -315,7 +315,7 @@ class KitList extends React.Component {
let temp3 = temp2.split('{{name}}');
let filledSoundT = temp3.join(suggestion);
let newDrumX = getXmlDOMFromString(filledSoundT);
let newSound = xmlToJson(newDrumX).sound;
let newSound = xml3ToJson(newDrumX).sound;
this.props.kitList.push(newSound);
this.forceUpdate();
}
Expand Down
5 changes: 4 additions & 1 deletion xmlView/src/SongViewLib.js
Original file line number Diff line number Diff line change
Expand Up @@ -772,7 +772,10 @@ upConvertSong()
else if (jsonDoc['sound']) toMake = 'sound';
else if (jsonDoc['kit']) toMake = 'kit';
if (!toMake) return;
let saveText = headerStr + jsonToXML3String(toMake, this.jsonDocument[toMake]);
let makeDoc = jsonDoc[toMake];
makeDoc.firmwareVersion="4.0.1"
makeDoc.earliestCompatibleFirmware="4.0.0";
let saveText = headerStr + jsonToXML3String(toMake, makeDoc);
return saveText;
}

Expand Down
17 changes: 14 additions & 3 deletions xmlView/src/WaveView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,19 @@ class WaveView extends React.Component {

if (this.osc) {
this.wave.initialZone = {};
this.wave.initialZone.startMilliseconds = Number(this.osc.zone.startMilliseconds);
this.wave.initialZone.endMilliseconds = Number(this.osc.zone.endMilliseconds);
let startMS;
let endMS;
if (this.osc.zone.startMilliseconds)
{
startMS = Number(this.wave.initialZone.startMilliseconds);
endMS = Number(this.osc.zone.endMilliseconds);
}
else {
startMS = Number(this.osc.zone.startSamplePos) / 44.1;
endMS = Number(this.osc.zone.endSamplePos) / 44.1;
}
this.wave.initialZone.startMilliseconds = startMS;
this.wave.initialZone.endMilliseconds = endMS;
}
// console.log("aft openWaveSurfer");
}
Expand Down Expand Up @@ -120,7 +131,7 @@ class WaveView extends React.Component {
let track = this.props.track;

if (this.osc && this.osc.zone) {
if (this.osc.zone.startMilliseconds) {
if (this.osc.zone.hasOwnProperty("startMilliseconds")) {
startT = Number(this.osc.zone.startMilliseconds) / 1000;
endT = Number(this.osc.zone.endMilliseconds) / 1000;
} else {
Expand Down
8 changes: 5 additions & 3 deletions xmlView/src/keyOrderTab.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


// Javascript does not specify a key-oder for enumerating properties of an object.
// This means that element ordering may have been altered by edits, or the mere
// act of going from XML to JSON. We fix this by consulting a table showing the
Expand Down Expand Up @@ -187,6 +185,7 @@
"presetSubSlot",
"trackInstances",
"clipInstances",
"defaultParams",
"soundSources",
"selectedDrumIndex",
],
Expand Down Expand Up @@ -291,9 +290,12 @@
"stutterRate",
"sampleRateReduction",
"bitCrush",
"equalizer",
"modFXOffset",
"modFXFeedback",
"delay",
"lpf",
"hpf",
"equalizer",
],
"envelope1": ["attack",
"decay",
Expand Down
Loading

0 comments on commit f758583

Please sign in to comment.