Class: Pdfrb::Model::Type::ActionSound

Inherits:
Cos::Dictionary show all
Defined in:
lib/pdfrb/model/type/action_sound.rb

Overview

Sound action (ISO 32000-2 §12.6.4.11, PDF 1.2, deprecated PDF 2.0). Plays a sound object.

Instance Attribute Summary

Attributes inherited from Object

#document, #gen, #oid, #value

Instance Method Summary collapse

Methods inherited from Cos::Dictionary

#[], #[]=, arlington_available?, arlington_default, arlington_key_to_symbol, arlington_loaded_for?, arlington_mark_loaded, arlington_object, arlington_one_type_to_ruby, arlington_required?, arlington_types_to_ruby, arlington_version, define_field, define_field_from_arlington, #delete, #each, each_field, #each_raw, #empty?, field, #initialize, #key?, #keys, lookup_type, own_fields, #pdf_type, register_type, type_map, #validate

Methods inherited from Object

#==, define_type, #deref, #indirect?, #initialize, #must_be_indirect?, #pdf_type, pdf_type

Constructor Details

This class inherits a constructor from Pdfrb::Model::Cos::Dictionary

Instance Method Details

#action_typeObject

/S — required, fixed "Sound".



17
18
19
# File 'lib/pdfrb/model/type/action_sound.rb', line 17

def action_type
  value[:S]&.to_sym
end

#mix?Boolean

/Mix — optional, default false. Whether to mix with existing sounds.

Returns:

  • (Boolean)


46
47
48
# File 'lib/pdfrb/model/type/action_sound.rb', line 46

def mix?
  value[:Mix] == true
end

#next_action(document = nil) ⇒ Object

/Next — optional next action(s).



51
52
53
54
55
56
# File 'lib/pdfrb/model/type/action_sound.rb', line 51

def next_action(document = nil)
  ref = value[:Next]
  return nil unless ref && document

  ref.is_a?(Pdfrb::Model::Reference) ? document.object(ref) : ref
end

#repeat?Boolean

/Repeat — optional, default false.

Returns:

  • (Boolean)


40
41
42
# File 'lib/pdfrb/model/type/action_sound.rb', line 40

def repeat?
  value[:Repeat] == true
end

#sound(document = nil) ⇒ Object

/Sound — required indirect stream with the sound data.



22
23
24
25
26
27
# File 'lib/pdfrb/model/type/action_sound.rb', line 22

def sound(document = nil)
  ref = value[:Sound]
  return nil unless ref && document

  ref.is_a?(Pdfrb::Model::Reference) ? document.object(ref) : ref
end

#synchronous?Boolean

/Synchronous — optional, default false.

Returns:

  • (Boolean)


35
36
37
# File 'lib/pdfrb/model/type/action_sound.rb', line 35

def synchronous?
  value[:Synchronous] == true
end

#typeObject

/Type — optional, fixed "Action".



12
13
14
# File 'lib/pdfrb/model/type/action_sound.rb', line 12

def type
  value[:Type]&.to_sym
end

#volumeObject

/Volume — optional, -1.0 to 1.0 (default 1.0).



30
31
32
# File 'lib/pdfrb/model/type/action_sound.rb', line 30

def volume
  value[:Volume] || 1.0
end