public class Sound extends AndroidNonvisibleComponent implements Component, OnResumeListener, OnStopListener, OnDestroyListener, Deleteable
SoundPool
.form
ACCELEROMETER_SENSITIVITY_MODERATE, ACCELEROMETER_SENSITIVITY_STRONG, ACCELEROMETER_SENSITIVITY_WEAK, ALIGNMENT_CENTER, ALIGNMENT_NORMAL, ALIGNMENT_OPPOSITE, ASSET_DIRECTORY, BUTTON_SHAPE_DEFAULT, BUTTON_SHAPE_OVAL, BUTTON_SHAPE_RECT, BUTTON_SHAPE_ROUNDED, COLOR_BLACK, COLOR_BLUE, COLOR_CYAN, COLOR_DEFAULT, COLOR_DKGRAY, COLOR_GRAY, COLOR_GREEN, COLOR_LTGRAY, COLOR_MAGENTA, COLOR_NONE, COLOR_ORANGE, COLOR_PINK, COLOR_RED, COLOR_WHITE, COLOR_YELLOW, DEFAULT_VALUE_COLOR_BLACK, DEFAULT_VALUE_COLOR_BLUE, DEFAULT_VALUE_COLOR_CYAN, DEFAULT_VALUE_COLOR_DEFAULT, DEFAULT_VALUE_COLOR_DKGRAY, DEFAULT_VALUE_COLOR_GRAY, DEFAULT_VALUE_COLOR_GREEN, DEFAULT_VALUE_COLOR_LTGRAY, DEFAULT_VALUE_COLOR_MAGENTA, DEFAULT_VALUE_COLOR_NONE, DEFAULT_VALUE_COLOR_ORANGE, DEFAULT_VALUE_COLOR_PINK, DEFAULT_VALUE_COLOR_RED, DEFAULT_VALUE_COLOR_WHITE, DEFAULT_VALUE_COLOR_YELLOW, DIRECTION_EAST, DIRECTION_MAX, DIRECTION_MIN, DIRECTION_NONE, DIRECTION_NORTH, DIRECTION_NORTHEAST, DIRECTION_NORTHWEST, DIRECTION_SOUTH, DIRECTION_SOUTHEAST, DIRECTION_SOUTHWEST, DIRECTION_WEST, FONT_DEFAULT_SIZE, LAYOUT_ORIENTATION_HORIZONTAL, LAYOUT_ORIENTATION_VERTICAL, LENGTH_FILL_PARENT, LENGTH_PREFERRED, LENGTH_UNKNOWN, SLIDER_MAX_VALUE, SLIDER_MIN_VALUE, SLIDER_THUMB_VALUE, TOAST_LENGTH_LONG, TOAST_LENGTH_SHORT, TYPEFACE_DEFAULT, TYPEFACE_MONOSPACE, TYPEFACE_SANSSERIF, TYPEFACE_SERIF
Constructor and Description |
---|
Sound(ComponentContainer container) |
Modifier and Type | Method and Description |
---|---|
int |
MinimumInterval()
Returns the minimum interval required between calls to Play(), in
milliseconds.
|
void |
MinimumInterval(int interval)
Specify the minimum interval required between calls to Play(), in
milliseconds.
|
void |
onDelete() |
void |
onDestroy() |
void |
onResume() |
void |
onStop() |
void |
Pause()
Pauses playing the sound if it is being played.
|
void |
Play()
Plays the sound.
|
void |
Resume()
Resumes playing the sound after a pause.
|
void |
SoundError(java.lang.String message) |
java.lang.String |
Source()
Returns the sound's filename.
|
void |
Source(java.lang.String path)
Sets the sound source
See
MediaUtil.determineMediaSource(com.google.appinventor.components.runtime.Form, java.lang.String) for information about what
a path can be. |
void |
Stop()
Stops playing the sound if it is being played.
|
void |
Vibrate(int millisecs)
Vibrates for the specified number of milliseconds.
|
getDispatchDelegate
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getDispatchDelegate
public Sound(ComponentContainer container)
public java.lang.String Source()
public void Source(java.lang.String path)
MediaUtil.determineMediaSource(com.google.appinventor.components.runtime.Form, java.lang.String)
for information about what
a path can be.path
- the path to the sound sourcepublic int MinimumInterval()
public void MinimumInterval(int interval)
interval
- minimum interval in mspublic void Play()
public void Pause()
public void Resume()
public void Stop()
public void Vibrate(int millisecs)
public void SoundError(java.lang.String message)
public void onStop()
onStop
in interface OnStopListener
public void onResume()
onResume
in interface OnResumeListener
public void onDestroy()
onDestroy
in interface OnDestroyListener
public void onDelete()
onDelete
in interface Deleteable