wahwah 1.5.0 → 1.5.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 02bf7083fb530d058140db0b5f5e18cf2710ba7a6ba7fed2d2978c2109764ab2
4
- data.tar.gz: dc9a32191879dfda4ea08477579ec4c631be6f0829d25ad066623232cd926a15
3
+ metadata.gz: 0ae84eaac046bfc70016dd80a23f1c246066d70264c064fd048127946a40bd51
4
+ data.tar.gz: bea598207d92e57cac06bfc948b1ea86a70b68b7ffd61c2231a5b2f75d193785
5
5
  SHA512:
6
- metadata.gz: 59b2cd82d8d52b273bb2abfa4085a083716fb9cb701102c0103e6ccf2a08b3909253c8bda2ffe2d423bed43a056a8aab1bd7d3c172468c6f72fa7dafc4879b56
7
- data.tar.gz: 578a61f74b3eea858ba31817d8d16e663b3e7680806886e2e44fc7b4c93b09b601a5559c07326f63cc0e43a6be2c1d362e6247297679e65578e301f0f7c591ee
6
+ metadata.gz: cc3e3ad5fb44882840f7fe1d21d77aa722a0bc5b13ef41b1d8243f6dc24ec83ac83ce2765e5941f09e7e097b458810235f11235d6b9b997623b9910082d8e023
7
+ data.tar.gz: 4f5fd37cbe0eadfec74eae4b73952bd9fe03b5a8ce67569c4662f54e142a33a163c94722257b6d461286b537b7c59cd0c52b33728659f606d1a1219b10332e00
@@ -95,6 +95,12 @@ module WahWah
95
95
  def parse_fmt_chunk(chunk)
96
96
  _, @channel, @sample_rate, _, _, @bit_depth = chunk.data.unpack("vvVVvv")
97
97
  @bitrate = @sample_rate * @channel * @bit_depth / 1000
98
+
99
+ # There is a rare situation where the data chunk is not included in the top RIFF chunk.
100
+ # In this case, the duration can not be got from the data chunk, some player even cannot play the file.
101
+ # So try to estimate the duration from the file size and bitrate.
102
+ # This may be inaccurate, but at least can get approximate duration.
103
+ @duration = (@file_size * 8) / (@bitrate * 1000).to_f if @duration.nil?
98
104
  end
99
105
 
100
106
  def parse_data_chunk(chunk)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module WahWah
4
- VERSION = "1.5.0"
4
+ VERSION = "1.5.1"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wahwah
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0
4
+ version: 1.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - aidewoode
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-07-10 00:00:00.000000000 Z
11
+ date: 2023-08-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler