Mercurial > audlegacy-plugins
comparison src/console/Blip_Buffer.cxx @ 341:986f098da058 trunk
[svn] - merge in blargg's changes
author | nenolod |
---|---|
date | Thu, 07 Dec 2006 15:20:41 -0800 |
parents | fb513e10174e |
children | 240bdf781ad0 |
comparison
equal
deleted
inserted
replaced
340:9e5a7158fa80 | 341:986f098da058 |
---|---|
118 clear(); | 118 clear(); |
119 | 119 |
120 return 0; // success | 120 return 0; // success |
121 } | 121 } |
122 | 122 |
123 blip_resampled_time_t Blip_Buffer::clock_rate_factor( long clock_rate ) const | 123 blip_resampled_time_t Blip_Buffer::clock_rate_factor( long rate ) const |
124 { | 124 { |
125 double ratio = (double) sample_rate_ / clock_rate; | 125 double ratio = (double) sample_rate_ / rate; |
126 blip_long factor = (blip_long) floor( ratio * (1L << BLIP_BUFFER_ACCURACY) + 0.5 ); | 126 blip_long factor = (blip_long) floor( ratio * (1L << BLIP_BUFFER_ACCURACY) + 0.5 ); |
127 assert( factor > 0 || !sample_rate_ ); // fails if clock/output ratio is too large | 127 assert( factor > 0 || !sample_rate_ ); // fails if clock/output ratio is too large |
128 return (blip_resampled_time_t) factor; | 128 return (blip_resampled_time_t) factor; |
129 } | 129 } |
130 | 130 |
187 } | 187 } |
188 } | 188 } |
189 | 189 |
190 // Blip_Synth_ | 190 // Blip_Synth_ |
191 | 191 |
192 #if BLIP_BUFFER_FAST | 192 Blip_Synth_Fast_::Blip_Synth_Fast_() |
193 Blip_Synth_::Blip_Synth_() | 193 { |
194 { | 194 buf = 0; |
195 buf = 0; | 195 last_amp = 0; |
196 last_amp = 0; | 196 delta_factor = 0; |
197 delta_factor = 0; | 197 } |
198 } | 198 |
199 | 199 void Blip_Synth_Fast_::volume_unit( double new_unit ) |
200 void Blip_Synth_::volume_unit( double new_unit ) | 200 { |
201 { | 201 delta_factor = int (new_unit * (1L << blip_sample_bits) + 0.5); |
202 delta_factor = int (new_unit * (1L << blip_sample_bits) + 0.5); | 202 } |
203 } | 203 |
204 #else | 204 #if !BLIP_BUFFER_FAST |
205 | 205 |
206 Blip_Synth_::Blip_Synth_( short* p, int w ) : | 206 Blip_Synth_::Blip_Synth_( short* p, int w ) : |
207 impulses( p ), | 207 impulses( p ), |
208 width( w ) | 208 width( w ) |
209 { | 209 { |