Class: Wavify::Codecs::Base
- Inherits:
-
Object
- Object
- Wavify::Codecs::Base
- Defined in:
- lib/wavify/codecs/base.rb,
sig/codecs.rbs
Overview
Class Method Summary collapse
-
.available? ⇒ Boolean
Returns whether optional runtime dependencies for this codec are present.
-
.can_read?(_io_or_path) ⇒ Boolean
Returns whether this codec can read the given path/IO.
-
.metadata(_io_or_path) ⇒ Hash
Reads metadata (format and duration-related info) without full decode.
-
.read(_io_or_path, format: nil) ⇒ Wavify::Core::SampleBuffer
Reads a full audio buffer from a path/IO.
-
.stream_read(_io_or_path, chunk_size: 4096) {|arg0| ... } ⇒ Enumerator
Streams decoded audio as chunked sample buffers.
-
.stream_write(_io_or_path, format:, **_codec_options) {|arg0| ... } ⇒ Enumerator, ...
Streams encoded chunks to a path/IO through a yielded writer.
-
.write(_io_or_path, _sample_buffer, format:, **_codec_options) ⇒ String, IO
Writes a full audio buffer to a path/IO.
Class Method Details
.available? ⇒ Boolean
Returns whether optional runtime dependencies for this codec are present.
70 71 72 |
# File 'lib/wavify/codecs/base.rb', line 70 def available? true end |
.can_read?(_io_or_path) ⇒ Boolean
Returns whether this codec can read the given path/IO.
18 19 20 |
# File 'lib/wavify/codecs/base.rb', line 18 def can_read?(_io_or_path) raise NotImplementedError end |
.metadata(_io_or_path) ⇒ Hash
Reads metadata (format and duration-related info) without full decode.
63 64 65 |
# File 'lib/wavify/codecs/base.rb', line 63 def (_io_or_path) raise NotImplementedError end |
.read(_io_or_path, format: nil) ⇒ Wavify::Core::SampleBuffer
Reads a full audio buffer from a path/IO.
27 28 29 |
# File 'lib/wavify/codecs/base.rb', line 27 def read(_io_or_path, format: nil) raise NotImplementedError end |
.stream_read(_io_or_path, chunk_size: 4096) {|arg0| ... } ⇒ Enumerator
Streams decoded audio as chunked sample buffers.
46 47 48 |
# File 'lib/wavify/codecs/base.rb', line 46 def stream_read(_io_or_path, chunk_size: 4096) raise NotImplementedError end |
.stream_write(_io_or_path, format:, **_codec_options) {|arg0| ... } ⇒ Enumerator, ...
Streams encoded chunks to a path/IO through a yielded writer.
55 56 57 |
# File 'lib/wavify/codecs/base.rb', line 55 def stream_write(_io_or_path, format:, **) raise NotImplementedError end |
.write(_io_or_path, _sample_buffer, format:, **_codec_options) ⇒ String, IO
Writes a full audio buffer to a path/IO.
37 38 39 |
# File 'lib/wavify/codecs/base.rb', line 37 def write(_io_or_path, _sample_buffer, format:, **) raise NotImplementedError end |