11#include "libsnd2_internal.h"
13void SsQueueKeyOn(
int voices)
17 for ( v1 = 0; (char)v1 < _SsVmMaxVoice; v1 += 1 )
22 if ( (v4 & voices) != 0 )
30 _svm_okof2 &= ~(u16)v7;
35 _svm_okof1 &= ~(u16)v4;
41void SsQueueReverb(
int voices,
int reverb)
48 for ( v2 = 0; (char)v2 < 24; v2 += 1 )
53 if ( (v5 & voices) != 0 )
60 v10 = _svm_orev2 & ~(1 << v9);
62 v10 = _svm_orev2 | (1 << v9);
70 _svm_orev1 &= ~(u16)v5;
81 printf(
"SsQueueRegisters \n");
84 if ( (mask & SND_VOLL) != 0 )
86 _svm_sreg_buf[vc].m_vol_left = sra->volume.left & ~0x8000;
87 _svm_sreg_dirty[vc] |= 1;
89 if ( (mask & SND_VOLR) != 0 )
91 _svm_sreg_buf[vc].m_vol_right = sra->volume.right & ~0x8000;
92 _svm_sreg_dirty[vc] |= 2;
94 if ( (mask & SND_ADSR1) != 0 )
96 _svm_sreg_buf[vc].m_adsr1 = sra->adsr1;
97 _svm_sreg_dirty[vc] |= 0x10;
99 if ( (mask & SND_ADSR2) != 0 )
101 _svm_sreg_buf[vc].m_adsr2 = sra->adsr2;
102 _svm_sreg_dirty[vc] |= 0x20;
104 if ( (mask & SND_PITCH) != 0 )
106 _svm_sreg_buf[vc].m_pitch = sra->pitch;
107 _svm_sreg_dirty[vc] |= 4;
109 if ( (mask & SND_ADDR) != 0 )
111 _svm_sreg_buf2[vc].m_vag_spu_addr = sra->addr;
112 _svm_sreg_dirty[vc] |= 8u;
116s16 SsGetActualProgFromProg(s16 vab_id, s16 prog)
118 if ( !((u16)vab_id < 0x11u && prog >= 0 && kMaxPrograms >= prog) )
120 return _svm_vab_pg[vab_id][prog].m_fake_prog_idx;
123void SsSetVoiceSettings(
int vc,
const SndVoiceStats *snd_v_attr)
127 voice_struct = &_svm_voice[vc];
128 voice_struct->m_vag_idx = snd_v_attr->vagId;
129 voice_struct->m_pitch = snd_v_attr->pitch;
130 voice_struct->m_voll1 = snd_v_attr->vol;
131 voice_struct->m_pan = snd_v_attr->pan;
132 voice_struct->m_seq_sep_no = 33;
133 voice_struct->m_note = snd_v_attr->note;
134 voice_struct->m_fake_program = snd_v_attr->prog_actual;
135 voice_struct->m_prog = snd_v_attr->prog_num;
136 voice_struct->m_tone = snd_v_attr->tone;
137 voice_struct->m_vab_id = snd_v_attr->vabId;
138 voice_struct->m_voll2 = snd_v_attr->vol;
141s16 SsVoiceCheck(
int vc,
int vab_id, s16 note)
145 if ( (
unsigned int)vc >= 0x18 )
147 voice_struct = &_svm_voice[vc];
148 if ( voice_struct->m_vab_id != vab_id >> 8 )
150 if ( voice_struct->m_prog != (u8)vab_id )
152 if ( voice_struct->m_note != note )