Browse code

update for C++17 compliance, update to latest 2sf, add WINE cross-compile makefiles

Adam Higerd authored on 2021/02/11 15:36:17
Showing 1 changed files
1 1
deleted file mode 100644
... ...
@@ -1,142 +0,0 @@
1
-////////////////////////////////////////////////////////////////////////////////
2
-///
3
-/// Sample rate transposer. Changes sample rate by using linear interpolation
4
-/// together with anti-alias filtering (first order interpolation with anti-
5
-/// alias filtering should be quite adequate for this application).
6
-///
7
-/// Use either of the derived classes of 'RateTransposerInteger' or
8
-/// 'RateTransposerFloat' for corresponding integer/floating point tranposing
9
-/// algorithm implementation.
10
-///
11
-/// Author        : Copyright (c) Olli Parviainen
12
-/// Author e-mail : oparviai 'at' iki.fi
13
-/// SoundTouch WWW: http://www.surina.net/soundtouch
14
-///
15
-////////////////////////////////////////////////////////////////////////////////
16
-//
17
-// Last changed  : $Date: 2009-02-21 13:00:14 -0300 (s�b, 21 fev 2009) $
18
-// File revision : $Revision: 4 $
19
-//
20
-// $Id: RateTransposer.h 63 2009-02-21 16:00:14Z oparviai $
21
-//
22
-////////////////////////////////////////////////////////////////////////////////
23
-//
24
-// License :
25
-//
26
-//  SoundTouch audio processing library
27
-//  Copyright (c) Olli Parviainen
28
-//
29
-//  This library is free software; you can redistribute it and/or
30
-//  modify it under the terms of the GNU Lesser General Public
31
-//  License as published by the Free Software Foundation; either
32
-//  version 2.1 of the License, or (at your option) any later version.
33
-//
34
-//  This library is distributed in the hope that it will be useful,
35
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
36
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
37
-//  Lesser General Public License for more details.
38
-//
39
-//  You should have received a copy of the GNU Lesser General Public
40
-//  License along with this library; if not, write to the Free Software
41
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
42
-//
43
-////////////////////////////////////////////////////////////////////////////////
44
-
45
-#pragma once
46
-
47
-#include "AAFilter.h"
48
-#include "FIFOSampleBuffer.h"
49
-
50
-namespace soundtouch
51
-{
52
-
53
-/// A common linear samplerate transposer class.
54
-///
55
-/// Note: Use function "RateTransposer::newInstance()" to create a new class
56
-/// instance instead of the "new" operator; that function automatically
57
-/// chooses a correct implementation depending on if integer or floating
58
-/// arithmetics are to be used.
59
-class RateTransposer : public FIFOProcessor
60
-{
61
-protected:
62
-	/// Anti-alias filter object
63
-	std::unique_ptr<AAFilter> pAAFilter;
64
-
65
-	float fRate;
66
-
67
-	int32_t numChannels;
68
-
69
-	/// Buffer for collecting samples to feed the anti-alias filter between
70
-	/// two batches
71
-	FIFOSampleBuffer storeBuffer;
72
-
73
-	/// Buffer for keeping samples between transposing & anti-alias filter
74
-	FIFOSampleBuffer tempBuffer;
75
-
76
-	/// Output sample buffer
77
-	FIFOSampleBuffer outputBuffer;
78
-
79
-	bool bUseAAFilter;
80
-
81
-	virtual void resetRegisters() = 0;
82
-
83
-	virtual uint32_t transposeStereo(SAMPLETYPE *dest, const SAMPLETYPE *src, uint32_t numSamples) = 0;
84
-	virtual uint32_t transposeMono(SAMPLETYPE *dest, const SAMPLETYPE *src, uint32_t numSamples) = 0;
85
-	uint32_t transpose(SAMPLETYPE *dest, const SAMPLETYPE *src, uint32_t numSamples);
86
-
87
-	void downsample(const SAMPLETYPE *src, uint32_t numSamples);
88
-	void upsample(const SAMPLETYPE *src, uint32_t numSamples);
89
-
90
-	/// Transposes sample rate by applying anti-alias filter to prevent folding.
91
-	/// Returns amount of samples returned in the "dest" buffer.
92
-	/// The maximum amount of samples that can be returned at a time is set by
93
-	/// the 'set_returnBuffer_size' function.
94
-	void processSamples(const SAMPLETYPE *src, uint32_t numSamples);
95
-
96
-public:
97
-	RateTransposer();
98
-	virtual ~RateTransposer();
99
-
100
-	/// Operator 'new' is overloaded so that it automatically creates a suitable instance
101
-	/// depending on if we're to use integer or floating point arithmetics.
102
-	static void *operator new(size_t s);
103
-
104
-	/// Use this function instead of "new" operator to create a new instance of this class.
105
-	/// This function automatically chooses a correct implementation, depending on if
106
-	/// integer ot floating point arithmetics are to be used.
107
-	static RateTransposer *newInstance();
108
-
109
-	/// Returns the output buffer object
110
-	FIFOSamplePipe *getOutput() { return &this->outputBuffer; }
111
-
112
-	/// Returns the store buffer object
113
-	FIFOSamplePipe *getStore() { return &this->storeBuffer; }
114
-
115
-	/// Return anti-alias filter object
116
-	AAFilter *getAAFilter();
117
-
118
-	/// Enables/disables the anti-alias filter. Zero to disable, nonzero to enable
119
-	void enableAAFilter(bool newMode);
120
-
121
-	/// Returns nonzero if anti-alias filter is enabled.
122
-	bool isAAFilterEnabled() const;
123
-
124
-	/// Sets new target rate. Normal rate = 1.0, smaller values represent slower
125
-	/// rate, larger faster rates.
126
-	virtual void setRate(float newRate);
127
-
128
-	/// Sets the number of channels, 1 = mono, 2 = stereo
129
-	void setChannels(int32_t channels);
130
-
131
-	/// Adds 'numSamples' pcs of samples from the 'samples' memory position into
132
-	/// the input of the object.
133
-	void putSamples(const SAMPLETYPE *samples, uint32_t numSamples);
134
-
135
-	/// Clears all the samples in the object
136
-	void clear();
137
-
138
-	/// Returns nonzero if there aren't any samples available for outputting.
139
-	bool isEmpty() const;
140
-};
141
-
142
-}
Browse code

Use #pragma once instead of include guards.

Naram Qashat authored on 2014/09/08 14:47:36
Showing 1 changed files
... ...
@@ -42,8 +42,7 @@
42 42
 //
43 43
 ////////////////////////////////////////////////////////////////////////////////
44 44
 
45
-#ifndef RateTransposer_H
46
-#define RateTransposer_H
45
+#pragma once
47 46
 
48 47
 #include "AAFilter.h"
49 48
 #include "FIFOSampleBuffer.h"
... ...
@@ -141,5 +140,3 @@ public:
141 140
 };
142 141
 
143 142
 }
144
-
145
-#endif
Browse code

Some more code cleanup in DeSmuME.

Naram Qashat authored on 2013/04/23 00:07:41
Showing 1 changed files
... ...
@@ -46,7 +46,6 @@
46 46
 #define RateTransposer_H
47 47
 
48 48
 #include "AAFilter.h"
49
-#include "FIFOSamplePipe.h"
50 49
 #include "FIFOSampleBuffer.h"
51 50
 
52 51
 namespace soundtouch
Browse code

Updating in_2sf to use a newish version of DeSmuME, 0.9.9 from SVN. Somewhat cleaned up as well, but not everything because it's a pain in the ass.

Naram Qashat authored on 2013/04/18 17:22:55
Showing 1 changed files
... ...
@@ -14,10 +14,10 @@
14 14
 ///
15 15
 ////////////////////////////////////////////////////////////////////////////////
16 16
 //
17
-// Last changed  : $Date: 2006/02/05 16:44:06 $
18
-// File revision : $Revision: 1.10 $
17
+// Last changed  : $Date: 2009-02-21 13:00:14 -0300 (s�b, 21 fev 2009) $
18
+// File revision : $Revision: 4 $
19 19
 //
20
-// $Id: RateTransposer.h,v 1.10 2006/02/05 16:44:06 Olli Exp $
20
+// $Id: RateTransposer.h 63 2009-02-21 16:00:14Z oparviai $
21 21
 //
22 22
 ////////////////////////////////////////////////////////////////////////////////
23 23
 //
... ...
@@ -49,8 +49,6 @@
49 49
 #include "FIFOSamplePipe.h"
50 50
 #include "FIFOSampleBuffer.h"
51 51
 
52
-#include "STTypes.h"
53
-
54 52
 namespace soundtouch
55 53
 {
56 54
 
... ...
@@ -64,11 +62,11 @@ class RateTransposer : public FIFOProcessor
64 62
 {
65 63
 protected:
66 64
 	/// Anti-alias filter object
67
-	AAFilter *pAAFilter;
65
+	std::unique_ptr<AAFilter> pAAFilter;
68 66
 
69 67
 	float fRate;
70 68
 
71
-	uint32_t uChannels;
69
+	int32_t numChannels;
72 70
 
73 71
 	/// Buffer for collecting samples to feed the anti-alias filter between
74 72
 	/// two batches
... ...
@@ -82,16 +80,12 @@ protected:
82 80
 
83 81
 	bool bUseAAFilter;
84 82
 
85
-	void init();
86
-
87 83
 	virtual void resetRegisters() = 0;
88 84
 
89 85
 	virtual uint32_t transposeStereo(SAMPLETYPE *dest, const SAMPLETYPE *src, uint32_t numSamples) = 0;
90 86
 	virtual uint32_t transposeMono(SAMPLETYPE *dest, const SAMPLETYPE *src, uint32_t numSamples) = 0;
91 87
 	uint32_t transpose(SAMPLETYPE *dest, const SAMPLETYPE *src, uint32_t numSamples);
92 88
 
93
-	void flushStoreBuffer();
94
-
95 89
 	void downsample(const SAMPLETYPE *src, uint32_t numSamples);
96 90
 	void upsample(const SAMPLETYPE *src, uint32_t numSamples);
97 91
 
... ...
@@ -107,7 +101,7 @@ public:
107 101
 
108 102
 	/// Operator 'new' is overloaded so that it automatically creates a suitable instance
109 103
 	/// depending on if we're to use integer or floating point arithmetics.
110
-	void *operator new(size_t s);
104
+	static void *operator new(size_t s);
111 105
 
112 106
 	/// Use this function instead of "new" operator to create a new instance of this class.
113 107
 	/// This function automatically chooses a correct implementation, depending on if
... ...
@@ -115,13 +109,13 @@ public:
115 109
 	static RateTransposer *newInstance();
116 110
 
117 111
 	/// Returns the output buffer object
118
-	FIFOSamplePipe *getOutput() { return &outputBuffer; };
112
+	FIFOSamplePipe *getOutput() { return &this->outputBuffer; }
119 113
 
120 114
 	/// Returns the store buffer object
121
-	FIFOSamplePipe *getStore() { return &storeBuffer; };
115
+	FIFOSamplePipe *getStore() { return &this->storeBuffer; }
122 116
 
123 117
 	/// Return anti-alias filter object
124
-	AAFilter *getAAFilter() const;
118
+	AAFilter *getAAFilter();
125 119
 
126 120
 	/// Enables/disables the anti-alias filter. Zero to disable, nonzero to enable
127 121
 	void enableAAFilter(bool newMode);
... ...
@@ -134,7 +128,7 @@ public:
134 128
 	virtual void setRate(float newRate);
135 129
 
136 130
 	/// Sets the number of channels, 1 = mono, 2 = stereo
137
-	void setChannels(uint32_t channels);
131
+	void setChannels(int32_t channels);
138 132
 
139 133
 	/// Adds 'numSamples' pcs of samples from the 'samples' memory position into
140 134
 	/// the input of the object.
Browse code

Import actual code.

Naram Qashat authored on 2013/03/26 02:41:19
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,152 @@
1
+////////////////////////////////////////////////////////////////////////////////
2
+///
3
+/// Sample rate transposer. Changes sample rate by using linear interpolation
4
+/// together with anti-alias filtering (first order interpolation with anti-
5
+/// alias filtering should be quite adequate for this application).
6
+///
7
+/// Use either of the derived classes of 'RateTransposerInteger' or
8
+/// 'RateTransposerFloat' for corresponding integer/floating point tranposing
9
+/// algorithm implementation.
10
+///
11
+/// Author        : Copyright (c) Olli Parviainen
12
+/// Author e-mail : oparviai 'at' iki.fi
13
+/// SoundTouch WWW: http://www.surina.net/soundtouch
14
+///
15
+////////////////////////////////////////////////////////////////////////////////
16
+//
17
+// Last changed  : $Date: 2006/02/05 16:44:06 $
18
+// File revision : $Revision: 1.10 $
19
+//
20
+// $Id: RateTransposer.h,v 1.10 2006/02/05 16:44:06 Olli Exp $
21
+//
22
+////////////////////////////////////////////////////////////////////////////////
23
+//
24
+// License :
25
+//
26
+//  SoundTouch audio processing library
27
+//  Copyright (c) Olli Parviainen
28
+//
29
+//  This library is free software; you can redistribute it and/or
30
+//  modify it under the terms of the GNU Lesser General Public
31
+//  License as published by the Free Software Foundation; either
32
+//  version 2.1 of the License, or (at your option) any later version.
33
+//
34
+//  This library is distributed in the hope that it will be useful,
35
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
36
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
37
+//  Lesser General Public License for more details.
38
+//
39
+//  You should have received a copy of the GNU Lesser General Public
40
+//  License along with this library; if not, write to the Free Software
41
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
42
+//
43
+////////////////////////////////////////////////////////////////////////////////
44
+
45
+#ifndef RateTransposer_H
46
+#define RateTransposer_H
47
+
48
+#include "AAFilter.h"
49
+#include "FIFOSamplePipe.h"
50
+#include "FIFOSampleBuffer.h"
51
+
52
+#include "STTypes.h"
53
+
54
+namespace soundtouch
55
+{
56
+
57
+/// A common linear samplerate transposer class.
58
+///
59
+/// Note: Use function "RateTransposer::newInstance()" to create a new class
60
+/// instance instead of the "new" operator; that function automatically
61
+/// chooses a correct implementation depending on if integer or floating
62
+/// arithmetics are to be used.
63
+class RateTransposer : public FIFOProcessor
64
+{
65
+protected:
66
+	/// Anti-alias filter object
67
+	AAFilter *pAAFilter;
68
+
69
+	float fRate;
70
+
71
+	uint32_t uChannels;
72
+
73
+	/// Buffer for collecting samples to feed the anti-alias filter between
74
+	/// two batches
75
+	FIFOSampleBuffer storeBuffer;
76
+
77
+	/// Buffer for keeping samples between transposing & anti-alias filter
78
+	FIFOSampleBuffer tempBuffer;
79
+
80
+	/// Output sample buffer
81
+	FIFOSampleBuffer outputBuffer;
82
+
83
+	bool bUseAAFilter;
84
+
85
+	void init();
86
+
87
+	virtual void resetRegisters() = 0;
88
+
89
+	virtual uint32_t transposeStereo(SAMPLETYPE *dest, const SAMPLETYPE *src, uint32_t numSamples) = 0;
90
+	virtual uint32_t transposeMono(SAMPLETYPE *dest, const SAMPLETYPE *src, uint32_t numSamples) = 0;
91
+	uint32_t transpose(SAMPLETYPE *dest, const SAMPLETYPE *src, uint32_t numSamples);
92
+
93
+	void flushStoreBuffer();
94
+
95
+	void downsample(const SAMPLETYPE *src, uint32_t numSamples);
96
+	void upsample(const SAMPLETYPE *src, uint32_t numSamples);
97
+
98
+	/// Transposes sample rate by applying anti-alias filter to prevent folding.
99
+	/// Returns amount of samples returned in the "dest" buffer.
100
+	/// The maximum amount of samples that can be returned at a time is set by
101
+	/// the 'set_returnBuffer_size' function.
102
+	void processSamples(const SAMPLETYPE *src, uint32_t numSamples);
103
+
104
+public:
105
+	RateTransposer();
106
+	virtual ~RateTransposer();
107
+
108
+	/// Operator 'new' is overloaded so that it automatically creates a suitable instance
109
+	/// depending on if we're to use integer or floating point arithmetics.
110
+	void *operator new(size_t s);
111
+
112
+	/// Use this function instead of "new" operator to create a new instance of this class.
113
+	/// This function automatically chooses a correct implementation, depending on if
114
+	/// integer ot floating point arithmetics are to be used.
115
+	static RateTransposer *newInstance();
116
+
117
+	/// Returns the output buffer object
118
+	FIFOSamplePipe *getOutput() { return &outputBuffer; };
119
+
120
+	/// Returns the store buffer object
121
+	FIFOSamplePipe *getStore() { return &storeBuffer; };
122
+
123
+	/// Return anti-alias filter object
124
+	AAFilter *getAAFilter() const;
125
+
126
+	/// Enables/disables the anti-alias filter. Zero to disable, nonzero to enable
127
+	void enableAAFilter(bool newMode);
128
+
129
+	/// Returns nonzero if anti-alias filter is enabled.
130
+	bool isAAFilterEnabled() const;
131
+
132
+	/// Sets new target rate. Normal rate = 1.0, smaller values represent slower
133
+	/// rate, larger faster rates.
134
+	virtual void setRate(float newRate);
135
+
136
+	/// Sets the number of channels, 1 = mono, 2 = stereo
137
+	void setChannels(uint32_t channels);
138
+
139
+	/// Adds 'numSamples' pcs of samples from the 'samples' memory position into
140
+	/// the input of the object.
141
+	void putSamples(const SAMPLETYPE *samples, uint32_t numSamples);
142
+
143
+	/// Clears all the samples in the object
144
+	void clear();
145
+
146
+	/// Returns nonzero if there aren't any samples available for outputting.
147
+	bool isEmpty() const;
148
+};
149
+
150
+}
151
+
152
+#endif