Comparing version 1.0.1-chuchu1 to 1.1.0-chuchu1
@@ -32,3 +32,3 @@ #!/usr/bin/env node | ||
// 'portPrefixMeta' 는 midi port prefix meta event(0x21)로 구별(없는경우 0) | ||
portSeparate:'trackName', | ||
portSeparate:'portPrefixMeta', | ||
@@ -40,3 +40,3 @@ // 파일 볼륨(0~200) | ||
fileVolume:200 | ||
},qs.decode(opts.params)); | ||
},qs.decode(opts.param)); | ||
@@ -43,0 +43,0 @@ fs.writeFileSync(output,YJKFileConverter.midi2yjk(fs.readFileSync(input),{ |
{ | ||
"name": "yjmidi", | ||
"version": "1.0.1-chuchu1", | ||
"version": "1.1.0-chuchu1", | ||
"main": "index.js", | ||
@@ -5,0 +5,0 @@ "description": "midi/yjk file parser/player", |
@@ -19,3 +19,4 @@ module.exports = { | ||
CUE_POINT:0x07, | ||
MIDI_CHANNEL_PREFIX:0x20, | ||
CHANNEL_PREFIX:0x20, | ||
PORT_PREFIX:0x21, // 사실 비표준이긴 한데 필요해서 넣어둠 | ||
END_OF_TRACK:0x2f, | ||
@@ -22,0 +23,0 @@ SET_TEMPO:0x51, |
@@ -56,2 +56,6 @@ const fs = require('fs'); | ||
delete event.param4; | ||
if(event.subtype == Consts.events.subtypes.meta.PORT_PREFIX){ | ||
event.port = event.data[0]; | ||
} | ||
}else if(event.type == Consts.events.types.MIDI){ | ||
@@ -58,0 +62,0 @@ let p = []; |
@@ -62,3 +62,3 @@ const MidiFile = require('./MidiFile'); | ||
compress:'raw', | ||
portSeparate:'trackName', | ||
portSeparate:'portPrefixMeta', | ||
fileVolume:200 | ||
@@ -85,3 +85,3 @@ },opts); | ||
if(file.header.format != 1) throw new TypeError('Only format 1 is supported'); | ||
file.tracks.forEach(track => { | ||
file.ports[0].forEach(track => { | ||
let eventsObj = track.getEvents(); | ||
@@ -101,2 +101,13 @@ let events = []; | ||
}; | ||
// 포트 번호 관련 | ||
let portnum; | ||
switch(opts.portSeparate){ | ||
case 'trackName': | ||
portnum = trackname2portnum(track2.meta.trackName); | ||
break; | ||
case 'portPrefixMeta': default: | ||
portnum = 0; // 이벤트를 도는 과정에서 바뀔 수 있으므로 일단 0으로 지정(기본값) | ||
break; | ||
} | ||
events.forEach(event => { | ||
@@ -121,2 +132,7 @@ if(event.type == Consts.events.types.META){ | ||
break; | ||
case Consts.events.subtypes.meta.PORT_PREFIX: | ||
// port에 따라 트랙을 분류하기 위한 부분 | ||
// port prefix(0x21) meta event로 처리하는 경우에만 portnum 변수를 수정 | ||
if(opts.portSeparate != 'trackName') portnum = event.port; | ||
break; | ||
/** | ||
@@ -139,3 +155,3 @@ case Consts.events.subtypes.meta.SEQUENCE_NUMBER: | ||
}); | ||
/** | ||
@@ -182,3 +198,2 @@ * delta time 방식으로 변환 | ||
let portnum = trackname2portnum(track2.meta.trackName); | ||
//console.log(track2.meta.track_name,portnum); | ||
@@ -345,5 +360,5 @@ if(!blocks[portnum]) blocks[portnum] = []; | ||
return BinaryXML.fromParsedXML(xml,{ compress }); | ||
return BinaryXML.fromParsedXML(xml,{ compress:opts.compress }); | ||
//return Buffer.from(JSON.stringify(json,0,4),'utf8'); | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
56959
1106