1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-16 14:00:40 +00:00

Bring that Whole New World to the Old Continent too

Applies the clang-format style to the 2.1 branch as done for master in
5dbf1809c6.
This commit is contained in:
Rémi Verschelde
2017-03-19 00:36:26 +01:00
parent 1d418afe86
commit f8db8a3faa
1308 changed files with 147754 additions and 174357 deletions

View File

@@ -30,122 +30,112 @@
#include "cp_player_data.h"
#include <stdio.h>
CPPlayer::CPPlayer(CPMixer *p_mixer, CPSong *p_song) {
CPPlayer::CPPlayer(CPMixer *p_mixer,CPSong *p_song){
song=p_song;
mixer=p_mixer;
control.max_voices=p_mixer->get_total_voice_count()-1; //leave one for the sample
control.force_no_nna=false;
control.external_vibrato=false;
control.filters=true;
control.random_seed=128364; //anything
control.play_mode=0;
song = p_song;
mixer = p_mixer;
control.max_voices = p_mixer->get_total_voice_count() - 1; //leave one for the sample
control.force_no_nna = false;
control.external_vibrato = false;
control.filters = true;
control.random_seed = 128364; //anything
control.play_mode = 0;
set_virtual_channels(p_mixer->get_total_voice_count());
mixer->set_callback( &CPPlayer::callback_function, this );
mixer->set_callback(&CPPlayer::callback_function, this);
reset();
}
CPPlayer::~CPPlayer(){
CPPlayer::~CPPlayer() {
}
void CPPlayer::set_virtual_channels(int p_amount) {
if (p_amount<1) return;
if (p_amount>mixer->get_total_voice_count())
if (p_amount < 1) return;
if (p_amount > mixer->get_total_voice_count())
return;
control.max_voices=p_amount;
control.max_voices = p_amount;
}
void CPPlayer::callback_function(void *p_userdata) {
CPPlayer*pd=(CPPlayer*)p_userdata;
pd->process_tick();
CPPlayer *pd = (CPPlayer *)p_userdata;
pd->process_tick();
}
void CPPlayer::process_tick() {
handle_tick();
mixer->set_callback_interval( 2500000/control.tempo );
song_usecs+=2500000/control.tempo;
mixer->set_callback_interval(2500000 / control.tempo);
song_usecs += 2500000 / control.tempo;
}
void CPPlayer::reset() {
if ( mixer==NULL ) return ;
if ( song==NULL ) return ;
if (mixer == NULL) return;
if (song == NULL) return;
int i;
for (i=0;i<control.max_voices;i++) {
for (i = 0; i < control.max_voices; i++) {
voice[i].reset();
voice[i].reset();
mixer->stop_voice(i);
}
for (i=0;i<CPPattern::WIDTH;i++) {
control.channel[i].reset();
control.channel[i].channel_volume=song->get_channel_volume(i);
control.channel[i].channel_panning=((int)song->get_channel_pan( i)*PAN_RIGHT/64);
for (i = 0; i < CPPattern::WIDTH; i++) {
control.channel[i].reset();
control.channel[i].channel_volume = song->get_channel_volume(i);
control.channel[i].channel_panning = ((int)song->get_channel_pan(i) * PAN_RIGHT / 64);
if (song->is_channel_surround(i))
control.channel[i].channel_panning=PAN_SURROUND;
control.channel[i].mute=song->is_channel_mute( i );
control.channel[i].chorus_send=song->get_channel_chorus(i)*0xFF/64;
control.channel[i].reverb_send=song->get_channel_reverb(i)*0xFF/64;
control.channel[i].channel_panning = PAN_SURROUND;
control.channel[i].mute = song->is_channel_mute(i);
control.channel[i].chorus_send = song->get_channel_chorus(i) * 0xFF / 64;
control.channel[i].reverb_send = song->get_channel_reverb(i) * 0xFF / 64;
}
control.speed = song->get_speed();
control.tempo = song->get_tempo();
control.global_volume = song->get_global_volume();
control.speed=song->get_speed();
control.tempo=song->get_tempo();
control.global_volume=song->get_global_volume();
control.position.current_pattern = 0;
control.position.current_row = 0;
control.position.current_order = 0;
control.position.force_next_order = -1;
control.ticks_counter = control.speed;
control.position.forbid_jump = false;
control.position.current_pattern=0;
control.position.current_row=0;
control.position.current_order=0;
control.position.force_next_order=-1;
control.ticks_counter=control.speed;
control.position.forbid_jump=false;
song_usecs=0;
song_usecs = 0;
}
int64_t CPPlayer::get_channel_last_note_time_usec(int p_channel) const {
CP_FAIL_INDEX_V(p_channel,64,-1);
CP_FAIL_INDEX_V(p_channel, 64, -1);
return control.channel[p_channel].last_event_usecs;
}
void CPPlayer::set_channel_global_volume(int p_channel,int p_volume) {
CP_FAIL_INDEX(p_channel,64);
control.channel[p_channel].channel_global_volume=CLAMP(p_volume,0,255);
void CPPlayer::set_channel_global_volume(int p_channel, int p_volume) {
CP_FAIL_INDEX(p_channel, 64);
control.channel[p_channel].channel_global_volume = CLAMP(p_volume, 0, 255);
}
int CPPlayer::get_channel_global_volume(int p_channel) const{
int CPPlayer::get_channel_global_volume(int p_channel) const {
CP_FAIL_INDEX_V(p_channel,64,-1);
CP_FAIL_INDEX_V(p_channel, 64, -1);
return control.channel[p_channel].channel_global_volume;
}
bool CPPlayer::reached_end_of_song() {
return control.reached_end;
}
void CPPlayer::set_force_external_vibratos(bool p_force) {
control.external_vibrato=p_force;
control.external_vibrato = p_force;
}
void CPPlayer::set_force_no_nna(bool p_force) {
control.force_no_nna=p_force;
control.force_no_nna = p_force;
}