|
25 | 25 | #define PLOSSFAC ((BUFFER_FRAMES) / 64) |
26 | 26 |
|
27 | 27 | enum samplesize { |
28 | | - SIZE_8, SIZE_16 |
| 28 | + SIZE_8, SIZE_16, SIZE_32 |
29 | 29 | }; |
30 | 30 |
|
31 | 31 | static snd_pcm_t * scope_pcm; |
@@ -60,6 +60,7 @@ static int dotimeout; |
60 | 60 | static oscore_task scope_task; |
61 | 61 |
|
62 | 62 | #define SM_ALGORITHM(sample, shr, sub) (((byte) (sample >> shr)) - sub) |
| 63 | +#define SM_ALGORITHM_SCALE(sample, scale, sub) (((byte) ((float) sample * (scale))) - sub) |
63 | 64 | #define LD_ALGORITHM(typ, shr, sub) \ |
64 | 65 | for (int indx = 0; indx < BUFFER_FRAMES; indx++) { \ |
65 | 66 | typ sampleA = ((typ *) bufferA)[indx * (sf_2c ? 2 : 1)]; \ |
@@ -120,6 +121,12 @@ static void * thread_func(void * ign) { |
120 | 121 | } else { |
121 | 122 | LD_ALGORITHM(byte, 0, 0x80); |
122 | 123 | } |
| 124 | + } else if (sf_sampsize == SIZE_32) { |
| 125 | + if (sf_us) { |
| 126 | + LD_ALGORITHM(unsigned int, 24, 0); |
| 127 | + } else { |
| 128 | + LD_ALGORITHM(unsigned int, 24, 0x80); |
| 129 | + } |
123 | 130 | } |
124 | 131 | // This actually connects it all together |
125 | 132 | for (int i = 0; i < frames; i++) { |
@@ -284,6 +291,9 @@ int init(int modulen, char* argstr) { |
284 | 291 | case SIZE_16: |
285 | 292 | bytesPerSample = 2; |
286 | 293 | break; |
| 294 | + case SIZE_32: |
| 295 | + bytesPerSample = 4; |
| 296 | + break; |
287 | 297 | } |
288 | 298 |
|
289 | 299 | bufferA = malloc(BUFFER_FRAMES * (sf_2c ? 2 : 1) * bytesPerSample); |
|
0 commit comments