ref: e582ae7b30841736fb90deb7791ee9227dac1617
parent: 5ccd729ea5a67c3c80fe3b117d4bd58c58226745
author: Olav Sørensen <olav.sorensen@live.no>
date: Thu Sep 23 15:24:18 EDT 2021
Cleanup
--- a/src/pt2_audio.c
+++ b/src/pt2_audio.c
@@ -1,5 +1,3 @@
-// the audio filters and BLEP synthesis were coded by aciddose
-
// for finding memory leaks in debug mode with Visual Studio
#if defined _DEBUG && defined _MSC_VER
#include <crtdbg.h>
@@ -35,7 +33,7 @@
#include "pt2_structs.h"
#include "pt2_rcfilter.h"
#include "pt2_ledfilter.h"
-#include "pt2_downsamplers2x.h"
+#include "pt2_downsample2x.h"
#define STEREO_NORM_FACTOR 0.5 /* cumulative mid/side normalization factor (1/sqrt(2))*(1/sqrt(2)) */
@@ -680,7 +678,6 @@
CLAMP16(smp32);
out[1] = (int16_t)smp32;
}
-
static inline void processMixedSamplesAmigaPanning_2x(int32_t i, int16_t *out) // 2x oversampling
{
--- a/src/pt2_blep.c
+++ b/src/pt2_blep.c
@@ -107,25 +107,6 @@
b->samplesLeft = BLEP_NS;
}
-/* 8bitbubsy: simplified, faster version of blepAdd for blep'ing voice volume.
-** Result is identical! (confirmed with binary comparison w/ MOD2WAV)
-*/
-void blepVolAdd(blep_t *b, double dAmplitude)
-{
- const double *dBlepSrc = get_minblep_table();
-
- int32_t i = b->index;
- for (int32_t n = 0; n < BLEP_NS; n++)
- {
- b->dBuffer[i] += dAmplitude * (*dBlepSrc);
- dBlepSrc += BLEP_SP;
-
- i = (i + 1) & BLEP_RNS;
- }
-
- b->samplesLeft = BLEP_NS;
-}
-
double blepRun(blep_t *b, double dInput)
{
double dBlepOutput = dInput + b->dBuffer[b->index];
--- a/src/pt2_blep.h
+++ b/src/pt2_blep.h
@@ -32,5 +32,4 @@
} blep_t;
void blepAdd(blep_t *b, double dOffset, double dAmplitude);
-void blepVolAdd(blep_t *b, double dAmplitude);
double blepRun(blep_t *b, double dInput);
--- a/src/pt2_chordmaker.c
+++ b/src/pt2_chordmaker.c
@@ -16,7 +16,7 @@
#include "pt2_sampler.h"
#include "pt2_audio.h"
#include "pt2_blep.h"
-#include "pt2_downsamplers2x.h"
+#include "pt2_downsample2x.h"
#define MAX_NOTES 4
--- /dev/null
+++ b/src/pt2_downsample2x.h
@@ -1,0 +1,19 @@
+#pragma once
+
+#include <stdint.h>
+
+// reserved for main audio channel mixer, PAT2SMP and MOD2WAV
+void clearMixerDownsamplerStates(void);
+double decimate2x_L(double x0, double x1);
+double decimate2x_R(double x0, double x1);
+// --------------------------------------
+
+// Warning: These can exceed -1.0 .. 1.0 because of undershoot/overshoot!
+void downsample2xFloat(float *buffer, uint32_t originalLength);
+void downsample2xDouble(double *buffer, uint32_t originalLength);
+
+// Warning: These are slow and use normalization to prevent clipping from undershoot/overshoot!
+void downsample2x8Bit(int8_t *buffer, uint32_t originalLength);
+void downsample2x8BitU(uint8_t *buffer, uint32_t originalLength);
+void downsample2x16Bit(int16_t *buffer, uint32_t originalLength);
+void downsample2x32Bit(int32_t *buffer, uint32_t originalLength);
--- a/src/pt2_downsamplers2x.h
+++ /dev/null
@@ -1,19 +1,0 @@
-#pragma once
-
-#include <stdint.h>
-
-// reserved for main audio channel mixer, PAT2SMP and MOD2WAV
-void clearMixerDownsamplerStates(void);
-double decimate2x_L(double x0, double x1);
-double decimate2x_R(double x0, double x1);
-// --------------------------------------
-
-// Warning: These can exceed -1.0 .. 1.0 because of undershoot/overshoot!
-void downsample2xFloat(float *buffer, uint32_t originalLength);
-void downsample2xDouble(double *buffer, uint32_t originalLength);
-
-// Warning: These are slow and use normalization to prevent clipping from undershoot/overshoot!
-void downsample2x8Bit(int8_t *buffer, uint32_t originalLength);
-void downsample2x8BitU(uint8_t *buffer, uint32_t originalLength);
-void downsample2x16Bit(int16_t *buffer, uint32_t originalLength);
-void downsample2x32Bit(int32_t *buffer, uint32_t originalLength);
--- a/src/pt2_mod2wav.c
+++ b/src/pt2_mod2wav.c
@@ -14,7 +14,7 @@
#include "pt2_visuals.h"
#include "pt2_mod2wav.h"
#include "pt2_structs.h"
-#include "pt2_downsamplers2x.h"
+#include "pt2_downsample2x.h"
#define TICKS_PER_RENDER_CHUNK 64
--- a/src/pt2_pat2smp.c
+++ b/src/pt2_pat2smp.c
@@ -14,7 +14,7 @@
#include "pt2_textout.h"
#include "pt2_rcfilter.h"
#include "pt2_pat2smp.h"
-#include "pt2_downsamplers2x.h"
+#include "pt2_downsample2x.h"
bool intMusic(void); // pt2_replayer.c
void storeTempVariables(void); // pt2_replayer.c
--- a/src/pt2_sample_loader.c
+++ b/src/pt2_sample_loader.c
@@ -18,7 +18,7 @@
#include "pt2_unicode.h"
#include "pt2_config.h"
#include "pt2_sampling.h"
-#include "pt2_downsamplers2x.h"
+#include "pt2_downsample2x.h"
enum
{
--- a/vs2019_project/pt2-clone/pt2-clone.vcxproj
+++ b/vs2019_project/pt2-clone/pt2-clone.vcxproj
@@ -257,7 +257,7 @@
<ClInclude Include="..\..\src\pt2_pat2smp.h" />
<ClInclude Include="..\..\src\pt2_pattern_viewer.h" />
<ClInclude Include="..\..\src\pt2_rcfilter.h" />
- <ClInclude Include="..\..\src\pt2_downsamplers2x.h" />
+ <ClInclude Include="..\..\src\pt2_downsample2x.h" />
<ClInclude Include="..\..\src\pt2_sample_loader.h" />
<ClInclude Include="..\..\src\pt2_sampler.h" />
<ClInclude Include="..\..\src\pt2_sample_saver.h" />
--- a/vs2019_project/pt2-clone/pt2-clone.vcxproj.filters
+++ b/vs2019_project/pt2-clone/pt2-clone.vcxproj.filters
@@ -99,7 +99,7 @@
<ClInclude Include="..\..\src\pt2_chordmaker.h">
<Filter>headers</Filter>
</ClInclude>
- <ClInclude Include="..\..\src\pt2_downsamplers2x.h">
+ <ClInclude Include="..\..\src\pt2_downsample2x.h">
<Filter>headers</Filter>
</ClInclude>
<ClInclude Include="..\..\src\pt2_math.h">