11#include "libspu2_internal.h"
13unsigned int _SpuSetAnyVoice(
int on_off_flags,
unsigned int voice_bits,
int word_idx1,
int word_idx2)
18 unsigned int ret_bits;
20 if ( (_spu_env & 1) != 0 )
22 p_register_1 = _spu_RQ[word_idx1 - 188];
23 p_register_2 = (u8)_spu_RQ[word_idx2 - 188];
27 p_register_1 = _spu_RXX[512 * _spu_core + word_idx1];
28 p_register_2 = (u8)_spu_RXX[512 * _spu_core + word_idx2];
30 ret_bits = p_register_1 | (p_register_2 << 16);
31 switch ( on_off_flags )
34 if ( (_spu_env & 1) != 0 )
36 _spu_RQ[word_idx1 - 188] &= ~(u16)voice_bits;
37 _spu_RQ[word_idx2 - 188] &= ~((voice_bits >> 16) & 0xFF);
38 _spu_RQmask |= 1 << ((word_idx1 - 190) >> 1);
39 if ( (1 << ((word_idx1 - 190) >> 1)) == 16 )
46 _spu_RXX[512 * _spu_core + word_idx1] &= ~(u16)voice_bits;
47 _spu_RXX[512 * _spu_core + word_idx2] &= ~((voice_bits >> 16 & 0xFF));
49 ret_bits &= ~(voice_bits & 0xFFFFFF);
52 if ( (_spu_env & 1) != 0 )
54 _spu_RQ[word_idx1 - 188] |= voice_bits;
55 _spu_RQ[word_idx2 - 188] |= (voice_bits >> 16) & 0xFF;
56 _spu_RQmask |= 1 << ((word_idx1 - 190) >> 1);
57 if ( (1 << ((word_idx1 - 190) >> 1)) == 16 )
64 _spu_RXX[512 * _spu_core + word_idx1] |= voice_bits;
65 _spu_RXX[512 * _spu_core + word_idx2] |= (voice_bits >> 16) & 0xFF;
67 ret_bits |= voice_bits & 0xFFFFFF;
70 if ( (_spu_env & 1) != 0 )
72 _spu_RQ[word_idx1 - 188] = voice_bits;
73 _spu_RQ[word_idx2 - 188] = (voice_bits >> 16) & 0xFF;
74 _spu_RQmask |= 1 << ((word_idx1 - 190) >> 1);
75 if ( (1 << ((word_idx1 - 190) >> 1)) == 16 )
82 _spu_RXX[512 * _spu_core + word_idx1] = voice_bits;
83 _spu_RXX[512 * _spu_core + word_idx2] = (voice_bits >> 16) & 0xFF;
85 ret_bits = voice_bits & 0xFFFFFF;
90 return ret_bits & 0xFFFFFF;