Play recorded sounds: Difference between revisions

Added BBC BASIC
No edit summary
(Added BBC BASIC)
Line 47:
pause>nul
exit
 
=={{header|BBC BASIC}}==
{{works with|BBC BASIC for Windows}}
BBC BASIC for Windows has native support for playing MIDI files, and WAV files can be played using simple API calls:
<lang bbcbasic> SND_LOOP = 8
SND_ASYNC = 1
SND_FILENAME = &20000
PRINT "Playing a MIDI file..."
*PLAY C:\windows\media\canyon.mid
WAIT 300
PRINT "Playing the Windows TADA sound quietly..."
wave$ = "\windows\media\tada.wav"
volume% = 10000
SYS "waveOutSetVolume", -1, volume% + (volume% << 16)
SYS "PlaySound", wave$, 0, SND_FILENAME + SND_ASYNC
WAIT 300
PRINT "Playing the Windows TADA sound loudly on the left channel..."
volume% = 65535
SYS "waveOutSetVolume", -1, volume%
SYS "PlaySound", wave$, 0, SND_FILENAME + SND_ASYNC
WAIT 300
PRINT "Playing the Windows TADA sound loudly on the right channel..."
volume% = 65535
SYS "waveOutSetVolume", -1, volume% << 16
SYS "PlaySound", wave$, 0, SND_FILENAME + SND_ASYNC
WAIT 300
PRINT "Looping the Windows TADA sound on both channels..."
volume% = 65535
SYS "waveOutSetVolume", -1, volume% + (volume% << 16)
SYS "PlaySound", wave$, 0, SND_FILENAME + SND_ASYNC + SND_LOOP
WAIT 300
SYS "PlaySound", 0, 0, 0
PRINT "Stopped looping..."
WAIT 300
SOUND OFF
PRINT "Stopped MIDI."
END</lang>
 
=={{header|C sharp|C#}}==