seal 0.1.0 → 0.1.1
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/README.md +1 -1
- data/include/seal/buf.h +13 -8
- data/include/seal/core.h +1 -5
- data/include/seal/efs.h +22 -22
- data/include/seal/err.h +3 -8
- data/include/seal/fmt.h +1 -6
- data/include/seal/listener.h +7 -6
- data/include/seal/raw.h +2 -6
- data/include/seal/rvb.h +12 -6
- data/include/seal/src.h +27 -10
- data/include/seal/stream.h +12 -5
- data/mpg123/build/config.guess +0 -0
- data/mpg123/build/config.sub +0 -0
- data/mpg123/build/depcomp +0 -0
- data/mpg123/build/install-sh +0 -0
- data/mpg123/build/missing +0 -0
- data/mpg123/configure +0 -0
- data/mpg123/ports/MSVC++/2010/libmpg123/libmpg123.vcxproj +5 -0
- data/mpg123/ports/MSVC++/2010/libmpg123/yasm.exe +0 -0
- data/mpg123/scripts/benchmark-cpu.pl +0 -0
- data/mpg123/src/win32_net.c +0 -0
- data/mpg123/src/win32_support.c +0 -0
- data/mpg123/src/win32_support.h +0 -0
- data/mpg123/windows-builds.sh +0 -0
- data/spec/seal/core_spec.rb +1 -1
- data/spec/seal/effect_slot_spec.rb +5 -8
- data/spec/seal/reverb_spec.rb +10 -9
- data/spec/seal/source_spec.rb +23 -10
- data/spec/seal/stream_spec.rb +7 -0
- data/spec/spec_helper.rb +2 -1
- data/spec/support/boolean_reader_aliases.rb +9 -0
- data/src/rubyext.c +115 -67
- data/src/seal/buf.c +0 -6
- data/src/seal/core.c +1 -7
- data/src/seal/efs.c +0 -9
- data/src/seal/err.c +0 -6
- data/src/seal/fmt.c +0 -6
- data/src/seal/listener.c +0 -6
- data/src/seal/mpg.c +0 -6
- data/src/seal/mpg.h +0 -4
- data/src/seal/ov.c +0 -6
- data/src/seal/ov.h +1 -5
- data/src/seal/raw.c +0 -6
- data/src/seal/reader.c +4 -11
- data/src/seal/reader.h +1 -5
- data/src/seal/src.c +9 -6
- data/src/seal/stream.c +0 -6
- data/src/seal/threading.c +0 -6
- data/src/seal/threading.h +1 -6
- data/src/seal/wav.c +1 -8
- data/src/seal/wav.h +2 -6
- metadata +5 -3
- data/src/win32api.rb +0 -29
data/README.md
CHANGED
@@ -71,7 +71,7 @@ Apply a reverberation effect to the sound source:
|
|
71
71
|
# Allocate an effect slot and associate a specific reverb object.
|
72
72
|
slot = EffectSlot.new(Reverb.new(Reverb::Preset::FOREST))
|
73
73
|
# Start feeding the slot.
|
74
|
-
|
74
|
+
source.feed(slot, 0)
|
75
75
|
```
|
76
76
|
|
77
77
|
Uninitialize Seal:
|
data/include/seal/buf.h
CHANGED
@@ -1,13 +1,15 @@
|
|
1
1
|
/*
|
2
|
-
*
|
3
|
-
*
|
4
|
-
*
|
2
|
+
* Interfaces for manipulating buffers. Buffers are essentially abstract
|
3
|
+
* representations of (raw) audio data and are used by sources. Buffers are
|
4
|
+
* most suitable for small-sized sound effect which can be efficiently loaded
|
5
|
+
* to memory at once. Streams, on the other hand, are more suitable for massive
|
6
|
+
* audio such as background music.
|
5
7
|
*
|
6
|
-
*
|
7
|
-
*
|
8
|
-
*
|
9
|
-
*
|
10
|
-
*
|
8
|
+
* In order to have 3D sound effect on the buffer, the audio file needs to have
|
9
|
+
* mono-channel. If the audio file has multi-channel, the sound will not be
|
10
|
+
* positioned in a 3D space. Multi-channel audio (a.k.a. stereo) is already
|
11
|
+
* designed to have illusion of directionality and audible perspective. Most
|
12
|
+
* sound effect should be monophonic.
|
11
13
|
*/
|
12
14
|
|
13
15
|
#ifndef _SEAL_BUF_H_
|
@@ -28,6 +30,9 @@ extern "C" {
|
|
28
30
|
* Initializes a new buffer. If the buffer is no longer needed, call
|
29
31
|
* `seal_destroy_buf' to release the resources used by the buffer.
|
30
32
|
*
|
33
|
+
* There is a limit on the number of allocated buffer. This function returns an
|
34
|
+
* error if it is exceeding the limit.
|
35
|
+
*
|
31
36
|
* @param buf the buffer to initialize
|
32
37
|
*/
|
33
38
|
seal_err_t seal_init_buf(seal_buf_t*);
|
data/include/seal/core.h
CHANGED
@@ -1,9 +1,5 @@
|
|
1
1
|
/*
|
2
|
-
*
|
3
|
-
* under the terms of the GNU Lesser General Public License. See COPYING
|
4
|
-
* attached with the library.
|
5
|
-
*
|
6
|
-
* core.h defines interfaces for low-level Seal operations.
|
2
|
+
* Interfaces for global Seal operations.
|
7
3
|
*/
|
8
4
|
|
9
5
|
#ifndef _SEAL_CORE_H_
|
data/include/seal/efs.h
CHANGED
@@ -1,25 +1,33 @@
|
|
1
1
|
/*
|
2
|
-
*
|
3
|
-
*
|
4
|
-
*
|
2
|
+
* Interfaces for manipulating effect slots, which are containers for effect
|
3
|
+
* objects. Effect slots can attach effect objects (such as reverb objects) and
|
4
|
+
* then be fed with a mix of audio from different sources, essentially
|
5
|
+
* filtering the rendering of the sound sources and output to the mixer based
|
6
|
+
* on the attached effect object. For example, if a reverb object is attached
|
7
|
+
* to an effect slot and one source is feeding the slot, the sound of that
|
8
|
+
* source will have the reverberation effect defined by the reverb object.
|
9
|
+
|
10
|
+
* Multiple sources can feed the same effect slot, but conversely there is a
|
11
|
+
* limit on the number of effect slots a source can feed concurrently. See the
|
12
|
+
* documentation for EffectSlot#feed for more details.
|
5
13
|
*
|
6
|
-
*
|
7
|
-
*
|
8
|
-
* sound.
|
14
|
+
* For more infomation about effect slots, check out the OpenAL effect
|
15
|
+
* extension guide at: http://zhang.su/seal/EffectsExtensionGuide.pdf
|
9
16
|
*/
|
10
17
|
|
11
18
|
#ifndef _SEAL_EFS_H_
|
12
19
|
#define _SEAL_EFS_H_
|
13
20
|
|
14
|
-
#include "src.h"
|
15
21
|
#include "err.h"
|
16
22
|
|
17
23
|
typedef struct seal_efs_t seal_efs_t;
|
18
24
|
|
19
25
|
/*
|
20
26
|
* Initializes a new effect slot. If the effect slot is no longer needed, call
|
21
|
-
* `seal_destroy_efs' to release the resources used by the effect
|
22
|
-
*
|
27
|
+
* `seal_destroy_efs' to release the resources used by the effect slot.
|
28
|
+
*
|
29
|
+
* There is a limit on the number of allocated effect slots. This function
|
30
|
+
* returns an error if it is exceeding the limit.
|
23
31
|
*
|
24
32
|
* @param efs the effect slot to initialize
|
25
33
|
*/
|
@@ -34,25 +42,17 @@ seal_err_t seal_destroy_efs(seal_efs_t*);
|
|
34
42
|
|
35
43
|
/*
|
36
44
|
* Fills an effect slot with an effect object, then the effect Slot will
|
37
|
-
* become ready to be
|
45
|
+
* become ready to be fed by sources. Pass 0 to unfill the slot.
|
46
|
+
*
|
47
|
+
* Changing the parameters of the effect object after it is attached to the
|
48
|
+
* slot will not change the sound effect provided by the slot. To update the
|
49
|
+
* sound effect, the effect object must be re-attached to the slot.
|
38
50
|
*
|
39
51
|
* @param efs the effect slot to fill
|
40
52
|
* @param effect the effect to fill the effect slot with
|
41
53
|
*/
|
42
54
|
seal_err_t seal_set_efs_effect(seal_efs_t*, void* /*effect*/);
|
43
55
|
|
44
|
-
/*
|
45
|
-
* Mixes a sound effect loaded into an effect slot with a source's output.
|
46
|
-
* Later calls to this function with a different effect slot and the same
|
47
|
-
* index will override the old effect slot association.
|
48
|
-
*
|
49
|
-
* @see seal_get_neffects_per_src
|
50
|
-
* @param efs the slot that contains the effect to mix
|
51
|
-
* @param index the zero-based index of the effect
|
52
|
-
* @param src the source that feeds the effect slot
|
53
|
-
*/
|
54
|
-
seal_err_t seal_feed_efs(seal_efs_t*, int /*index*/, seal_src_t*);
|
55
|
-
|
56
56
|
/*
|
57
57
|
* Sets the output level of an effect Slot in the interval [0.0f, 1.0f]. A
|
58
58
|
* value of 0.0 mutes the output.
|
data/include/seal/err.h
CHANGED
@@ -1,12 +1,7 @@
|
|
1
1
|
/*
|
2
|
-
*
|
3
|
-
*
|
4
|
-
*
|
5
|
-
*
|
6
|
-
* err.h defines Seal errors and provides subroutines for clearing and
|
7
|
-
* retriving errors. Seal functions will set a thread-local error flag when
|
8
|
-
* error strikes, so if the last Seal function call returns 0, the exact error
|
9
|
-
* and detailed error message can be retrieved using functions in this module.
|
2
|
+
* Seal errors and interfaces for retriving error messages. Most Seal functions
|
3
|
+
* return an error code which can be used to retrieve the corresponding error
|
4
|
+
* message.
|
10
5
|
*/
|
11
6
|
|
12
7
|
#ifndef _SEAL_ERR_H_
|
data/include/seal/fmt.h
CHANGED
@@ -1,10 +1,5 @@
|
|
1
1
|
/*
|
2
|
-
*
|
3
|
-
* under the terms of the GNU Lesser General Public License. See COPYING
|
4
|
-
* attached with the library.
|
5
|
-
*
|
6
|
-
* fmt.h defines all the supported audio file format and provides utilities
|
7
|
-
* to deal with them.
|
2
|
+
* Supported audio file formats and utilities to deal with them.
|
8
3
|
*/
|
9
4
|
|
10
5
|
#ifndef _SEAL_FMT_H_
|
data/include/seal/listener.h
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
/*
|
2
|
-
*
|
3
|
-
*
|
4
|
-
*
|
5
|
-
*
|
6
|
-
*
|
7
|
-
*
|
2
|
+
* Interfaces for manipulating the listener singleton object. The listener
|
3
|
+
* object abstractly represents the main object in a sound application which
|
4
|
+
* "hears" all the sound. For example, the listener object can be used to
|
5
|
+
* represent the main character moving around on the map in a role-playing
|
6
|
+
* game. The properties of the listener (position, velocity, etc.) combined
|
7
|
+
* with those of the existing sources determine how the sound should be
|
8
|
+
* rendered.
|
8
9
|
*/
|
9
10
|
|
10
11
|
#ifndef _SEAL_LISTENER_H_
|
data/include/seal/raw.h
CHANGED
@@ -1,10 +1,6 @@
|
|
1
1
|
/*
|
2
|
-
*
|
3
|
-
*
|
4
|
-
* attached with the library.
|
5
|
-
*
|
6
|
-
* raw.h defines the the data structure `seal_raw_t' that represents raw PCM
|
7
|
-
* data as well as a series of operations on them.
|
2
|
+
* Interfaces for manipulating the data structure `seal_raw_t' which contains
|
3
|
+
* raw PCM data.
|
8
4
|
*/
|
9
5
|
|
10
6
|
#ifndef _SEAL_RAW_H_
|
data/include/seal/rvb.h
CHANGED
@@ -1,10 +1,13 @@
|
|
1
1
|
/*
|
2
|
-
*
|
3
|
-
*
|
4
|
-
*
|
5
|
-
*
|
6
|
-
*
|
7
|
-
*
|
2
|
+
* Interfaces for manipulating reverberation effect objects which can be loaded
|
3
|
+
* into effect slots. The reverberation parameters can be customized to
|
4
|
+
* emulate reverberations in different environment or can be loaded from
|
5
|
+
* presets. The preset constants suggest the reverberation environment, for
|
6
|
+
* example, `SEAL_ICEPALACE_LONGPASSAGE_REVERB` emulates the reverberation in
|
7
|
+
* a long passage of an ice palace.
|
8
|
+
*
|
9
|
+
* For more infomation about reverberations, check out the OpenAL effect
|
10
|
+
* extension guide at: http://zhang.su/seal/EffectsExtensionGuide.pdf
|
8
11
|
*/
|
9
12
|
|
10
13
|
#ifndef _SEAL_RVB_H_
|
@@ -169,6 +172,9 @@ extern "C" {
|
|
169
172
|
* Initializes a new reverb effect. If the reverb is no longer needed, call
|
170
173
|
* `seal_destroy_rvb' to release the resources used by the reverb.
|
171
174
|
*
|
175
|
+
* There is a limit on the number of allocated reverbs. This function returns
|
176
|
+
* an error if it is exceeding the limit.
|
177
|
+
*
|
172
178
|
* @param reverb the reverb object to initialize
|
173
179
|
*/
|
174
180
|
seal_err_t seal_init_rvb(seal_rvb_t*);
|
data/include/seal/src.h
CHANGED
@@ -1,10 +1,8 @@
|
|
1
1
|
/*
|
2
|
-
*
|
3
|
-
*
|
4
|
-
* attached with the
|
5
|
-
*
|
6
|
-
* src.h wraps up the abstract data type `seal_src_t'. Sources are abstract
|
7
|
-
* representations of sound sources which emit sound in Euclidean space.
|
2
|
+
* Interfaces for manipulating sources. Sources are abstract representations of
|
3
|
+
* sound sources which emit sound in a Euclidean space. The sound comes from
|
4
|
+
* its attached buffer or stream. Its properties combined with those of the
|
5
|
+
* listener singleton object determine how the sound should be rendered.
|
8
6
|
*/
|
9
7
|
|
10
8
|
#ifndef _SEAL_SRC_H_
|
@@ -13,13 +11,13 @@
|
|
13
11
|
#include <stddef.h>
|
14
12
|
#include "buf.h"
|
15
13
|
#include "stream.h"
|
14
|
+
#include "efs.h"
|
16
15
|
#include "err.h"
|
17
16
|
|
18
17
|
/*
|
19
|
-
* A
|
20
|
-
*
|
21
|
-
*
|
22
|
-
* will become the `SEAL_STREAMING' type.
|
18
|
+
* A source not attached to anything is of the `SEAL_UNDETERMINED` type. A
|
19
|
+
* source that is attached to a buffer will become the `SEAL_STATIC` type.
|
20
|
+
* A source that is attached to a stream will become the `SEAL_STREAMING` type.
|
23
21
|
*/
|
24
22
|
enum seal_src_type_t
|
25
23
|
{
|
@@ -55,6 +53,9 @@ extern "C" {
|
|
55
53
|
* Initializes a new source. If the source is no longer needed, call
|
56
54
|
* `seal_destroy_source' to release any resource used by the source.
|
57
55
|
*
|
56
|
+
* There is a limit on the number of allocated sources. This function returns
|
57
|
+
* an error if it is exceeding the limit.
|
58
|
+
*
|
58
59
|
* @param src the source to initialize
|
59
60
|
*/
|
60
61
|
seal_err_t seal_init_src(seal_src_t*);
|
@@ -140,6 +141,22 @@ seal_err_t seal_set_src_buf(seal_src_t*, seal_buf_t*);
|
|
140
141
|
*/
|
141
142
|
seal_err_t seal_set_src_stream(seal_src_t*, seal_stream_t*);
|
142
143
|
|
144
|
+
/*
|
145
|
+
* Feeds an effect slot with the output of a source so the output is filtered
|
146
|
+
* based on the effect attached to the slot. Later calls to this function with
|
147
|
+
* a different effect slot and the same source and index will override the old
|
148
|
+
* association.
|
149
|
+
*
|
150
|
+
* @see seal_get_per_src_effect_limit
|
151
|
+
* @param src the source that feeds the effect slot
|
152
|
+
* @param efs the effect slot to feed
|
153
|
+
* @param index the zero-based index for the effect; each different effect
|
154
|
+
* slot that the source is feeding must have a unique
|
155
|
+
* corresponding index; the max is the return value of
|
156
|
+
* seal_get_per_src_effect_limit - 1.
|
157
|
+
*/
|
158
|
+
seal_err_t seal_feed_efs(seal_src_t*, seal_efs_t*, int /*index*/);
|
159
|
+
|
143
160
|
/*
|
144
161
|
* Updates a streaming source. If the source is not up-to-date, the playback
|
145
162
|
* will end before the end of the stream is reached. Does nothing if the
|
data/include/seal/stream.h
CHANGED
@@ -1,10 +1,17 @@
|
|
1
1
|
/*
|
2
|
-
*
|
3
|
-
*
|
4
|
-
*
|
2
|
+
* Interfaces for manipulating streams used by streaming sources. Streams are
|
3
|
+
* usually necessary when the audio data is too massive to fit into main
|
4
|
+
* memory as a whole (such as a background music, which can eat up to dozens of
|
5
|
+
* megabytes of memory after decoding), in which case buffers are not suitable.
|
5
6
|
*
|
6
|
-
*
|
7
|
-
*
|
7
|
+
* Streams often contain multi-channel audio (since most of the time they are
|
8
|
+
* used to play background music, and background music files are often
|
9
|
+
* multi-channel already), which means that they often contain sound that are
|
10
|
+
* not positioned, i.e., not processed by the 3D sound rendering pipeline. That
|
11
|
+
* fact is totally fine for background music since they are usually not
|
12
|
+
* associated to any object in the application. If positioned streams are
|
13
|
+
* needed and the audio file has multi-channel, the audio file need to be
|
14
|
+
* converted to mono-channel.
|
8
15
|
*/
|
9
16
|
|
10
17
|
#ifndef _SEAL_STREAM_H_
|
data/mpg123/build/config.guess
CHANGED
File without changes
|
data/mpg123/build/config.sub
CHANGED
File without changes
|
data/mpg123/build/depcomp
CHANGED
File without changes
|
data/mpg123/build/install-sh
CHANGED
File without changes
|
data/mpg123/build/missing
CHANGED
File without changes
|
data/mpg123/configure
CHANGED
File without changes
|
@@ -340,6 +340,8 @@ yasm -a x86 -p gas -r raw -f win32 -g null -m x86 -o "$(ProjectDir)..\libmpg123\
|
|
340
340
|
<AdditionalDependencies>dct36_3dnow.o;dct36_3dnowext.o;dct64_3dnow.o;dct64_3dnowext.o;dct64_mmx.o;dct64_sse.o;dct64_sse_float.o;equalizer_3dnow.o;getcpuflags.o;synth_3dnow.o;synth_3dnowext.o;synth_i586.o;synth_mmx.o;synth_sse.o;synth_sse_float.o;synth_stereo_sse_float.o;tabinit_mmx.o;synth_sse_accurate.o;synth_sse_s32.o;synth_stereo_sse_accurate.o;synth_stereo_sse_s32.o;%(AdditionalDependencies)</AdditionalDependencies>
|
341
341
|
<OutputFile>$(ProjectDir)Debug\$(ProjectName).lib</OutputFile>
|
342
342
|
<AdditionalLibraryDirectories>$(ProjectDir)\Debug;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
343
|
+
<IgnoreAllDefaultLibraries>
|
344
|
+
</IgnoreAllDefaultLibraries>
|
343
345
|
</Lib>
|
344
346
|
</ItemDefinitionGroup>
|
345
347
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release_x86|Win32'">
|
@@ -434,6 +436,9 @@ yasm -a x86 -p gas -r raw -f win32 -g null -m x86 -o "$(ProjectDir)..\libmpg123\
|
|
434
436
|
<OutputFile>$(ProjectDir)Release\$(ProjectName).lib</OutputFile>
|
435
437
|
<AdditionalLibraryDirectories>$(ProjectDir)\Release;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
436
438
|
</Lib>
|
439
|
+
<PreBuildEvent>
|
440
|
+
<Command>del "$(ProjectDir)..\..\..\..\src\libmpg123\mpg123.h"</Command>
|
441
|
+
</PreBuildEvent>
|
437
442
|
</ItemDefinitionGroup>
|
438
443
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug_x86_Dll|Win32'">
|
439
444
|
<ClCompile>
|
File without changes
|
File without changes
|
data/mpg123/src/win32_net.c
CHANGED
File without changes
|
data/mpg123/src/win32_support.c
CHANGED
File without changes
|
data/mpg123/src/win32_support.h
CHANGED
File without changes
|
data/mpg123/windows-builds.sh
CHANGED
File without changes
|
data/spec/seal/core_spec.rb
CHANGED
@@ -16,7 +16,7 @@ describe Seal do
|
|
16
16
|
Seal.listener.should be Seal.listener
|
17
17
|
Seal.listener.should be_a Listener
|
18
18
|
expect { Seal::Listener.new }.to raise_error NoMethodError
|
19
|
-
expect { Seal::Listener.allocate }.to raise_error
|
19
|
+
expect { Seal::Listener.allocate }.to raise_error
|
20
20
|
end
|
21
21
|
|
22
22
|
it 'defines a limit on the number of effect slots per source' do
|
@@ -11,6 +11,7 @@ describe EffectSlot do
|
|
11
11
|
|
12
12
|
it_validates 'the boolean attribute', :auto
|
13
13
|
it_validates 'the float attribute', :gain, "[0, 1]"
|
14
|
+
it_defines 'boolean reader aliases', [:auto]
|
14
15
|
|
15
16
|
it 'can initialize with an effect' do
|
16
17
|
reverb = Reverb.new
|
@@ -25,14 +26,10 @@ describe EffectSlot do
|
|
25
26
|
effect_slot.effect.should be reverb
|
26
27
|
end
|
27
28
|
|
28
|
-
it '
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
sources << Source.new
|
33
|
-
effect_slot.feed(i, sources[-1])
|
29
|
+
it 'can be fed by multiple sources' do
|
30
|
+
23.times do
|
31
|
+
source = Source.new
|
32
|
+
source.feed(subject, 0)
|
34
33
|
end
|
35
|
-
expect { effect_slot.feed(sources.size, Source.new) }.to raise_error \
|
36
|
-
/Invalid parameter value/
|
37
34
|
end
|
38
35
|
end
|
data/spec/seal/reverb_spec.rb
CHANGED
@@ -30,15 +30,16 @@ describe Reverb do
|
|
30
30
|
it_validates 'the float attribute', :reflections_delay, '[0, 0.3]'
|
31
31
|
it_validates 'the float attribute', :reflections_gain, '[0, 3.16]'
|
32
32
|
it_validates 'the float attribute', :room_rolloff_factor, '[0, 10]'
|
33
|
+
it_defines 'boolean reader aliases', [:hfdecay_limited]
|
33
34
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
35
|
+
specify_preset_loading = -> mod do
|
36
|
+
mod.constants.each do |const_sym|
|
37
|
+
constant = mod.const_get(const_sym)
|
38
|
+
case constant
|
39
|
+
when Module
|
40
|
+
specify_preset_loading.(constant)
|
41
|
+
else
|
42
|
+
it "can load preset #{mod}::#{const_sym}" do
|
42
43
|
expect do
|
43
44
|
reverb = Reverb.new(constant)
|
44
45
|
reverb.load(constant)
|
@@ -46,6 +47,6 @@ describe Reverb do
|
|
46
47
|
end
|
47
48
|
end
|
48
49
|
end
|
49
|
-
test_load_presets.call(Reverb::Preset)
|
50
50
|
end
|
51
|
+
specify_preset_loading.(Reverb::Preset)
|
51
52
|
end
|
data/spec/seal/source_spec.rb
CHANGED
@@ -11,7 +11,7 @@ describe Source do
|
|
11
11
|
it_behaves_like 'a movable object'
|
12
12
|
|
13
13
|
describe 'by default' do
|
14
|
-
its(:auto
|
14
|
+
its(:auto) { should be_true }
|
15
15
|
its(:buffer) { should be_nil }
|
16
16
|
its(:chunk_size) { should eq 36864 }
|
17
17
|
its(:gain) { should be_within(TOLERANCE).of(1.0) }
|
@@ -21,13 +21,14 @@ describe Source do
|
|
21
21
|
its(:relative) { should be_false }
|
22
22
|
its(:state) { should be INITIAL }
|
23
23
|
its(:stream) { should be_nil }
|
24
|
-
its
|
24
|
+
its(:type) { should be UNDETERMINED }
|
25
25
|
end
|
26
26
|
|
27
27
|
it_validates 'the boolean attribute', :relative
|
28
28
|
it_validates 'the boolean attribute', :auto
|
29
29
|
it_validates 'the float attribute', :pitch, "[0, +inf.)"
|
30
30
|
it_validates 'the float attribute', :gain, "[0, +inf.)"
|
31
|
+
it_defines 'boolean reader aliases', [:auto, :relative, :looping]
|
31
32
|
|
32
33
|
it 'validates its queue size is in [2, 63]' do
|
33
34
|
error_pattern = /Invalid parameter value/
|
@@ -180,6 +181,18 @@ describe Source do
|
|
180
181
|
end
|
181
182
|
end
|
182
183
|
|
184
|
+
describe 'feeding effect slots' do
|
185
|
+
it 'can only feed a limited number concurrently' do
|
186
|
+
effect_slot = nil
|
187
|
+
Seal.per_source_effect_limit.times do |i|
|
188
|
+
effect_slot = EffectSlot.new
|
189
|
+
source.feed(effect_slot, i)
|
190
|
+
end
|
191
|
+
expect { source.feed(effect_slot, Seal.per_source_effect_limit) }.to \
|
192
|
+
raise_error /Invalid parameter value/
|
193
|
+
end
|
194
|
+
end
|
195
|
+
|
183
196
|
describe 'automatic streaming' do
|
184
197
|
let(:source) do
|
185
198
|
Source.new.tap do |source|
|
@@ -209,31 +222,31 @@ describe Source do
|
|
209
222
|
|
210
223
|
describe 'looping' do
|
211
224
|
example 'as undetermined type' do
|
212
|
-
source.looping
|
225
|
+
source.looping.should be_false
|
213
226
|
source.looping = true
|
214
227
|
source.looping.should be_true
|
215
228
|
source.looping = false
|
216
|
-
source.looping
|
229
|
+
source.looping.should be_false
|
217
230
|
end
|
218
231
|
|
219
232
|
example 'as streaming type' do
|
220
233
|
source.looping = true
|
221
234
|
source.stream = stream
|
222
|
-
source.looping
|
235
|
+
source.looping.should be_true
|
223
236
|
source.looping = false
|
224
|
-
source.looping
|
237
|
+
source.looping.should be_false
|
225
238
|
source.looping = true
|
226
|
-
source.looping
|
239
|
+
source.looping.should be_true
|
227
240
|
end
|
228
241
|
|
229
242
|
example 'as static type' do
|
230
243
|
source.looping = true
|
231
244
|
source.buffer = buffer
|
232
|
-
source.looping
|
245
|
+
source.looping.should be_true
|
233
246
|
source.looping = false
|
234
|
-
source.looping
|
247
|
+
source.looping.should be_false
|
235
248
|
source.looping = true
|
236
|
-
source.looping
|
249
|
+
source.looping.should be_true
|
237
250
|
end
|
238
251
|
|
239
252
|
# This example depends on the length of the test audio file.
|