The following programme segment works in BB4W 5.95a on Windows 7 (plays a
looping sound for 2s then terminates) but just keeps silemt on BB4w
6.16a on Windows 11 and gives STOP at line 30 (no sound playing). In either
case double clicking on the WAV file itself plays it OK.
In a strange twist - if I add *both* the lines
2 SYS "PlaySound","SystemStart",0,&10001
4 DIM mbuf% 4000000
then the sound does play on Windows 11.
10 SYS "PlaySound","C:\\windows\media\ringout.WAV", 0, 1+8
20 SYS "PlaySound",0,0,&10 TO t%
30 IF t% THEN STOP : REM no sound is playing
40 WAIT 20
50 SYS "PlaySound",0,0,1
Can you elucidate please?
I have an app that makes extensive use of PlaySound and is now silent ...
PlaySound
- JeremyNicoll
- Posts: 95
- Joined: Sun 26 Jul 2020, 22:22
- Location: Edinburgh
Re: PlaySound
Why is there a double backslash in the filepath in line 10 ?
-
svrsig
- Posts: 3
- Joined: Mon 19 Sep 2022, 19:10
Re: PlaySound
I saw an example and it seemed to work with a double slash.Why is there a double backslash in the filepath in line 10 ?
- JeremyNicoll
- Posts: 95
- Joined: Sun 26 Jul 2020, 22:22
- Location: Edinburgh
Re: PlaySound
If the example in question was eg:
https://learn.microsoft.com/en-us/windo ... udio-files
then the double backslashes -- which you should note occur there on every directory separator not just the first one - are there because of the rules for forming strings in C++. But you're not writing in C++.
An obvious reason for PlaySound not to work would be a bad filepath. TBH I'm a bit surprised you don't seem to check the file exists first - but maybe you did that somewhere else?
When you say "it" worked; what precisely do you mean by "it"? Do you mean the example you saw - or your prior use of this method?
https://learn.microsoft.com/en-us/windo ... udio-files
then the double backslashes -- which you should note occur there on every directory separator not just the first one - are there because of the rules for forming strings in C++. But you're not writing in C++.
An obvious reason for PlaySound not to work would be a bad filepath. TBH I'm a bit surprised you don't seem to check the file exists first - but maybe you did that somewhere else?
When you say "it" worked; what precisely do you mean by "it"? Do you mean the example you saw - or your prior use of this method?