11#include "libsnd2_internal.h"
15void _SsVmInit(
int voice_count)
20 _spu_setInTransfer(0);
22 SpuInitMalloc(32, (
char *)_ss_spu_vm_rec);
23 memset(&_svm_sreg_buf, 0,
sizeof(_svm_sreg_buf));
24 memset(&_svm_sreg_buf2, 0,
sizeof(_svm_sreg_buf2));
25 memset(&_svm_sreg_dirty, 0,
sizeof(_svm_sreg_dirty));
27 memset(&_svm_vab_used, 0,
sizeof(_svm_vab_used));
28 if ( ((
char)voice_count & 0xFFFFu) < 0x18 )
29 _SsVmMaxVoice = (char)voice_count;
33 SPU_VOICE_VOLL | SPU_VOICE_VOLR | SPU_VOICE_PITCH | SPU_VOICE_WDSA | SPU_VOICE_ADSR_ADSR1 | SPU_VOICE_ADSR_ADSR2;
34 voice_attr.pitch = 0x1000;
35 voice_attr.addr = 0x5000;
36 voice_attr.adsr1 = 0x80FF;
37 voice_attr.volume.left = 0;
38 voice_attr.volume.right = 0;
39 voice_attr.adsr2 = 0x4000;
40 for ( v8 = 0; v8 < _SsVmMaxVoice; v8 += 1 )
44 voice_struct = &_svm_voice[v8];
45 voice_struct->m_unk02 = 24;
46 voice_struct->m_vag_idx = 255;
47 voice_struct->m_unk1d = 0;
48 voice_struct->m_pitch = 0;
49 voice_struct->m_key_stat = 0;
50 voice_struct->m_seq_sep_no = -1;
51 voice_struct->m_fake_program = 0;
52 voice_struct->m_prog = 0;
53 voice_struct->m_tone = 255;
54 voice_struct->m_voll1 = 0;
55 voice_struct->m_channel_idx = 0;
56 voice_struct->m_pan = 64;
57 voice_struct->m_voll2 = 0;
58 voice_struct->m_b_auto_vol = 0;
59 voice_struct->m_auto_vol_amount = 0;
60 voice_struct->m_auto_vol_dt1 = 0;
61 voice_struct->m_auto_vol_dt2 = 0;
62 voice_struct->m_b_auto_pan = 0;
63 voice_struct->m_auto_pan_amount = 0;
64 voice_struct->m_auto_pan_dt1 = 0;
65 voice_struct->m_auto_pan_dt2 = 0;
66 voice_struct->m_auto_pan_start = 0;
67 voice_struct->m_auto_vol_start = 0;
68 voice_attr.voice = 1 << v8;
69 SpuSetVoiceAttr(&voice_attr);
70 _svm_cur.m_voice_idx = v8;
74 _svm_rattr.depth.left = 0x3FFF;
75 _svm_rattr.depth.right = 0x3FFF;
84 _svm_auto_kof_mode = 0;
86 _svm_vab_not_send_size = 0;