Play recorded sounds: Difference between revisions
Content added Content deleted
m ({{omit from|Openscad}}) |
(VBA) |
||
Line 351: | Line 351: | ||
cat $1 >> /dev/audio # Write file $1 to the speaker's Character Special (/dev/audio).</lang> |
cat $1 >> /dev/audio # Write file $1 to the speaker's Character Special (/dev/audio).</lang> |
||
=={{header|VBA}}== |
|||
Visual Basic for Applications can play sounds in the .WAV format by calling the multimedia library winmm.dll. |
|||
See [http://support.microsoft.com/kb/158140/en-us http://support.microsoft.com/kb/158140/en-us]. The "Flags" parameter can be used e.g. to play a sound continuously (that is, until the function is called again to stop playing). |
|||
Volume can be set using the function waveOutSetVolume, see [http://support.microsoft.com/kb/118377/en-us http://support.microsoft.com/kb/118377/en-us]. |
|||
<lang vb> |
|||
Declare Function libPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" _ |
|||
(ByVal filename As String, ByVal Flags As Long) As Long |
|||
Sub PlaySound(sWav As String) |
|||
Call libPlaySound(sWav, 1) '1 to play asynchronously |
|||
End Sub |
|||
</lang> |
|||
Type <pre>Playsound "d:\explode.wav"</pre> in the Immediate window and that sound will play. Nothing will happen if the file d:\explode.wav does not exist. |
|||
{{omit from|Applesoft BASIC}} |
{{omit from|Applesoft BASIC}} |