trait Sound extends AnyRef
Each instance of this trait represents a recorded sound sample.
You create Sound
s with the methods on the companion object: Sound("my_sound_file.wav")
.
The supported formats are WAV, AIFF, AU, AIFC, and SND.
This trait has an alias in the top-level package o1, so it’s accessible to
students simply via import o1._
.
This type is essentially a wrapper around the key functionality in javax.sound.Sampled, especially its Clip class.
- Alphabetic
- By Inheritance
- Sound
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Abstract Value Members
- abstract val description: String
A description of the sound’s origin.
A description of the sound’s origin. Examples:
"file:/D:/O1Course/Pong/bin/sounds/slap.wav"
"http://www.aalto.fi/does_not_exist.wav (failed to create)"
- abstract def isDefined: Boolean
whether the
Sound
object represents a successfully loaded sound sample.whether the
Sound
object represents a successfully loaded sound sample. This will betrue
if the methods on the companion object successfully loaded the sound from a file or a URL, andfalse
if there was a problem - abstract def play(repeats: Int = 0, volume: Float = this.volume): Unit
Plays the sound sample, possibly multiple times in sequence.
Plays the sound sample, possibly multiple times in sequence.
- repeats
how many additional times the sound should play after being played once; if you pass in KeepRepeating, the sound will repeat indefinitely unless stop is called
- volume
you may pass in a number to override the sounds’s default volume adjustment
- abstract def stop(): Unit
Stops the playing of the sound sample, previously started with play.
- abstract val volume: Float
an adjustment to the loaded sound sample’s volume: a positive number makes it louder a negative one quieter.
an adjustment to the loaded sound sample’s volume: a positive number makes it louder a negative one quieter. A value equal to Mute means the sound is completely silent.
- abstract def withVolume(differentVolume: Float): Sound
Returns an other
Sound
otherwise identical to this one but with the given volume adjustment.
Concrete Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##(): Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString: String
A
String
representation of the sound; equals description.A
String
representation of the sound; equals description.- Definition Classes
- Sound → AnyRef → Any
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
Deprecated Value Members
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated @deprecated
- Deprecated
(Since version ) see corresponding Javadoc for more information.