I am making a little helper program for quickly sampling sound files, like in the windows/media folder so I can find out what the windows sounds sound like. I build a list of wav files, show the list, and when I pick a file I then play it. The code for the window and the code that is executed when a wav file is picked is shown below. It all works IF...I plod through the files slowly. But if I try to click through them too quickly, the program crashes in this manner:
** Access Error: Cannot open sound
** Where: SOUND-LAUNCH
** Near: SOUND-PORT: open sound://
insert SOUND-PORT
>>
Does anyone know what I might be doing wrong?
Thank you.
;; -- Function to play a sound.
SOUND-LAUNCH: does [
wait 0
SOUND-PORT: open sound://
insert SOUND-PORT load to-file SOUND-LIST/picked
wait SOUND-PORT
close SOUND-PORT
]
;; -- Build and view main window.
;; -- SOUND-NAMES is a list of file names built in code not shown here for clarity.
MAIN-WINDOW: layout [
across
banner 'Wav Demo Assistant' font [shadow: none]
return
SOUND-LIST: text-list 300x700 data (SOUND-NAMES)
[SOUND-LAUNCH]
return
button 'Quit' [quit]
]
view MAIN-WINDOW