PS2SDK
PS2 Homebrew Libraries
Loading...
Searching...
No Matches
sstempo.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 SsSetTempo(s16 sep_no, s16 seq_no, s16 tempo)
14{
15 libsnd2_sequence_struct_t *score_struct;
16 unsigned int v4;
17 int v5;
18 int v6;
19 unsigned int v7;
20
21 score_struct = &_ss_score[sep_no][seq_no];
22 v4 = score_struct->m_resolution_of_quarter_note * tempo;
23 v5 = VBLANK_MINUS;
24 v6 = 15 * VBLANK_MINUS;
25 score_struct->m_unk94 = tempo;
26 v7 = 4 * v6;
27 if ( 10 * v4 < (unsigned int)(4 * v6) )
28 {
29 unsigned int v9;
30
31 if ( !v4 )
32 __builtin_trap();
33 v9 = 600 * v5 / v4;
34 score_struct->m_unk52 = v9;
35 score_struct->m_unk54 = v9;
36 }
37 else
38 {
39 unsigned int v11;
40 unsigned int v12;
41
42 v11 = 10 * score_struct->m_resolution_of_quarter_note * score_struct->m_unk94 / v7;
43 v12 = 10 * score_struct->m_resolution_of_quarter_note * score_struct->m_unk94 % v7;
44 score_struct->m_unk52 = -1;
45 score_struct->m_unk54 = v11;
46 if ( (unsigned int)(2 * v6) < v12 )
47 {
48 score_struct->m_unk54 = v11 + 1;
49 }
50 }
51 score_struct->m_unk56 = score_struct->m_unk54;
52}