Update some music ref docs (#1693)

* Update some music ref docs

* bad link

* Actually add the note, hello
This commit is contained in:
Galen Nickel
2018-12-02 16:46:05 -08:00
committed by GitHub
parent 36e146c257
commit dda488c08f
9 changed files with 155 additions and 35 deletions

View File

@ -1,20 +1,33 @@
# Stop Melody
# stop Melody
Stops playing a musical melody.
## Simulator
Stop playing a musical melody.
```sig
music.stopMelody(MelodyStopOptions.All)
```
Melodies are played either in the _foreground_ or _background_. This allows more than one melody to be active at once. If a melody is set to play in the background, it can be interrupeted, or paused, temporarily while a melody set for the foreground is played. If the foreground melody is not set to play ``forever``, then the background melody resumes when the foreground melody is finished.
When a melody begins, it has an option set for how the melody is to play. The melody plays just one time, ``once``, or it will keep repeating, ``forever``. With these options the melody will play in the foreground either once or continue to repeat. Of course, if you set ``forever``, any melody that was started in background will never play unless you stop the foreground melody.
You can stop either a ``foreground`` melody, a ``background`` melody, or ``all`` melodies.
## ~ hint
**Simulator**: This function only works on the @boardname@ and in some browsers.
## ~
## Parameters
* ``options`` specifies which melodies (foreground, background or both) need to be stopped
* **options**: specify which melodies (foreground, background or both) to stop:
>* ``all``: stop all melodies
>* ``foreground``: stop the foreground melody
>* ``background``: stop the background melody
## Example
This example plays the ``Entertainer`` built-in melody.
Play the ``Entertainer`` built-in melody and then stop it after 5 seconds.
```blocks
music.beginMelody(music.builtInMelody(Melodies.Entertainer), MelodyOptions.Forever)