lame 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.travis.yml +3 -4
- data/README.md +51 -17
- data/lib/lame.rb +1 -0
- data/lib/lame/buffer.rb +1 -1
- data/lib/lame/encoder.rb +10 -11
- data/lib/lame/encoding/long_buffer_encoder.rb +1 -1
- data/lib/lame/encoding/stereo_buffer_encoder.rb +1 -0
- data/lib/lame/ffi.rb +2 -0
- data/lib/lame/version.rb +1 -1
- data/spec/buffer_spec.rb +8 -8
- data/spec/configuration_spec.rb +76 -76
- data/spec/decoder_spec.rb +34 -34
- data/spec/decoding/decoded_frame_spec.rb +7 -7
- data/spec/decoding/id3_tag_parser_spec.rb +3 -3
- data/spec/decoding/mp3_data_header_parser_spec.rb +21 -21
- data/spec/decoding/mpeg_audio_frame_finder_spec.rb +15 -15
- data/spec/decoding/mpeg_audio_frame_matcher_spec.rb +2 -2
- data/spec/decoding/single_frame_decoder_spec.rb +36 -35
- data/spec/decoding/stream_decoder_spec.rb +10 -10
- data/spec/delegation_spec.rb +37 -37
- data/spec/encoder_spec.rb +100 -100
- data/spec/encoding/flusher_spec.rb +16 -16
- data/spec/encoding/id3_spec.rb +38 -38
- data/spec/encoding/interleaved_buffer_encoder_spec.rb +25 -25
- data/spec/encoding/stereo_buffer_encoder_spec.rb +34 -33
- data/spec/encoding/vbr_info_spec.rb +16 -16
- data/spec/ffi/decode_flags_spec.rb +3 -2
- data/spec/ffi/encoding_spec.rb +22 -22
- data/spec/ffi/global_flags_spec.rb +159 -157
- data/spec/ffi/id3tag_spec.rb +24 -24
- data/spec/ffi/mp3_data_spec.rb +3 -3
- data/spec/integration/encoding_spec.rb +75 -3
- data/spec/integration/id3_tags_spec.rb +18 -18
- data/spec/lib/custom_matchers.rb +4 -4
- data/spec/lib/wave_file_generator.rb +9 -9
- data/spec/spec_helper.rb +0 -1
- metadata +38 -60
data/spec/ffi/encoding_spec.rb
CHANGED
@@ -14,11 +14,11 @@ module LAME
|
|
14
14
|
context "initialization" do
|
15
15
|
|
16
16
|
it "initializes the parameters" do
|
17
|
-
LAME.lame_init_params(@flags_pointer).
|
17
|
+
expect(LAME.lame_init_params(@flags_pointer)).to eql 0
|
18
18
|
end
|
19
19
|
|
20
20
|
it "inits the bitstream" do
|
21
|
-
LAME.lame_init_bitstream(@flags_pointer).
|
21
|
+
expect(LAME.lame_init_bitstream(@flags_pointer)).to eql 0
|
22
22
|
end
|
23
23
|
|
24
24
|
end
|
@@ -45,7 +45,7 @@ module LAME
|
|
45
45
|
|
46
46
|
it "encodes" do
|
47
47
|
return_code = LAME.lame_encode_buffer(@flags_pointer, input_buffer_left, input_buffer_right, input_buffer_size, output_buffer, output_buffer_size)
|
48
|
-
return_code.
|
48
|
+
expect(return_code).to be >= 0
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
@@ -54,7 +54,7 @@ module LAME
|
|
54
54
|
|
55
55
|
it "encodes" do
|
56
56
|
return_code = LAME.lame_encode_buffer_float(@flags_pointer, input_buffer_left, input_buffer_right, input_buffer_size, output_buffer, output_buffer_size)
|
57
|
-
return_code.
|
57
|
+
expect(return_code).to be >= 0
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
@@ -63,7 +63,7 @@ module LAME
|
|
63
63
|
|
64
64
|
it "encodes" do
|
65
65
|
return_code = LAME.lame_encode_buffer_ieee_float(@flags_pointer, input_buffer_left, input_buffer_right, input_buffer_size, output_buffer, output_buffer_size)
|
66
|
-
return_code.
|
66
|
+
expect(return_code).to be >= 0
|
67
67
|
end
|
68
68
|
end
|
69
69
|
|
@@ -72,7 +72,7 @@ module LAME
|
|
72
72
|
|
73
73
|
it "encodes" do
|
74
74
|
return_code = LAME.lame_encode_buffer_ieee_double(@flags_pointer, input_buffer_left, input_buffer_right, input_buffer_size, output_buffer, output_buffer_size)
|
75
|
-
return_code.
|
75
|
+
expect(return_code).to be >= 0
|
76
76
|
end
|
77
77
|
end
|
78
78
|
|
@@ -81,7 +81,7 @@ module LAME
|
|
81
81
|
|
82
82
|
it "encodes" do
|
83
83
|
return_code = LAME.lame_encode_buffer_long(@flags_pointer, input_buffer_left, input_buffer_right, input_buffer_size, output_buffer, output_buffer_size)
|
84
|
-
return_code.
|
84
|
+
expect(return_code).to be >= 0
|
85
85
|
end
|
86
86
|
end
|
87
87
|
|
@@ -90,7 +90,7 @@ module LAME
|
|
90
90
|
|
91
91
|
it "encodes" do
|
92
92
|
return_code = LAME.lame_encode_buffer_long2(@flags_pointer, input_buffer_left, input_buffer_right, input_buffer_size, output_buffer, output_buffer_size)
|
93
|
-
return_code.
|
93
|
+
expect(return_code).to be >= 0
|
94
94
|
end
|
95
95
|
end
|
96
96
|
|
@@ -99,7 +99,7 @@ module LAME
|
|
99
99
|
|
100
100
|
it "encodes" do
|
101
101
|
return_code = LAME.lame_encode_buffer_int(@flags_pointer, input_buffer_left, input_buffer_right, input_buffer_size, output_buffer, output_buffer_size)
|
102
|
-
return_code.
|
102
|
+
expect(return_code).to be >= 0
|
103
103
|
end
|
104
104
|
end
|
105
105
|
|
@@ -110,7 +110,7 @@ module LAME
|
|
110
110
|
|
111
111
|
it "encodes" do
|
112
112
|
return_code = LAME.lame_encode_buffer_interleaved(@flags_pointer, input_buffer_interleaved, input_buffer_size, output_buffer, output_buffer_size)
|
113
|
-
return_code.
|
113
|
+
expect(return_code).to be >= 0
|
114
114
|
end
|
115
115
|
end
|
116
116
|
|
@@ -119,7 +119,7 @@ module LAME
|
|
119
119
|
|
120
120
|
it "encodes" do
|
121
121
|
return_code = LAME.lame_encode_buffer_interleaved_ieee_float(@flags_pointer, input_buffer_interleaved, input_buffer_size, output_buffer, output_buffer_size)
|
122
|
-
return_code.
|
122
|
+
expect(return_code).to be >= 0
|
123
123
|
end
|
124
124
|
end
|
125
125
|
|
@@ -128,7 +128,7 @@ module LAME
|
|
128
128
|
|
129
129
|
it "encodes" do
|
130
130
|
return_code = LAME.lame_encode_buffer_interleaved_ieee_double(@flags_pointer, input_buffer_interleaved, input_buffer_size, output_buffer, output_buffer_size)
|
131
|
-
return_code.
|
131
|
+
expect(return_code).to be >= 0
|
132
132
|
end
|
133
133
|
end
|
134
134
|
|
@@ -140,14 +140,14 @@ module LAME
|
|
140
140
|
let(:input_type) { :short }
|
141
141
|
|
142
142
|
it "flushes" do
|
143
|
-
LAME.lame_encode_flush(@flags_pointer, output_buffer, output_buffer_size).
|
143
|
+
expect(LAME.lame_encode_flush(@flags_pointer, output_buffer, output_buffer_size)).to be >= 0
|
144
144
|
end
|
145
145
|
|
146
146
|
it "flushes nogap" do
|
147
147
|
# encode something so the flush doesn't give an error
|
148
148
|
LAME.lame_encode_buffer(@flags_pointer, input_buffer_left, input_buffer_right, input_buffer_size, output_buffer, output_buffer_size)
|
149
149
|
|
150
|
-
LAME.lame_encode_flush_nogap(@flags_pointer, output_buffer, output_buffer_size).
|
150
|
+
expect(LAME.lame_encode_flush_nogap(@flags_pointer, output_buffer, output_buffer_size)).to be >= 0
|
151
151
|
end
|
152
152
|
end
|
153
153
|
|
@@ -165,7 +165,7 @@ module LAME
|
|
165
165
|
|
166
166
|
frame_size = LAME.lame_get_lametag_frame(@flags_pointer, output_buffer, output_buffer_size)
|
167
167
|
#p output_buffer.get_bytes(0, frame_size)
|
168
|
-
frame_size.
|
168
|
+
expect(frame_size).to eql 417
|
169
169
|
end
|
170
170
|
end
|
171
171
|
|
@@ -182,7 +182,7 @@ module LAME
|
|
182
182
|
|
183
183
|
bitrate_count = bitrate_count_ptr.read_array_of_int(14)
|
184
184
|
# 9th = 128 (see below)
|
185
|
-
bitrate_count.
|
185
|
+
expect(bitrate_count).to eql [0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0]
|
186
186
|
end
|
187
187
|
|
188
188
|
it "has bitrate kbps" do
|
@@ -191,7 +191,7 @@ module LAME
|
|
191
191
|
|
192
192
|
bitrate_kbps = bitrate_kbps_ptr.read_array_of_int(14)
|
193
193
|
# 9th = 128 (see bitrate table, without 0)
|
194
|
-
bitrate_kbps.
|
194
|
+
expect(bitrate_kbps).to eql [32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320]
|
195
195
|
end
|
196
196
|
|
197
197
|
it "has stereo mode hist" do
|
@@ -200,11 +200,11 @@ module LAME
|
|
200
200
|
|
201
201
|
stereo_mode_hist = stereo_mode_hist_ptr.read_array_of_int(4)
|
202
202
|
# see lame.h for meaning
|
203
|
-
stereo_mode_hist.
|
203
|
+
expect(stereo_mode_hist).to eql [0, 0, 1, 0]
|
204
204
|
end
|
205
205
|
|
206
206
|
it "has bitrate stereo mode hist" do
|
207
|
-
|
207
|
+
skip "multi-dimensional array"
|
208
208
|
end
|
209
209
|
|
210
210
|
it "has block type hist" do
|
@@ -213,17 +213,17 @@ module LAME
|
|
213
213
|
|
214
214
|
block_type_hist = block_type_hist_ptr.read_array_of_int(6)
|
215
215
|
# see lame.h for meaning
|
216
|
-
block_type_hist.
|
216
|
+
expect(block_type_hist).to eql [4, 0, 0, 0, 0, 4]
|
217
217
|
end
|
218
218
|
|
219
219
|
it "has bitrate block type hist" do
|
220
|
-
|
220
|
+
skip "multi-dimensional array"
|
221
221
|
end
|
222
222
|
end
|
223
223
|
|
224
224
|
context "closing" do
|
225
225
|
it "closes" do
|
226
|
-
LAME.lame_close(@flags_pointer).
|
226
|
+
expect(LAME.lame_close(@flags_pointer)).to eql 0
|
227
227
|
end
|
228
228
|
end
|
229
229
|
end
|
@@ -4,13 +4,13 @@ module LAME
|
|
4
4
|
describe GlobalFlags do
|
5
5
|
it "initializes LAME" do
|
6
6
|
pointer = ::FFI::Pointer.new(0)
|
7
|
-
LAME.
|
7
|
+
expect(LAME).to receive(:lame_init).and_return(pointer)
|
8
8
|
GlobalFlags.new
|
9
9
|
end
|
10
10
|
|
11
11
|
it "closes the LAME struct pointer" do
|
12
12
|
pointer = ::FFI::Pointer.new(0)
|
13
|
-
LAME.
|
13
|
+
expect(LAME).to receive(:lame_close).with(pointer)
|
14
14
|
GlobalFlags.release(pointer)
|
15
15
|
end
|
16
16
|
end
|
@@ -31,9 +31,9 @@ module LAME
|
|
31
31
|
# puts format
|
32
32
|
end
|
33
33
|
|
34
|
-
LAME.lame_set_msgf(@flags_pointer, callback).
|
35
|
-
LAME.lame_set_errorf(@flags_pointer, callback).
|
36
|
-
LAME.lame_set_debugf(@flags_pointer, callback).
|
34
|
+
expect(LAME.lame_set_msgf(@flags_pointer, callback)).to eql 0
|
35
|
+
expect(LAME.lame_set_errorf(@flags_pointer, callback)).to eql 0
|
36
|
+
expect(LAME.lame_set_debugf(@flags_pointer, callback)).to eql 0
|
37
37
|
|
38
38
|
LAME.lame_init_params(@flags_pointer)
|
39
39
|
|
@@ -48,93 +48,93 @@ module LAME
|
|
48
48
|
end
|
49
49
|
|
50
50
|
it "has a number of samples" do
|
51
|
-
LAME.
|
52
|
-
LAME.
|
51
|
+
expect(LAME).to have_flag(:num_samples).with_value(2**32-1).for(@flags_pointer)
|
52
|
+
expect(LAME).to be_able_to_set(:num_samples).to(1).for(@flags_pointer)
|
53
53
|
end
|
54
54
|
|
55
55
|
it "has an input samplerate" do
|
56
|
-
LAME.
|
57
|
-
LAME.
|
56
|
+
expect(LAME).to have_flag(:in_samplerate).with_value(44100).for(@flags_pointer)
|
57
|
+
expect(LAME).to be_able_to_set(:in_samplerate).to(22050).for(@flags_pointer)
|
58
58
|
end
|
59
59
|
|
60
60
|
it "has a number of channels" do
|
61
|
-
LAME.
|
62
|
-
LAME.
|
61
|
+
expect(LAME).to have_flag(:num_channels).with_value(2).for(@flags_pointer)
|
62
|
+
expect(LAME).to be_able_to_set(:num_channels).to(1).for(@flags_pointer)
|
63
63
|
end
|
64
64
|
|
65
65
|
it "has a scale" do
|
66
|
-
LAME.
|
67
|
-
LAME.
|
66
|
+
expect(LAME).to have_flag(:scale).with_value(0.95).for(@flags_pointer)
|
67
|
+
expect(LAME).to be_able_to_set(:scale).to(2.0).for(@flags_pointer)
|
68
68
|
end
|
69
69
|
|
70
70
|
it "has a scale_left" do
|
71
|
-
LAME.
|
72
|
-
LAME.
|
71
|
+
expect(LAME).to have_flag(:scale_left).with_value(1.0).for(@flags_pointer)
|
72
|
+
expect(LAME).to be_able_to_set(:scale_left).to(2.0).for(@flags_pointer)
|
73
73
|
end
|
74
74
|
|
75
75
|
it "has a scale_right" do
|
76
|
-
LAME.
|
77
|
-
LAME.
|
76
|
+
expect(LAME).to have_flag(:scale_right).with_value(1.0).for(@flags_pointer)
|
77
|
+
expect(LAME).to be_able_to_set(:scale_right).to(2.0).for(@flags_pointer)
|
78
78
|
end
|
79
79
|
|
80
80
|
it "has a output samplerate" do
|
81
|
-
LAME.
|
82
|
-
LAME.
|
81
|
+
expect(LAME).to have_flag(:out_samplerate).with_value(44100).for(@flags_pointer)
|
82
|
+
expect(LAME).to be_able_to_set(:out_samplerate).to(48000).for(@flags_pointer)
|
83
83
|
end
|
84
84
|
|
85
85
|
it "has an analysis" do
|
86
|
-
LAME.
|
87
|
-
LAME.
|
86
|
+
expect(LAME).to have_flag(:analysis).with_value(0).for(@flags_pointer)
|
87
|
+
expect(LAME).to be_able_to_set(:analysis).to(1).for(@flags_pointer)
|
88
88
|
end
|
89
89
|
|
90
90
|
it "has bWriteVbrTag" do
|
91
|
-
LAME.
|
92
|
-
LAME.
|
91
|
+
expect(LAME).to have_flag(:bWriteVbrTag).with_value(1).for(@flags_pointer)
|
92
|
+
expect(LAME).to be_able_to_set(:bWriteVbrTag).to(0).for(@flags_pointer)
|
93
93
|
end
|
94
94
|
|
95
95
|
it "has decode only" do
|
96
|
-
LAME.
|
97
|
-
LAME.
|
96
|
+
expect(LAME).to have_flag(:decode_only).with_value(0).for(@flags_pointer)
|
97
|
+
expect(LAME).to be_able_to_set(:decode_only).to(1).for(@flags_pointer)
|
98
98
|
end
|
99
99
|
|
100
100
|
it "has a quality" do
|
101
|
-
LAME.
|
102
|
-
LAME.
|
101
|
+
expect(LAME).to have_flag(:quality).with_value(3).for(@flags_pointer)
|
102
|
+
expect(LAME).to be_able_to_set(:quality).to(1).for(@flags_pointer)
|
103
103
|
end
|
104
104
|
|
105
105
|
it "has a mode" do
|
106
|
-
LAME.
|
107
|
-
LAME.
|
106
|
+
expect(LAME).to have_flag(:mode).with_value(:joint_stereo).for(@flags_pointer)
|
107
|
+
expect(LAME).to be_able_to_set(:mode).to(:stereo).for(@flags_pointer)
|
108
108
|
end
|
109
109
|
|
110
110
|
it "has force ms" do
|
111
|
-
LAME.
|
112
|
-
LAME.
|
111
|
+
expect(LAME).to have_flag(:force_ms).with_value(0).for(@flags_pointer)
|
112
|
+
expect(LAME).to be_able_to_set(:force_ms).to(1).for(@flags_pointer)
|
113
113
|
end
|
114
114
|
|
115
115
|
it "has free format" do
|
116
|
-
LAME.
|
117
|
-
LAME.
|
116
|
+
expect(LAME).to have_flag(:free_format).with_value(0).for(@flags_pointer)
|
117
|
+
expect(LAME).to be_able_to_set(:free_format).to(1).for(@flags_pointer)
|
118
118
|
end
|
119
119
|
|
120
120
|
it "has find replay gain" do
|
121
|
-
LAME.
|
122
|
-
LAME.
|
121
|
+
expect(LAME).to have_flag(:findReplayGain).with_value(0).for(@flags_pointer)
|
122
|
+
expect(LAME).to be_able_to_set(:findReplayGain).to(1).for(@flags_pointer)
|
123
123
|
end
|
124
124
|
|
125
125
|
it "has decode on the fly" do
|
126
|
-
LAME.
|
127
|
-
LAME.
|
126
|
+
expect(LAME).to have_flag(:decode_on_the_fly).with_value(0).for(@flags_pointer)
|
127
|
+
expect(LAME).to be_able_to_set(:decode_on_the_fly).to(1).for(@flags_pointer)
|
128
128
|
end
|
129
129
|
|
130
130
|
it "has nogap total" do
|
131
|
-
LAME.
|
132
|
-
LAME.
|
131
|
+
expect(LAME).to have_flag(:nogap_total).with_value(0).for(@flags_pointer)
|
132
|
+
expect(LAME).to be_able_to_set(:nogap_total).to(1).for(@flags_pointer)
|
133
133
|
end
|
134
134
|
|
135
135
|
it "has nogap current index" do
|
136
|
-
LAME.
|
137
|
-
LAME.
|
136
|
+
expect(LAME).to have_flag(:nogap_currentindex).with_value(0).for(@flags_pointer)
|
137
|
+
expect(LAME).to be_able_to_set(:nogap_currentindex).to(1).for(@flags_pointer)
|
138
138
|
end
|
139
139
|
|
140
140
|
# lame_set_errorf
|
@@ -142,335 +142,335 @@ module LAME
|
|
142
142
|
# lame_set_msgf
|
143
143
|
|
144
144
|
it "has a brate" do
|
145
|
-
LAME.
|
146
|
-
LAME.
|
145
|
+
expect(LAME).to have_flag(:brate).with_value(128).for(@flags_pointer)
|
146
|
+
expect(LAME).to be_able_to_set(:brate).to(192).for(@flags_pointer)
|
147
147
|
end
|
148
148
|
|
149
149
|
it "has a compression ratio" do
|
150
|
-
LAME.
|
151
|
-
#LAME.
|
150
|
+
expect(LAME).to have_flag(:compression_ratio).with_value(1).for(@flags_pointer)
|
151
|
+
#expect(LAME).to be_able_to_set(:compression_ratio).to(11.025).for(@flags_pointer) # can't set it..?
|
152
152
|
end
|
153
153
|
|
154
154
|
it "has a preset" do
|
155
|
-
LAME.lame_set_preset(@flags_pointer, :V0).
|
155
|
+
expect(LAME.lame_set_preset(@flags_pointer, :V0)).to eql :V0
|
156
156
|
end
|
157
157
|
|
158
158
|
it "sets asm optimizations" do
|
159
|
-
LAME.lame_set_asm_optimizations(@flags_pointer, :MMX, 1).
|
159
|
+
expect(LAME.lame_set_asm_optimizations(@flags_pointer, :MMX, 1)).to eql :MMX
|
160
160
|
end
|
161
161
|
|
162
162
|
it "has a copyright mark" do
|
163
|
-
LAME.
|
164
|
-
LAME.
|
163
|
+
expect(LAME).to have_flag(:copyright).with_value(0).for(@flags_pointer)
|
164
|
+
expect(LAME).to be_able_to_set(:copyright).to(1).for(@flags_pointer)
|
165
165
|
end
|
166
166
|
|
167
167
|
it "has an original mark" do
|
168
|
-
LAME.
|
169
|
-
LAME.
|
168
|
+
expect(LAME).to have_flag(:original).with_value(1).for(@flags_pointer)
|
169
|
+
expect(LAME).to be_able_to_set(:original).to(0).for(@flags_pointer)
|
170
170
|
end
|
171
171
|
|
172
172
|
it "has error protection" do
|
173
|
-
LAME.
|
174
|
-
LAME.
|
173
|
+
expect(LAME).to have_flag(:error_protection).with_value(0).for(@flags_pointer)
|
174
|
+
expect(LAME).to be_able_to_set(:error_protection).to(1).for(@flags_pointer)
|
175
175
|
end
|
176
176
|
|
177
177
|
it "has extension mark" do
|
178
|
-
LAME.
|
179
|
-
LAME.
|
178
|
+
expect(LAME).to have_flag(:extension).with_value(0).for(@flags_pointer)
|
179
|
+
expect(LAME).to be_able_to_set(:extension).to(1).for(@flags_pointer)
|
180
180
|
end
|
181
181
|
|
182
182
|
it "has strict ISO" do
|
183
|
-
LAME.
|
184
|
-
LAME.
|
183
|
+
expect(LAME).to have_flag(:strict_ISO).with_value(2).for(@flags_pointer) # ?
|
184
|
+
expect(LAME).to be_able_to_set(:strict_ISO).to(1).for(@flags_pointer)
|
185
185
|
end
|
186
186
|
|
187
187
|
context "quantization/noise shaping" do
|
188
188
|
|
189
189
|
it "has disable reservoir" do
|
190
|
-
LAME.
|
191
|
-
LAME.
|
190
|
+
expect(LAME).to have_flag(:disable_reservoir).with_value(0).for(@flags_pointer)
|
191
|
+
expect(LAME).to be_able_to_set(:disable_reservoir).to(1).for(@flags_pointer)
|
192
192
|
end
|
193
193
|
|
194
194
|
it "has quant comp" do
|
195
|
-
LAME.
|
196
|
-
LAME.
|
195
|
+
expect(LAME).to have_flag(:quant_comp).with_value(9).for(@flags_pointer)
|
196
|
+
expect(LAME).to be_able_to_set(:quant_comp).to(11).for(@flags_pointer)
|
197
197
|
end
|
198
198
|
|
199
199
|
it "has quant comp short" do
|
200
|
-
LAME.
|
201
|
-
LAME.
|
200
|
+
expect(LAME).to have_flag(:quant_comp_short).with_value(9).for(@flags_pointer)
|
201
|
+
expect(LAME).to be_able_to_set(:quant_comp_short).to(11).for(@flags_pointer)
|
202
202
|
end
|
203
203
|
|
204
204
|
it "has experimentalX" do
|
205
|
-
LAME.
|
206
|
-
LAME.
|
205
|
+
expect(LAME).to have_flag(:experimentalX).with_value(9).for(@flags_pointer)
|
206
|
+
expect(LAME).to be_able_to_set(:experimentalX).to(11).for(@flags_pointer)
|
207
207
|
end
|
208
208
|
|
209
209
|
it "has experimentalY" do
|
210
|
-
LAME.
|
211
|
-
LAME.
|
210
|
+
expect(LAME).to have_flag(:experimentalY).with_value(0).for(@flags_pointer)
|
211
|
+
expect(LAME).to be_able_to_set(:experimentalY).to(1).for(@flags_pointer)
|
212
212
|
end
|
213
213
|
|
214
214
|
it "has experimentalZ" do
|
215
|
-
LAME.
|
216
|
-
LAME.
|
215
|
+
expect(LAME).to have_flag(:experimentalZ).with_value(0).for(@flags_pointer)
|
216
|
+
expect(LAME).to be_able_to_set(:experimentalZ).to(1).for(@flags_pointer)
|
217
217
|
end
|
218
218
|
|
219
219
|
it "has exp nspsytune" do
|
220
|
-
LAME.
|
221
|
-
LAME.
|
220
|
+
expect(LAME).to have_flag(:exp_nspsytune).with_value(1).for(@flags_pointer)
|
221
|
+
expect(LAME).to be_able_to_set(:exp_nspsytune).to(0).for(@flags_pointer)
|
222
222
|
end
|
223
223
|
|
224
224
|
it "has msfix" do
|
225
|
-
LAME.
|
226
|
-
LAME.
|
225
|
+
expect(LAME).to have_flag(:msfix).with_value(1.95).for(@flags_pointer)
|
226
|
+
expect(LAME).to be_able_to_set(:msfix).to(1.55).and_return(nil).for(@flags_pointer)
|
227
227
|
end
|
228
228
|
end
|
229
229
|
|
230
230
|
context "VBR" do
|
231
231
|
it "has VBR mode" do
|
232
|
-
LAME.
|
233
|
-
LAME.
|
232
|
+
expect(LAME).to have_flag(:VBR).with_value(:vbr_off).for(@flags_pointer)
|
233
|
+
expect(LAME).to be_able_to_set(:VBR).to(:vbr_mt).for(@flags_pointer)
|
234
234
|
end
|
235
235
|
|
236
236
|
it "has VBR q" do
|
237
|
-
LAME.
|
238
|
-
LAME.
|
237
|
+
expect(LAME).to have_flag(:VBR_q).with_value(4).for(@flags_pointer)
|
238
|
+
expect(LAME).to be_able_to_set(:VBR_q).to(5).for(@flags_pointer)
|
239
239
|
end
|
240
240
|
|
241
241
|
it "has VBR quality" do
|
242
|
-
LAME.
|
243
|
-
LAME.
|
242
|
+
expect(LAME).to have_flag(:VBR_quality).with_value(4.0).for(@flags_pointer)
|
243
|
+
expect(LAME).to be_able_to_set(:VBR_quality).to(5.0).for(@flags_pointer)
|
244
244
|
end
|
245
245
|
|
246
246
|
it "has VBR mean bitrate kbps" do
|
247
|
-
LAME.
|
248
|
-
LAME.
|
247
|
+
expect(LAME).to have_flag(:VBR_mean_bitrate_kbps).with_value(128).for(@flags_pointer)
|
248
|
+
expect(LAME).to be_able_to_set(:VBR_mean_bitrate_kbps).to(192).for(@flags_pointer)
|
249
249
|
end
|
250
250
|
|
251
251
|
it "has VBR min bitrate kbps" do
|
252
|
-
LAME.
|
253
|
-
LAME.
|
252
|
+
expect(LAME).to have_flag(:VBR_min_bitrate_kbps).with_value(0).for(@flags_pointer)
|
253
|
+
expect(LAME).to be_able_to_set(:VBR_min_bitrate_kbps).to(128).for(@flags_pointer)
|
254
254
|
end
|
255
255
|
|
256
256
|
it "has VBR max bitrate kbps" do
|
257
|
-
LAME.
|
258
|
-
LAME.
|
257
|
+
expect(LAME).to have_flag(:VBR_max_bitrate_kbps).with_value(0).for(@flags_pointer)
|
258
|
+
expect(LAME).to be_able_to_set(:VBR_max_bitrate_kbps).to(256).for(@flags_pointer)
|
259
259
|
end
|
260
260
|
|
261
261
|
it "has VBR hard min bitrate kbps" do
|
262
|
-
LAME.
|
263
|
-
LAME.
|
262
|
+
expect(LAME).to have_flag(:VBR_hard_min).with_value(0).for(@flags_pointer)
|
263
|
+
expect(LAME).to be_able_to_set(:VBR_hard_min).to(1).for(@flags_pointer)
|
264
264
|
end
|
265
265
|
end
|
266
266
|
|
267
267
|
context "filtering control" do
|
268
268
|
it "has lowpassfreq" do
|
269
|
-
LAME.
|
270
|
-
LAME.
|
269
|
+
expect(LAME).to have_flag(:lowpassfreq).with_value(17000).for(@flags_pointer)
|
270
|
+
expect(LAME).to be_able_to_set(:lowpassfreq).to(18000).for(@flags_pointer)
|
271
271
|
end
|
272
272
|
|
273
273
|
it "has lowpasswidth" do
|
274
|
-
LAME.
|
275
|
-
LAME.
|
274
|
+
expect(LAME).to have_flag(:lowpasswidth).with_value(-1).for(@flags_pointer)
|
275
|
+
expect(LAME).to be_able_to_set(:lowpasswidth).to(200).for(@flags_pointer)
|
276
276
|
end
|
277
277
|
|
278
278
|
it "has highpassfreq" do
|
279
|
-
LAME.
|
280
|
-
LAME.
|
279
|
+
expect(LAME).to have_flag(:highpassfreq).with_value(0).for(@flags_pointer)
|
280
|
+
expect(LAME).to be_able_to_set(:highpassfreq).to(-1).for(@flags_pointer)
|
281
281
|
end
|
282
282
|
|
283
283
|
it "has highpasswidth" do
|
284
|
-
LAME.
|
285
|
-
LAME.
|
284
|
+
expect(LAME).to have_flag(:highpasswidth).with_value(-1).for(@flags_pointer)
|
285
|
+
expect(LAME).to be_able_to_set(:highpasswidth).to(200).for(@flags_pointer)
|
286
286
|
end
|
287
287
|
end
|
288
288
|
|
289
289
|
context "psycho acoustics" do
|
290
290
|
it "has ATHonly" do
|
291
|
-
LAME.
|
292
|
-
LAME.
|
291
|
+
expect(LAME).to have_flag(:ATHonly).with_value(0).for(@flags_pointer)
|
292
|
+
expect(LAME).to be_able_to_set(:ATHonly).to(1).for(@flags_pointer)
|
293
293
|
end
|
294
294
|
|
295
295
|
it "has ATHshort" do
|
296
|
-
LAME.
|
297
|
-
LAME.
|
296
|
+
expect(LAME).to have_flag(:ATHshort).with_value(0).for(@flags_pointer)
|
297
|
+
expect(LAME).to be_able_to_set(:ATHshort).to(1).for(@flags_pointer)
|
298
298
|
end
|
299
299
|
|
300
300
|
it "has noATH" do
|
301
|
-
LAME.
|
302
|
-
LAME.
|
301
|
+
expect(LAME).to have_flag(:noATH).with_value(0).for(@flags_pointer)
|
302
|
+
expect(LAME).to be_able_to_set(:noATH).to(1).for(@flags_pointer)
|
303
303
|
end
|
304
304
|
|
305
305
|
it "has ATHtype" do
|
306
|
-
LAME.
|
307
|
-
LAME.
|
306
|
+
expect(LAME).to have_flag(:ATHtype).with_value(4).for(@flags_pointer)
|
307
|
+
expect(LAME).to be_able_to_set(:ATHtype).to(5).for(@flags_pointer)
|
308
308
|
end
|
309
309
|
|
310
310
|
it "has ATHlower" do
|
311
|
-
LAME.
|
312
|
-
LAME.
|
311
|
+
expect(LAME).to have_flag(:ATHlower).with_value(3.0).for(@flags_pointer)
|
312
|
+
expect(LAME).to be_able_to_set(:ATHlower).to(4.0).for(@flags_pointer)
|
313
313
|
end
|
314
314
|
|
315
315
|
it "has athaa type" do
|
316
|
-
LAME.
|
317
|
-
LAME.
|
316
|
+
expect(LAME).to have_flag(:athaa_type).with_value(-1).for(@flags_pointer)
|
317
|
+
expect(LAME).to be_able_to_set(:athaa_type).to(1).for(@flags_pointer)
|
318
318
|
end
|
319
319
|
|
320
320
|
it "has athaa sensitivity" do
|
321
|
-
LAME.
|
322
|
-
LAME.
|
321
|
+
expect(LAME).to have_flag(:athaa_sensitivity).with_value(0.0).for(@flags_pointer)
|
322
|
+
expect(LAME).to be_able_to_set(:athaa_sensitivity).to(1.0).for(@flags_pointer)
|
323
323
|
end
|
324
324
|
end
|
325
325
|
|
326
326
|
context "blocks" do
|
327
327
|
it "has allow diff short" do
|
328
|
-
LAME.
|
329
|
-
LAME.
|
328
|
+
expect(LAME).to have_flag(:allow_diff_short).with_value(0).for(@flags_pointer)
|
329
|
+
expect(LAME).to be_able_to_set(:allow_diff_short).to(1).for(@flags_pointer)
|
330
330
|
end
|
331
331
|
|
332
332
|
it "has useTemporal" do
|
333
|
-
LAME.
|
334
|
-
LAME.
|
333
|
+
expect(LAME).to have_flag(:useTemporal).with_value(1).for(@flags_pointer)
|
334
|
+
expect(LAME).to be_able_to_set(:useTemporal).to(0).for(@flags_pointer)
|
335
335
|
end
|
336
336
|
|
337
337
|
it "has interChRatio" do
|
338
|
-
LAME.
|
339
|
-
LAME.
|
338
|
+
expect(LAME).to have_flag(:interChRatio).with_value(0.0002).for(@flags_pointer)
|
339
|
+
expect(LAME).to be_able_to_set(:interChRatio).to(0.0003).for(@flags_pointer)
|
340
340
|
end
|
341
341
|
|
342
342
|
it "has no short blocks" do
|
343
|
-
LAME.
|
344
|
-
LAME.
|
343
|
+
expect(LAME).to have_flag(:no_short_blocks).with_value(0).for(@flags_pointer)
|
344
|
+
expect(LAME).to be_able_to_set(:no_short_blocks).to(1).for(@flags_pointer)
|
345
345
|
end
|
346
346
|
|
347
347
|
it "has force short blocks" do
|
348
|
-
LAME.
|
349
|
-
LAME.
|
348
|
+
expect(LAME).to have_flag(:force_short_blocks).with_value(0).for(@flags_pointer)
|
349
|
+
expect(LAME).to be_able_to_set(:force_short_blocks).to(1).for(@flags_pointer)
|
350
350
|
end
|
351
351
|
|
352
352
|
it "has emphasis" do
|
353
|
-
LAME.
|
354
|
-
LAME.
|
353
|
+
expect(LAME).to have_flag(:emphasis).with_value(0).for(@flags_pointer)
|
354
|
+
expect(LAME).to be_able_to_set(:emphasis).to(1).for(@flags_pointer)
|
355
355
|
end
|
356
356
|
end
|
357
357
|
|
358
358
|
context "internal variables" do
|
359
359
|
it "has a version" do
|
360
|
-
LAME.
|
360
|
+
expect(LAME).to have_getter(:version).with_value(1).for(@flags_pointer)
|
361
361
|
end
|
362
362
|
|
363
363
|
it "has encoder delay" do
|
364
|
-
LAME.
|
364
|
+
expect(LAME).to have_getter(:encoder_delay).with_value(576).for(@flags_pointer)
|
365
365
|
end
|
366
366
|
|
367
367
|
it "has encoder padding" do
|
368
|
-
LAME.
|
368
|
+
expect(LAME).to have_getter(:encoder_padding).with_value(0).for(@flags_pointer)
|
369
369
|
end
|
370
370
|
|
371
371
|
it "has framesize" do
|
372
|
-
LAME.
|
372
|
+
expect(LAME).to have_getter(:framesize).with_value(1152).for(@flags_pointer)
|
373
373
|
end
|
374
374
|
|
375
375
|
it "has mf samples to encode" do
|
376
|
-
LAME.
|
376
|
+
expect(LAME).to have_getter(:mf_samples_to_encode).with_value(1728).for(@flags_pointer)
|
377
377
|
end
|
378
378
|
|
379
379
|
# mp3buffer (see below)
|
380
380
|
|
381
381
|
it "has frameNum" do
|
382
|
-
LAME.
|
382
|
+
expect(LAME).to have_getter(:frameNum).with_value(0).for(@flags_pointer)
|
383
383
|
end
|
384
384
|
|
385
385
|
# unpredictable default value between versions:
|
386
386
|
it "has totalframes" do
|
387
|
-
# LAME.
|
388
|
-
LAME.
|
387
|
+
# expect(LAME).to have_getter(:totalframes).with_value(3728272).for(@flags_pointer)
|
388
|
+
expect(LAME).to have_getter(:totalframes).for(@flags_pointer)
|
389
389
|
end
|
390
390
|
|
391
391
|
it "has RatioGain" do
|
392
|
-
LAME.
|
392
|
+
expect(LAME).to have_getter(:RadioGain).with_value(0).for(@flags_pointer)
|
393
393
|
end
|
394
394
|
|
395
395
|
it "has AudiophileGain" do
|
396
|
-
LAME.
|
396
|
+
expect(LAME).to have_getter(:AudiophileGain).with_value(0).for(@flags_pointer)
|
397
397
|
end
|
398
398
|
|
399
399
|
it "has PeakSample" do
|
400
|
-
LAME.
|
400
|
+
expect(LAME).to have_getter(:PeakSample).with_value(0.0).for(@flags_pointer)
|
401
401
|
end
|
402
402
|
|
403
403
|
it "has noclipGainChange" do
|
404
|
-
LAME.
|
404
|
+
expect(LAME).to have_getter(:noclipGainChange).with_value(0).for(@flags_pointer)
|
405
405
|
end
|
406
406
|
|
407
407
|
it "has noclipScale" do
|
408
|
-
LAME.
|
408
|
+
expect(LAME).to have_getter(:noclipScale).with_value(-1.0).for(@flags_pointer)
|
409
409
|
end
|
410
410
|
end
|
411
411
|
|
412
412
|
context "version" do
|
413
413
|
it "has a version" do
|
414
|
-
LAME.get_lame_version.
|
414
|
+
expect(LAME.get_lame_version).to match /3\.\d\d\.\d/
|
415
415
|
end
|
416
416
|
|
417
417
|
it "has a short version" do
|
418
|
-
LAME.get_lame_short_version.
|
418
|
+
expect(LAME.get_lame_short_version).to match /3\.\d\d\.\d/
|
419
419
|
end
|
420
420
|
|
421
421
|
it "has a very short version" do
|
422
|
-
LAME.get_lame_very_short_version.
|
422
|
+
expect(LAME.get_lame_very_short_version).to match /LAME3\.\d\dr\d/
|
423
423
|
end
|
424
424
|
|
425
425
|
it "has a psy version" do
|
426
|
-
LAME.get_psy_version.
|
426
|
+
expect(LAME.get_psy_version).to eql "1.0"
|
427
427
|
end
|
428
428
|
|
429
429
|
it "has a url" do
|
430
|
-
LAME.get_lame_url.
|
430
|
+
expect(LAME.get_lame_url).to eql "http://lame.sf.net"
|
431
431
|
end
|
432
432
|
|
433
433
|
it "has os bitness" do
|
434
|
-
LAME.get_lame_os_bitness.
|
434
|
+
expect(LAME.get_lame_os_bitness).to match /(32|64)bits/
|
435
435
|
end
|
436
436
|
|
437
437
|
context "numerical version" do
|
438
438
|
|
439
439
|
let(:version) { LAME.get_lame_version_numerical(@flags_pointer) }
|
440
440
|
it "has a major version" do
|
441
|
-
version[:major].
|
442
|
-
|
441
|
+
expect(version[:major]).to eql 3
|
443
442
|
end
|
443
|
+
|
444
444
|
it "has a minor version" do
|
445
|
-
version[:minor].
|
445
|
+
expect(version[:minor]).to eql 99
|
446
446
|
end
|
447
447
|
|
448
448
|
it "has a alpha version" do
|
449
|
-
version[:alpha].
|
449
|
+
expect(version[:alpha]).to eql 0
|
450
450
|
end
|
451
451
|
|
452
452
|
it "has a beta version" do
|
453
|
-
version[:beta].
|
453
|
+
expect(version[:beta]).to eql 0
|
454
454
|
end
|
455
455
|
|
456
456
|
it "has a psy_major version" do
|
457
|
-
version[:psy_major].
|
457
|
+
expect(version[:psy_major]).to eql 1
|
458
458
|
end
|
459
459
|
|
460
460
|
it "has a psy_minor version" do
|
461
|
-
version[:psy_minor].
|
461
|
+
expect(version[:psy_minor]).to eql 0
|
462
462
|
end
|
463
463
|
|
464
464
|
it "has a psy_alpha version" do
|
465
|
-
version[:psy_alpha].
|
465
|
+
expect(version[:psy_alpha]).to eql 0
|
466
466
|
end
|
467
467
|
|
468
468
|
it "has a psy_beta version" do
|
469
|
-
version[:psy_beta].
|
469
|
+
expect(version[:psy_beta]).to eql 0
|
470
470
|
end
|
471
471
|
|
472
472
|
it "has features" do
|
473
|
-
version[:features].
|
473
|
+
expect(version[:features]).to eql ""
|
474
474
|
end
|
475
475
|
end
|
476
476
|
|
@@ -488,17 +488,19 @@ module LAME
|
|
488
488
|
LAME.lame_set_errorf(@flags_pointer, callback)
|
489
489
|
LAME.lame_init_params(@flags_pointer)
|
490
490
|
|
491
|
-
LAME.
|
491
|
+
expect(LAME).to have_getter(:size_mp3buffer).with_value(834).for(@flags_pointer)
|
492
492
|
end
|
493
493
|
|
494
494
|
it "prints config" do
|
495
|
-
|
496
|
-
|
495
|
+
skip "we need to be able to tweak logging to be able to test this" do
|
496
|
+
LAME.lame_print_config(@flags_pointer)
|
497
|
+
end
|
497
498
|
end
|
498
499
|
|
499
500
|
it "prints internals" do
|
500
|
-
|
501
|
-
|
501
|
+
skip "we need to be able to tweak logging to be able to test this" do
|
502
|
+
LAME.lame_print_internals(@flags_pointer)
|
503
|
+
end
|
502
504
|
end
|
503
505
|
|
504
506
|
end
|
@@ -517,7 +519,7 @@ module LAME
|
|
517
519
|
[0, 8, 16, 24, 32, 40, 48, 56, 64, -1, -1, -1, -1, -1, -1, -1]
|
518
520
|
]
|
519
521
|
|
520
|
-
table.
|
522
|
+
expect(table).to eql expected
|
521
523
|
end
|
522
524
|
|
523
525
|
it "has the samplerate table" do
|
@@ -533,7 +535,7 @@ module LAME
|
|
533
535
|
[11025, 12000, 8000, -1]
|
534
536
|
]
|
535
537
|
|
536
|
-
table.
|
538
|
+
expect(table).to eql expected
|
537
539
|
end
|
538
540
|
|
539
541
|
end
|