Class: Gosu::Channel

Inherits:
Object
  • Object
show all
Defined in:
rdoc/gosu.rb

Overview

Sample#play returns a Channel that represents the sound currently being played.

This object can be used to stop sounds dynamically, or to check whether they have finished.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#pan=(value) ⇒ Float (writeonly)

Set the amount of panning, i.e. the position of the sound when using stereo speakers. 0.0 is the centre, negative values are to the left, positive values are to the right. If something happens on the edge of the screen, a good value for pan would be ±0.1.

Parameters:

  • (Float)

Returns:

  • (Float)


616
617
618
# File 'rdoc/gosu.rb', line 616

def pan=(value)
  @pan = value
end

#speed=(value) ⇒ Float (writeonly)

Sets the playback speed. A value of 2.0 will play the sample at 200% speed and one octave higher. A value of 0.5 will play the sample at 50% speed and one octave lower. The valid range of this property depends on the operating system, but values up to 8.0 should work.

Parameters:

  • (Float)

Returns:

  • (Float)


610
611
612
# File 'rdoc/gosu.rb', line 610

def speed=(value)
  @speed = value
end

#volume=(value) ⇒ Float (writeonly)

Sets the playback volume, in the range [0.0; 1.0], where 0 is completely silent and 1 is full volume. Values outside of this range will be clamped to [0.0; 1.0].

Parameters:

  • (Float)

Returns:

  • (Float)


604
605
606
# File 'rdoc/gosu.rb', line 604

def volume=(value)
  @volume = value
end

Instance Method Details

#pausevoid

Note:

The sample will still occupy a playback channel while paused.

This method returns an undefined value.

Pauses the sample, to be resumed afterwards.



632
# File 'rdoc/gosu.rb', line 632

def pause; end

#paused?true, false

Returns whether the sample is paused.

Returns:

  • (true, false)

    whether the sample is paused.



642
# File 'rdoc/gosu.rb', line 642

def paused?; end

#playing?true, false

Returns whether the sample is playing.

Returns:

  • (true, false)

    whether the sample is playing.



646
# File 'rdoc/gosu.rb', line 646

def playing?; end

#resumevoid

This method returns an undefined value.

Resumes playback of the sample.



638
# File 'rdoc/gosu.rb', line 638

def resume; end

#stopvoid

This method returns an undefined value.

Stops playback of this sample instance. After calling this method, the sample instance is useless and can be discarded.

Calling ‘stop` after the sample has finished is harmless and has no effect.



624
# File 'rdoc/gosu.rb', line 624

def stop; end