Class: AudioGlue::Template::HeadContext

Inherits:
Object
  • Object
show all
Defined in:
lib/audio_glue/template/head_context.rb

Overview

The context in which the head statement of a .glue template is executed. It’s used to set the format, rate and channels on the template.

Instance Method Summary collapse

Constructor Details

#initialize(template) ⇒ HeadContext

Returns a new instance of HeadContext.

Parameters:



8
9
10
# File 'lib/audio_glue/template/head_context.rb', line 8

def initialize(template)
  @template = template
end

Instance Method Details

#channels(channels_value) ⇒ void

This method returns an undefined value.

Set the number of channels on the template.

Parameters:

  • channels_value (Integer, String)


35
36
37
# File 'lib/audio_glue/template/head_context.rb', line 35

def channels(channels_value)
  @template.channels = channels_value
end

#format(format_value) ⇒ void

This method returns an undefined value.

Set the audio format on the template (“mp3”, “ogg”, “wav”, etc).

Parameters:

  • format_value (Symbol, String)


17
18
19
# File 'lib/audio_glue/template/head_context.rb', line 17

def format(format_value)
  @template.format = format_value
end

#rate(rate_value) ⇒ void

This method returns an undefined value.

Set the audio bitrate on the template.

Parameters:

  • rate_value (Integer, String)


26
27
28
# File 'lib/audio_glue/template/head_context.rb', line 26

def rate(rate_value)
  @template.rate = rate_value
end