PS2SDK
PS2 Homebrew Libraries
cc_6.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 
13 void _SsContDataEntry(s16 sep_no, s16 seq_no, u8 control_value)
14 {
15  libsnd2_sequence_struct_t *score_struct;
16  int m_channel_idx;
17  ProgAtr prog_attr;
18  VagAtr old_vag_attr;
19 
20  score_struct = &_ss_score[sep_no][seq_no];
21  m_channel_idx = score_struct->m_channel_idx;
22  SsUtGetProgAtr((char)score_struct->m_vab_id, (u8)score_struct->m_programs[m_channel_idx], &prog_attr);
23  if ( score_struct->m_unk1C == 1 )
24  {
25  if ( !score_struct->m_unk15 )
26  {
27  score_struct->m_unk1D = control_value;
28  score_struct->m_unk1C = 0;
29  score_struct->m_unk15 = 1;
30  score_struct->m_delta_value = _SsReadDeltaValue(sep_no, seq_no);
31  return;
32  }
33  }
34  if ( score_struct->m_unk1E == 2 )
35  {
36  int tone_idx_cur;
37 
38  for ( tone_idx_cur = 0; tone_idx_cur < prog_attr.tones; tone_idx_cur += 1 )
39  {
40  SsUtGetVagAtr(
41  (char)score_struct->m_vab_id, (u8)score_struct->m_programs[m_channel_idx], tone_idx_cur, &old_vag_attr);
42  if ( (u8)score_struct->m_unk18 == 0 )
43  {
44  old_vag_attr.pbmax = control_value & 0x7F;
45  old_vag_attr.pbmin = control_value & 0x7F;
46  }
47  SsUtSetVagAtr(
48  (char)score_struct->m_vab_id, (u8)score_struct->m_programs[m_channel_idx], tone_idx_cur, &old_vag_attr);
49  }
50  if ( score_struct->m_unk19 )
51  {
52  score_struct->m_delta_value = _SsReadDeltaValue(sep_no, seq_no);
53  score_struct->m_unk1E = 0;
54  return;
55  }
56  }
57  if ( score_struct->m_unk1F != 2 )
58  {
59  score_struct->m_delta_value = _SsReadDeltaValue(sep_no, seq_no);
60  return;
61  }
62  if ( score_struct->m_unk1B == 16 )
63  SsFCALL.ccentry[(u8)score_struct->m_fn_idx](
64  (char)score_struct->m_vab_id,
65  (u8)score_struct->m_programs[m_channel_idx],
66  0,
67  old_vag_attr,
68  score_struct->m_fn_idx,
69  control_value);
70  else
71  SsFCALL.ccentry[(u8)score_struct->m_fn_idx](
72  (char)score_struct->m_vab_id,
73  (u8)score_struct->m_programs[m_channel_idx],
74  score_struct->m_unk1B,
75  old_vag_attr,
76  score_struct->m_fn_idx,
77  control_value);
78  score_struct->m_delta_value = _SsReadDeltaValue(sep_no, seq_no);
79  score_struct->m_unk1F = 0;
80 }
libsnd2_sequence_struct_
Definition: libsnd2_internal.h:47
VagAtr
Definition: libsnd2.h:172
ProgAtr
Definition: libsnd2.h:158