Python and XAudio2 - Play Resource

For questions about using Classic.

Post » Sun Sep 22, 2013 2:10 pm

I'm trying to use XAudio2 in a Python script, mainly playing sounds / resources. My question is: how do I do this? Do I have to

[CODE]XAudio2.AutoplayResource(System.AppPath+"menu_move_01.wav",0)[/CODE]

Every time I try to play a sound using a Python script it gives me an error:
[CODE]XAudio2: Failed to load file from disk. Check the filename exists and that the file is of a supported format. (0x80004005)[/CODE]

That resource / file is a simple .WAV file, playing well from an event when called, but not from script. This would help me greatly if I could invoke it using Python, so any help appreciated, as always!
B
4
S
1
Posts: 28
Reputation: 435

Post » Sun Sep 22, 2013 8:42 pm

The action equivilent of the script is a combo select, so in python you would use a integer index. 0 for the first resource, 1 for the second and so on. To use a filename you'll have to use "play from file" and have the files alongside your exe.
You could alternatively use the resource plugin to avoid integers.
B
92
S
32
G
109
Posts: 5,291
Reputation: 70,993


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 1 guest