Skip to content

Commit

Permalink
Merge pull request #36 from jamiefaye/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
jamiefaye authored Sep 15, 2019
2 parents 20638cc + 5cdcc71 commit d207ddc
Show file tree
Hide file tree
Showing 15 changed files with 428 additions and 341 deletions.
21 changes: 18 additions & 3 deletions midian/src/DelugeToMidi.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,19 @@ function forceArray(obj) {
return aObj;
}

function getClipArray(song) {
if (song.tracks) {
if (song.tracks.track) {
return forceArray(song.tracks.track);
}
}

if (song.sessionClips) {
return forceArray(song.sessionClips);
}

return [];
}
// Used to cope with y addresses of -32768
function rowYfilter(row) {
if (row.drumIndex) return Number(row.drumIndex);
Expand Down Expand Up @@ -232,7 +245,9 @@ function encodeInstrumentAsMidiTrack(inst, lane, song, timeoff, head)
{
let instString = inst.trackInstances;
if (!instString) return [];
let trackTab = forceArray(song.tracks.track);


let trackTab = getClipArray(song);
let maxTrack = trackTab.length;
let midiOut = [];
let highTime = 0;
Expand Down Expand Up @@ -329,7 +344,7 @@ function delugeToMidiArranged(midi, song) {
}

function addTrackToMidi(midiDoc, song, trackNum, timeoff, clipS, clipE) {
let delTrackTab = forceArray(song.tracks.track);
let delTrackTab = getClipArray(song);
let delTrack = delTrackTab[delTrackTab.length - trackNum];
let trackLen = Number(delTrack.trackLength);
let toMidiChan = 0;
Expand All @@ -344,7 +359,7 @@ function addTrackToMidi(midiDoc, song, trackNum, timeoff, clipS, clipE) {
}

function convertAllTracks(midi, song) {
let delTrackTab = forceArray(song.tracks.track);
let delTrackTab = getClipArray(song);
// for (let i = delTrackTab.length; i >= 1; i--) {
for (let i = 1; i <= delTrackTab.length; ++i) {
addTrackToMidi(midi, song, i, 0, 0, 0);
Expand Down
1 change: 1 addition & 0 deletions midian/src/midian.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ function onLoad()
if (buildType !== 'mpc') {
let data = empty_song_template();
let homeSong = makeDelugeDoc("SONG.XML", data, {transTrack: transTrackToMidi, viewer: 'midian'});
homeSong.noPasteYet = true;
songManager.homeDoc = homeSong;
setFocusDoc(homeSong);
}
Expand Down
239 changes: 101 additions & 138 deletions midian/src/templates/empty_song.handlebars
Original file line number Diff line number Diff line change
@@ -1,22 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<firmwareVersion>2.1.2</firmwareVersion>
<earliestCompatibleFirmware>2.0.0</earliestCompatibleFirmware>
<song>
<previewNumPads>144</previewNumPads>
<preview>00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000FF06FF000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000FF0600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000FF0600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000FF0600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000FF0600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000FF0600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000FF0600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000FF06800080</preview>
<arrangementAutoScrollOn>0</arrangementAutoScrollOn>
<xScroll>0</xScroll>
<xZoom>12</xZoom>
<yScrollSongView>-7</yScrollSongView>
<yScrollArrangementView>-7</yScrollArrangementView>
<xScrollArrangementView>0</xScrollArrangementView>
<xZoomArrangementView>96</xZoomArrangementView>
<timePerTimerTick>459</timePerTimerTick>
<timerTickFraction>1610612736</timerTickFraction>
<rootNote>0</rootNote>
<inputTickMagnitude>1</inputTickMagnitude>
<swingAmount>0</swingAmount>
<swingInterval>7</swingInterval>
<song
firmwareVersion="3.0.0"
earliestCompatibleFirmware="3.0.0"
previewNumPads="144"
preview="000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000FF0000000000000000000000FC0003000000000000000000F0000F000000000000000000D1002E00000000000000000000FF06005AA5"
arrangementAutoScrollOn="0"
xScroll="0"
xZoom="12"
yScrollSongView="-7"
yScrollArrangementView="-7"
xScrollArrangementView="0"
xZoomArrangementView="96"
timePerTimerTick="459"
timerTickFraction="1610612736"
rootNote="0"
inputTickMagnitude="1"
swingAmount="0"
swingInterval="7"
affectEntire="0"
activeModFunction="1"
lpfMode="24dB"
modFXType="flanger"
modFXCurrentParam="feedback"
currentFilterType="lpf">
<modeNotes>
<modeNote>0</modeNote>
<modeNote>2</modeNote>
Expand All @@ -26,131 +32,88 @@
<modeNote>9</modeNote>
<modeNote>11</modeNote>
</modeNotes>
<reverb>
<roomSize>1288490496</roomSize>
<dampening>1546188288</dampening>
<width>2147483647</width>
<pan>0</pan>
<compressor>
<attack>370161836</attack>
<release>935373126</release>
<volume>-21474836</volume>
<syncLevel>144</syncLevel>
</compressor>
<reverb
roomSize="1288490496"
dampening="1546188288"
width="2147483647"
pan="0">
<compressor
attack="1863657221"
release="69758976"
volume="-21474836"
shape="-601295438"
syncLevel="6" />
</reverb>
<affectEntire>0</affectEntire>
<activeModFunction>1</activeModFunction>
<lpfMode>24dB</lpfMode>
<modFXType>flanger</modFXType>
<delay>
<pingPong>1</pingPong>
<analog>0</analog>
<syncLevel>7</syncLevel>
</delay>
<modFXCurrentParam>feedback</modFXCurrentParam>
<currentFilterType>lpf</currentFilterType>
<songParams>
<delay>
<rate>0x00000000</rate>
<feedback>0x80000000</feedback>
</delay>
<reverbAmount>0x80000000</reverbAmount>
<volume>0x3504F334</volume>
<pan>0x00000000</pan>
<lpf>
<frequency>0x7FFFFFFF</frequency>
<resonance>0x80000000</resonance>
</lpf>
<hpf>
<frequency>0x80000000</frequency>
<resonance>0x80000000</resonance>
</hpf>
<modFXDepth>0x00000000</modFXDepth>
<modFXRate>0xE0000000</modFXRate>
<stutterRate>0x00000000</stutterRate>
<sampleRateReduction>0x80000000</sampleRateReduction>
<bitCrush>0x80000000</bitCrush>
<equalizer>
<bass>0x00000000</bass>
<treble>0x00000000</treble>
<bassFrequency>0x00000000</bassFrequency>
<trebleFrequency>0x00000000</trebleFrequency>
</equalizer>
<modFXOffset>0x00000000</modFXOffset>
<modFXFeedback>0x80000000</modFXFeedback>
<delay
pingPong="1"
analog="0"
syncLevel="7" />
<compressor
syncLevel="6"
attack="327244"
release="936" />
<songParams
reverbAmount="0x80000000"
volume="0x3504F334"
pan="0x00000000"
sidechainCompressorShape="0xDC28F5B2"
modFXDepth="0x00000000"
modFXRate="0xE0000000"
stutterRate="0x00000000"
sampleRateReduction="0x80000000"
bitCrush="0x80000000"
modFXOffset="0x00000000"
modFXFeedback="0x80000000">
<delay
rate="0x00000000"
feedback="0x80000000" />
<lpf
frequency="0x7FFFFFFF"
resonance="0x80000000" />
<hpf
frequency="0x80000000"
resonance="0x80000000" />
<equalizer
bass="0x00000000"
treble="0x00000000"
bassFrequency="0x00000000"
trebleFrequency="0x00000000" />
</songParams>
<instruments>
<midiChannel>
<channel>0</channel>
<suffix>-1</suffix>
</midiChannel>
<midiChannel
channel="0"
suffix="-1"
isArmedForRecording="0" />
</instruments>
<sections>
<section>
<id>0</id>
<numRepeats>0</numRepeats>
</section>
<section>
<id>1</id>
<numRepeats>0</numRepeats>
</section>
<section>
<id>2</id>
<numRepeats>0</numRepeats>
</section>
<section>
<id>3</id>
<numRepeats>0</numRepeats>
</section>
<section>
<id>4</id>
<numRepeats>0</numRepeats>
</section>
<section>
<id>5</id>
<numRepeats>0</numRepeats>
</section>
<section>
<id>6</id>
<numRepeats>0</numRepeats>
</section>
<section>
<id>7</id>
<numRepeats>0</numRepeats>
</section>
<section>
<id>8</id>
<numRepeats>0</numRepeats>
</section>
<section>
<id>9</id>
<numRepeats>0</numRepeats>
</section>
<section>
<id>10</id>
<numRepeats>0</numRepeats>
</section>
<section>
<id>11</id>
<numRepeats>0</numRepeats>
</section>
<section id="0" numRepeats="0" />
<section id="1" numRepeats="0" />
<section id="2" numRepeats="0" />
<section id="3" numRepeats="0" />
<section id="4" numRepeats="0" />
<section id="5" numRepeats="0" />
<section id="6" numRepeats="0" />
<section id="7" numRepeats="0" />
<section id="8" numRepeats="0" />
<section id="9" numRepeats="0" />
<section id="10" numRepeats="0" />
<section id="11" numRepeats="0" />
</sections>
<tracks>
<track>
<inKeyMode>1</inKeyMode>
<yScroll>35</yScroll>
<yScrollKeyboard>50</yScrollKeyboard>
<isPlaying>1</isPlaying>
<isSoloing>0</isSoloing>
<playEnabledAtStart>1</playEnabledAtStart>
<trackLength>192</trackLength>
<colourOffset>-60</colourOffset>
<beingEdited>1</beingEdited>
<activeModFunction>0</activeModFunction>
<midiChannel>0</midiChannel>
<section>0</section>
<sessionClips>
<instrumentClip
inKeyMode="1"
yScroll="35"
yScrollKeyboard="50"
midiChannel="0"
isPlaying="1"
isSoloing="0"
isArmedForRecording="1"
length="192"
colourOffset="-60"
section="0"
selected="1">
<noteRows>
</noteRows>
</track>
</tracks>
</song>
</instrumentClip>
</sessionClips>
</song>
5 changes: 5 additions & 0 deletions xmlView/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion xmlView/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
"react-dropdown": "^1.6.4",
"react-sortable-hoc": "^0.6.8",
"shortid": "^2.2.14",
"webpack": "^4.30.0"
"webpack": "^4.30.0",
"xml-escape": "^1.1.0"
},
"devDependencies": {
"babel-core": "^6.26.3",
Expand Down
Loading

0 comments on commit d207ddc

Please sign in to comment.