WaveSwissKnife 0.2.0.20120302
Sign up to get free protection for your applications and to get access to all the features.
- data/AUTHORS +4 -0
- data/ChangeLog +31 -0
- data/Credits +3 -0
- data/LICENSE +31 -0
- data/README +15 -0
- data/ReleaseInfo +8 -0
- data/bin/WSK.rb +14 -0
- data/ext/WSK/AnalyzeUtils/AnalyzeUtils.c +272 -0
- data/ext/WSK/AnalyzeUtils/extconf.rb +7 -0
- data/ext/WSK/ArithmUtils/ArithmUtils.c +862 -0
- data/ext/WSK/ArithmUtils/extconf.rb +15 -0
- data/ext/WSK/CommonBuild.rb +29 -0
- data/ext/WSK/FFTUtils/FFTUtils.c +662 -0
- data/ext/WSK/FFTUtils/extconf.rb +15 -0
- data/ext/WSK/FunctionUtils/FunctionUtils.c +182 -0
- data/ext/WSK/FunctionUtils/extconf.rb +15 -0
- data/ext/WSK/SilentUtils/SilentUtils.c +431 -0
- data/ext/WSK/SilentUtils/extconf.rb +7 -0
- data/ext/WSK/VolumeUtils/VolumeUtils.c +494 -0
- data/ext/WSK/VolumeUtils/extconf.rb +15 -0
- data/external/CommonUtils/build.rb +28 -0
- data/external/CommonUtils/include/CommonUtils.h +177 -0
- data/external/CommonUtils/src/CommonUtils.c +639 -0
- data/lib/WSK/Actions/Analyze.rb +176 -0
- data/lib/WSK/Actions/ApplyMap.desc.rb +15 -0
- data/lib/WSK/Actions/ApplyMap.rb +57 -0
- data/lib/WSK/Actions/ApplyVolumeFct.desc.rb +30 -0
- data/lib/WSK/Actions/ApplyVolumeFct.rb +72 -0
- data/lib/WSK/Actions/Compare.desc.rb +25 -0
- data/lib/WSK/Actions/Compare.rb +238 -0
- data/lib/WSK/Actions/ConstantCompare.desc.rb +20 -0
- data/lib/WSK/Actions/ConstantCompare.rb +61 -0
- data/lib/WSK/Actions/Cut.desc.rb +20 -0
- data/lib/WSK/Actions/Cut.rb +60 -0
- data/lib/WSK/Actions/CutFirstSignal.desc.rb +25 -0
- data/lib/WSK/Actions/CutFirstSignal.rb +72 -0
- data/lib/WSK/Actions/DCShifter.desc.rb +15 -0
- data/lib/WSK/Actions/DCShifter.rb +67 -0
- data/lib/WSK/Actions/DrawFct.desc.rb +20 -0
- data/lib/WSK/Actions/DrawFct.rb +59 -0
- data/lib/WSK/Actions/FFT.rb +104 -0
- data/lib/WSK/Actions/GenAllValues.rb +67 -0
- data/lib/WSK/Actions/GenConstant.desc.rb +20 -0
- data/lib/WSK/Actions/GenConstant.rb +56 -0
- data/lib/WSK/Actions/GenSawtooth.rb +57 -0
- data/lib/WSK/Actions/GenSine.desc.rb +20 -0
- data/lib/WSK/Actions/GenSine.rb +73 -0
- data/lib/WSK/Actions/Identity.rb +43 -0
- data/lib/WSK/Actions/Mix.desc.rb +15 -0
- data/lib/WSK/Actions/Mix.rb +149 -0
- data/lib/WSK/Actions/Multiply.desc.rb +15 -0
- data/lib/WSK/Actions/Multiply.rb +73 -0
- data/lib/WSK/Actions/NoiseGate.desc.rb +35 -0
- data/lib/WSK/Actions/NoiseGate.rb +129 -0
- data/lib/WSK/Actions/SilenceInserter.desc.rb +20 -0
- data/lib/WSK/Actions/SilenceInserter.rb +87 -0
- data/lib/WSK/Actions/SilenceRemover.desc.rb +30 -0
- data/lib/WSK/Actions/SilenceRemover.rb +74 -0
- data/lib/WSK/Actions/VolumeProfile.desc.rb +35 -0
- data/lib/WSK/Actions/VolumeProfile.rb +63 -0
- data/lib/WSK/Common.rb +292 -0
- data/lib/WSK/FFT.rb +527 -0
- data/lib/WSK/Functions.rb +770 -0
- data/lib/WSK/Launcher.rb +216 -0
- data/lib/WSK/Maps.rb +29 -0
- data/lib/WSK/Model/CachedBufferReader.rb +151 -0
- data/lib/WSK/Model/Header.rb +133 -0
- data/lib/WSK/Model/InputData.rb +193 -0
- data/lib/WSK/Model/RawReader.rb +78 -0
- data/lib/WSK/Model/WaveReader.rb +91 -0
- data/lib/WSK/OutputInterfaces/DirectStream.rb +146 -0
- data/lib/WSK/RIFFReader.rb +60 -0
- metadata +155 -0
@@ -0,0 +1,177 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright (c) 2009 - 2012 Muriel Salvan (muriel@x-aeon.com)
|
3
|
+
* Licensed under the terms specified in LICENSE file. No warranty is provided.
|
4
|
+
**/
|
5
|
+
|
6
|
+
#ifndef __COMMONUTILS_COMMONUTILS_H__
|
7
|
+
#define __COMMONUTILS_COMMONUTILS_H__
|
8
|
+
|
9
|
+
#include "ruby.h"
|
10
|
+
|
11
|
+
// Struct used to interpret raw buffers data of 24 bits
|
12
|
+
typedef struct {
|
13
|
+
signed int value:24;
|
14
|
+
} t24bits;
|
15
|
+
|
16
|
+
// Type used to identify each sample value
|
17
|
+
typedef int tSampleValue;
|
18
|
+
|
19
|
+
// Type used to identify each sample index
|
20
|
+
typedef long long int tSampleIndex;
|
21
|
+
|
22
|
+
// Pointer to a function that can be called when parsing a raw buffer
|
23
|
+
typedef int(*tPtrFctProcess)(const tSampleValue, const tSampleIndex, const int, void*);
|
24
|
+
// Pointer to a function that can be called when parsing a raw buffer and writing another raw buffer
|
25
|
+
typedef int(*tPtrFctProcessOutput)(const tSampleValue, tSampleValue*, const tSampleIndex, const int, void*);
|
26
|
+
// Pointer to a function that can be called when writing a raw buffer
|
27
|
+
typedef int(*tPtrFctProcessOutputOnly)(tSampleValue*, const tSampleIndex, const int, void*);
|
28
|
+
|
29
|
+
// Struct containing data for a threshold information
|
30
|
+
typedef struct {
|
31
|
+
tSampleValue min;
|
32
|
+
tSampleValue max;
|
33
|
+
} tThresholdInfo;
|
34
|
+
|
35
|
+
// Function types, as defined in Functions.rb
|
36
|
+
#define FCTTYPE_PIECEWISE_LINEAR 0
|
37
|
+
|
38
|
+
// Function pointer for free
|
39
|
+
typedef void(*tPtrFctFree)(void*);
|
40
|
+
|
41
|
+
// Struct used to store piecewise linear function data
|
42
|
+
typedef struct {
|
43
|
+
int nbrPoints;
|
44
|
+
// The array of points coordinates, sorted by X value
|
45
|
+
tSampleIndex* pointsX;
|
46
|
+
long double* pointsY;
|
47
|
+
} tFunction_PiecewiseLinear;
|
48
|
+
|
49
|
+
// Struct used to store a function
|
50
|
+
typedef struct {
|
51
|
+
// The function type
|
52
|
+
int fctType;
|
53
|
+
// The pointer to the free method (it will be called by the GC)
|
54
|
+
tPtrFctFree freeFct;
|
55
|
+
// The function object (should be a tFunction_Xxxx* type)
|
56
|
+
void* fctData;
|
57
|
+
} tFunction;
|
58
|
+
|
59
|
+
/**
|
60
|
+
* Invoke each_raw_buffer on an input data.
|
61
|
+
* This is meant to be used with rb_iterate.
|
62
|
+
*
|
63
|
+
* Parameters::
|
64
|
+
* * *iValArgs* (<em>list<Object></em>): List of arguments:
|
65
|
+
* ** *iValInputData* (<em>WSK::Model::InputData</em>): The input data
|
66
|
+
* ** *iValIdxBeginSample* (_Integer_): Index of the first sample to search from
|
67
|
+
*/
|
68
|
+
VALUE commonutils_callEachRawBuffer(
|
69
|
+
VALUE iValArgs);
|
70
|
+
|
71
|
+
/**
|
72
|
+
* Invoke each_reverse_raw_buffer on an input data.
|
73
|
+
* This is meant to be used with rb_iterate.
|
74
|
+
*
|
75
|
+
* Parameters::
|
76
|
+
* * *iValArgs* (<em>list<Object></em>): List of arguments:
|
77
|
+
* ** *iValInputData* (<em>WSK::Model::InputData</em>): The input data
|
78
|
+
* ** *iValIdxBeginSample* (_Integer_): Index of the first sample to search from
|
79
|
+
*/
|
80
|
+
VALUE commonutils_callEachReverseRawBuffer(
|
81
|
+
VALUE iValArgs);
|
82
|
+
|
83
|
+
/**
|
84
|
+
* Iterate through a raw buffer.
|
85
|
+
*
|
86
|
+
* Parameters::
|
87
|
+
* * *iPtrRawBuffer* (<em>const char*</em>): The raw buffer
|
88
|
+
* * *iNbrBitsPerSample* (<em>const int</em>): The number of bits per sample
|
89
|
+
* * *iNbrChannels* (<em>const int</em>): The number of channels
|
90
|
+
* * *iNbrSamples* (<em>const tSampleIndex</em>): The number of samples
|
91
|
+
* * *iIdxOffsetSample* (<em>const tSampleIndex</em>): The base offset of samples to be counted and given to the processing method
|
92
|
+
* * *iPtrProcessMethod* (<em>const tPtrFctProcess</em>): Pointer to the method to call for processing
|
93
|
+
* * *iPtrArgs* (<em>void*</em>): Pointer to a user specific struct that will be given to the processing function
|
94
|
+
*/
|
95
|
+
void commonutils_iterateThroughRawBuffer(
|
96
|
+
const char* iPtrRawBuffer,
|
97
|
+
const int iNbrBitsPerSample,
|
98
|
+
const int iNbrChannels,
|
99
|
+
const tSampleIndex iNbrSamples,
|
100
|
+
const tSampleIndex iIdxOffsetSample,
|
101
|
+
const tPtrFctProcess iPtrProcessMethod,
|
102
|
+
void* iPtrArgs);
|
103
|
+
|
104
|
+
/**
|
105
|
+
* Iterate through a raw buffer, and writes another raw buffer.
|
106
|
+
*
|
107
|
+
* Parameters::
|
108
|
+
* * *iSelf* (_Object_): Object used to call log methods
|
109
|
+
* * *iPtrRawBuffer* (<em>const char*</em>): The raw buffer
|
110
|
+
* * *oPtrRawBufferOut* (<em>char*</em>): The raw buffer to write
|
111
|
+
* * *iNbrBitsPerSample* (<em>const int</em>): The number of bits per sample
|
112
|
+
* * *iNbrChannels* (<em>const int</em>): The number of channels
|
113
|
+
* * *iNbrSamples* (<em>const tSampleIndex</em>): The number of samples
|
114
|
+
* * *iIdxOffsetSample* (<em>const tSampleIndex</em>): The base offset of samples to be counted and given to the processing method
|
115
|
+
* * *iNeedCheck* (<em>const int</em>): Do we need checking output value ranges ? 0 = no, 1 = yes
|
116
|
+
* * *iPtrProcessMethod* (<em>const tPtrFctProcessOutput</em>): Pointer to the method to call for processing
|
117
|
+
* * *iPtrArgs* (<em>void*</em>): Pointer to a user specific struct that will be given to the processing function
|
118
|
+
*/
|
119
|
+
void commonutils_iterateThroughRawBufferOutput(
|
120
|
+
VALUE iSelf,
|
121
|
+
const char* iPtrRawBuffer,
|
122
|
+
char* oPtrRawBufferOut,
|
123
|
+
const int iNbrBitsPerSample,
|
124
|
+
const int iNbrChannels,
|
125
|
+
const tSampleIndex iNbrSamples,
|
126
|
+
const tSampleIndex iIdxOffsetSample,
|
127
|
+
const int iNeedCheck,
|
128
|
+
const tPtrFctProcessOutput iPtrProcessMethod,
|
129
|
+
void* iPtrArgs);
|
130
|
+
|
131
|
+
/**
|
132
|
+
* Iterate through an output raw buffer only, without input raw buffer.
|
133
|
+
*
|
134
|
+
* Parameters::
|
135
|
+
* * *iSelf* (_Object_): Object used to call log methods
|
136
|
+
* * *oPtrRawBufferOut* (<em>char*</em>): The raw buffer to write
|
137
|
+
* * *iNbrBitsPerSample* (<em>const int</em>): The number of bits per sample
|
138
|
+
* * *iNbrChannels* (<em>const int</em>): The number of channels
|
139
|
+
* * *iNbrSamples* (<em>const tSampleIndex</em>): The number of samples
|
140
|
+
* * *iIdxOffsetSample* (<em>const tSampleIndex</em>): The base offset of samples to be counted and given to the processing method
|
141
|
+
* * *iNeedCheck* (<em>const int</em>): Do we need checking output value ranges ? 0 = no, 1 = yes
|
142
|
+
* * *iPtrProcessMethod* (<em>const tPtrFctProcessOutputOnly</em>): Pointer to the method to call for processing
|
143
|
+
* * *iPtrArgs* (<em>void*</em>): Pointer to a user specific struct that will be given to the processing function
|
144
|
+
*/
|
145
|
+
void commonutils_iterateThroughRawBufferOutputOnly(
|
146
|
+
VALUE iSelf,
|
147
|
+
char* oPtrRawBufferOut,
|
148
|
+
const int iNbrBitsPerSample,
|
149
|
+
const int iNbrChannels,
|
150
|
+
const tSampleIndex iNbrSamples,
|
151
|
+
const tSampleIndex iIdxOffsetSample,
|
152
|
+
const int iNeedCheck,
|
153
|
+
const tPtrFctProcessOutputOnly iPtrProcessMethod,
|
154
|
+
void* iPtrArgs);
|
155
|
+
|
156
|
+
/**
|
157
|
+
* Iterate through a raw buffer in reverse mode.
|
158
|
+
*
|
159
|
+
* Parameters::
|
160
|
+
* * *iPtrRawBuffer* (<em>const char*</em>): The raw buffer
|
161
|
+
* * *iNbrBitsPerSample* (<em>const int</em>): The number of bits per sample
|
162
|
+
* * *iNbrChannels* (<em>const int</em>): The number of channels
|
163
|
+
* * *iNbrSamples* (<em>const tSampleIndex</em>): The number of samples
|
164
|
+
* * *iIdxOffsetSample* (<em>const tSampleIndex</em>): The base offset of samples to be counted and given to the processing method
|
165
|
+
* * *iPtrProcessMethod* (<em>const tPtrFctProcess</em>): Pointer to the method to call for processing
|
166
|
+
* * *iPtrArgs* (<em>void*</em>): Pointer to a user specific struct that will be given to the processing function
|
167
|
+
*/
|
168
|
+
void commonutils_iterateReverseThroughRawBuffer(
|
169
|
+
const char* iPtrRawBuffer,
|
170
|
+
const int iNbrBitsPerSample,
|
171
|
+
const int iNbrChannels,
|
172
|
+
const tSampleIndex iNbrSamples,
|
173
|
+
const tSampleIndex iIdxOffsetSample,
|
174
|
+
const tPtrFctProcess iPtrProcessMethod,
|
175
|
+
void* iPtrArgs);
|
176
|
+
|
177
|
+
#endif
|