Class: Audio::FileOutput

Inherits:
FileOutputC show all
Defined in:
ext/audio/output.c,
lib/audio/output.rb

Overview

オーディオファイル出力機能をサポートするクラス。

Instance Method Summary collapse

Methods inherited from LiveOutputC

#close, #closed?, #play, #playing?, #waiting

Constructor Details

#initialize(driver_id: Audio::Info.driver_id('wav'), filename:, overwrite: false, bits: 16, rate: 44100, channels: 2, byte_format: Audio::Info::FMT_NATIVE, matrix: nil, options: nil, thread: nil) ⇒ FileOutput

Returns a new instance of FileOutput.



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/audio/output.rb', line 26

def initialize(
      driver_id:
        Audio::Info.driver_id('wav'),
      filename:, overwrite: false,
      bits: 16, rate: 44100, channels: 2,
      byte_format:
        Audio::Info::FMT_NATIVE,
      matrix: nil, options: nil, thread: nil)
  ao = super(driver_id, filename, overwrite,
             bits, rate, channels, byte_format,
             matrix, options, thread)
  if block_given?
    begin
      yield ao
    ensure
      ao.close
    end
  end
end