Debian Codegraph @

mednafen/include/blip/Blip_Buffer.h

raw symbols SCIP
1 // Band-limited sound synthesis buffercxx . . $ `<file>/mednafen/include/blip/Blip_Buffer.h`/
2 // Various changes and hacks for use in Mednafen.
3
4 #ifdef __GNUC__cxx . . $ `<built-in>:8:9`!
5 #define blip_inlinecxx . . $ `mednafen/include/blip/Blip_Buffer.h:5:10`! inline __attribute__((always_inline))
6 #else
7 #define blip_inline inline
8 #endif
9
10 #include <limits.h>
11 #include <stdint.h>
12
13 // Blip_Buffer 0.4.1
14 #ifndef BLIP_BUFFER_Hcxx . . $ `mednafen/include/blip/Blip_Buffer.h:15:9`!
15 #define BLIP_BUFFER_Hcxx . . $ `mednafen/include/blip/Blip_Buffer.h:15:9`!
16
17 // Internal
18 typedef int32_tcxx . . $ int32_t# blip_longcxx . . $ blip_long#;
19 typedef uint32_tcxx . . $ uint32_t# blip_ulongcxx . . $ blip_ulong#;
20 typedef int64_tcxx . . $ int64_t# blip_s64cxx . . $ blip_s64#;
21 typedef uint64_tcxx . . $ uint64_t# blip_u64cxx . . $ blip_u64#;
22
23 // Time unit at source clock rate
24 typedef blip_longcxx . . $ blip_long# blip_time_tcxx . . $ blip_time_t#;
25
26 // Output samples are 16-bit signed, with a range of -32768 to 32767
27 typedef short blip_sample_tcxx . . $ blip_sample_t#;
28 enumcxx . . $ $anonymous_type_9fbbe4a08064f381_0# { blip_sample_maxcxx . . $ blip_sample_max. = 32767 };
29
30 class Blip_Buffercxx . . $ Blip_Buffer# {
31 public:
32 typedef const char* blargg_err_tcxx . . $ Blip_Buffer#blargg_err_t#;
33
34 // Set output sample rate and buffer length in milliseconds (1/1000 sec, defaults
35 // to 1/4 second), then clear buffer. Returns NULL on success, otherwise if there
36 // isn't enough memory, returns error without affecting current buffer setup.
37 blargg_err_tcxx . . $ Blip_Buffer#blargg_err_t# set_sample_ratecxx . . $ Blip_Buffer#set_sample_rate(ee827314cdea73de).( long samples_per_sec, int msec_length = 1000 / 4 );
38
39 // Set number of source time units per second
40 void clock_ratecxx . . $ Blip_Buffer#clock_rate(1624ee8275b10bda).( long );
41
42 // End current time frame of specified duration and make its samples available
43 // (along with any still-unread samples) for reading with read_samples(). Begins
44 // a new time frame at the end of the current frame.
45 void end_framecxx . . $ Blip_Buffer#end_frame(d4f767463ce0a6b3).( blip_time_tcxx . . $ blip_time_t# time );
46
47 // Read at most 'max_samples' out of buffer into 'dest', removing them from from
48 // the buffer. Returns number of samples actually read and removed. If stereo is
49 // true, increments 'dest' one extra time after writing each sample, to allow
50 // easy interleving of two channels into a stereo output buffer.
51 long read_samplescxx . . $ Blip_Buffer#read_samples(44cf187bb4d07f06).( blip_sample_tcxx . . $ blip_sample_t#* dest, long max_samples, int stereo = 0 );
52
53 // Additional optional features
54
55 // Current output sample rate
56 long sample_ratecxx . . $ Blip_Buffer#sample_rate(57a65ae535d7db84).() const;
57
58 // Length of buffer, in milliseconds
59 int lengthcxx . . $ Blip_Buffer#length(455f465bc33b4cdf).() const;
60
61 // Number of source time units per second
62 long clock_ratecxx . . $ Blip_Buffer#clock_rate(57a65ae535d7db84).() const;
63
64 // Set frequency high-pass filter frequency, where higher values reduce bass more
65 void bass_freqcxx . . $ Blip_Buffer#bass_freq(d4f767463ce0a6b3).( int frequency );
66
67 // Number of samples delay from synthesis to samples read out
68 int output_latencycxx . . $ Blip_Buffer#output_latency(455f465bc33b4cdf).() const;
69
70 // Remove all available samples and clear buffer to silence. If 'entire_buffer' is
71 // false, just clears out any samples waiting rather than the entire buffer.
72 void clearcxx . . $ Blip_Buffer#clear(d4f767463ce0a6b3).( int entire_buffer = 1 );
73
74 // Number of samples available for reading with read_samples()
75 long samples_availcxx . . $ Blip_Buffer#samples_avail(57a65ae535d7db84).() const;
76
77 // Remove 'count' samples from those waiting to be read
78 void remove_samplescxx . . $ Blip_Buffer#remove_samples(1624ee8275b10bda).( long count );
79
80 // Experimental features
81
82 // Count number of clocks needed until 'count' samples will be available.
83 // If buffer can't even hold 'count' samples, returns number of clocks until
84 // buffer becomes full.
85 blip_time_tcxx . . $ blip_time_t# count_clockscxx . . $ Blip_Buffer#count_clocks(54963ccf8c7a5971).( long count ) const;
86
87 // Number of raw samples that can be mixed within frame of specified duration.
88 long count_samplescxx . . $ Blip_Buffer#count_samples(9ebf7bebeea16932).( blip_time_tcxx . . $ blip_time_t# duration ) const;
89
90 // not documented yet
91 void set_modifiedcxx . . $ Blip_Buffer#set_modified(49f6e7a06ebc5aa8).() { modified_cxx . . $ Blip_Buffer#modified_. = 1; }
92 int clear_modifiedcxx . . $ Blip_Buffer#clear_modified(b126dc7c1de90089).() { int b = modified_cxx . . $ Blip_Buffer#modified_.; modified_cxx . . $ Blip_Buffer#modified_. = 0; return b; }
93 typedef blip_u64cxx . . $ blip_u64# blip_resampled_time_tcxx . . $ Blip_Buffer#blip_resampled_time_t#;
94 void remove_silencecxx . . $ Blip_Buffer#remove_silence(1624ee8275b10bda).( long count );
95 blip_resampled_time_tcxx . . $ Blip_Buffer#blip_resampled_time_t# resampled_durationcxx . . $ Blip_Buffer#resampled_duration(79dc3568750208f6).( int t ) const { return t * factor_cxx . . $ Blip_Buffer#factor_.; }
96 blip_resampled_time_tcxx . . $ Blip_Buffer#blip_resampled_time_t# resampled_timecxx . . $ Blip_Buffer#resampled_time(79dc3568750208f6).( blip_time_tcxx . . $ blip_time_t# t ) const { return t * factor_cxx . . $ Blip_Buffer#factor_. + offset_cxx . . $ Blip_Buffer#offset_.; }
97 blip_resampled_time_tcxx . . $ Blip_Buffer#blip_resampled_time_t# clock_rate_factorcxx . . $ Blip_Buffer#clock_rate_factor(2867b430557b1c2e).( long clock_rate ) const;
98 public:
99 Blip_Buffercxx . . $ Blip_Buffer#Blip_Buffer(49f6e7a06ebc5aa8).();
100 ~cxx . . $ Blip_Buffer#`~Blip_Buffer`(ced63f7c635d850d).Blip_Buffercxx . . $ Blip_Buffer#();
101
102 // Deprecated
103 typedef blip_resampled_time_tcxx . . $ Blip_Buffer#blip_resampled_time_t# resampled_time_tcxx . . $ Blip_Buffer#resampled_time_t#;
104 blargg_err_tcxx . . $ Blip_Buffer#blargg_err_t# sample_ratecxx . . $ Blip_Buffer#sample_rate(595caefabb192cea).( long r ) { return set_sample_ratecxx . . $ Blip_Buffer#set_sample_rate(ee827314cdea73de).( r ); }
105 blargg_err_tcxx . . $ Blip_Buffer#blargg_err_t# sample_ratecxx . . $ Blip_Buffer#sample_rate(ee827314cdea73de).( long r, int msec ) { return set_sample_ratecxx . . $ Blip_Buffer#set_sample_rate(ee827314cdea73de).( r, msec ); }
106 private:
107 // noncopyable
108 Blip_Buffercxx . . $ Blip_Buffer#Blip_Buffer(69a6568f39ecd3db).( const Blip_Buffercxx . . $ Blip_Buffer#& );
109 Blip_Buffercxx . . $ Blip_Buffer#& operatorcxx . . $ Blip_Buffer#`operator=`(8df10b6e15a20347). = ( const Blip_Buffercxx . . $ Blip_Buffer#& );
110 public:
111 typedef blip_time_tcxx . . $ blip_time_t# buf_t_cxx . . $ Blip_Buffer#buf_t_#;
112 blip_u64cxx . . $ blip_u64# factor_cxx . . $ Blip_Buffer#factor_.;
113 blip_resampled_time_tcxx . . $ Blip_Buffer#blip_resampled_time_t# offset_cxx . . $ Blip_Buffer#offset_.;
114 buf_t_cxx . . $ Blip_Buffer#buf_t_#* buffer_cxx . . $ Blip_Buffer#buffer_.;
115 blip_longcxx . . $ blip_long# buffer_size_cxx . . $ Blip_Buffer#buffer_size_.;
116 blip_longcxx . . $ blip_long# reader_accum_cxx . . $ Blip_Buffer#reader_accum_.;
117 int bass_shift_cxx . . $ Blip_Buffer#bass_shift_.;
118 private:
119 long sample_rate_cxx . . $ Blip_Buffer#sample_rate_.;
120 long clock_rate_cxx . . $ Blip_Buffer#clock_rate_.;
121 int bass_freq_cxx . . $ Blip_Buffer#bass_freq_.;
122 int length_cxx . . $ Blip_Buffer#length_.;
123 int modified_cxx . . $ Blip_Buffer#modified_.;
124 friend class Blip_Readercxx . . $ Blip_Reader#;
125 };
126
127 #ifdef HAVE_CONFIG_H
128 #include "config.h"
129 #endif
130
131 #define BLIP_BUFFER_ACCURACYcxx . . $ `mednafen/include/blip/Blip_Buffer.h:131:9`! 32
132 #define BLIP_PHASE_BITScxx . . $ `mednafen/include/blip/Blip_Buffer.h:132:9`! 8
133
134 // Number of bits in resample ratio fraction. Higher values give a more accurate ratio
135 // but reduce maximum buffer size.
136 //#ifndef BLIP_BUFFER_ACCURACY
137 // #define BLIP_BUFFER_ACCURACY 16
138 //#endif
139
140 // Number bits in phase offset. Fewer than 6 bits (64 phase offsets) results in
141 // noticeable broadband noise when synthesizing high frequency square waves.
142 // Affects size of Blip_Synth objects since they store the waveform directly.
143 //#ifndef BLIP_PHASE_BITS
144 // #if BLIP_BUFFER_FAST
145 // #define BLIP_PHASE_BITS 8
146 // #else
147 // #define BLIP_PHASE_BITS 6
148 // #endif
149 //#endif
150
151 // Internal
152 typedef blip_u64cxx . . $ blip_u64# blip_resampled_time_tcxx . . $ blip_resampled_time_t#;
153 int const blip_widest_impulse_cxx . . $ blip_widest_impulse_. = 16;
154 int const blip_buffer_extra_cxx . . $ blip_buffer_extra_. = blip_widest_impulse_cxx . . $ blip_widest_impulse_. + 2;
155 int const blip_rescxx . . $ blip_res. = 1 << BLIP_PHASE_BITScxx . . $ `mednafen/include/blip/Blip_Buffer.h:132:9`!;
156 class blip_eq_tcxx . . $ blip_eq_t#;
157
158 class Blip_Synth_Fast_cxx . . $ Blip_Synth_Fast_# {
159 public:
160 Blip_Buffercxx . . $ Blip_Buffer#* bufcxx . . $ Blip_Synth_Fast_#buf.;
161 int last_ampcxx . . $ Blip_Synth_Fast_#last_amp.;
162 int delta_factorcxx . . $ Blip_Synth_Fast_#delta_factor.;
163
164 void volume_unitcxx . . $ Blip_Synth_Fast_#volume_unit(ba8836b59fb42830).( double );
165 Blip_Synth_Fast_cxx . . $ Blip_Synth_Fast_#Blip_Synth_Fast_(49f6e7a06ebc5aa8).();
166 void treble_eqcxx . . $ Blip_Synth_Fast_#treble_eq(a728e5f0d25ddc61).( blip_eq_tcxx . . $ blip_eq_t# const& ) { }
167 };
168
169 class Blip_Synth_cxx . . $ Blip_Synth_# {
170 public:
171 Blip_Buffercxx . . $ Blip_Buffer#* bufcxx . . $ Blip_Synth_#buf.;
172 int last_ampcxx . . $ Blip_Synth_#last_amp.;
173 int delta_factorcxx . . $ Blip_Synth_#delta_factor.;
174
175 void volume_unitcxx . . $ Blip_Synth_#volume_unit(ba8836b59fb42830).( double );
176 Blip_Synth_cxx . . $ Blip_Synth_#Blip_Synth_(4683f455c3e046d4).( short* impulses, int width );
177 void treble_eqcxx . . $ Blip_Synth_#treble_eq(a728e5f0d25ddc61).( blip_eq_tcxx . . $ blip_eq_t# const& );
178 private:
179 double volume_unit_cxx . . $ Blip_Synth_#volume_unit_.;
180 short* const impulsescxx . . $ Blip_Synth_#impulses.;
181 int const widthcxx . . $ Blip_Synth_#width.;
182 blip_longcxx . . $ blip_long# kernel_unitcxx . . $ Blip_Synth_#kernel_unit.;
183 int impulses_sizecxx . . $ Blip_Synth_#impulses_size(455f465bc33b4cdf).() const { return blip_rescxx . . $ blip_res. / 2 * widthcxx . . $ Blip_Synth_#width. + 1; }
184 void adjust_impulsecxx . . $ Blip_Synth_#adjust_impulse(49f6e7a06ebc5aa8).();
185 };
186
187 // Quality level. Start with blip_good_quality.
188 const int blip_med_qualitycxx . . $ blip_med_quality. = 8;
189 const int blip_good_qualitycxx . . $ blip_good_quality. = 12;
190 const int blip_high_qualitycxx . . $ blip_high_quality. = 16;
191
192 // Range specifies the greatest expected change in amplitude. Calculate it
193 // by finding the difference between the maximum and minimum expected
194 // amplitudes (max - min).
195 template<int quality,int range>
196 class Blip_Synthcxx . . $ Blip_Synth# {
197 public:
198 // Set overall volume of waveform
199 void volumecxx . . $ Blip_Synth#volume(ba8836b59fb42830).( double v ) { implcxx . . $ Blip_Synth#impl..volume_unitcxx . . $ Blip_Synth_Fast_#volume_unit(ba8836b59fb42830).( v * (1.0 / (range < 0 ? -range : range)) ); }
200
201 // Configure low-pass filter (see blip_buffer.txt)
202 void treble_eqcxx . . $ Blip_Synth#treble_eq(a728e5f0d25ddc61).( blip_eq_tcxx . . $ blip_eq_t# const& eq ) { implcxx . . $ Blip_Synth#impl..treble_eqcxx . . $ Blip_Synth_Fast_#treble_eq(a728e5f0d25ddc61).( eq ); }
203
204 // Get/set Blip_Buffer used for output
205 Blip_Buffercxx . . $ Blip_Buffer#* outputcxx . . $ Blip_Synth#output(80d8c0660567c34).() const { return implcxx . . $ Blip_Synth#impl..bufcxx . . $ Blip_Synth_Fast_#buf.; }
206 void outputcxx . . $ Blip_Synth#output(1a991b1b0165523b).( Blip_Buffercxx . . $ Blip_Buffer#* b ) { implcxx . . $ Blip_Synth#impl..bufcxx . . $ Blip_Synth_Fast_#buf. = b; implcxx . . $ Blip_Synth#impl..last_ampcxx . . $ Blip_Synth_Fast_#last_amp. = 0; }
207
208 // Update amplitude of waveform at given time. Using this requires a separate
209 // Blip_Synth for each waveform.
210 void updatecxx . . $ Blip_Synth#update(3e454b8ccf442868).( blip_time_tcxx . . $ blip_time_t# time, int amplitude );
211
212 // Low-level interface
213
214 // Add an amplitude transition of specified delta, optionally into specified buffer
215 // rather than the one set with output(). Delta can be positive or negative.
216 // The actual change in amplitude is delta * (volume / range)
217 void offsetcxx . . $ Blip_Synth#offset(90077ce6337795eb).( blip_time_tcxx . . $ blip_time_t#, int delta, Blip_Buffercxx . . $ Blip_Buffer#* ) const;
218 void offsetcxx . . $ Blip_Synth#offset(db7b78144a373e11).( blip_time_tcxx . . $ blip_time_t# t, int delta ) const { offsetcxx . . $ Blip_Synth#offset(db7b78144a373e11).( t, delta, implcxx . . $ Blip_Synth#impl..bufcxx . . $ Blip_Synth_Fast_#buf. ); }
219
220 // Works directly in terms of fractional output samples. Contact author for more info.
221 void offset_resampledcxx . . $ Blip_Synth#offset_resampled(86a249e3a5814d7b).( blip_resampled_time_tcxx . . $ blip_resampled_time_t#, int delta, Blip_Buffercxx . . $ Blip_Buffer#* ) const;
222
223 // Same as offset(), except code is inlined for higher performance
224 void offset_inlinecxx . . $ Blip_Synth#offset_inline(90077ce6337795eb).( blip_time_tcxx . . $ blip_time_t# t, int delta, Blip_Buffercxx . . $ Blip_Buffer#* buf ) const {
225 offset_resampledcxx . . $ Blip_Synth#offset_resampled(86a249e3a5814d7b).( t * buf->factor_cxx . . $ Blip_Buffer#factor_. + buf->offset_cxx . . $ Blip_Buffer#offset_., delta, buf );
226 }
227 void offset_inlinecxx . . $ Blip_Synth#offset_inline(db7b78144a373e11).( blip_time_tcxx . . $ blip_time_t# t, int delta ) const {
228 offset_resampledcxx . . $ Blip_Synth#offset_resampled(86a249e3a5814d7b).( t * implcxx . . $ Blip_Synth#impl..bufcxx . . $ Blip_Synth_Fast_#buf.->factor_cxx . . $ Blip_Buffer#factor_. + implcxx . . $ Blip_Synth#impl..bufcxx . . $ Blip_Synth_Fast_#buf.->offset_cxx . . $ Blip_Buffer#offset_., delta, implcxx . . $ Blip_Synth#impl..bufcxx . . $ Blip_Synth_Fast_#buf. );
229 }
230
231 private:
232 Blip_Synth_Fast_cxx . . $ Blip_Synth_Fast_# implcxx . . $ Blip_Synth#impl.;
233 };
234
235 // Low-pass equalization parameters
236 class blip_eq_tcxx . . $ blip_eq_t# {
237 public:
238 // Logarithmic rolloff to treble dB at half sampling rate. Negative values reduce
239 // treble, small positive values (0 to 5.0) increase treble.
240 blip_eq_tcxx . . $ blip_eq_t#blip_eq_t(ba8836b59fb42830).( double treble_db = 0 );
241
242 // See blip_buffer.txt
243 blip_eq_tcxx . . $ blip_eq_t#blip_eq_t(4fde810f210164e8).( double treble, long rolloff_freq, long sample_rate, long cutoff_freq = 0 );
244
245 private:
246 double treblecxx . . $ blip_eq_t#treble.;
247 long rolloff_freqcxx . . $ blip_eq_t#rolloff_freq.;
248 long sample_ratecxx . . $ blip_eq_t#sample_rate.;
249 long cutoff_freqcxx . . $ blip_eq_t#cutoff_freq.;
250 void generatecxx . . $ blip_eq_t#generate(99245bc659b293d5).( float* out, int count ) const;
251 friend class Blip_Synth_cxx . . $ Blip_Synth_#;
252 };
253
254 int const blip_sample_bitscxx . . $ blip_sample_bits. = 30;
255
256 #define BLIP_RESTRICTcxx . . $ `mednafen/include/blip/Blip_Buffer.h:256:9`!
257
258 // Optimized reading from Blip_Buffer, for use in custom sample output
259
260 // Begin reading from buffer. Name should be unique to the current block.
261 #define BLIP_READER_BEGINcxx . . $ `mednafen/include/blip/Blip_Buffer.h:261:9`!( name, blip_buffer ) \
262 const Blip_Buffer::buf_t_* BLIP_RESTRICTcxx . . $ `mednafen/include/blip/Blip_Buffer.h:256:9`! name##_reader_buf = (blip_buffer).buffer_;\
263 blip_long name##_reader_accum = (blip_buffer).reader_accum_
264
265 // Get value to pass to BLIP_READER_NEXT()
266 #define BLIP_READER_BASScxx . . $ `mednafen/include/blip/Blip_Buffer.h:266:9`!( blip_buffer ) ((blip_buffer).bass_shift_)
267
268 // Constant value to use instead of BLIP_READER_BASS(), for slightly more optimal
269 // code at the cost of having no bass control
270 int const blip_reader_default_basscxx . . $ blip_reader_default_bass. = 9;
271
272 // Current sample
273 #define BLIP_READER_READcxx . . $ `mednafen/include/blip/Blip_Buffer.h:273:9`!( name ) (name##_reader_accum >> (blip_sample_bits - 16))
274
275 // Current raw sample in full internal resolution
276 #define BLIP_READER_READ_RAWcxx . . $ `mednafen/include/blip/Blip_Buffer.h:276:9`!( name ) (name##_reader_accum)
277
278 // Advance to next sample
279 #define BLIP_READER_NEXTcxx . . $ `mednafen/include/blip/Blip_Buffer.h:279:9`!( name, bass ) \
280 (void) (name##_reader_accum += *name##_reader_buf++ - (name##_reader_accum >> (bass)))
281
282 // End reading samples from buffer. The number of samples read must now be removed
283 // using Blip_Buffer::remove_samples().
284 #define BLIP_READER_ENDcxx . . $ `mednafen/include/blip/Blip_Buffer.h:284:9`!( name, blip_buffer ) \
285 (void) ((blip_buffer).reader_accum_ = name##_reader_accum)
286
287
288 // Compatibility with older version
289 const long blip_unscaledcxx . . $ blip_unscaled. = 65535;
290 const int blip_low_qualitycxx . . $ blip_low_quality. = blip_med_qualitycxx . . $ blip_med_quality.;
291 const int blip_best_qualitycxx . . $ blip_best_quality. = blip_high_qualitycxx . . $ blip_high_quality.;
292
293 // Deprecated; use BLIP_READER macros as follows:
294 // Blip_Reader r; r.begin( buf ); -> BLIP_READER_BEGIN( r, buf );
295 // int bass = r.begin( buf ) -> BLIP_READER_BEGIN( r, buf ); int bass = BLIP_READER_BASS( buf );
296 // r.read() -> BLIP_READER_READ( r )
297 // r.read_raw() -> BLIP_READER_READ_RAW( r )
298 // r.next( bass ) -> BLIP_READER_NEXT( r, bass )
299 // r.next() -> BLIP_READER_NEXT( r, blip_reader_default_bass )
300 // r.end( buf ) -> BLIP_READER_END( r, buf )
301 class Blip_Readercxx . . $ Blip_Reader# {
302 public:
303 int begincxx . . $ Blip_Reader#begin(bd49e4dbde136ad8).( Blip_Buffercxx . . $ Blip_Buffer#& );
304 blip_longcxx . . $ blip_long# readcxx . . $ Blip_Reader#read(455f465bc33b4cdf).() const { return accumcxx . . $ Blip_Reader#accum. >> (blip_sample_bitscxx . . $ blip_sample_bits. - 16); }
305 blip_longcxx . . $ blip_long# read_rawcxx . . $ Blip_Reader#read_raw(455f465bc33b4cdf).() const { return accumcxx . . $ Blip_Reader#accum.; }
306 void nextcxx . . $ Blip_Reader#next(d4f767463ce0a6b3).( int bass_shift = 9 ) { accumcxx . . $ Blip_Reader#accum. += *bufcxx . . $ Blip_Reader#buf.++ - (accumcxx . . $ Blip_Reader#accum. >> bass_shift); }
307 void endcxx . . $ Blip_Reader#end(a2d8fa65957500ee).( Blip_Buffercxx . . $ Blip_Buffer#& b ) { b.reader_accum_cxx . . $ Blip_Buffer#reader_accum_. = accumcxx . . $ Blip_Reader#accum.; }
308
309 private:
310 const Blip_Buffercxx . . $ Blip_Buffer#::buf_t_cxx . . $ Blip_Buffer#buf_t_#* bufcxx . . $ Blip_Reader#buf.;
311 blip_longcxx . . $ blip_long# accumcxx . . $ Blip_Reader#accum.;
312 };
313
314 // End of public interface
315
316 #include <assert.h>
317
318 template<int quality,int range>
319 blip_inlinecxx . . $ `mednafen/include/blip/Blip_Buffer.h:5:10`! void Blip_Synthcxx . . $ Blip_Synth#<quality,range>::offset_resampledcxx . . $ Blip_Synth#offset_resampled(86a249e3a5814d7b).( blip_resampled_time_tcxx . . $ blip_resampled_time_t# time,
320 int delta, Blip_Buffercxx . . $ Blip_Buffer#* blip_buf ) const
321 {
322 // Fails if time is beyond end of Blip_Buffer, due to a bug in caller code or the
323 // need for a longer buffer as set by set_sample_rate().
324 assertcxx . . $ `/usr/include/assert.h:102:11`!( (blip_long) (time >> BLIP_BUFFER_ACCURACYcxx . . $ `mednafen/include/blip/Blip_Buffer.h:131:9`!) < blip_buf->buffer_size_ );
325 delta *= implcxx . . $ Blip_Synth#impl..delta_factorcxx . . $ Blip_Synth_Fast_#delta_factor.;
326 blip_longcxx . . $ blip_long#* BLIP_RESTRICTcxx . . $ `mednafen/include/blip/Blip_Buffer.h:256:9`! buf = blip_buf->buffer_cxx . . $ Blip_Buffer#buffer_. + (time >> BLIP_BUFFER_ACCURACYcxx . . $ `mednafen/include/blip/Blip_Buffer.h:131:9`!);
327 int phase = (int) (time >> (BLIP_BUFFER_ACCURACYcxx . . $ `mednafen/include/blip/Blip_Buffer.h:131:9`! - BLIP_PHASE_BITScxx . . $ `mednafen/include/blip/Blip_Buffer.h:132:9`!) & (blip_rescxx . . $ blip_res. - 1));
328
329 blip_longcxx . . $ blip_long# left = buf [0] + delta;
330
331 // Kind of crappy, but doing shift after multiply results in overflow.
332 // Alternate way of delaying multiply by delta_factor results in worse
333 // sub-sample resolution.
334 blip_longcxx . . $ blip_long# right = (delta >> BLIP_PHASE_BITScxx . . $ `mednafen/include/blip/Blip_Buffer.h:132:9`!) * phase;
335 left -= right;
336 right += buf [1];
337
338 buf [0] = left;
339 buf [1] = right;
340 }
341
342 #undef BLIP_FWD
343 #undef BLIP_REV
344
345 template<int quality,int range>
346 blip_inlinecxx . . $ `mednafen/include/blip/Blip_Buffer.h:5:10`! void Blip_Synthcxx . . $ Blip_Synth#<quality,range>::offsetcxx . . $ Blip_Synth#offset(90077ce6337795eb).( blip_time_tcxx . . $ blip_time_t# t, int delta, Blip_Buffercxx . . $ Blip_Buffer#* buf ) const
347 {
348 offset_resampledcxx . . $ Blip_Synth#offset_resampled(86a249e3a5814d7b).( t * buf->factor_cxx . . $ Blip_Buffer#factor_. + buf->offset_cxx . . $ Blip_Buffer#offset_., delta, buf );
349 }
350
351 template<int quality,int range>
352 blip_inlinecxx . . $ `mednafen/include/blip/Blip_Buffer.h:5:10`! void Blip_Synthcxx . . $ Blip_Synth#<quality,range>::updatecxx . . $ Blip_Synth#update(3e454b8ccf442868).( blip_time_tcxx . . $ blip_time_t# t, int amp )
353 {
354 int delta = amp - implcxx . . $ Blip_Synth#impl..last_ampcxx . . $ Blip_Synth_Fast_#last_amp.;
355 implcxx . . $ Blip_Synth#impl..last_ampcxx . . $ Blip_Synth_Fast_#last_amp. = amp;
356 offset_resampledcxx . . $ Blip_Synth#offset_resampled(86a249e3a5814d7b).( t * implcxx . . $ Blip_Synth#impl..bufcxx . . $ Blip_Synth_Fast_#buf.->factor_cxx . . $ Blip_Buffer#factor_. + implcxx . . $ Blip_Synth#impl..bufcxx . . $ Blip_Synth_Fast_#buf.->offset_cxx . . $ Blip_Buffer#offset_., delta, implcxx . . $ Blip_Synth#impl..bufcxx . . $ Blip_Synth_Fast_#buf. );
357 }
358
359 blip_inlinecxx . . $ `mednafen/include/blip/Blip_Buffer.h:5:10`! blip_eq_tcxx . . $ blip_eq_t#::blip_eq_tcxx . . $ blip_eq_t#blip_eq_t(ba8836b59fb42830).( double t ) :
360 treblecxx . . $ blip_eq_t#treble.( t ), rolloff_freqcxx . . $ blip_eq_t#rolloff_freq.( 0 ), sample_ratecxx . . $ blip_eq_t#sample_rate.( 44100 ), cutoff_freqcxx . . $ blip_eq_t#cutoff_freq.( 0 ) { }
361 blip_inlinecxx . . $ `mednafen/include/blip/Blip_Buffer.h:5:10`! blip_eq_tcxx . . $ blip_eq_t#::blip_eq_tcxx . . $ blip_eq_t#blip_eq_t(4fde810f210164e8).( double t, long rf, long sr, long cf ) :
362 treblecxx . . $ blip_eq_t#treble.( t ), rolloff_freqcxx . . $ blip_eq_t#rolloff_freq.( rf ), sample_ratecxx . . $ blip_eq_t#sample_rate.( sr ), cutoff_freqcxx . . $ blip_eq_t#cutoff_freq.( cf ) { }
363
364 blip_inlinecxx . . $ `mednafen/include/blip/Blip_Buffer.h:5:10`! int Blip_Buffercxx . . $ Blip_Buffer#::lengthcxx . . $ Blip_Buffer#length(455f465bc33b4cdf).() const { return length_cxx . . $ Blip_Buffer#length_.; }
365 blip_inlinecxx . . $ `mednafen/include/blip/Blip_Buffer.h:5:10`! long Blip_Buffercxx . . $ Blip_Buffer#::samples_availcxx . . $ Blip_Buffer#samples_avail(57a65ae535d7db84).() const { return (long) (offset_cxx . . $ Blip_Buffer#offset_. >> BLIP_BUFFER_ACCURACYcxx . . $ `mednafen/include/blip/Blip_Buffer.h:131:9`!); }
366 blip_inlinecxx . . $ `mednafen/include/blip/Blip_Buffer.h:5:10`! long Blip_Buffercxx . . $ Blip_Buffer#::sample_ratecxx . . $ Blip_Buffer#sample_rate(57a65ae535d7db84).() const { return sample_rate_cxx . . $ Blip_Buffer#sample_rate_.; }
367 blip_inlinecxx . . $ `mednafen/include/blip/Blip_Buffer.h:5:10`! int Blip_Buffercxx . . $ Blip_Buffer#::output_latencycxx . . $ Blip_Buffer#output_latency(455f465bc33b4cdf).() const { return blip_widest_impulse_cxx . . $ blip_widest_impulse_. / 2; }
368 blip_inlinecxx . . $ `mednafen/include/blip/Blip_Buffer.h:5:10`! void Blip_Buffercxx . . $ Blip_Buffer#::clock_ratecxx . . $ Blip_Buffer#clock_rate(1624ee8275b10bda).( long cps ) { factor_cxx . . $ Blip_Buffer#factor_. = clock_rate_factorcxx . . $ Blip_Buffer#clock_rate_factor(2867b430557b1c2e).( clock_rate_cxx . . $ Blip_Buffer#clock_rate_. = cps ); }
369
370 blip_inlinecxx . . $ `mednafen/include/blip/Blip_Buffer.h:5:10`! int Blip_Readercxx . . $ Blip_Reader#::begincxx . . $ Blip_Reader#begin(bd49e4dbde136ad8).( Blip_Buffercxx . . $ Blip_Buffer#& blip_buf )
371 {
372 bufcxx . . $ Blip_Reader#buf. = blip_buf.buffer_cxx . . $ Blip_Buffer#buffer_.;
373 accumcxx . . $ Blip_Reader#accum. = blip_buf.reader_accum_cxx . . $ Blip_Buffer#reader_accum_.;
374 return blip_buf.bass_shift_cxx . . $ Blip_Buffer#bass_shift_.;
375 }
376
377 int const blip_max_lengthcxx . . $ blip_max_length. = 0;
378 int const blip_default_lengthcxx . . $ blip_default_length. = 250;
379
380 #endif