• R/O
  • HTTP
  • SSH
  • HTTPS

コミット

タグ
未設定

よく使われているワード(クリックで追加)

javaandroidc++objective-ccocoa誰得c#linuxgamebathyscaphephp翻訳qtpythonrubycwindowsomegattwitterguiframeworkbtronarduinovb.netdirectxtestゲームエンジンdom計画中(planning stage)previewer

Voice data server for navigation voice changer app.


コミットメタ情報

リビジョン9685d51d1190cd90dadacdf5c4989d4cf78eb975 (tree)
日時2013-10-20 00:40:06
作者HMML <hmml3939@gmai...>
コミッターHMML

ログメッセージ

Fix preview generation for mixed rate/channel data.

変更サマリ

差分

--- a/lib/paperclip_processors/voice_preview.rb
+++ b/lib/paperclip_processors/voice_preview.rb
@@ -38,14 +38,20 @@ class VoicePreview < Paperclip::Processor
3838 end
3939 end
4040 end
41- tfiles.empty? and return dst # give up
42- system(*['sox', tfiles.sort, dst_path].flatten) or raise "Failed to execute sox: #{$?}"
41+ tfiles.empty? and raise "File missing."
42+ tfiles.each do |tf|
43+ `soxi -r "#{tf}"`.to_i == 44100 && `soxi -c "#{tf}"`.to_i == 1 and next
44+ rtmp = "#{tmpdir}/rate-convert-tmp-#{$$}.ogg"
45+ system('sox', tf, '-c', '1', '-r', '44100', rtmp) or raise "Failed on rate/channel conversion, sox fail (#{$?})"
46+ FileUtils.mv rtmp, tf
47+ end
48+ system(*['sox', tfiles.sort, dst_path].flatten) or raise "Failed to concat, sox fail (#{$?})"
4349 rescue => e
44- raise Paperclip::Error, "Error: Failed to generate preview ogg: #{e.message}"
50+ Rails.logger.error "Error: Failed to generate preview voice: #{e.message}"
51+ raise Paperclip::Error, "Error: Failed to generate preview voice: #{e.message}"
4552 ensure
4653 FileUtils.remove_entry_secure tmpdir
4754 end
48-
4955 dst
5056 end
5157 end