AI2 Component  (Version nb184)
com.google.appinventor.components.runtime.Sound Class Reference
Inheritance diagram for com.google.appinventor.components.runtime.Sound:
com.google.appinventor.components.runtime.AndroidNonvisibleComponent com.google.appinventor.components.runtime.Component com.google.appinventor.components.runtime.OnResumeListener com.google.appinventor.components.runtime.OnStopListener com.google.appinventor.components.runtime.OnDestroyListener com.google.appinventor.components.runtime.Deleteable com.google.appinventor.components.runtime.Component

Public Member Functions

 Sound (ComponentContainer container)
 
String Source ()
 
void Source (String path)
 
int MinimumInterval ()
 
void MinimumInterval (int interval)
 
void Play ()
 
void Pause ()
 
void Resume ()
 
void Stop ()
 
void Vibrate (int millisecs)
 
void SoundError (String message)
 
void onStop ()
 
void onResume ()
 
void onDestroy ()
 
void onDelete ()
 
- Public Member Functions inherited from com.google.appinventor.components.runtime.AndroidNonvisibleComponent
HandlesEventDispatching getDispatchDelegate ()
 

Additional Inherited Members

- Static Public Attributes inherited from com.google.appinventor.components.runtime.Component
static final String ASSET_DIRECTORY = "component"
 
static final int ALIGNMENT_NORMAL = 0
 
static final int ALIGNMENT_CENTER = 1
 
static final int ALIGNMENT_OPPOSITE = 2
 
static final int ACCELEROMETER_SENSITIVITY_WEAK = 1
 
static final int ACCELEROMETER_SENSITIVITY_MODERATE = 2
 
static final int ACCELEROMETER_SENSITIVITY_STRONG = 3
 
static final int BUTTON_SHAPE_DEFAULT = 0
 
static final int BUTTON_SHAPE_ROUNDED = 1
 
static final int BUTTON_SHAPE_RECT = 2
 
static final int BUTTON_SHAPE_OVAL = 3
 
static final int COLOR_NONE = 0x00FFFFFF
 
static final int COLOR_BLACK = 0xFF000000
 
static final int COLOR_BLUE = 0xFF0000FF
 
static final int COLOR_CYAN = 0xFF00FFFF
 
static final int COLOR_DKGRAY = 0xFF444444
 
static final int COLOR_GRAY = 0xFF888888
 
static final int COLOR_GREEN = 0xFF00FF00
 
static final int COLOR_LTGRAY = 0xFFCCCCCC
 
static final int COLOR_MAGENTA = 0xFFFF00FF
 
static final int COLOR_ORANGE = 0xFFFFC800
 
static final int COLOR_PINK = 0xFFFFAFAF
 
static final int COLOR_RED = 0xFFFF0000
 
static final int COLOR_WHITE = 0xFFFFFFFF
 
static final int COLOR_YELLOW = 0xFFFFFF00
 
static final int COLOR_DEFAULT = 0x00000000
 
static final String DEFAULT_VALUE_COLOR_NONE = "&H00FFFFFF"
 
static final String DEFAULT_VALUE_COLOR_BLACK = "&HFF000000"
 
static final String DEFAULT_VALUE_COLOR_BLUE = "&HFF0000FF"
 
static final String DEFAULT_VALUE_COLOR_CYAN = "&HFF00FFFF"
 
static final String DEFAULT_VALUE_COLOR_DKGRAY = "&HFF444444"
 
static final String DEFAULT_VALUE_COLOR_GRAY = "&HFF888888"
 
static final String DEFAULT_VALUE_COLOR_GREEN = "&HFF00FF00"
 
static final String DEFAULT_VALUE_COLOR_LTGRAY = "&HFFCCCCCC"
 
static final String DEFAULT_VALUE_COLOR_MAGENTA = "&HFFFF00FF"
 
static final String DEFAULT_VALUE_COLOR_ORANGE = "&HFFFFC800"
 
static final String DEFAULT_VALUE_COLOR_PINK = "&HFFFFAFAF"
 
static final String DEFAULT_VALUE_COLOR_RED = "&HFFFF0000"
 
static final String DEFAULT_VALUE_COLOR_WHITE = "&HFFFFFFFF"
 
static final String DEFAULT_VALUE_COLOR_YELLOW = "&HFFFFFF00"
 
static final String DEFAULT_VALUE_COLOR_DEFAULT = "&H00000000"
 
static final float FONT_DEFAULT_SIZE = 14
 
static final int LAYOUT_ORIENTATION_HORIZONTAL = ComponentConstants.LAYOUT_ORIENTATION_HORIZONTAL
 
static final int LAYOUT_ORIENTATION_VERTICAL = ComponentConstants.LAYOUT_ORIENTATION_VERTICAL
 
static final int SCALING_SCALE_PROPORTIONALLY = 0
 
static final int SCALING_SCALE_TO_FIT = 1
 
static final int TYPEFACE_DEFAULT = 0
 
static final int TYPEFACE_SANSSERIF = 1
 
static final int TYPEFACE_SERIF = 2
 
static final int TYPEFACE_MONOSPACE = 3
 
static final int LENGTH_PREFERRED = -1
 
static final int LENGTH_FILL_PARENT = -2
 
static final int LENGTH_UNKNOWN = -3
 
static final int LENGTH_PERCENT_TAG = -1000
 
static final int TOAST_LENGTH_SHORT = 0
 
static final int TOAST_LENGTH_LONG = 1
 
static final int DIRECTION_NORTH = 1
 
static final int DIRECTION_NORTHEAST = 2
 
static final int DIRECTION_EAST = 3
 
static final int DIRECTION_SOUTHEAST = 4
 
static final int DIRECTION_SOUTH = -1
 
static final int DIRECTION_SOUTHWEST = -2
 
static final int DIRECTION_WEST = -3
 
static final int DIRECTION_NORTHWEST = -4
 
static final int DIRECTION_NONE = 0
 
static final int DIRECTION_MIN = -4
 
static final int DIRECTION_MAX = 4
 
static float SLIDER_MIN_VALUE = 10
 
static float SLIDER_MAX_VALUE = 50
 
static float SLIDER_THUMB_VALUE = (SLIDER_MIN_VALUE + SLIDER_MAX_VALUE) / 2.0f
 
static final String DEFAULT_VALUE_TEXT_TO_SPEECH_COUNTRY = ""
 
static final String DEFAULT_VALUE_TEXT_TO_SPEECH_LANGUAGE = ""
 
- Protected Member Functions inherited from com.google.appinventor.components.runtime.AndroidNonvisibleComponent
 AndroidNonvisibleComponent (Form form)
 
- Protected Attributes inherited from com.google.appinventor.components.runtime.AndroidNonvisibleComponent
final Form form
 

Detailed Description

A multimedia component that plays sound files and optionally vibrates for the number of milliseconds (thousandths of a second) specified in the Blocks Editor. The name of the sound file to play can be specified either in the Designer or in the Blocks Editor.

For supported sound file formats, see Android Supported Media Formats.

This Sound component is best for short sound files, such as sound effects, while the Player component is more efficient for longer sounds, such as songs.

@internaldoc Multimedia component that plays sounds and optionally vibrates. A sound is specified via filename. See also android.media.SoundPool.

Author
sharo.nosp@m.n@go.nosp@m.ogle..nosp@m.com (Sharon Perl)
hal@m.nosp@m.it.e.nosp@m.du (Hal Abelson) added wait for load to complete

Definition at line 73 of file Sound.java.

Constructor & Destructor Documentation

◆ Sound()

com.google.appinventor.components.runtime.Sound.Sound ( ComponentContainer  container)

Definition at line 128 of file Sound.java.

Member Function Documentation

◆ MinimumInterval() [1/2]

int com.google.appinventor.components.runtime.Sound.MinimumInterval ( )

Returns the minimum interval required between calls to Play(), in milliseconds. Once the sound starts playing, all further Play() calls will be ignored until the interval has elapsed.

Returns
minimum interval in ms

Definition at line 227 of file Sound.java.

◆ MinimumInterval() [2/2]

void com.google.appinventor.components.runtime.Sound.MinimumInterval ( int  interval)

Specifies the minimum interval required between calls to Play(), in milliseconds. Once the sound starts playing, all further Play() calls will be ignored until the interval has elapsed.

Parameters
intervalminimum interval in ms

Definition at line 241 of file Sound.java.

◆ onDelete()

void com.google.appinventor.components.runtime.Sound.onDelete ( )

Implements com.google.appinventor.components.runtime.Deleteable.

Definition at line 391 of file Sound.java.

◆ onDestroy()

void com.google.appinventor.components.runtime.Sound.onDestroy ( )

◆ onResume()

void com.google.appinventor.components.runtime.Sound.onResume ( )

◆ onStop()

void com.google.appinventor.components.runtime.Sound.onStop ( )

◆ Pause()

void com.google.appinventor.components.runtime.Sound.Pause ( )

Pauses playing the sound if it is being played.

Definition at line 314 of file Sound.java.

◆ Play()

void com.google.appinventor.components.runtime.Sound.Play ( )

Plays the sound.

Definition at line 253 of file Sound.java.

◆ Resume()

void com.google.appinventor.components.runtime.Sound.Resume ( )

Resumes playing the sound after a pause.

Definition at line 326 of file Sound.java.

◆ SoundError()

void com.google.appinventor.components.runtime.Sound.SoundError ( String  message)

Definition at line 358 of file Sound.java.

◆ Source() [1/2]

String com.google.appinventor.components.runtime.Sound.Source ( )

Returns the sound's filename.

Definition at line 160 of file Sound.java.

◆ Source() [2/2]

void com.google.appinventor.components.runtime.Sound.Source ( String  path)

The name of the sound file. Only certain formats are supported. See http://developer.android.com/guide/appendix/media-formats.html.

@internaldoc

See MediaUtil#determineMediaSource for information about what a path can be.

Parameters
paththe path to the sound source

Definition at line 177 of file Sound.java.

◆ Stop()

void com.google.appinventor.components.runtime.Sound.Stop ( )

Stops playing the sound if it is being played.

Definition at line 338 of file Sound.java.

◆ Vibrate()

void com.google.appinventor.components.runtime.Sound.Vibrate ( int  millisecs)

Vibrates for the specified number of milliseconds.

Definition at line 351 of file Sound.java.


The documentation for this class was generated from the following file: