Class: Osb::Sample
- Inherits:
-
Object
- Object
- Osb::Sample
- Defined in:
- lib/osb/sample.rb
Overview
Audio sample.
Instance Method Summary collapse
-
#initialize(time:, layer:, file_path:, volume: 100) ⇒ Sample
constructor
A new instance of Sample.
Constructor Details
#initialize(time:, layer:, file_path:, volume: 100) ⇒ Sample
Returns a new instance of Sample.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/osb/sample.rb', line 13 def initialize(time:, layer:, file_path:, volume: 100) Internal.assert_type!(layer, String, "layer") Internal.assert_value!(layer, Layer::ALL, "layer") Internal.assert_type!(file_path, String, "file_path") layer_ = case layer when Osb::Layer::Background 0 when Osb::Layer::Foreground 1 when Osb::Layer::Fail 2 when Osb::Layer::Pass 3 else raise InvalidValueError, "An audio sample can only exists in one of these layers: " + "Background, Foreground, Fail or Pass." end @command = "Sample,#{time},#{layer_},\"#{file_path}}\",#{volume}" end |