carrierwave-audio 1.0.7 → 1.0.8
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/lib/carrierwave/audio/processor.rb +18 -4
- data/lib/carrierwave/audio/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 727554e942f93928cf0a5fe38da5c5bbe6943ecc
|
4
|
+
data.tar.gz: cc8bfc6ad0ec24c02725d477bd64c3bc7ca8df4c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 54736000293f383b639c5fde95575b33a1d61cfc731719d5e31113a52f21687eb1e65eb5e754845b86fbd081968eed4fe98d70cb89a1fd9b70e312c85643d1c1
|
7
|
+
data.tar.gz: c5b3cb7b4907e8c0ca04f64c3368dcd7755f0c7dc379ab19fd2a87f870158fd0140c9f19a5867f84e3895ad8657386d68b5f777fdc99f408ca1496c231b9b38a
|
@@ -86,16 +86,30 @@ module CarrierWave
|
|
86
86
|
@log = Log.new(options[:logger])
|
87
87
|
@log.start!
|
88
88
|
|
89
|
-
|
90
|
-
|
91
|
-
|
89
|
+
source_samplerate = Soxi::Wrapper.file(source).samplerate.to_i
|
90
|
+
watermark_samplerate = Soxi::Wrapper.file(watermark_file_path).samplerate.to_i
|
92
91
|
watermark_ext = File.extname(watermark_file_path)
|
93
92
|
watermark_options = { type: watermark_ext.gsub(/\./, '') }
|
93
|
+
converted_watermark = watermark_file_path
|
94
|
+
if source_samplerate != watermark_samplerate
|
95
|
+
converted_watermark = tmp_filename(source: source, format: watermark_ext, prefix: "cnvt_wtmk")
|
96
|
+
@log.timed("\nConverting watermarked file to source samplerate of #{source_samplerate}...") do
|
97
|
+
convert_file(
|
98
|
+
input_file_path: watermark_file_path,
|
99
|
+
input_options: watermark_options,
|
100
|
+
output_file_path: converted_watermark,
|
101
|
+
output_options: output_options_for_format(watermark_options[:type]).merge(rate: source_samplerate)
|
102
|
+
)
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
ext = File.extname(source)
|
107
|
+
input_options = { type: ext.gsub(/\./, '') }
|
94
108
|
final_filename = tmp_filename(source: source, format: format, prefix: "wtmk")
|
95
109
|
@log.timed("\nCombining source file and watermark, limiting final output...") do
|
96
110
|
combiner = Sox::Cmd.new(combine: :mix)
|
97
111
|
combiner.add_input source, input_options
|
98
|
-
combiner.add_input
|
112
|
+
combiner.add_input converted_watermark, watermark_options
|
99
113
|
combiner.set_output final_filename, output_options_for_format(format)
|
100
114
|
combiner.set_effects({ trim: "0 =#{Soxi::Wrapper.file(source).seconds}", vol: "0 db 0.01" })
|
101
115
|
combiner.run
|