DirectSound: List of further ideas

New releases and general discussions.

Post » Sun Mar 16, 2008 8:39 pm

I would like some automations available in the directsound object regarding music. Some features that would greatly benefit me would be

Autoplay music to channel - allow me to control which channel the music plays on. Reserving and controlling channels without having to always add play events will greatly simplify things.

Auto fade music / channel to (volume) for (time).

Auto fade out music / channel for (time) and stop playing.

Autoplay with fade in for (time).


And if it were a perfect world, a little bit of math applied to the automations could provide

Fade Style:
Linear
Exponential (slow rise/fall)
Exponential (fast rise/fall)


Anybody have any more to add?
B
3
S
2
G
4
Posts: 310
Reputation: 2,120

Post » Sun Mar 16, 2008 10:29 pm

Getting music to fade should be easy with events. Use a variable for the volume and modify it as necessary.

If variable 'volume' is greater than x (x=desired volume) then subtract amount*timedelta from variable 'volume'.

Amount is how much you want per second. 100*timedelta will go from 100 to 0 in 1 second. 50 will take 2 seconds. If variable volume is 0, stop playing.

You can use a second variable to affect the amount, though that gets a little tricker.

Admittedly, my sound card isn't working, so I can't test it. But it should work in theory.
Moderator
B
88
S
32
G
33
Posts: 3,005
Reputation: 27,432

Post » Sun Mar 16, 2008 10:32 pm

Good ideas. I wanted to do Play Music on Channel, but it's a bit complicated (means decompressing an MP3/OGG/module or whatever to a WAV buffer), but I'll see what I can do.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,630

Post » Mon Mar 17, 2008 2:59 am

Didn't know the music-to-channel was complicated. To be honest, if that process would be anything other than instantaneous I'd rather do without it.

I have been encountering bugs where Directsound will duplicate my music played, and it will lose the ability to control one of the two instances of that music. I have already filed this bug on SourceForge. But it kinda tells me that the ability to play more than one mp3 with the object exists, even if at this point both cannot be controlled separately.

Arima:
Yes, events would provide a means for most of what I want to accomplish. In the case where the same functions will be used multiple times across layouts and programs, having these abilities automated by the object will do wonders.

In either case, I will be uploading tutorial .caps when I get around to working with directsound more closely.
B
3
S
2
G
4
Posts: 310
Reputation: 2,120


Return to Construct Classic Discussion

Who is online

Users browsing this forum: No registered users and 2 guests