You don't say what version of BBC BASIC you are using, so I will assume it's BBC BASIC for SDL 2.0; you also don't say what the path to the file is, so I will assume it's in the same directory as the BASIC program itself. Additionally I have assumed CD-quality audio (44.1 kHz sampling, 2 channels). With those assumptions here is some code to play the WAV file:Hi
this may seem simple but i am learning.
could anyone write an example of how to play a .wav file in my program. my file name is test1.wav
Code: Select all
INSTALL @lib$ + "audiolib"
PROC_initAudio
wav%% = FN_loadWAV(@dir$ + "test1.wav", 44100, 2)
IF wav%% = 0 ERROR 100, "Couldn't open WAV file"
PROC_playSound(wav%%)
Code: Select all
REPEAT
REM do whatever your program needs to do in the foreground here
PROC_trackMusic(wav%%, FALSE, FALSE, TRUE)
WAIT 10
UNTIL whatever_condition_terminates_your_program