Notable differences from upstream:
* Did not use the same #include setup for the new byuu apu and instead chose to do things more traditionally, as the latter is also much easier to deal with in Visual Studio than just including .cpp files into other .cpp files...
* MSU1 support not included (I see no need for this in a plugin meant to be used for original SNES music).
* The dynamic rate control on the APU not included (I also see no need for it in this plugin).
* The extra resamplers I added in were removed as the original hermite resampler was folded into a single non-inhertiable resampler.
* Bits of cleanup.
| 1 | 1 |
deleted file mode 100644 |
| ... | ... |
@@ -1,125 +0,0 @@ |
| 1 |
-/* Simple resampler based on bsnes's ruby audio library */ |
|
| 2 |
- |
|
| 3 |
-#pragma once |
|
| 4 |
- |
|
| 5 |
-#include <cmath> |
|
| 6 |
-#include "resampler.h" |
|
| 7 |
- |
|
| 8 |
-class BsplineResampler : public Resampler |
|
| 9 |
-{
|
|
| 10 |
-protected: |
|
| 11 |
- double r_step; |
|
| 12 |
- double r_frac; |
|
| 13 |
- int r_left[6], r_right[6]; |
|
| 14 |
- |
|
| 15 |
- template<typename T1, typename T2> static T1 CLAMP(T1 x, T2 low, T2 high) { return x > high ? high : (x < low ? low : x); }
|
|
| 16 |
- template<typename T> static short SHORT_CLAMP(T n) { return static_cast<short>(CLAMP(n, -32768, 32767)); }
|
|
| 17 |
- |
|
| 18 |
- double bspline(double x, double a, double b, double c, double d, double e, double f) |
|
| 19 |
- {
|
|
| 20 |
- float ym2py2 = a + e, ym1py1 = b + d; |
|
| 21 |
- float y2mym2 = e - a, y1mym1 = d - b; |
|
| 22 |
- float sixthym1py1 = 1 / 6.0 * ym1py1; |
|
| 23 |
- float c0 = 1 / 120.0 * ym2py2 + 13 / 60.0 * ym1py1 + 0.55 * c; |
|
| 24 |
- float c1 = 1 / 24.0 * y2mym2 + 5 / 12.0 * y1mym1; |
|
| 25 |
- float c2 = 1 / 12.0 * ym2py2 + sixthym1py1 - 0.5 * c; |
|
| 26 |
- float c3 = 1 / 12.0 * y2mym2 - 1 / 6.0 * y1mym1; |
|
| 27 |
- float c4 = 1 / 24.0 * ym2py2 - sixthym1py1 + 0.25 * c; |
|
| 28 |
- float c5 = 1 / 120.0 * (f - a) + 1 / 24.0 * (b - e) + 1 / 12.0 * (d - c); |
|
| 29 |
- return ((((c5 * x + c4) * x + c3) * x + c2) * x + c1) * x + c0; |
|
| 30 |
- } |
|
| 31 |
- |
|
| 32 |
-public: |
|
| 33 |
- BsplineResampler(int num_samples) : Resampler(num_samples) |
|
| 34 |
- {
|
|
| 35 |
- this->clear(); |
|
| 36 |
- } |
|
| 37 |
- |
|
| 38 |
- void time_ratio(double ratio) |
|
| 39 |
- {
|
|
| 40 |
- this->r_step = ratio; |
|
| 41 |
- this->clear(); |
|
| 42 |
- } |
|
| 43 |
- |
|
| 44 |
- void clear() |
|
| 45 |
- {
|
|
| 46 |
- ring_buffer::clear(); |
|
| 47 |
- this->r_frac = 1.0; |
|
| 48 |
- this->r_left[0] = this->r_left[1] = this->r_left[2] = this->r_left[3] = this->r_left[4] = this->r_left[5] = 0; |
|
| 49 |
- this->r_right[0] = this->r_right[1] = this->r_right[2] = this->r_right[3] = this->r_right[4] = this->r_right[5] = 0; |
|
| 50 |
- } |
|
| 51 |
- |
|
| 52 |
- void read(short *data, int num_samples) |
|
| 53 |
- {
|
|
| 54 |
- int i_position = this->start >> 1; |
|
| 55 |
- short *internal_buffer = reinterpret_cast<short *>(&this->buffer[0]); |
|
| 56 |
- int o_position = 0; |
|
| 57 |
- int consumed = 0; |
|
| 58 |
- |
|
| 59 |
- while (o_position < num_samples && consumed < this->buffer_size) |
|
| 60 |
- {
|
|
| 61 |
- int s_left = internal_buffer[i_position]; |
|
| 62 |
- int s_right = internal_buffer[i_position + 1]; |
|
| 63 |
- int max_samples = this->buffer_size >> 1; |
|
| 64 |
- static const double margin_of_error = 1.0e-10; |
|
| 65 |
- |
|
| 66 |
- if (std::abs(this->r_step - 1.0) < margin_of_error) |
|
| 67 |
- {
|
|
| 68 |
- data[o_position] = static_cast<short>(s_left); |
|
| 69 |
- data[o_position + 1] = static_cast<short>(s_right); |
|
| 70 |
- |
|
| 71 |
- o_position += 2; |
|
| 72 |
- i_position += 2; |
|
| 73 |
- if (i_position >= max_samples) |
|
| 74 |
- i_position -= max_samples; |
|
| 75 |
- consumed += 2; |
|
| 76 |
- |
|
| 77 |
- continue; |
|
| 78 |
- } |
|
| 79 |
- |
|
| 80 |
- while (this->r_frac <= 1.0 && o_position < num_samples) |
|
| 81 |
- {
|
|
| 82 |
- data[o_position] = SHORT_CLAMP(bspline(this->r_frac, this->r_left[0], this->r_left[1], this->r_left[2], this->r_left[3], this->r_left[4], this->r_left[5])); |
|
| 83 |
- data[o_position + 1] = SHORT_CLAMP(bspline(this->r_frac, this->r_right[0], this->r_right[1], this->r_right[2], this->r_right[3], this->r_right[4], this->r_right[5])); |
|
| 84 |
- |
|
| 85 |
- o_position += 2; |
|
| 86 |
- |
|
| 87 |
- this->r_frac += this->r_step; |
|
| 88 |
- } |
|
| 89 |
- |
|
| 90 |
- if (this->r_frac > 1.0) |
|
| 91 |
- {
|
|
| 92 |
- this->r_left[0] = this->r_left[1]; |
|
| 93 |
- this->r_left[1] = this->r_left[2]; |
|
| 94 |
- this->r_left[2] = this->r_left[3]; |
|
| 95 |
- this->r_left[3] = this->r_left[4]; |
|
| 96 |
- this->r_left[4] = this->r_left[5]; |
|
| 97 |
- this->r_left[5] = s_left; |
|
| 98 |
- |
|
| 99 |
- this->r_right[0] = this->r_right[1]; |
|
| 100 |
- this->r_right[1] = this->r_right[2]; |
|
| 101 |
- this->r_right[2] = this->r_right[3]; |
|
| 102 |
- this->r_right[3] = this->r_right[4]; |
|
| 103 |
- this->r_right[4] = this->r_right[5]; |
|
| 104 |
- this->r_right[5] = s_right; |
|
| 105 |
- |
|
| 106 |
- this->r_frac -= 1.0; |
|
| 107 |
- |
|
| 108 |
- i_position += 2; |
|
| 109 |
- if (i_position >= max_samples) |
|
| 110 |
- i_position -= max_samples; |
|
| 111 |
- consumed += 2; |
|
| 112 |
- } |
|
| 113 |
- } |
|
| 114 |
- |
|
| 115 |
- this->size -= consumed << 1; |
|
| 116 |
- this->start += consumed << 1; |
|
| 117 |
- if (this->start >= this->buffer_size) |
|
| 118 |
- this->start -= this->buffer_size; |
|
| 119 |
- } |
|
| 120 |
- |
|
| 121 |
- int avail() |
|
| 122 |
- {
|
|
| 123 |
- return static_cast<int>(std::floor(((this->size >> 2) - this->r_frac) / this->r_step) * 2); |
|
| 124 |
- } |
|
| 125 |
-}; |
* [2SF] Used more up-to-date asmjit, despite the ugly looking code.
| ... | ... |
@@ -52,7 +52,7 @@ public: |
| 52 | 52 |
void read(short *data, int num_samples) |
| 53 | 53 |
{
|
| 54 | 54 |
int i_position = this->start >> 1; |
| 55 |
- short *internal_buffer = reinterpret_cast<short *>(this->buffer); |
|
| 55 |
+ short *internal_buffer = reinterpret_cast<short *>(&this->buffer[0]); |
|
| 56 | 56 |
int o_position = 0; |
| 57 | 57 |
int consumed = 0; |
| 58 | 58 |
|
| ... | ... |
@@ -1,7 +1,6 @@ |
| 1 | 1 |
/* Simple resampler based on bsnes's ruby audio library */ |
| 2 | 2 |
|
| 3 |
-#ifndef __BSPLINE_RESAMPLER_H |
|
| 4 |
-#define __BSPLINE_RESAMPLER_H |
|
| 3 |
+#pragma once |
|
| 5 | 4 |
|
| 6 | 5 |
#include <cmath> |
| 7 | 6 |
#include "resampler.h" |
| ... | ... |
@@ -124,5 +123,3 @@ public: |
| 124 | 123 |
return static_cast<int>(std::floor(((this->size >> 2) - this->r_frac) / this->r_step) * 2); |
| 125 | 124 |
} |
| 126 | 125 |
}; |
| 127 |
- |
|
| 128 |
-#endif /* __BSPLINE_RESAMPLER_H */ |
| ... | ... |
@@ -6,9 +6,6 @@ |
| 6 | 6 |
#include <cmath> |
| 7 | 7 |
#include "resampler.h" |
| 8 | 8 |
|
| 9 |
-#undef CLAMP |
|
| 10 |
-#undef SHORT_CLAMP |
|
| 11 |
- |
|
| 12 | 9 |
class BsplineResampler : public Resampler |
| 13 | 10 |
{
|
| 14 | 11 |
protected: |
| ... | ... |
@@ -47,7 +44,7 @@ public: |
| 47 | 44 |
|
| 48 | 45 |
void clear() |
| 49 | 46 |
{
|
| 50 |
- ring_buffer::clear (); |
|
| 47 |
+ ring_buffer::clear(); |
|
| 51 | 48 |
this->r_frac = 1.0; |
| 52 | 49 |
this->r_left[0] = this->r_left[1] = this->r_left[2] = this->r_left[3] = this->r_left[4] = this->r_left[5] = 0; |
| 53 | 50 |
this->r_right[0] = this->r_right[1] = this->r_right[2] = this->r_right[3] = this->r_right[4] = this->r_right[5] = 0; |
| ... | ... |
@@ -65,7 +62,7 @@ public: |
| 65 | 62 |
int s_left = internal_buffer[i_position]; |
| 66 | 63 |
int s_right = internal_buffer[i_position + 1]; |
| 67 | 64 |
int max_samples = this->buffer_size >> 1; |
| 68 |
- const double margin_of_error = 1.0e-10; |
|
| 65 |
+ static const double margin_of_error = 1.0e-10; |
|
| 69 | 66 |
|
| 70 | 67 |
if (std::abs(this->r_step - 1.0) < margin_of_error) |
| 71 | 68 |
{
|
| ... | ... |
@@ -122,7 +119,7 @@ public: |
| 122 | 119 |
this->start -= this->buffer_size; |
| 123 | 120 |
} |
| 124 | 121 |
|
| 125 |
- inline int avail() |
|
| 122 |
+ int avail() |
|
| 126 | 123 |
{
|
| 127 | 124 |
return static_cast<int>(std::floor(((this->size >> 2) - this->r_frac) / this->r_step) * 2); |
| 128 | 125 |
} |
| ... | ... |
@@ -8,8 +8,6 @@ |
| 8 | 8 |
|
| 9 | 9 |
#undef CLAMP |
| 10 | 10 |
#undef SHORT_CLAMP |
| 11 |
-template<typename T1, typename T2> static inline T1 CLAMP(T1 x, T2 low, T2 high) { return x > high ? high : (x < low ? low : x); }
|
|
| 12 |
-template<typename T> static inline short SHORT_CLAMP(T n) { return static_cast<short>(CLAMP(n, -32768, 32767)); }
|
|
| 13 | 11 |
|
| 14 | 12 |
class BsplineResampler : public Resampler |
| 15 | 13 |
{
|
| ... | ... |
@@ -18,6 +16,9 @@ protected: |
| 18 | 16 |
double r_frac; |
| 19 | 17 |
int r_left[6], r_right[6]; |
| 20 | 18 |
|
| 19 |
+ template<typename T1, typename T2> static T1 CLAMP(T1 x, T2 low, T2 high) { return x > high ? high : (x < low ? low : x); }
|
|
| 20 |
+ template<typename T> static short SHORT_CLAMP(T n) { return static_cast<short>(CLAMP(n, -32768, 32767)); }
|
|
| 21 |
+ |
|
| 21 | 22 |
double bspline(double x, double a, double b, double c, double d, double e, double f) |
| 22 | 23 |
{
|
| 23 | 24 |
float ym2py2 = a + e, ym1py1 = b + d; |
| ... | ... |
@@ -16,16 +16,20 @@ class BsplineResampler : public Resampler |
| 16 | 16 |
protected: |
| 17 | 17 |
double r_step; |
| 18 | 18 |
double r_frac; |
| 19 |
- int r_left[4], r_right[4]; |
|
| 19 |
+ int r_left[6], r_right[6]; |
|
| 20 | 20 |
|
| 21 |
- double bspline(double x, double a, double b, double c, double d) |
|
| 21 |
+ double bspline(double x, double a, double b, double c, double d, double e, double f) |
|
| 22 | 22 |
{
|
| 23 |
- double ym1py1 = a + c; |
|
| 24 |
- double c0 = 1 / 6.0 * ym1py1 + 2 / 3.0 * b; |
|
| 25 |
- double c1 = 0.5 * (c - a); |
|
| 26 |
- double c2 = 0.5 * ym1py1 - b; |
|
| 27 |
- double c3 = 0.5 * (b - c) + 1 / 6.0 * (d - a); |
|
| 28 |
- return ((c3 * x + c2) * x + c1) * x + c0; |
|
| 23 |
+ float ym2py2 = a + e, ym1py1 = b + d; |
|
| 24 |
+ float y2mym2 = e - a, y1mym1 = d - b; |
|
| 25 |
+ float sixthym1py1 = 1 / 6.0 * ym1py1; |
|
| 26 |
+ float c0 = 1 / 120.0 * ym2py2 + 13 / 60.0 * ym1py1 + 0.55 * c; |
|
| 27 |
+ float c1 = 1 / 24.0 * y2mym2 + 5 / 12.0 * y1mym1; |
|
| 28 |
+ float c2 = 1 / 12.0 * ym2py2 + sixthym1py1 - 0.5 * c; |
|
| 29 |
+ float c3 = 1 / 12.0 * y2mym2 - 1 / 6.0 * y1mym1; |
|
| 30 |
+ float c4 = 1 / 24.0 * ym2py2 - sixthym1py1 + 0.25 * c; |
|
| 31 |
+ float c5 = 1 / 120.0 * (f - a) + 1 / 24.0 * (b - e) + 1 / 12.0 * (d - c); |
|
| 32 |
+ return ((((c5 * x + c4) * x + c3) * x + c2) * x + c1) * x + c0; |
|
| 29 | 33 |
} |
| 30 | 34 |
|
| 31 | 35 |
public: |
| ... | ... |
@@ -44,8 +48,8 @@ public: |
| 44 | 48 |
{
|
| 45 | 49 |
ring_buffer::clear (); |
| 46 | 50 |
this->r_frac = 1.0; |
| 47 |
- this->r_left[0] = this->r_left[1] = this->r_left[2] = this->r_left[3] = 0; |
|
| 48 |
- this->r_right[0] = this->r_right[1] = this->r_right[2] = this->r_right[3] = 0; |
|
| 51 |
+ this->r_left[0] = this->r_left[1] = this->r_left[2] = this->r_left[3] = this->r_left[4] = this->r_left[5] = 0; |
|
| 52 |
+ this->r_right[0] = this->r_right[1] = this->r_right[2] = this->r_right[3] = this->r_right[4] = this->r_right[5] = 0; |
|
| 49 | 53 |
} |
| 50 | 54 |
|
| 51 | 55 |
void read(short *data, int num_samples) |
| ... | ... |
@@ -78,8 +82,8 @@ public: |
| 78 | 82 |
|
| 79 | 83 |
while (this->r_frac <= 1.0 && o_position < num_samples) |
| 80 | 84 |
{
|
| 81 |
- data[o_position] = SHORT_CLAMP(bspline(this->r_frac, this->r_left[0], this->r_left[1], this->r_left[2], this->r_left[3])); |
|
| 82 |
- data[o_position + 1] = SHORT_CLAMP(bspline(this->r_frac, this->r_right[0], this->r_right[1], this->r_right[2], this->r_right[3])); |
|
| 85 |
+ data[o_position] = SHORT_CLAMP(bspline(this->r_frac, this->r_left[0], this->r_left[1], this->r_left[2], this->r_left[3], this->r_left[4], this->r_left[5])); |
|
| 86 |
+ data[o_position + 1] = SHORT_CLAMP(bspline(this->r_frac, this->r_right[0], this->r_right[1], this->r_right[2], this->r_right[3], this->r_right[4], this->r_right[5])); |
|
| 83 | 87 |
|
| 84 | 88 |
o_position += 2; |
| 85 | 89 |
|
| ... | ... |
@@ -91,12 +95,16 @@ public: |
| 91 | 95 |
this->r_left[0] = this->r_left[1]; |
| 92 | 96 |
this->r_left[1] = this->r_left[2]; |
| 93 | 97 |
this->r_left[2] = this->r_left[3]; |
| 94 |
- this->r_left[3] = s_left; |
|
| 98 |
+ this->r_left[3] = this->r_left[4]; |
|
| 99 |
+ this->r_left[4] = this->r_left[5]; |
|
| 100 |
+ this->r_left[5] = s_left; |
|
| 95 | 101 |
|
| 96 | 102 |
this->r_right[0] = this->r_right[1]; |
| 97 | 103 |
this->r_right[1] = this->r_right[2]; |
| 98 | 104 |
this->r_right[2] = this->r_right[3]; |
| 99 |
- this->r_right[3] = s_right; |
|
| 105 |
+ this->r_right[3] = this->r_right[4]; |
|
| 106 |
+ this->r_right[4] = this->r_right[5]; |
|
| 107 |
+ this->r_right[5] = s_right; |
|
| 100 | 108 |
|
| 101 | 109 |
this->r_frac -= 1.0; |
| 102 | 110 |
|
| 1 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,122 @@ |
| 1 |
+/* Simple resampler based on bsnes's ruby audio library */ |
|
| 2 |
+ |
|
| 3 |
+#ifndef __BSPLINE_RESAMPLER_H |
|
| 4 |
+#define __BSPLINE_RESAMPLER_H |
|
| 5 |
+ |
|
| 6 |
+#include <cmath> |
|
| 7 |
+#include "resampler.h" |
|
| 8 |
+ |
|
| 9 |
+#undef CLAMP |
|
| 10 |
+#undef SHORT_CLAMP |
|
| 11 |
+template<typename T1, typename T2> static inline T1 CLAMP(T1 x, T2 low, T2 high) { return x > high ? high : (x < low ? low : x); }
|
|
| 12 |
+template<typename T> static inline short SHORT_CLAMP(T n) { return static_cast<short>(CLAMP(n, -32768, 32767)); }
|
|
| 13 |
+ |
|
| 14 |
+class BsplineResampler : public Resampler |
|
| 15 |
+{
|
|
| 16 |
+protected: |
|
| 17 |
+ double r_step; |
|
| 18 |
+ double r_frac; |
|
| 19 |
+ int r_left[4], r_right[4]; |
|
| 20 |
+ |
|
| 21 |
+ double bspline(double x, double a, double b, double c, double d) |
|
| 22 |
+ {
|
|
| 23 |
+ double ym1py1 = a + c; |
|
| 24 |
+ double c0 = 1 / 6.0 * ym1py1 + 2 / 3.0 * b; |
|
| 25 |
+ double c1 = 0.5 * (c - a); |
|
| 26 |
+ double c2 = 0.5 * ym1py1 - b; |
|
| 27 |
+ double c3 = 0.5 * (b - c) + 1 / 6.0 * (d - a); |
|
| 28 |
+ return ((c3 * x + c2) * x + c1) * x + c0; |
|
| 29 |
+ } |
|
| 30 |
+ |
|
| 31 |
+public: |
|
| 32 |
+ BsplineResampler(int num_samples) : Resampler(num_samples) |
|
| 33 |
+ {
|
|
| 34 |
+ this->clear(); |
|
| 35 |
+ } |
|
| 36 |
+ |
|
| 37 |
+ void time_ratio(double ratio) |
|
| 38 |
+ {
|
|
| 39 |
+ this->r_step = ratio; |
|
| 40 |
+ this->clear(); |
|
| 41 |
+ } |
|
| 42 |
+ |
|
| 43 |
+ void clear() |
|
| 44 |
+ {
|
|
| 45 |
+ ring_buffer::clear (); |
|
| 46 |
+ this->r_frac = 1.0; |
|
| 47 |
+ this->r_left[0] = this->r_left[1] = this->r_left[2] = this->r_left[3] = 0; |
|
| 48 |
+ this->r_right[0] = this->r_right[1] = this->r_right[2] = this->r_right[3] = 0; |
|
| 49 |
+ } |
|
| 50 |
+ |
|
| 51 |
+ void read(short *data, int num_samples) |
|
| 52 |
+ {
|
|
| 53 |
+ int i_position = this->start >> 1; |
|
| 54 |
+ short *internal_buffer = reinterpret_cast<short *>(this->buffer); |
|
| 55 |
+ int o_position = 0; |
|
| 56 |
+ int consumed = 0; |
|
| 57 |
+ |
|
| 58 |
+ while (o_position < num_samples && consumed < this->buffer_size) |
|
| 59 |
+ {
|
|
| 60 |
+ int s_left = internal_buffer[i_position]; |
|
| 61 |
+ int s_right = internal_buffer[i_position + 1]; |
|
| 62 |
+ int max_samples = this->buffer_size >> 1; |
|
| 63 |
+ const double margin_of_error = 1.0e-10; |
|
| 64 |
+ |
|
| 65 |
+ if (std::abs(this->r_step - 1.0) < margin_of_error) |
|
| 66 |
+ {
|
|
| 67 |
+ data[o_position] = static_cast<short>(s_left); |
|
| 68 |
+ data[o_position + 1] = static_cast<short>(s_right); |
|
| 69 |
+ |
|
| 70 |
+ o_position += 2; |
|
| 71 |
+ i_position += 2; |
|
| 72 |
+ if (i_position >= max_samples) |
|
| 73 |
+ i_position -= max_samples; |
|
| 74 |
+ consumed += 2; |
|
| 75 |
+ |
|
| 76 |
+ continue; |
|
| 77 |
+ } |
|
| 78 |
+ |
|
| 79 |
+ while (this->r_frac <= 1.0 && o_position < num_samples) |
|
| 80 |
+ {
|
|
| 81 |
+ data[o_position] = SHORT_CLAMP(bspline(this->r_frac, this->r_left[0], this->r_left[1], this->r_left[2], this->r_left[3])); |
|
| 82 |
+ data[o_position + 1] = SHORT_CLAMP(bspline(this->r_frac, this->r_right[0], this->r_right[1], this->r_right[2], this->r_right[3])); |
|
| 83 |
+ |
|
| 84 |
+ o_position += 2; |
|
| 85 |
+ |
|
| 86 |
+ this->r_frac += this->r_step; |
|
| 87 |
+ } |
|
| 88 |
+ |
|
| 89 |
+ if (this->r_frac > 1.0) |
|
| 90 |
+ {
|
|
| 91 |
+ this->r_left[0] = this->r_left[1]; |
|
| 92 |
+ this->r_left[1] = this->r_left[2]; |
|
| 93 |
+ this->r_left[2] = this->r_left[3]; |
|
| 94 |
+ this->r_left[3] = s_left; |
|
| 95 |
+ |
|
| 96 |
+ this->r_right[0] = this->r_right[1]; |
|
| 97 |
+ this->r_right[1] = this->r_right[2]; |
|
| 98 |
+ this->r_right[2] = this->r_right[3]; |
|
| 99 |
+ this->r_right[3] = s_right; |
|
| 100 |
+ |
|
| 101 |
+ this->r_frac -= 1.0; |
|
| 102 |
+ |
|
| 103 |
+ i_position += 2; |
|
| 104 |
+ if (i_position >= max_samples) |
|
| 105 |
+ i_position -= max_samples; |
|
| 106 |
+ consumed += 2; |
|
| 107 |
+ } |
|
| 108 |
+ } |
|
| 109 |
+ |
|
| 110 |
+ this->size -= consumed << 1; |
|
| 111 |
+ this->start += consumed << 1; |
|
| 112 |
+ if (this->start >= this->buffer_size) |
|
| 113 |
+ this->start -= this->buffer_size; |
|
| 114 |
+ } |
|
| 115 |
+ |
|
| 116 |
+ inline int avail() |
|
| 117 |
+ {
|
|
| 118 |
+ return static_cast<int>(std::floor(((this->size >> 2) - this->r_frac) / this->r_step) * 2); |
|
| 119 |
+ } |
|
| 120 |
+}; |
|
| 121 |
+ |
|
| 122 |
+#endif /* __BSPLINE_RESAMPLER_H */ |