Sha256: b52e05853e180ef77c638cbe4fd72ffea02fa67a58b0cc9c8c71dc3f9ee604e2

Contents?: true

Size: 514 Bytes

Versions: 2

Compression:

Stored size: 514 Bytes

Contents

require "coreaudio"

# Select option name device as default output device
def set_nominal_rate(rate)
  available_rates = CoreAudio.default_output_device.available_sample_rate.flatten.uniq
  rate = rate.to_f
  if (!rate || !available_rates.member?(rate))
    puts "Please enter a valid sample rate. Choose one of the following: #{available_rates.join(', ')}"
    return -1
  end

  CoreAudio.default_output_device(nominal_rate: rate)
  puts "Output device sample rate set to #{rate}"
end

set_nominal_rate(ARGV[0])

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
coreaudio-0.0.12 examples/set_def_out_sample_rate.rb
coreaudio-0.0.11 examples/set_def_out_sample_rate.rb