PS2SDK
PS2 Homebrew Libraries
Loading...
Searching...
No Matches
ut_vvol.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
13s16 SsUtGetDetVVol(s16 vc, s16 *detvoll, s16 *detvolr)
14{
15 if ( (u16)vc >= 0x18u )
16 return -1;
17 SpuGetVoiceVolume(vc, detvoll, detvolr);
18 return 0;
19}
20
21s16 SsUtSetDetVVol(s16 vc, s16 detvoll, s16 detvolr)
22{
23 if ( (u16)vc >= 0x18u )
24 return -1;
25 _svm_sreg_buf[vc].m_vol_left = detvoll;
26 _svm_sreg_buf[vc].m_vol_right = detvolr;
27 _svm_sreg_dirty[vc] |= 3;
28 return 0;
29}
30
31s16 SsUtGetVVol(s16 vc, s16 *voll, s16 *volr)
32{
33 s16 voll_tmp;
34 s16 volr_tmp;
35
36 if ( (u16)vc >= 0x18u )
37 return -1;
38 SpuGetVoiceVolume(vc, &voll_tmp, &volr_tmp);
39 *voll = voll_tmp / 129;
40 *volr = volr_tmp / 129;
41 return 0;
42}
43
44s16 SsUtSetVVol(s16 vc, s16 voll, s16 volr)
45{
46 if ( (u16)vc >= 0x18u )
47 return -1;
48 _svm_sreg_buf[vc].m_vol_left = 129 * voll;
49 _svm_sreg_buf[vc].m_vol_right = 129 * volr;
50 _svm_sreg_dirty[vc] |= 3;
51 return 0;
52}