object Sound
This companion object of class Sound
provides methods for creating new Sound
objects.
It has an alias in the top-level package o1, so it’s accessible to students simply via import o1._
.
- Alphabetic
- By Inheritance
- Sound
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
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
- def apply(url: URL, volume: Float): Sound
Loads a sound sample from the given URL.
Loads a sound sample from the given URL. The sound needs to be in one of these formats: WAV, AIFF, AU, AIFC, SND. Throws an
IOException
if the URL is inaccessible.- url
a URL to a sound sample
- volume
an adjustment to the sound’s volume: a positive number makes it louder, a negative one quieter. Pass in Mute to make the sound completely silent.
- returns
the sound; if the system doesn’t support sound, or if sound support is disabled, returns a silent Sound whose
isDefined
method returnsfalse
- def apply(id: String, volume: Float = 0): Sound
Loads a sound sample from a URL or a local file.
Loads a sound sample from a URL or a local file. The sound needs to be in one of these formats: WAV, AIFF, AU, AIFC, SND.
- id
a path or URL that identifies the sound sample; this needs to be a classpath-relative file path or an URL, as specified for the parameter of o1.util.tryForURL
- volume
an adjustment to the sound’s volume: a positive number makes it louder, a negative one quieter. Pass in Mute to make the sound completely silent.
- returns
the sound; if a sound matching
id
could not be located, if the system doesn’t support sound, or if sound support is disabled, returns a silent Sound whoseisDefined
method returnsfalse
- 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
- Definition Classes
- 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.