ebur128_stream 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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -2
- data/ebur128_stream.gemspec +3 -4
- data/ext/ebur128_stream/src/analyzer.rs +4 -4
- data/ext/ebur128_stream/src/normalize.rs +3 -3
- data/lib/ebur128_stream/version.rb +1 -1
- data/lib/ebur128_stream.rb +15 -0
- data/test/test_analizer.rb +5 -0
- metadata +5 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b55b7c45c635a852a0918c7924683b6786692ce765e42e64818568d95b69afd2
|
|
4
|
+
data.tar.gz: 9d7d12b7b2c8a39e29e784c8c8ee4ac3634c330b7b8e74e0265465404a6acced
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6df035ae78a53961e648ac2dc4ece1d2e204fdf39896c2a56e16f7682434191311983bb459775752353a120cac8f49b0c63cf4bbe95b0e829023dfad23766376
|
|
7
|
+
data.tar.gz: b0b5b0e635c405d5abf2e1e60d2f4ddf9259b2c4fda8b602a28cad7d2860bc6ad1a417c660f7ffc9656d275908d343fb4507e24a1bd7038139f970d6718a5ce7
|
data/CHANGELOG.md
CHANGED
data/ebur128_stream.gemspec
CHANGED
|
@@ -11,12 +11,12 @@ Gem::Specification.new do |spec|
|
|
|
11
11
|
|
|
12
12
|
spec.summary = "Streaming, zero-allocation EBU R128 loudness measurement."
|
|
13
13
|
spec.description = "Ruby binding for Streaming, zero-allocation EBU R128 loudness measurement in pure Rust."
|
|
14
|
-
spec.homepage = "https://github.com/KitaitiMakoto/ebur128-stream/tree/
|
|
14
|
+
spec.homepage = "https://github.com/KitaitiMakoto/ebur128-stream/tree/ruby/bindings/ruby"
|
|
15
15
|
spec.required_ruby_version = ">= 3.2.0"
|
|
16
16
|
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
|
17
17
|
spec.metadata["homepage_uri"] = spec.homepage
|
|
18
|
-
spec.metadata["source_code_uri"] = "https://github.com/KitaitiMakoto/ebur128-stream/tree/
|
|
19
|
-
spec.metadata["changelog_uri"] = "https://github.com/KitaitiMakoto/ebur128-stream/tree/
|
|
18
|
+
spec.metadata["source_code_uri"] = "https://github.com/KitaitiMakoto/ebur128-stream/tree/ruby/bindings/ruby"
|
|
19
|
+
spec.metadata["changelog_uri"] = "https://github.com/KitaitiMakoto/ebur128-stream/tree/ruby/bindings/ruby/CHANGELOG.md"
|
|
20
20
|
|
|
21
21
|
# Uncomment the line below to require MFA for gem pushes.
|
|
22
22
|
# This helps protect your gem from supply chain attacks by ensuring
|
|
@@ -26,7 +26,6 @@ Gem::Specification.new do |spec|
|
|
|
26
26
|
|
|
27
27
|
# Specify which files should be added to the gem when it is released.
|
|
28
28
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
|
29
|
-
gemspec = File.basename(__FILE__)
|
|
30
29
|
spec.files = IO.popen(%w[git ls-files -z], chdir: __dir__, err: IO::NULL) do |ls|
|
|
31
30
|
ls.readlines("\x0", chomp: true)
|
|
32
31
|
end + ["LICENSE-APACHE", "LICENSE-MIT"]
|
|
@@ -19,7 +19,7 @@ impl Analyzer {
|
|
|
19
19
|
fn new(args: &[Value]) -> Result<Self, Error> {
|
|
20
20
|
let args = scan_args::<(), (), (), (), _, ()>(args)?;
|
|
21
21
|
let kws =
|
|
22
|
-
get_kwargs::<_, (Channels,), (Option<Integer
|
|
22
|
+
get_kwargs::<_, (Channels,), (Option<Option<Integer>>, Option<Option<RArray>>, Option<Option<Integer>>), ()>(
|
|
23
23
|
args.keywords,
|
|
24
24
|
&["channels"],
|
|
25
25
|
&["sample_rate", "modes", "expected_duration"],
|
|
@@ -29,11 +29,11 @@ impl Analyzer {
|
|
|
29
29
|
|
|
30
30
|
let mut builder = engine::AnalyzerBuilder::new().channels(&channels);
|
|
31
31
|
|
|
32
|
-
if let Some(sample_rate) = sample_rate {
|
|
32
|
+
if let Some(sample_rate) = sample_rate.flatten() {
|
|
33
33
|
builder = builder.sample_rate(sample_rate.to_u32()?);
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
if let Some(values) = modes {
|
|
36
|
+
if let Some(values) = modes.flatten() {
|
|
37
37
|
use engine::Mode;
|
|
38
38
|
|
|
39
39
|
let mut modes = Mode::empty();
|
|
@@ -53,7 +53,7 @@ impl Analyzer {
|
|
|
53
53
|
}
|
|
54
54
|
builder = builder.modes(modes);
|
|
55
55
|
}
|
|
56
|
-
if let Some(expected_duration) = expected_duration {
|
|
56
|
+
if let Some(expected_duration) = expected_duration.flatten() {
|
|
57
57
|
builder = builder.expected_duration(Duration::from_secs(expected_duration.to_u64()?));
|
|
58
58
|
}
|
|
59
59
|
|
|
@@ -18,7 +18,7 @@ struct Normalizer {
|
|
|
18
18
|
impl Normalizer {
|
|
19
19
|
fn new(args: &[Value]) -> Result<Self, Error> {
|
|
20
20
|
let args = scan_args::<(), (), (), (), _, ()>(args)?;
|
|
21
|
-
let kws = get_kwargs::<_, (u32, Channels), (Option<f64
|
|
21
|
+
let kws = get_kwargs::<_, (u32, Channels), (Option<Option<f64>>, Option<Option<f64>>), ()>(
|
|
22
22
|
args.keywords,
|
|
23
23
|
&["sample_rate", "channels"],
|
|
24
24
|
&["target_lufs", "true_peak_ceiling_dbtp"],
|
|
@@ -29,8 +29,8 @@ impl Normalizer {
|
|
|
29
29
|
Ok(Self {
|
|
30
30
|
sample_rate,
|
|
31
31
|
channels: channels.into_boxed_slice(),
|
|
32
|
-
target_lufs,
|
|
33
|
-
true_peak_ceiling_dbtp,
|
|
32
|
+
target_lufs: target_lufs.flatten(),
|
|
33
|
+
true_peak_ceiling_dbtp: true_peak_ceiling_dbtp.flatten(),
|
|
34
34
|
})
|
|
35
35
|
}
|
|
36
36
|
|
data/lib/ebur128_stream.rb
CHANGED
|
@@ -22,6 +22,21 @@ module EBUR128Stream
|
|
|
22
22
|
}
|
|
23
23
|
end
|
|
24
24
|
|
|
25
|
+
def pretty_print(q)
|
|
26
|
+
attrs = self.class::ATTRS
|
|
27
|
+
a_width = attrs.max_by(&:length).length
|
|
28
|
+
|
|
29
|
+
q.object_group self do
|
|
30
|
+
q.breakable
|
|
31
|
+
attrs.each_with_index do |attr, index|
|
|
32
|
+
q.comma_breakable unless index == 0
|
|
33
|
+
q.text attr.to_s.rjust(a_width)
|
|
34
|
+
q.text " = "
|
|
35
|
+
q.pp send(attr)
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
25
40
|
def ==(other)
|
|
26
41
|
deconstruct_keys(nil) == other.deconstruct_keys(nil)
|
|
27
42
|
end
|
data/test/test_analizer.rb
CHANGED
|
@@ -21,6 +21,11 @@ class TestAnalyzer < Test::Unit::TestCase
|
|
|
21
21
|
end
|
|
22
22
|
end
|
|
23
23
|
|
|
24
|
+
test "new with nil" do
|
|
25
|
+
analyzer = Analyzer.new(channels: [:left, :right], sample_rate: nil)
|
|
26
|
+
assert_equal 48_000, analyzer.sample_rate
|
|
27
|
+
end
|
|
28
|
+
|
|
24
29
|
test "push_interleaved" do
|
|
25
30
|
analyzer = Analyzer.new(channels: [:left, :right], modes: [:all])
|
|
26
31
|
assert_nothing_raised do
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ebur128_stream
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Kitaiti Makoto
|
|
@@ -148,15 +148,15 @@ files:
|
|
|
148
148
|
- test/test_normalizer.rb
|
|
149
149
|
- test/test_report.rb
|
|
150
150
|
- test/test_snapshot.rb
|
|
151
|
-
homepage: https://github.com/KitaitiMakoto/ebur128-stream/tree/
|
|
151
|
+
homepage: https://github.com/KitaitiMakoto/ebur128-stream/tree/ruby/bindings/ruby
|
|
152
152
|
licenses:
|
|
153
153
|
- Apache-2.0
|
|
154
154
|
- MIT
|
|
155
155
|
metadata:
|
|
156
156
|
allowed_push_host: https://rubygems.org
|
|
157
|
-
homepage_uri: https://github.com/KitaitiMakoto/ebur128-stream/tree/
|
|
158
|
-
source_code_uri: https://github.com/KitaitiMakoto/ebur128-stream/tree/
|
|
159
|
-
changelog_uri: https://github.com/KitaitiMakoto/ebur128-stream/tree/
|
|
157
|
+
homepage_uri: https://github.com/KitaitiMakoto/ebur128-stream/tree/ruby/bindings/ruby
|
|
158
|
+
source_code_uri: https://github.com/KitaitiMakoto/ebur128-stream/tree/ruby/bindings/ruby
|
|
159
|
+
changelog_uri: https://github.com/KitaitiMakoto/ebur128-stream/tree/ruby/bindings/ruby/CHANGELOG.md
|
|
160
160
|
rdoc_options: []
|
|
161
161
|
require_paths:
|
|
162
162
|
- lib
|