AppPath\sounds\gun\gunshot.wav

For questions about using Classic.

Post » Sun Oct 25, 2009 12:36 am

I have a Xaudio2 object, and I want to set its sound to a file in a sub folder of my appPath. I tried this, but no luck:
AppPath\sounds\gun\gunshot.wav
How would I do this?
B
7
S
2
G
3
Posts: 139
Reputation: 2,331

Post » Sun Oct 25, 2009 1:25 am

either
AppPath&"\sounds\gun\gunshot.wav"

or

AppPath+"\sounds\gun\gunshot.wav"

if that dosent work try taking out the leading \

apppath is an expression and you need to put it together with a string.
B
5
S
2
G
4
Posts: 632
Reputation: 2,829

Post » Sun Oct 25, 2009 3:22 am

you don't need the '\' straight after the appPath (the one before 'sounds'), as the appPath already places one.
B
134
S
65
G
16
Posts: 1,766
Reputation: 19,190

Post » Sun Oct 25, 2009 12:12 pm

I thought so but I couldnt remember off the top of my head
B
5
S
2
G
4
Posts: 632
Reputation: 2,829

Post » Sun Oct 25, 2009 3:09 pm

You've written the original expression as "Apppath divided by sounds divided by gun..."!

I'd always stick with using & to concatenate strings, because it can also take numbers and add them to strings, whereas + will give an error. So go with:

AppPath & "sounds\gun\gunshot.wav"
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,580


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 2 guests