11#include "libsnd2_internal.h"
13s16 SsUtKeyOnV(s16 vc, s16 vab_id, s16 prog, s16 tone, s16 note, s16 fine, s16 voll, s16 volr)
19 if ( _snd_ev_flag == 1 )
22 if ( (u16)vc >= 0x18u || _SsVmVSetUp(vab_id, prog) )
27 _svm_cur.m_seq_sep_no = 33;
28 _svm_cur.m_note = note;
29 _svm_cur.m_fine = fine;
30 _svm_cur.m_tone = tone;
33 _svm_cur.m_unk05 = 64;
34 _svm_cur.m_voll = voll;
40 volr_lshift_6 = volr << 6;
45 voll_lshift_6 = voll << 6;
48 if ( volr == -1 && (
unsigned int)voll_lshift_6 == 0x80000000 )
50 _svm_cur.m_voll = volr;
51 _svm_cur.m_unk05 = 127 - voll_lshift_6 / volr;
57 if ( voll == -1 && (
unsigned int)volr_lshift_6 == 0x80000000 )
59 _svm_cur.m_voll = voll;
60 _svm_cur.m_unk05 = volr_lshift_6 / voll;
63 pProg = &_svm_pg[prog];
64 _svm_cur.m_mvol = pProg->mvol;
65 _svm_cur.m_mpan = pProg->mpan;
66 _svm_cur.m_sep_sep_no_tonecount = pProg->tones;
67 pVag = &_svm_tn[16 * _svm_cur.m_fake_program + tone];
68 _svm_cur.m_prior = pVag->prior;
69 _svm_cur.m_vag_idx2 = pVag->vag;
70 _svm_cur.m_vol = pVag->vol;
71 _svm_cur.m_pan = pVag->pan;
72 _svm_cur.m_centre = pVag->center;
73 _svm_cur.m_shift = pVag->shift;
74 _svm_cur.m_mode = pVag->mode;
75 if ( _svm_cur.m_vag_idx2 == 0 )
80 _svm_cur.m_voice_idx = vc;
81 voice_struct = &_svm_voice[vc];
82 voice_struct->m_seq_sep_no = 33;
83 voice_struct->m_vab_id = vab_id;
84 voice_struct->m_prog = prog;
85 voice_struct->m_fake_program = _svm_cur.m_fake_program;
86 voice_struct->m_vag_idx = _svm_cur.m_vag_idx2;
87 voice_struct->m_note = note;
88 voice_struct->m_unk1d = 1;
89 voice_struct->m_unk02 = 0;
90 voice_struct->m_tone = _svm_cur.m_tone;
91 voice_struct->m_voll2 = _svm_cur.m_voll;
93 if ( _svm_cur.m_vag_idx2 == 255 )
99 _SsVmKeyOnNow(1, note2pitch2(note, fine));
105s16 SsUtKeyOffV(s16 vc)
107 if ( _snd_ev_flag == 1 )
110 if ( (u16)vc >= 0x18u )
115 _svm_cur.m_voice_idx = vc;