Skip to content

Commit

Permalink
gs.hの内容を全部実装 #22
Browse files Browse the repository at this point in the history
  • Loading branch information
kujirahand committed Dec 19, 2023
1 parent c7d7a23 commit 9e0d5b6
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/mml_def.rs
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,7 @@ pub fn init_system_functions() -> HashMap<String, SystemFunction> {
sysfunc_cc_add!(sf, "GSChorusSendToReverb", TokenType::GSEffect, 'I', 0x3F); // GSChorusSendToReverb(val) (ex) GSChorusSendToReverb(0)
sysfunc_cc_add!(sf, "GSChorusSendToDelay", TokenType::GSEffect, 'I', 0x40); // GSChorusSendToDelay(val) (ex) GSChorusSendToDelay(0)
sysfunc_cc_add!(sf, "GS_RHYTHM", TokenType::GSEffect, 'I', 0x15); // Change to rhythm part val=0:instrument/1:drum1/2:drum2 (ex) GSChorusSendToDelay(0)
sysfunc_cc_add!(sf, "GSScaleTuning", TokenType::GSEffect, 'A', 0x11); // GS Scale Tuning. GSScaleTuning(C,Cp,D,Dp,E,F,Fp,G,Gp,A,Ap,B) (ex) GSScaleTuning(0,0,0,0,0,0,0,0,0,0,0,0)
//@ Script command
sysfunc_add!(sf, "Int", TokenType::DefInt, '*'); // define int variables (ex) Int A = 3
sysfunc_add!(sf, "INT", TokenType::DefInt, '*'); // define int variables (ex) INT A = 3
Expand Down
19 changes: 19 additions & 0 deletions src/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,25 @@ pub fn exec(song: &mut Song, tokens: &Vec<Token>) -> bool {
vec![0xF0, 0x41, dev, 0x42, 0x12, 0x40, 0x01, num, val, 0xf7],
));
},
0x11 => { // GSScaleTuning
if data.len() >= 12 {
let mut a = vec![];
for v in data.iter() {
a.push(v.to_i() as u8);
}
for ic in 0x11..=0x1F {
let e = Event::sysex_raw(
time,
vec![
0xF0, 0x41, dev, 0x42, 0x12, 0x40, ic, 0x40,
a[0], a[1], a[2], a[3], a[4], a[5],
a[6], a[7], a[8], a[9], a[10], a[11],
0xf7
]);
song.add_event(e);
}
}
},
0x15 => { // change to the rhytm part
let val = if data.len() >= 1 { data[1].to_i() as u8 } else { 0 };
let ch = trk!(song).channel;
Expand Down

0 comments on commit 9e0d5b6

Please sign in to comment.