seal 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -58,7 +58,7 @@ extern "C" {
58
58
  *
59
59
  * @param src the source to initialize
60
60
  */
61
- seal_err_t seal_init_src(seal_src_t*);
61
+ seal_err_t SEAL_API seal_init_src(seal_src_t*);
62
62
 
63
63
  /*
64
64
  * Destroys a source. Will not free the associated buffer or stream. Can
@@ -67,7 +67,7 @@ seal_err_t seal_init_src(seal_src_t*);
67
67
  *
68
68
  * @param src the source to destroy
69
69
  */
70
- seal_err_t seal_destroy_src(seal_src_t*);
70
+ seal_err_t SEAL_API seal_destroy_src(seal_src_t*);
71
71
 
72
72
  /*
73
73
  * Starts to play a source. Applying to a `SEAL_PLAYING' source will restart
@@ -80,7 +80,7 @@ seal_err_t seal_destroy_src(seal_src_t*);
80
80
  *
81
81
  * @param src the source to play
82
82
  */
83
- seal_err_t seal_play_src(seal_src_t*);
83
+ seal_err_t SEAL_API seal_play_src(seal_src_t*);
84
84
 
85
85
  /*
86
86
  * Pauses the playing of a source. Applying to a `SEAL_PLAYING' source will
@@ -89,7 +89,7 @@ seal_err_t seal_play_src(seal_src_t*);
89
89
  *
90
90
  * @param src the source to pause
91
91
  */
92
- seal_err_t seal_pause_src(seal_src_t*);
92
+ seal_err_t SEAL_API seal_pause_src(seal_src_t*);
93
93
 
94
94
  /*
95
95
  * Stops the playing of a source. Applying to a `SEAL_PLAYING' or
@@ -99,7 +99,7 @@ seal_err_t seal_pause_src(seal_src_t*);
99
99
  *
100
100
  * @param src the source to stop
101
101
  */
102
- seal_err_t seal_stop_src(seal_src_t*);
102
+ seal_err_t SEAL_API seal_stop_src(seal_src_t*);
103
103
 
104
104
  /*
105
105
  * Rewinds a source to the beginning. Applying to a `SEAL_PLAYING',
@@ -110,7 +110,15 @@ seal_err_t seal_stop_src(seal_src_t*);
110
110
  *
111
111
  * @param src the source to rewind
112
112
  */
113
- seal_err_t seal_rewind_src(seal_src_t*);
113
+ seal_err_t SEAL_API seal_rewind_src(seal_src_t*);
114
+
115
+ /*
116
+ * Moves the source (changes the position) based on the source velocity. This
117
+ * is a syntactic sugar for adding the velocity vector and position vector.
118
+ *
119
+ * @param src the source to move
120
+ */
121
+ seal_err_t SEAL_API seal_move_src(seal_src_t*);
114
122
 
115
123
  /*
116
124
  * Associates a buffer with a source so that the source is ready to play the
@@ -122,7 +130,7 @@ seal_err_t seal_rewind_src(seal_src_t*);
122
130
  * @param src the source to associate the buffer `buf' with
123
131
  * @param buf the buffer to associate the source `src' with
124
132
  */
125
- seal_err_t seal_set_src_buf(seal_src_t*, seal_buf_t*);
133
+ seal_err_t SEAL_API seal_set_src_buf(seal_src_t*, seal_buf_t*);
126
134
 
127
135
  /*
128
136
  * Associates an opened stream with a source so that audio data can be
@@ -139,7 +147,7 @@ seal_err_t seal_set_src_buf(seal_src_t*, seal_buf_t*);
139
147
  * @param src the source to associate the stream `stream' with
140
148
  * @param stream the stream to associate the source `src' with
141
149
  */
142
- seal_err_t seal_set_src_stream(seal_src_t*, seal_stream_t*);
150
+ seal_err_t SEAL_API seal_set_src_stream(seal_src_t*, seal_stream_t*);
143
151
 
144
152
  /*
145
153
  * Feeds an effect slot with the output of a source so the output is filtered
@@ -155,7 +163,7 @@ seal_err_t seal_set_src_stream(seal_src_t*, seal_stream_t*);
155
163
  * corresponding index; the max is the return value of
156
164
  * seal_get_per_src_effect_limit - 1.
157
165
  */
158
- seal_err_t seal_feed_efs(seal_src_t*, seal_efs_t*, int /*index*/);
166
+ seal_err_t SEAL_API seal_feed_efs(seal_src_t*, seal_efs_t*, int /*index*/);
159
167
 
160
168
  /*
161
169
  * Updates a streaming source. If the source is not up-to-date, the playback
@@ -165,7 +173,7 @@ seal_err_t seal_feed_efs(seal_src_t*, seal_efs_t*, int /*index*/);
165
173
  *
166
174
  * @param src the source to update
167
175
  */
168
- seal_err_t seal_update_src(seal_src_t*);
176
+ seal_err_t SEAL_API seal_update_src(seal_src_t*);
169
177
 
170
178
  /*
171
179
  * Releases the current buffer or stream from a source (hence empties the
@@ -175,7 +183,7 @@ seal_err_t seal_update_src(seal_src_t*);
175
183
  *
176
184
  * @param src the source to detach the audio of
177
185
  */
178
- seal_err_t seal_detach_src_audio(seal_src_t*);
186
+ seal_err_t SEAL_API seal_detach_src_audio(seal_src_t*);
179
187
 
180
188
  /*
181
189
  * Sets the size of the streaming queue internally used by a source. The queue
@@ -189,7 +197,7 @@ seal_err_t seal_detach_src_audio(seal_src_t*);
189
197
  * @param src the source to set the queue size of
190
198
  * @param size the queue size in the interval [2, 63]
191
199
  */
192
- seal_err_t seal_set_src_queue_size(seal_src_t*, size_t);
200
+ seal_err_t SEAL_API seal_set_src_queue_size(seal_src_t*, size_t);
193
201
 
194
202
  /*
195
203
  * Sets the maximum size, in byte, of the audio chunk which buffers the audio
@@ -202,7 +210,7 @@ seal_err_t seal_set_src_queue_size(seal_src_t*, size_t);
202
210
  * multiple of 9216; non-multiple value will be adjusted to the
203
211
  * closest smaller multiple automatically
204
212
  */
205
- seal_err_t seal_set_src_chunk_size(seal_src_t*, size_t);
213
+ seal_err_t SEAL_API seal_set_src_chunk_size(seal_src_t*, size_t);
206
214
 
207
215
  /*
208
216
  * Sets the position of a source in a right-handed Cartesian coordinate
@@ -213,8 +221,11 @@ seal_err_t seal_set_src_chunk_size(seal_src_t*, size_t);
213
221
  * @param y the y position to set
214
222
  * @param z the z position to set
215
223
  */
216
- seal_err_t seal_set_src_pos(seal_src_t*, float /*x*/, float /*y*/,
217
- float /*z*/);
224
+ seal_err_t SEAL_API seal_set_src_pos(
225
+ seal_src_t*, float /*x*/,
226
+ float /*y*/,
227
+ float /*z*/
228
+ );
218
229
 
219
230
  /*
220
231
  * Sets the velocity of a source in a right-handed Cartesian coordinate
@@ -226,8 +237,11 @@ seal_err_t seal_set_src_pos(seal_src_t*, float /*x*/, float /*y*/,
226
237
  * @param y the y velocity to set
227
238
  * @param z the z velocity to set
228
239
  */
229
- seal_err_t seal_set_src_vel(seal_src_t*, float /*x*/, float /*y*/,
230
- float /*z*/);
240
+ seal_err_t SEAL_API seal_set_src_vel(
241
+ seal_src_t*, float /*x*/,
242
+ float /*y*/,
243
+ float /*z*/
244
+ );
231
245
 
232
246
  /*
233
247
  * Sets the pitch shift multiplier of a source. 1.0f means identity; each
@@ -237,7 +251,7 @@ seal_err_t seal_set_src_vel(seal_src_t*, float /*x*/, float /*y*/,
237
251
  * @param src the source to set the pitch of
238
252
  * @param pitch the pitch multiplier in the interval (0.0f, +inf.)
239
253
  */
240
- seal_err_t seal_set_src_pitch(seal_src_t*, float /*pitch*/);
254
+ seal_err_t SEAL_API seal_set_src_pitch(seal_src_t*, float /*pitch*/);
241
255
 
242
256
  /*
243
257
  * Sets the scalar amplitude multiplier of a source. 1.0f means that the sound
@@ -246,7 +260,7 @@ seal_err_t seal_set_src_pitch(seal_src_t*, float /*pitch*/);
246
260
  * @param src the source to set the gain of
247
261
  * @param gain the scalar amplitude multiplier in the interval [0.0f, +inf.)
248
262
  */
249
- seal_err_t seal_set_src_gain(seal_src_t*, float /*gain*/);
263
+ seal_err_t SEAL_API seal_set_src_gain(seal_src_t*, float /*gain*/);
250
264
 
251
265
  /*
252
266
  * Sets whether a source should be automatically updated asynchronously by a
@@ -257,7 +271,7 @@ seal_err_t seal_set_src_gain(seal_src_t*, float /*gain*/);
257
271
  * @param src the source to set the auto update flag of
258
272
  * @param automatic 1 to set it auto update or otherwise 0
259
273
  */
260
- seal_err_t seal_set_src_auto(seal_src_t*, char /*automatic*/);
274
+ seal_err_t SEAL_API seal_set_src_auto(seal_src_t*, char /*automatic*/);
261
275
 
262
276
  /*
263
277
  * Sets whether a source's position, velocity, cone and direction are all
@@ -267,7 +281,7 @@ seal_err_t seal_set_src_auto(seal_src_t*, char /*automatic*/);
267
281
  * @param relative 1 to set it relative to the listener or otherwise 0
268
282
  * @return nonzero if successful or otherwise 0
269
283
  */
270
- seal_err_t seal_set_src_relative(seal_src_t*, char /*relative*/);
284
+ seal_err_t SEAL_API seal_set_src_relative(seal_src_t*, char /*relative*/);
271
285
 
272
286
  /*
273
287
  * Sets whether the playback of a source is looping. A looping source will
@@ -278,7 +292,7 @@ seal_err_t seal_set_src_relative(seal_src_t*, char /*relative*/);
278
292
  * @param src the source to set the looping flag of
279
293
  * @param looping 1 to set it looping or otherwise 0
280
294
  */
281
- seal_err_t seal_set_src_looping(seal_src_t*, char /*looping*/);
295
+ seal_err_t SEAL_API seal_set_src_looping(seal_src_t*, char /*looping*/);
282
296
 
283
297
  /*
284
298
  * Gets the buffer of a source. The default is 0 (null pointer).
@@ -287,7 +301,7 @@ seal_err_t seal_set_src_looping(seal_src_t*, char /*looping*/);
287
301
  * @param src the source to get the buffer of
288
302
  * @return the buffer
289
303
  */
290
- seal_buf_t* seal_get_src_buf(seal_src_t*);
304
+ seal_buf_t* SEAL_API seal_get_src_buf(seal_src_t*);
291
305
 
292
306
  /*
293
307
  * Gets the stream of a source. The default is 0 (null pointer).
@@ -296,7 +310,7 @@ seal_buf_t* seal_get_src_buf(seal_src_t*);
296
310
  * @param src the source to get the stream of
297
311
  * @return the receiver of the stream
298
312
  */
299
- seal_stream_t* seal_get_src_stream(seal_src_t*);
313
+ seal_stream_t* SEAL_API seal_get_src_stream(seal_src_t*);
300
314
 
301
315
  /*
302
316
  * Gets the size, in byte, of a source's streaming queue. The default is 3.
@@ -305,7 +319,7 @@ seal_stream_t* seal_get_src_stream(seal_src_t*);
305
319
  * @param src the source to get the queue size of
306
320
  * @param psize the receiver of the the queue size
307
321
  */
308
- seal_err_t seal_get_src_queue_size(seal_src_t*, size_t* /*psize*/);
322
+ seal_err_t SEAL_API seal_get_src_queue_size(seal_src_t*, size_t* /*psize*/);
309
323
 
310
324
  /*
311
325
  * Gets the size, in byte, of a source's streaming chunk. The default is
@@ -315,7 +329,7 @@ seal_err_t seal_get_src_queue_size(seal_src_t*, size_t* /*psize*/);
315
329
  * @param src the source to get the chunk size of
316
330
  * @param psize the receiver of the chunk size
317
331
  */
318
- seal_err_t seal_get_src_chunk_size(seal_src_t*, size_t* /*psize*/);
332
+ seal_err_t SEAL_API seal_get_src_chunk_size(seal_src_t*, size_t* /*psize*/);
319
333
 
320
334
  /*
321
335
  * Gets the position of a source. The default is ( 0.0f, 0.0f, 0.0f ).
@@ -326,8 +340,12 @@ seal_err_t seal_get_src_chunk_size(seal_src_t*, size_t* /*psize*/);
326
340
  * @param py the receiver of the y position
327
341
  * @param pz the receiver of the z position
328
342
  */
329
- seal_err_t seal_get_src_pos(seal_src_t*, float* /*px*/, float* /*py*/,
330
- float* /*pz*/);
343
+ seal_err_t SEAL_API seal_get_src_pos(
344
+ seal_src_t*,
345
+ float* /*px*/,
346
+ float* /*py*/,
347
+ float* /*pz*/
348
+ );
331
349
 
332
350
  /*
333
351
  * Gets the velocity of a source. The default is ( 0.0f, 0.0f, 0.0f ).
@@ -338,8 +356,12 @@ seal_err_t seal_get_src_pos(seal_src_t*, float* /*px*/, float* /*py*/,
338
356
  * @param py the receiver of the y velocity
339
357
  * @param pz the receiver of the z velocity
340
358
  */
341
- seal_err_t seal_get_src_vel(seal_src_t*, float* /*px*/, float* /*py*/,
342
- float* /*pz*/);
359
+ seal_err_t SEAL_API seal_get_src_vel(
360
+ seal_src_t*,
361
+ float* /*px*/,
362
+ float* /*py*/,
363
+ float* /*pz*/
364
+ );
343
365
 
344
366
  /*
345
367
  * Gets the pitch of a source. The default is 1.0f.
@@ -348,7 +370,7 @@ seal_err_t seal_get_src_vel(seal_src_t*, float* /*px*/, float* /*py*/,
348
370
  * @param src the source to get the pitch of
349
371
  * @param ppitch the receiver of the pitch
350
372
  */
351
- seal_err_t seal_get_src_pitch(seal_src_t*, float* /*ppitch*/);
373
+ seal_err_t SEAL_API seal_get_src_pitch(seal_src_t*, float* /*ppitch*/);
352
374
 
353
375
  /*
354
376
  * Gets the gain of a source. The default is 1.0f.
@@ -357,7 +379,7 @@ seal_err_t seal_get_src_pitch(seal_src_t*, float* /*ppitch*/);
357
379
  * @param src the source to get the gain of
358
380
  * @param pgain the receiver of the gain
359
381
  */
360
- seal_err_t seal_get_src_gain(seal_src_t*, float* /*pgain*/);
382
+ seal_err_t SEAL_API seal_get_src_gain(seal_src_t*, float* /*pgain*/);
361
383
 
362
384
  /*
363
385
  * Determines if a source is automatically updated. The default is true
@@ -367,7 +389,7 @@ seal_err_t seal_get_src_gain(seal_src_t*, float* /*pgain*/);
367
389
  * @param src the source to determine
368
390
  * @param pauto the receiver of the auto update flag
369
391
  */
370
- seal_err_t seal_is_src_auto(seal_src_t*, char* /*pauto*/);
392
+ seal_err_t SEAL_API seal_is_src_auto(seal_src_t*, char* /*pauto*/);
371
393
 
372
394
  /*
373
395
  * Determines if a source is relative. The default is false (0).
@@ -376,7 +398,7 @@ seal_err_t seal_is_src_auto(seal_src_t*, char* /*pauto*/);
376
398
  * @param src the source to determine
377
399
  * @param prelative the receiver of the relative flag
378
400
  */
379
- seal_err_t seal_is_src_relative(seal_src_t*, char* /*prelative*/);
401
+ seal_err_t SEAL_API seal_is_src_relative(seal_src_t*, char* /*prelative*/);
380
402
 
381
403
  /*
382
404
  * Determines if a source is looping. The default is false (0).
@@ -385,7 +407,7 @@ seal_err_t seal_is_src_relative(seal_src_t*, char* /*prelative*/);
385
407
  * @param src the source to determine
386
408
  * @param plooping the receiver of the looping flag
387
409
  */
388
- seal_err_t seal_is_src_looping(seal_src_t*, char* /*plooping*/);
410
+ seal_err_t SEAL_API seal_is_src_looping(seal_src_t*, char* /*plooping*/);
389
411
 
390
412
  /*
391
413
  * Gets the type of a source.
@@ -394,7 +416,10 @@ seal_err_t seal_is_src_looping(seal_src_t*, char* /*plooping*/);
394
416
  * @param src the source to get the source type of
395
417
  * @param ptype the receiver of the source type
396
418
  */
397
- seal_err_t seal_get_src_type(seal_src_t*, seal_src_type_t* /*ptype*/);
419
+ seal_err_t SEAL_API seal_get_src_type(
420
+ seal_src_t*,
421
+ seal_src_type_t* /*ptype*/
422
+ );
398
423
 
399
424
  /*
400
425
  * Gets the state of a source.
@@ -403,7 +428,10 @@ seal_err_t seal_get_src_type(seal_src_t*, seal_src_type_t* /*ptype*/);
403
428
  * @param src the source to get the state of
404
429
  * @param pstate the receiver of the source state
405
430
  */
406
- seal_err_t seal_get_src_state(seal_src_t*, seal_src_state_t* /*pstate*/);
431
+ seal_err_t SEAL_API seal_get_src_state(
432
+ seal_src_t*,
433
+ seal_src_state_t* /*pstate*/
434
+ );
407
435
 
408
436
  #ifdef __cplusplus
409
437
  }
@@ -38,8 +38,11 @@ extern "C" {
38
38
  * audio format will be attempted if the passed-in `fmt' is
39
39
  * `SEAL_UNKNOWN_FMT'
40
40
  */
41
- seal_err_t seal_open_stream(seal_stream_t*, const char* /*filename*/,
42
- seal_fmt_t);
41
+ seal_err_t SEAL_API seal_open_stream(
42
+ seal_stream_t*,
43
+ const char* /*filename*/,
44
+ seal_fmt_t
45
+ );
43
46
 
44
47
  /*
45
48
  * Streams from an opened stream.
@@ -56,14 +59,18 @@ seal_err_t seal_open_stream(seal_stream_t*, const char* /*filename*/,
56
59
  * @param psize the receiver of the actual size, in bytes, of streamed
57
60
  * data if successful or otherwise a negative integer
58
61
  */
59
- seal_err_t seal_stream(seal_stream_t*, seal_raw_t*, size_t* /*psize*/);
62
+ seal_err_t SEAL_API seal_stream(
63
+ seal_stream_t*,
64
+ seal_raw_t*,
65
+ size_t* /*psize*/
66
+ );
60
67
 
61
68
  /*
62
69
  * Rewinds a stream to the beginning.
63
70
  *
64
71
  * @param stream the stream to rewind
65
72
  */
66
- seal_err_t seal_rewind_stream(seal_stream_t*);
73
+ seal_err_t SEAL_API seal_rewind_stream(seal_stream_t*);
67
74
 
68
75
  /*
69
76
  * Closes a stream opened by `seal_open_stream'.
@@ -71,7 +78,7 @@ seal_err_t seal_rewind_stream(seal_stream_t*);
71
78
  * @param stream the stream to close; will be left untouched if an error
72
79
  * occurs
73
80
  */
74
- seal_err_t seal_close_stream(seal_stream_t*);
81
+ seal_err_t SEAL_API seal_close_stream(seal_stream_t*);
75
82
 
76
83
  #ifdef __cplusplus
77
84
  }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -182,7 +182,7 @@
182
182
  <PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_WARNINGS;OPT_GENERIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
183
183
  <ExceptionHandling>
184
184
  </ExceptionHandling>
185
- <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
185
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
186
186
  <BufferSecurityCheck>false</BufferSecurityCheck>
187
187
  <FunctionLevelLinking>false</FunctionLevelLinking>
188
188
  <EnableEnhancedInstructionSet>StreamingSIMDExtensions</EnableEnhancedInstructionSet>
@@ -355,7 +355,7 @@ yasm -a x86 -p gas -r raw -f win32 -g null -m x86 -o "$(ProjectDir)..\libmpg123\
355
355
  <PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_WARNINGS;OPT_MULTI;OPT_GENERIC;OPT_I386;OPT_I586;OPT_MMX;OPT_3DNOW;OPT_3DNOWEXT;OPT_SSE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
356
356
  <ExceptionHandling>
357
357
  </ExceptionHandling>
358
- <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
358
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
359
359
  <BufferSecurityCheck>false</BufferSecurityCheck>
360
360
  <FunctionLevelLinking>false</FunctionLevelLinking>
361
361
  <EnableEnhancedInstructionSet>StreamingSIMDExtensions</EnableEnhancedInstructionSet>
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -20,6 +20,16 @@ class Symbol
20
20
  end
21
21
  end
22
22
 
23
+ module Helpers
24
+ def with_motion(movable)
25
+ original_position = movable.position
26
+ original_velocity = movable.velocity
27
+ yield
28
+ movable.position = original_position
29
+ movable.velocity = original_velocity
30
+ end
31
+ end
32
+
23
33
  Dir["./spec/support/**/*.rb"].each { |f| require f }
24
34
  require 'seal'
25
35
  include Seal
@@ -30,11 +40,14 @@ WAV_PATH = File.join FIXTURE_DIR, 'tone_up.wav'
30
40
  OV_PATH = File.join FIXTURE_DIR, 'heal.ogg'
31
41
 
32
42
  RSpec.configure do |config|
33
- config.include CustomMatchers
34
- config.alias_it_should_behave_like_to :it_validates, 'validates that'
35
- config.alias_it_should_behave_like_to :it_defines, 'defines'
36
43
 
37
44
  config.instance_eval do
45
+ include CustomMatchers
46
+ include Helpers, :include_helpers
47
+
48
+ alias_it_should_behave_like_to :it_validates, 'validates that'
49
+ alias_it_should_behave_like_to :it_defines, 'defines'
50
+
38
51
  before :all do
39
52
  Seal.startup
40
53
  end
@@ -6,17 +6,31 @@ shared_examples 'a movable object' do
6
6
  its(:velocity) { should eq [0, 0, 0] }
7
7
  end
8
8
 
9
- it 'can change its position' do
10
- old_position = subject.position
11
- subject.position = 3.2, 3.1, -0.3
12
- subject.position.should be_each_within(TOLERANCE).of [3.2, 3.1, -0.3]
13
- subject.position = old_position
14
- end
9
+ context 'with motion', :include_helpers do
10
+ it 'changes its position' do
11
+ with_motion(subject) do
12
+ subject.position = 3.2, 3.1, -0.3
13
+ subject.position.should be_each_within(TOLERANCE).of [3.2, 3.1, -0.3]
14
+ end
15
+ end
16
+
17
+ it 'changes its velocity' do
18
+ with_motion(subject) do
19
+ subject.velocity = 1.3, -3, 0.566
20
+ subject.velocity.should be_each_within(TOLERANCE).of [1.3, -3, 0.566]
21
+ end
22
+ end
15
23
 
16
- it 'can change its velocity' do
17
- old_velocity = subject.velocity
18
- subject.velocity = 1.3, -3, 0.566
19
- subject.velocity.should be_each_within(TOLERANCE).of [1.3, -3, 0.566]
20
- subject.velocity = old_velocity
24
+ it 'moves based on velocity' do
25
+ with_motion(subject) do
26
+ subject.velocity = 3, -3.51, 0.2
27
+ 5.times do
28
+ position = subject.position
29
+ new_position = position.zip(subject.velocity).map { |x, y| x + y }
30
+ subject.move
31
+ subject.position.should be_each_within(TOLERANCE).of new_position
32
+ end
33
+ end
34
+ end
21
35
  end
22
36
  end