Xaudio2 won't play music sequencer samples

For questions about using Classic.

Post » Tue Nov 30, 2010 3:36 pm

Hi, I'm trying to create a basic music sequencer that can later be expanded into a game or some other kind of application. I am having issues with the Xaudio2 plugin, as it won't play the samples assigned to the beats when the marker passes over them.

I'm not sure if this is because it's used in other layouts with other sounds or what, but I would think that shouldn't interfere with these.

I also have other questions about how to make this as I am not mathematically minded at all nor do I have a solid grasp on the logic of how to set up events. I'm assuming my events are extremely inefficient for what I'm trying to do. If someone could provide some info or show me a better way that isn't too math heavy through events on how to do the following I would greatly appreciate it. If not I just need to solve the sound playing issue for now however.

- Have different samples assigned to each channel and have them play when the marker passes over a colored beat
- Have the marker wrap back around to the other side without it causing any pause in between to maintain smooth loop
- Have an object respond to the peak levels of only part of the sound (like the kick drum) rather than all of the sounds playing at once.

http://dl.dropbox.com/u/15972778/beat.cap

Thank you in advance! :)
B
1
G
2
Posts: 5
Reputation: 635

Post » Tue Nov 30, 2010 5:44 pm

The reason the the sound isn't playing is there is no XAudio2 instance on "Layout 3", even though the XAudio2 object is on "Layout 1" and has global enabled. Global doesn't mean it will exist on all layouts, it means that after an instance is created it will still exist when layouts are changed at runtime.

A simple fix would be to create an XAudio2 object at the start of "Layout 3". It is also a good idea to check if there are any XAudio2 instances before you create another to prevent distortion caused by multiple instances.

[code:3ldjpl9m]+ System: Start of layout
+ System: CountMatching("XAudio2") Equal to 0
-> System: Create object XAudio2 on layer 1 at (0, 0)
[/code:3ldjpl9m]
B
79
S
24
G
54
Posts: 4,747
Reputation: 40,757

Post » Wed Dec 01, 2010 8:48 pm

If your still having problems with the audio object, this might help ?



I use this method on my beatbox project.

The first line activates the red line which moves fron left to right.
When it collides a blue object, a sound is played.

I only use one X2Auduio object (global)

Hope it helps

regards

chrisbrobs
B
19
S
6
G
7
Posts: 1,206
Reputation: 7,300


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 2 guests