Problem with XAudio2

For questions about using Classic.

Post » Sun Jan 17, 2010 5:09 pm

Hello, this is my first post.
Sorry if the question is resolved, I used the search but found no solutions.
When I use XAudio2 I have a problem with FPS.
The first thing I load the wav to resources. Then, after the conditions put to action: XAudio2: Autoplay resource "sound.wav" (No Loop). (Sound is played every 150 ms)
When I start the game after some time FPS drops.
Please help.

PS: Sorry for my English, translated online.
B
3
S
1
G
2
Posts: 11
Reputation: 847

Post » Mon Jan 18, 2010 11:02 pm

[quote="NYKLE":rsjoxy4v]Hello, this is my first post.
Sorry if the question is resolved, I used the search but found no solutions.
When I use XAudio2 I have a problem with FPS.
The first thing I load the wav to resources. Then, after the conditions put to action: XAudio2: Autoplay resource "sound.wav" (No Loop). (Sound is played every 150 ms)
When I start the game after some time FPS drops.
Please help.

PS: Sorry for my English, translated online.[/quote:rsjoxy4v]

I think that since you made the sound play every 150ms automatically, it plays on different channels everytime, and after sometime there are so much open channels that your game lags?

I could be wrong, I have no idea how the XAudio2 REALLY works.. just guessing.

I'm still struggling with the XAudio2 too heh, but I think that might be it.
B
106
S
35
G
36
Posts: 792
Reputation: 24,703

Post » Tue Jan 19, 2010 1:15 am

Andreyin has a point... you could try loading the sound into it's own channel and playing it that way to see if it helps any. Eh, it couldn't hurt vv
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Wed Jan 20, 2010 12:06 am

Thanks, I'll try as you said.
B
3
S
1
G
2
Posts: 11
Reputation: 847

Post » Wed Jan 20, 2010 4:17 am

I'm having a lot of trouble with XAudio2, myself.. in my game there's an occasional thunder, and I want it to make a sound, but I'm not sure how to do it.. I tried applying the "run just once" event to when the screen flashes, but if I do that, only the first thunder makes a sound.. the next ones don't.

What am I doing wrong? ):
B
106
S
35
G
36
Posts: 792
Reputation: 24,703

Post » Wed Jan 20, 2010 5:44 am

Are you playing in a channel? Try setting the position back to 0 before you play the channel again. It's probably playing, but since it's at the end it's basically playing nothing.

Alternatively you could Autoplay the file or resource, then it automatically starts the sound over from the beginning on a random unused channel.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Wed Jan 20, 2010 6:37 pm

[quote="deadeye":1djwj9k7]Are you playing in a channel? Try setting the position back to 0 before you play the channel again. It's probably playing, but since it's at the end it's basically playing nothing.

Alternatively you could Autoplay the file or resource, then it automatically starts the sound over from the beginning on a random unused channel.[/quote:1djwj9k7]

I was using autoplay, and it DID work, but suddenly, one day, it stopped.. not sure why ):

Here's the cap file :

http://sites.google.com/site/usonic/HER ... ects=0&d=1
B
106
S
35
G
36
Posts: 792
Reputation: 24,703


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 4 guests