diff options
author | Torne Wuff <torne@wolfpuppy.org.uk> | 2011-11-06 22:44:25 +0000 |
---|---|---|
committer | Torne Wuff <torne@wolfpuppy.org.uk> | 2011-11-06 22:44:25 +0000 |
commit | 569285794b9112f0134ddad4bb886308ea4a7be6 (patch) | |
tree | ce702cb07829820261a682c471133c76d11c610e /apps/codecs/libgme/sms_fm_apu.c | |
parent | d9b7d58fa6c9ceb136bea429adf6746cc7138208 (diff) | |
download | rockbox-569285794b9112f0134ddad4bb886308ea4a7be6.tar.gz rockbox-569285794b9112f0134ddad4bb886308ea4a7be6.zip |
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
Diffstat (limited to 'apps/codecs/libgme/sms_fm_apu.c')
-rw-r--r-- | apps/codecs/libgme/sms_fm_apu.c | 164 |
1 files changed, 82 insertions, 82 deletions
diff --git a/apps/codecs/libgme/sms_fm_apu.c b/apps/codecs/libgme/sms_fm_apu.c index 6fd00545d6..ee5ce48932 100644 --- a/apps/codecs/libgme/sms_fm_apu.c +++ b/apps/codecs/libgme/sms_fm_apu.c | |||
@@ -1,82 +1,82 @@ | |||
1 | #include "sms_fm_apu.h" | 1 | #include "sms_fm_apu.h" |
2 | 2 | ||
3 | #include "blargg_source.h" | 3 | #include "blargg_source.h" |
4 | 4 | ||
5 | void Fm_apu_create( struct Sms_Fm_Apu* this ) | 5 | void Fm_apu_create( struct Sms_Fm_Apu* this ) |
6 | { | 6 | { |
7 | Synth_init( &this->synth ); | 7 | Synth_init( &this->synth ); |
8 | Ym2413_init( &this->apu ); | 8 | Ym2413_init( &this->apu ); |
9 | } | 9 | } |
10 | 10 | ||
11 | blargg_err_t Fm_apu_init( struct Sms_Fm_Apu* this, int clock_rate, int sample_rate ) | 11 | blargg_err_t Fm_apu_init( struct Sms_Fm_Apu* this, int clock_rate, int sample_rate ) |
12 | { | 12 | { |
13 | this->period_ = (blip_time_t) (clock_rate / sample_rate); | 13 | this->period_ = (blip_time_t) (clock_rate / sample_rate); |
14 | CHECK_ALLOC( !Ym2413_set_rate( &this->apu, sample_rate, clock_rate ) ); | 14 | CHECK_ALLOC( !Ym2413_set_rate( &this->apu, sample_rate, clock_rate ) ); |
15 | 15 | ||
16 | Fm_apu_set_output( this, 0 ); | 16 | Fm_apu_set_output( this, 0 ); |
17 | Fm_apu_volume( this, (int)FP_ONE_VOLUME ); | 17 | Fm_apu_volume( this, (int)FP_ONE_VOLUME ); |
18 | Fm_apu_reset( this ); | 18 | Fm_apu_reset( this ); |
19 | return 0; | 19 | return 0; |
20 | } | 20 | } |
21 | 21 | ||
22 | void Fm_apu_reset( struct Sms_Fm_Apu* this ) | 22 | void Fm_apu_reset( struct Sms_Fm_Apu* this ) |
23 | { | 23 | { |
24 | this->addr = 0; | 24 | this->addr = 0; |
25 | this->next_time = 0; | 25 | this->next_time = 0; |
26 | this->last_amp = 0; | 26 | this->last_amp = 0; |
27 | 27 | ||
28 | Ym2413_reset( &this->apu ); | 28 | Ym2413_reset( &this->apu ); |
29 | } | 29 | } |
30 | 30 | ||
31 | void fm_run_until( struct Sms_Fm_Apu* this, blip_time_t end_time ); | 31 | void fm_run_until( struct Sms_Fm_Apu* this, blip_time_t end_time ); |
32 | void Fm_apu_write_data( struct Sms_Fm_Apu* this, blip_time_t time, int data ) | 32 | void Fm_apu_write_data( struct Sms_Fm_Apu* this, blip_time_t time, int data ) |
33 | { | 33 | { |
34 | if ( time > this->next_time ) | 34 | if ( time > this->next_time ) |
35 | fm_run_until( this, time ); | 35 | fm_run_until( this, time ); |
36 | 36 | ||
37 | Ym2413_write( &this->apu, this->addr, data ); | 37 | Ym2413_write( &this->apu, this->addr, data ); |
38 | } | 38 | } |
39 | 39 | ||
40 | void fm_run_until( struct Sms_Fm_Apu* this, blip_time_t end_time ) | 40 | void fm_run_until( struct Sms_Fm_Apu* this, blip_time_t end_time ) |
41 | { | 41 | { |
42 | assert( end_time > this->next_time ); | 42 | assert( end_time > this->next_time ); |
43 | 43 | ||
44 | struct Blip_Buffer* const output = this->output_; | 44 | struct Blip_Buffer* const output = this->output_; |
45 | if ( !output ) | 45 | if ( !output ) |
46 | { | 46 | { |
47 | this->next_time = end_time; | 47 | this->next_time = end_time; |
48 | return; | 48 | return; |
49 | } | 49 | } |
50 | 50 | ||
51 | blip_time_t time = this->next_time; | 51 | blip_time_t time = this->next_time; |
52 | struct Ym2413_Emu* emu = &this->apu; | 52 | struct Ym2413_Emu* emu = &this->apu; |
53 | do | 53 | do |
54 | { | 54 | { |
55 | short samples [2]; | 55 | short samples [2]; |
56 | Ym2413_run( emu, 1, samples ); | 56 | Ym2413_run( emu, 1, samples ); |
57 | int amp = (samples [0] + samples [1]) >> 1; | 57 | int amp = (samples [0] + samples [1]) >> 1; |
58 | 58 | ||
59 | int delta = amp - this->last_amp; | 59 | int delta = amp - this->last_amp; |
60 | if ( delta ) | 60 | if ( delta ) |
61 | { | 61 | { |
62 | this->last_amp = amp; | 62 | this->last_amp = amp; |
63 | Synth_offset_inline( &this->synth, time, delta, output ); | 63 | Synth_offset_inline( &this->synth, time, delta, output ); |
64 | } | 64 | } |
65 | time += this->period_; | 65 | time += this->period_; |
66 | } | 66 | } |
67 | while ( time < end_time ); | 67 | while ( time < end_time ); |
68 | 68 | ||
69 | this->next_time = time; | 69 | this->next_time = time; |
70 | } | 70 | } |
71 | 71 | ||
72 | void Fm_apu_end_frame( struct Sms_Fm_Apu* this, blip_time_t time ) | 72 | void Fm_apu_end_frame( struct Sms_Fm_Apu* this, blip_time_t time ) |
73 | { | 73 | { |
74 | if ( time > this->next_time ) | 74 | if ( time > this->next_time ) |
75 | fm_run_until( this, time ); | 75 | fm_run_until( this, time ); |
76 | 76 | ||
77 | this->next_time -= time; | 77 | this->next_time -= time; |
78 | assert( this->next_time >= 0 ); | 78 | assert( this->next_time >= 0 ); |
79 | 79 | ||
80 | if ( this->output_ ) | 80 | if ( this->output_ ) |
81 | Blip_set_modified( this->output_ ); | 81 | Blip_set_modified( this->output_ ); |
82 | } | 82 | } |