Method: Sox::Combiner#initialize

Defined in:
lib/sox/combiner.rb

#initialize(input_files, options = {}) ⇒ Combiner

Returns a new instance of Combiner.

Parameters:

  • input_files (Array<String>)

    input files

  • options (Hash) (defaults to: {})

Options Hash (options):

  • :combine (Symbol)

    value for --combine sox option. Use underscore instead of hyphen, e.g. :mix_power.

  • :channels (Integer)

    number of channels in output file.

  • :rate (Integer)

    rate of output file

  • :norm (Boolean)

    apply norm effect on output.

  • :strategy (Symbol)

    strategy to treat temporary files, default is :process_substitution which reduces disk IO.

Raises:

  • (ArgumentError)


53
54
55
56
57
58
59
60
61
62
# File 'lib/sox/combiner.rb', line 53

def initialize(input_files, options = {})
  raise(ArgumentError, "Input files are missing") if input_files.empty?

  opts           = DEFAULT_OPTIONS.merge(options)
  strategy_name  = opts.delete(:strategy)
  strategy_class = STRATEGIES[strategy_name]
  raise(ArgumentError, "Unknown strategy #{strategy_name.inspect}") unless strategy_class

  @strategy      = strategy_class.new(input_files, opts)
end