+ 1
How to pass a variable to PlaySound()
I have a random number generator that produces 0-12 and that picks a random listing from a array with entries 1-13 that correspond to a n.wav (eg 12.wav) I want to pass the new variable ( randarr=5 = 5.wav) and pass that to play sound to play that WAV file. halp!?
6 Réponses
+ 5
You can convert the number to a String and then use String::ConCat( s1, s2).
where s1 is the converted number and s2 is ".wav" then pass the result as PlaySound()'s first argument.
Note this is not standard c++, but c++ .Net which it looks like you're using.
+ 1
sorry I thought this was c++ only my bad
+ 1
cool that gives me some directed research Thank you. this will eventually end up going in a raspberry pi zero. but I'm currently developing in codeblocks
0
I could fill the array with "1.wav" if that makes a difference. then call arr[x] like PlaySound(TEXT(arr[x]), null, SND_SYNC)????