- Store your sound and music files in the sounds/ folder of a Plasmacore project.
- Sounds in the root "sounds/" folder (and most subfolders) are used by all platforms.
- Sounds in e.g. "sounds/platform-mac-ios" will only be used for Mac and iOS platforms.
- Sounds in e.g. "sounds/platform-not-mac-ios" will be used for every platform except Mac and iOS.
- Currently available platforms are "windows", "mac", "linux", "ios", "android", and "wp7".
- For iOS you must add each of your sounds to the Xcode project as a resource (right click the Target, Add->Existing Files...).
- For Mac, iOS, and Android, use "WAV" for effects and prefer "M4A" over MP3 for music.
- For other systems use "WAV" for effects and "MP3" for music.
- Use class Sound to load and play sounds.
- Load Sound("filename") or Sound("filename",num_channels). num_channels refers to the number of simultaneous copies that may be played at once. Android will ignore num_channels and use one channel per sound.
- You will primarily use methods play() and stop() and the Logical setting repeats.
- You may wish to check property is_playing to play a second piece of music after the first is done.
- Keep a reference to Sound object while playing it, otherwise it may stop during a garbage collection.
class SoundTest : Screen PROPERTIES effect("bell.wav",2) : Sound # Replace with your own sound effect music("level1.mp3") : Sound METHODS method init music.repeats = true music.play method on( KeyEvent e ) if (e.is_press(Key.keycode_space)) effect.play endClass