WaveSwissKnife 0.3.0.20121227 → 0.3.1.20130103

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/AUTHORS CHANGED
@@ -3,3 +3,4 @@
3
3
  * 0.1.0.20110830
4
4
  * 0.2.0.20120302
5
5
  * 0.3.0.20121227
6
+ * 0.3.1.20130103
data/ChangeLog CHANGED
@@ -1,5 +1,9 @@
1
1
  = WaveSwissKnife Release History
2
2
 
3
+ == 0.3.1.20130103 (Beta)
4
+
5
+ * Bug correction: Core dumps using Ruby 1.9 and/or 64 bits environments
6
+
3
7
  == 0.3.0.20121227 (Beta)
4
8
 
5
9
  * Migrated C code to Ruby 1.9.3 API
data/ReleaseInfo CHANGED
@@ -2,7 +2,7 @@
2
2
  # This file has been generated by RubyPackager during a delivery.
3
3
  # More info about RubyPackager: http://rubypackager.sourceforge.net
4
4
  {
5
- :version => '0.3.0.20121227',
5
+ :version => '0.3.1.20130103',
6
6
  :tags => [ 'Beta' ],
7
7
  :dev_status => 'Beta'
8
8
  }
@@ -22,6 +22,14 @@ typedef struct {
22
22
  int nbrChannels;
23
23
  } tFirstSampleBeyondThresholdStruct;
24
24
 
25
+ // Struct used to convey data among iterators in the getNextSilentInThresholds method
26
+ typedef struct {
27
+ tSampleIndex* ptrIdxSample;
28
+ tSampleIndex* ptrIdxFirstSilentSample;
29
+ tThresholdInfo* ptrSilenceThresholds;
30
+ tSampleIndex* ptrIdxSilenceSample_Result;
31
+ } tNextSilentInThresholdsStruct;
32
+
25
33
  /**
26
34
  * Process a value read from an input buffer for the NextSilentSample function.
27
35
  *
@@ -123,45 +131,46 @@ int silentutils_Reverse_processValue(
123
131
 
124
132
  /**
125
133
  * Code block called by getNextSilentSample in the each_raw_buffer loop.
126
- * This is meant to be used with rb_iterate.
134
+ * This is meant to be used with rb_block_call.
127
135
  *
128
136
  * Parameters::
129
- * * *iValYieldArgs* (<em>list<Object></em>): The yield arguments:
130
- * ** *iValInputRawBuffer* (_String_): The raw buffer
131
- * ** *iValNbrSamples* (_Integer_): The number of samples in this buffer
132
- * ** *iValNbrChannels* (_Integer_): The number of channels in this buffer
133
- * * *iValIterateArgs* (<em>list<Object></em>): The iterate arguments:
137
+ * * *iYieldedObject* (_Object_): First parameter of iArgs
138
+ * * *iValContextArgs* (<em>list<Object></em>): The context arguments:
134
139
  * ** *iValNbrBitsPerSample* (_Integer_): Number of bits per sample
135
- * ** *iValPtrIdxSample* (_Integer_): Address of the IdxSample variable
136
- * ** *iValPtrIdxFirstSilentSample* (_Integer_): Address of the IdxFirstSilentSample variable
137
- * ** *iValPtrSilenceThresholds* (_Integer_): Address of the SilenceThresholds variable
140
+ * ** *iValData* (_DATA_): Data encapsulating the tNextSilentInThresholdsStruct that contains C variables to be modified
138
141
  * ** *iValMinSilenceSamples* (_Integer_): Minimal silence samples
139
- * ** *iValPtrIdxSilenceSample_Result* (_Integer_): Address of the IdxSilenceSample_Result variable
140
142
  * ** *iValBackwardsSearch* (_Boolean_): Do we search backwards ?
143
+ * * *iArgc* (_int_): Number of arguments in iArgs
144
+ * * *iArgs* (_VALUE[]_): Array of arguments given by the yield call:
145
+ * ** *iValInputRawBuffer* (_String_): The raw buffer
146
+ * ** *iValNbrSamples* (_Integer_): The number of samples in this buffer
147
+ * ** *iValNbrChannels* (_Integer_): The number of channels in this buffer
141
148
  */
142
149
  static VALUE silentutils_blockEachRawBuffer(
143
- VALUE iValYieldArgs,
144
- VALUE iValIterateArgs) {
150
+ VALUE iYieldedObject,
151
+ VALUE iValContextArgs,
152
+ int iArgc,
153
+ VALUE iArgs[]) {
145
154
  // Read arguments
146
- VALUE iValInputRawBuffer = rb_ary_entry(iValYieldArgs, 0);
147
- VALUE iValNbrSamples = rb_ary_entry(iValYieldArgs, 1);
148
- VALUE iValNbrChannels = rb_ary_entry(iValYieldArgs, 2);
149
- VALUE iValNbrBitsPerSample = rb_ary_entry(iValIterateArgs, 0);
150
- VALUE iValPtrIdxSample = rb_ary_entry(iValIterateArgs, 1);
151
- VALUE iValPtrIdxFirstSilentSample = rb_ary_entry(iValIterateArgs, 2);
152
- VALUE iValPtrSilenceThresholds = rb_ary_entry(iValIterateArgs, 3);
153
- VALUE iValMinSilenceSamples = rb_ary_entry(iValIterateArgs, 4);
154
- VALUE iValPtrIdxSilenceSample_Result = rb_ary_entry(iValIterateArgs, 5);
155
- VALUE iValBackwardsSearch = rb_ary_entry(iValIterateArgs, 6);
155
+ VALUE iValInputRawBuffer = iArgs[0];
156
+ VALUE iValNbrSamples = iArgs[1];
157
+ VALUE iValNbrChannels = iArgs[2];
158
+ VALUE iValNbrBitsPerSample = rb_ary_entry(iValContextArgs, 0);
159
+ VALUE iValData = rb_ary_entry(iValContextArgs, 1);
160
+ VALUE iValMinSilenceSamples = rb_ary_entry(iValContextArgs, 2);
161
+ VALUE iValBackwardsSearch = rb_ary_entry(iValContextArgs, 3);
156
162
  // Translate parameters in C types
157
163
  int iNbrBitsPerSample = FIX2INT(iValNbrBitsPerSample);
158
164
  tSampleIndex iNbrSamples = FIX2LONG(iValNbrSamples);
159
165
  int iNbrChannels = FIX2INT(iValNbrChannels);
160
- tSampleIndex* lPtrIdxSample = (tSampleIndex*)FIX2INT(iValPtrIdxSample);
161
- tSampleIndex* lPtrIdxFirstSilentSample = (tSampleIndex*)FIX2INT(iValPtrIdxFirstSilentSample);
162
- tThresholdInfo* lPtrSilenceThresholds = (tThresholdInfo*)FIX2INT(iValPtrSilenceThresholds);
163
166
  tSampleIndex iMinSilenceSamples = FIX2LONG(iValMinSilenceSamples);
164
- tSampleIndex* lPtrIdxSilenceSample_Result = (tSampleIndex*)FIX2INT(iValPtrIdxSilenceSample_Result);
167
+ // Get C pointers back from the data
168
+ tNextSilentInThresholdsStruct* lPtrData;
169
+ Data_Get_Struct(iValData, tNextSilentInThresholdsStruct, lPtrData);
170
+ tSampleIndex* lPtrIdxSample = lPtrData->ptrIdxSample;
171
+ tSampleIndex* lPtrIdxFirstSilentSample = lPtrData->ptrIdxFirstSilentSample;
172
+ tThresholdInfo* lPtrSilenceThresholds = lPtrData->ptrSilenceThresholds;
173
+ tSampleIndex* lPtrIdxSilenceSample_Result = lPtrData->ptrIdxSilenceSample_Result;
165
174
 
166
175
  // Get the real underlying raw buffer
167
176
  char* lPtrRawBuffer = RSTRING_PTR(iValInputRawBuffer);
@@ -260,46 +269,44 @@ static VALUE silentutils_getNextSilentInThresholds(
260
269
  // The result
261
270
  tSampleIndex lIdxSilenceSample_Result;
262
271
 
263
- // Encapsulate pointers to the data that will be used and modified by the iteration block
264
- VALUE lValPtrIdxSample = INT2FIX(&lIdxSample);
265
- VALUE lValPtrIdxFirstSilentSample = INT2FIX(&lIdxFirstSilentSample);
266
- VALUE lValPtrSilenceThresholds = INT2FIX(&lSilenceThresholds);
267
- VALUE lValPtrIdxSilenceSample_Result = INT2FIX(&lIdxSilenceSample_Result);
272
+ // Encapsulate the data that will be used and modified by the iteration block
273
+ tNextSilentInThresholdsStruct lData;
274
+ lData.ptrIdxSample = &lIdxSample;
275
+ lData.ptrIdxFirstSilentSample = &lIdxFirstSilentSample;
276
+ lData.ptrSilenceThresholds = &lSilenceThresholds;
277
+ lData.ptrIdxSilenceSample_Result = &lIdxSilenceSample_Result;
278
+ VALUE lValData = Data_Wrap_Struct(rb_cObject, NULL, NULL, &lData);
268
279
 
269
280
  lIdxFirstSilentSample = -1;
270
281
  lIdxSilenceSample_Result = -1;
271
282
 
272
283
  // Parse the data, using thresholds matching only
284
+ VALUE lEachArgs[1];
285
+ lEachArgs[0] = LONG2FIX(lIdxSample);
273
286
  if (iValBackwardsSearch == Qtrue) {
274
- rb_iterate(
275
- commonutils_callEachReverseRawBuffer,
276
- rb_ary_new3(2,
277
- iValInputData,
278
- LONG2FIX(lIdxSample)),
279
- silentutils_blockEachRawBuffer,
280
- rb_ary_new3(7,
287
+ rb_block_call(
288
+ iValInputData,
289
+ rb_intern("each_reverse_raw_buffer"),
290
+ 1,
291
+ lEachArgs,
292
+ RUBY_METHOD_FUNC(silentutils_blockEachRawBuffer),
293
+ rb_ary_new3(4,
281
294
  lValNbrBitsPerSample,
282
- lValPtrIdxSample,
283
- lValPtrIdxFirstSilentSample,
284
- lValPtrSilenceThresholds,
295
+ lValData,
285
296
  iValMinSilenceSamples,
286
- lValPtrIdxSilenceSample_Result,
287
297
  iValBackwardsSearch)
288
298
  );
289
299
  } else {
290
- rb_iterate(
291
- commonutils_callEachRawBuffer,
292
- rb_ary_new3(2,
293
- iValInputData,
294
- LONG2FIX(lIdxSample)),
295
- silentutils_blockEachRawBuffer,
296
- rb_ary_new3(7,
300
+ rb_block_call(
301
+ iValInputData,
302
+ rb_intern("each_raw_buffer"),
303
+ 1,
304
+ lEachArgs,
305
+ RUBY_METHOD_FUNC(silentutils_blockEachRawBuffer),
306
+ rb_ary_new3(4,
297
307
  lValNbrBitsPerSample,
298
- lValPtrIdxSample,
299
- lValPtrIdxFirstSilentSample,
300
- lValPtrSilenceThresholds,
308
+ lValData,
301
309
  iValMinSilenceSamples,
302
- lValPtrIdxSilenceSample_Result,
303
310
  iValBackwardsSearch)
304
311
  );
305
312
  }
@@ -56,30 +56,6 @@ typedef struct {
56
56
  void* fctData;
57
57
  } tFunction;
58
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
59
  /**
84
60
  * Iterate through a raw buffer.
85
61
  *
@@ -7,42 +7,6 @@
7
7
  #include "ruby.h"
8
8
  #include <stdio.h>
9
9
 
10
- /**
11
- * Invoke each_raw_buffer on an input data.
12
- * This is meant to be used with rb_iterate.
13
- *
14
- * Parameters::
15
- * * *iValArgs* (<em>list<Object></em>): List of arguments:
16
- * ** *iValInputData* (<em>WSK::Model::InputData</em>): The input data
17
- * ** *iValIdxBeginSample* (_Integer_): Index of the first sample to search from
18
- */
19
- VALUE commonutils_callEachRawBuffer(
20
- VALUE iValArgs) {
21
- // Read arguments
22
- VALUE iValInputData = rb_ary_entry(iValArgs, 0);
23
- VALUE iValIdxBeginSample = rb_ary_entry(iValArgs, 1);
24
-
25
- return rb_funcall(iValInputData, rb_intern("each_raw_buffer"), 1, iValIdxBeginSample);
26
- }
27
-
28
- /**
29
- * Invoke each_reverse_raw_buffer on an input data.
30
- * This is meant to be used with rb_iterate.
31
- *
32
- * Parameters::
33
- * * *iValArgs* (<em>list<Object></em>): List of arguments:
34
- * ** *iValInputData* (<em>WSK::Model::InputData</em>): The input data
35
- * ** *iValIdxBeginSample* (_Integer_): Index of the first sample to search from
36
- */
37
- VALUE commonutils_callEachReverseRawBuffer(
38
- VALUE iValArgs) {
39
- // Read arguments
40
- VALUE iValInputData = rb_ary_entry(iValArgs, 0);
41
- VALUE iValIdxBeginSample = rb_ary_entry(iValArgs, 1);
42
-
43
- return rb_funcall(iValInputData, rb_intern("each_reverse_raw_buffer"), 2, INT2FIX(0), iValIdxBeginSample);
44
- }
45
-
46
10
  /**
47
11
  * Iterate through a raw buffer.
48
12
  *
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: WaveSwissKnife
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0.20121227
4
+ version: 0.3.1.20130103
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-27 00:00:00.000000000 Z
12
+ date: 2013-01-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rUtilAnts