From 569285794b9112f0134ddad4bb886308ea4a7be6 Mon Sep 17 00:00:00 2001 From: Torne Wuff Date: Sun, 6 Nov 2011 22:44:25 +0000 Subject: Bulk convert all DOS line endings to UNIX. For the git migration we want a nice clean repository with UNIX line endings. git does not use svn:eol-style, we just need the file contents to be sane. Sorry everybody. I know this messes up blame. Scumbag *NIX developer says migrating to git will make line ending issues go away; commits giant change to svn which changes line endings anyway. :) git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30924 a1c6a512-1295-4272-9138-f99709370657 --- apps/codecs/libgme/nes_vrc7_apu.c | 176 +++++++++++++++++++------------------- 1 file changed, 88 insertions(+), 88 deletions(-) (limited to 'apps/codecs/libgme/nes_vrc7_apu.c') diff --git a/apps/codecs/libgme/nes_vrc7_apu.c b/apps/codecs/libgme/nes_vrc7_apu.c index 95bc676c26..8d3c2e88a6 100644 --- a/apps/codecs/libgme/nes_vrc7_apu.c +++ b/apps/codecs/libgme/nes_vrc7_apu.c @@ -1,88 +1,88 @@ - -#include "nes_vrc7_apu.h" -#include "blargg_source.h" - -int const period = 36; // NES CPU clocks per FM clock - -void Vrc7_init( struct Nes_Vrc7_Apu* this ) -{ - Synth_init( &this->synth ); - - OPLL_new ( &this->opll, 3579545, 3579545 / 72 ); - OPLL_reset_patch( &this->opll, OPLL_VRC7_TONE ); - - this->osc.output = 0; - this->osc.last_amp = 0; - this->mask = 0; - - Vrc7_volume( this, (int)FP_ONE_VOLUME ); - Vrc7_reset( this ); -} - -void Vrc7_reset( struct Nes_Vrc7_Apu* this ) -{ - this->addr = 0; - this->next_time = 0; - this->osc.last_amp = 0; - - OPLL_reset (&this->opll); - OPLL_setMask(&this->opll, this->mask); -} - -void Vrc7_set_rate( struct Nes_Vrc7_Apu* this, int r ) -{ - OPLL_set_quality( &this->opll, r < 44100 ? 0 : 1 ); -} - -void Vrc7_write_reg( struct Nes_Vrc7_Apu* this, int data ) -{ - this->addr = data; -} - -void Vrc7_run_until( struct Nes_Vrc7_Apu* this, blip_time_t end_time ); -void Vrc7_write_data( struct Nes_Vrc7_Apu* this, blip_time_t time, int data ) -{ - if ( time > this->next_time ) - Vrc7_run_until( this, time ); - - OPLL_writeIO( &this->opll, 0, this->addr ); - OPLL_writeIO( &this->opll, 1, data ); -} - -void Vrc7_end_frame( struct Nes_Vrc7_Apu* this, blip_time_t time ) -{ - if ( time > this->next_time ) - Vrc7_run_until( this, time ); - - this->next_time -= time; - assert( this->next_time >= 0 ); - - if ( this->osc.output ) - Blip_set_modified( this->osc.output ); -} - -void Vrc7_run_until( struct Nes_Vrc7_Apu* this, blip_time_t end_time ) -{ - require( end_time > this->next_time ); - - blip_time_t time = this->next_time; - OPLL* opll = &this->opll; // cache - struct Blip_Buffer* const output = this-> osc.output; - if ( output ) - { - do - { - int amp = OPLL_calc( opll ) << 1; - int delta = amp - this->osc.last_amp; - if ( delta ) - { - this->osc.last_amp = amp; - Synth_offset_inline( &this->synth, time, delta, output ); - } - time += period; - } - while ( time < end_time ); - } - - this->next_time = time; -} + +#include "nes_vrc7_apu.h" +#include "blargg_source.h" + +int const period = 36; // NES CPU clocks per FM clock + +void Vrc7_init( struct Nes_Vrc7_Apu* this ) +{ + Synth_init( &this->synth ); + + OPLL_new ( &this->opll, 3579545, 3579545 / 72 ); + OPLL_reset_patch( &this->opll, OPLL_VRC7_TONE ); + + this->osc.output = 0; + this->osc.last_amp = 0; + this->mask = 0; + + Vrc7_volume( this, (int)FP_ONE_VOLUME ); + Vrc7_reset( this ); +} + +void Vrc7_reset( struct Nes_Vrc7_Apu* this ) +{ + this->addr = 0; + this->next_time = 0; + this->osc.last_amp = 0; + + OPLL_reset (&this->opll); + OPLL_setMask(&this->opll, this->mask); +} + +void Vrc7_set_rate( struct Nes_Vrc7_Apu* this, int r ) +{ + OPLL_set_quality( &this->opll, r < 44100 ? 0 : 1 ); +} + +void Vrc7_write_reg( struct Nes_Vrc7_Apu* this, int data ) +{ + this->addr = data; +} + +void Vrc7_run_until( struct Nes_Vrc7_Apu* this, blip_time_t end_time ); +void Vrc7_write_data( struct Nes_Vrc7_Apu* this, blip_time_t time, int data ) +{ + if ( time > this->next_time ) + Vrc7_run_until( this, time ); + + OPLL_writeIO( &this->opll, 0, this->addr ); + OPLL_writeIO( &this->opll, 1, data ); +} + +void Vrc7_end_frame( struct Nes_Vrc7_Apu* this, blip_time_t time ) +{ + if ( time > this->next_time ) + Vrc7_run_until( this, time ); + + this->next_time -= time; + assert( this->next_time >= 0 ); + + if ( this->osc.output ) + Blip_set_modified( this->osc.output ); +} + +void Vrc7_run_until( struct Nes_Vrc7_Apu* this, blip_time_t end_time ) +{ + require( end_time > this->next_time ); + + blip_time_t time = this->next_time; + OPLL* opll = &this->opll; // cache + struct Blip_Buffer* const output = this-> osc.output; + if ( output ) + { + do + { + int amp = OPLL_calc( opll ) << 1; + int delta = amp - this->osc.last_amp; + if ( delta ) + { + this->osc.last_amp = amp; + Synth_offset_inline( &this->synth, time, delta, output ); + } + time += period; + } + while ( time < end_time ); + } + + this->next_time = time; +} -- cgit v1.2.3