Class: Sound

Inherits:
Object
  • Object
show all
Defined in:
mrb_doc/models/sound.rb

Overview

The Sound class holds shorter sounds, these are usually used for sound effects.

Defined Under Namespace

Classes: NotFound

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(frame_count) ⇒ Sound

Creates a new instance of Sound

Parameters:

  • frame_count (Integer)


12
13
14
15
16
# File 'mrb_doc/models/sound.rb', line 12

def initialize(frame_count)
  # mrb_Sound_initialize
  # src/mruby_integration/models/sound.cpp
  Sound.new
end

Instance Attribute Details

#frame_countInteger

Returns:

  • (Integer)


4
5
6
# File 'mrb_doc/models/sound.rb', line 4

def frame_count
  @frame_count
end

#pitchFloat

Returns:

  • (Float)


7
8
9
# File 'mrb_doc/models/sound.rb', line 7

def pitch
  @pitch
end

#volumeFloat

Returns:

  • (Float)


7
8
9
# File 'mrb_doc/models/sound.rb', line 7

def volume
  @volume
end

Class Method Details

.load(path) ⇒ Sound

Loads a sound file from the specified path

Parameters:

  • path (String)

Returns:

Raises:



37
38
39
40
# File 'mrb_doc/models/sound.rb', line 37

def self.load(path)
  # src/mruby_integration/models/sound.cpp
  Sound.new
end

.playingInteger

Returns the total amount of sounds playing using multi: true (the default)

Returns:

  • (Integer)


117
118
119
120
# File 'mrb_doc/models/sound.rb', line 117

def self.playing
  # src/mruby_integration/models/sound.cpp
  3
end

.stopnil

Stops all sounds that were played using multi: true (the default)

Returns:

  • (nil)


110
111
112
113
# File 'mrb_doc/models/sound.rb', line 110

def self.stop
  # src/mruby_integration/models/sound.cpp
  nil
end

Instance Method Details

#pausenil

Pauses the sound, you will need to call Sound#resume to start it again This can only be used if the sound was played with multi: false

Returns:

  • (nil)


78
79
80
81
# File 'mrb_doc/models/sound.rb', line 78

def pause
  # src/mruby_integration/models/sound.cpp
  nil
end

#play(multi: true) ⇒ nil

Starts playing the sound, if multi is true you won’t be able to pause/resume/stop this sound but you will be able to play it multiple times at once

Parameters:

  • multi (Boolean) (defaults to: true)

Returns:

  • (nil)


54
55
56
57
# File 'mrb_doc/models/sound.rb', line 54

def play(multi: true)
  # src/mruby_integration/models/music.cpp
  nil
end

#playing?Boolean

Is the sound currently playing? This can only be used if the sound was played with multi: false

Returns:

  • (Boolean)


62
63
64
65
# File 'mrb_doc/models/sound.rb', line 62

def playing?
  # src/mruby_integration/models/sound.cpp
  true
end

#resumenil

Resumes the sound This can only be used if the sound was played with multi: false

Returns:

  • (nil)


86
87
88
89
# File 'mrb_doc/models/sound.rb', line 86

def resume
  # src/mruby_integration/models/sound.cpp
  nil
end

#stopnil

Stops the sound, you will need to call Sound#play to start it again. This can only be used if the sound was played with multi: false

Returns:

  • (nil)


70
71
72
73
# File 'mrb_doc/models/sound.rb', line 70

def stop
  # src/mruby_integration/models/sound.cpp
  nil
end

#to_hHash

Return the object represented by a Hash

Returns:

  • (Hash)


26
27
28
29
30
31
# File 'mrb_doc/models/sound.rb', line 26

def to_h
  # src/mruby_integration/models/sound.cpp
  {
    frame_count: frame_count,
  }
end

#unloadnil

Unloads the sound from memory

Returns:

  • (nil)


44
45
46
47
# File 'mrb_doc/models/sound.rb', line 44

def unload
  # src/mruby_integration/models/sound.cpp
  nil
end