Class: MovingImages::MIMovie::AudioInstruction

Inherits:
Object
  • Object
show all
Defined in:
lib/moving_images/mimovie.rb

Overview

Instruction for specifying track volume. Only set one of volume/volumeramp.

Instance Method Summary (collapse)

Constructor Details

- (AudioInstruction) initialize(track: nil)

Initialize an audio instruction with an optional track.

Parameters:

  • track (Hash)

    Track identifier to have volume change applied to.



194
195
196
197
# File 'lib/moving_images/mimovie.rb', line 194

def initialize(track: nil)
  @audioinstructions = {}
  @audioinstructions[:track] = track unless track.nil?
end

Instance Method Details

- (Hash) audioinstructionhash

Return the audio instruction.

Returns:

  • (Hash)

    The audio instructions.



201
202
203
# File 'lib/moving_images/mimovie.rb', line 201

def audioinstructionhash
  @audioinstructions
end

- (Hash) set_volume_instruction(time: nil, volume: nil)

Assign a volume instruction.
The volume will remain at this level until the next time the volume is specified or the audio track ends.

Parameters:

  • time (Hash)

    The time when to set the audio track volume level. See: MovieTime.make_movietime

  • volume (Float)

    The volume level to be assigned.. Range 0..1

Returns:

  • (Hash)

    The audio instructions.



218
219
220
221
222
223
# File 'lib/moving_images/mimovie.rb', line 218

def set_volume_instruction(time: nil, volume: nil)
  @audioinstructions[:audioinstruction] = :volumeinstruction
  @audioinstructions[:time] = time
  @audioinstructions[:instructionvalue] = volume
  @audioinstructions
end

- (Hash) set_volumeramp_instruction(timerange: nil, startvolume: nil, endvolume: nil)

Assign a volume ramp audio instruction.

Parameters:

  • timerange (Hash)

    The time range over which the volume ramp is applied. The time range specifies the start time and how long the ramp takes. MovieTime.make_movie_timerange

  • startvolume (Float)

    The start volume level. Range 0..1

  • endvolume (Float)

    The end volume level. Range 0..1

Returns:

  • (Hash)

    The audio instructions.



232
233
234
235
236
237
238
239
# File 'lib/moving_images/mimovie.rb', line 232

def set_volumeramp_instruction(timerange: nil, startvolume: nil,
                               endvolume: nil)
  @audioinstructions[:audioinstruction] = :volumerampinstruction
  @audioinstructions[:timerange] = timerange
  @audioinstructions[:startrampvalue] = startvolume
  @audioinstructions[:endrampvalue] = endvolume
  @audioinstructions
end

- (Object) track=(track)

Assign the track to have volume instruction applied.

Parameters:

  • track (Hash)

    Track identifier to have volume change applied to.



207
208
209
# File 'lib/moving_images/mimovie.rb', line 207

def track=(track)
  @audioinstructions[:track] = track
end