PS2SDK
PS2 Homebrew Libraries
Loading...
Searching...
No Matches
vm_spb.c
1/*
2# _____ ___ ____ ___ ____
3# ____| | ____| | | |____|
4# | ___| |____ ___| ____| | \ PS2DEV Open Source Project.
5#-----------------------------------------------------------------------
6# Copyright ps2dev - http://www.ps2dev.org
7# Licenced under Academic Free License version 2.0
8# Review ps2sdk README & LICENSE files for further details.
9*/
10
11#include "libsnd2_internal.h"
12
13void SePitchBend(u8 vc, s16 arg1)
14{
15 char v8;
16 int tone;
17 int note;
18 int pbend;
19 const libsnd2_spu_voice_t *voice_struct;
20
21 if ( vc >= 0x18 )
22 {
23 return;
24 }
25 voice_struct = &_svm_voice[vc];
26 _svm_cur.m_fake_program = voice_struct->m_fake_program;
27 v8 = voice_struct->m_tone;
28 _svm_cur.m_voice_idx = vc;
29 _svm_cur.m_tone = v8;
30 tone = v8 + ((u8)_svm_cur.m_fake_program * 16);
31 if ( arg1 < 0 )
32 {
33 int v13;
34
35 v13 = arg1 * _svm_tn[tone].pbmin;
36 pbend = v13 / 127 + 127;
37 note = voice_struct->m_note + v13 / 127 - 1;
38 }
39 else
40 {
41 int v10;
42
43 v10 = arg1 * _svm_tn[tone].pbmax;
44 note = voice_struct->m_note + v10 / 127;
45 pbend = v10 % 127;
46 }
47 _svm_sreg_buf[vc].m_pitch = note2pitch2(note, pbend);
48 _svm_sreg_dirty[vc] |= 4;
49}