mirror of https://github.com/snes9xgit/snes9x.git
Backport Hermite Resampler bypass code from Libretro version
This commit is contained in:
parent
e4f1a75279
commit
412c655432
|
@ -66,6 +66,13 @@ class HermiteResampler : public Resampler
|
|||
void
|
||||
read (short *data, int num_samples)
|
||||
{
|
||||
//If we are outputting the exact same ratio as the input, pull directly from the input buffer
|
||||
if (r_step == 1.0)
|
||||
{
|
||||
ring_buffer::pull((unsigned char*)data, num_samples * sizeof(short));
|
||||
return;
|
||||
}
|
||||
|
||||
assert((num_samples & 1) == 0); // resampler always processes both stereo samples
|
||||
int i_position = start >> 1;
|
||||
int max_samples = buffer_size >> 1;
|
||||
|
@ -121,6 +128,12 @@ class HermiteResampler : public Resampler
|
|||
inline int
|
||||
avail (void)
|
||||
{
|
||||
//If we are outputting the exact same ratio as the input, find out directly from the input buffer
|
||||
if (r_step == 1.0)
|
||||
{
|
||||
return (ring_buffer::space_filled() + sizeof(short) - 1) / sizeof(short);
|
||||
}
|
||||
|
||||
return (int) floor (((size >> 2) - r_frac) / r_step) * 2;
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue