I’m kind of confused by the structure of the ChannelGroup system – why is it that a channel can only have one ChannelGroup (getChannelGroup), and why do we use Channel::setChannelGroup to add a channel to a group instead of just, say, ChannelGroup::add and ChannelGroup::remove? The limitation seems kind of strange, especially since the master channel group implicitly contains all channels. Is there a performance reason for this, or is it just the way it is? It’s probably too late now, but it would be cool if we could place a channel in multiple groups.
Also, how do channelgroups interact with the refcounted channel handles we get in some circumstances? If the channel handle becomes invalid after we place it into a channel group, is that invalid channel still in the group? If so, does that mean that if a new sound takes up that invalid channel, the group will affect that sound?
- Janus asked 12 years ago
[quote="brett":14l56uyh]what we will have later is being able to add a channel group to another channel group, so you can have one controlling channel group for all channel groups, and it also means you can add a dsp to the parent channelgroup that would affect all child groups.[/quote:14l56uyh]That would pretty much solve almost all my issues with the current design – the only thing I really miss is having a master group that applies to absolutely every single channel in the system. I don’t really have any major need for the ability to put a channel in 7 different groups.
[quote="brett":14l56uyh]I might add the functions i mentioned before though, and separate them with a comment so they are grouped by functions that scale channel values, vs functions that simply loop through and override them.[/quote:14l56uyh]Cool – it’ll be nice to have them if you can fit them in. Otherwise, I can make do with what I have now. The only thing that really feels like it should be there for consistency is an absolute setVolume, since all the other channelgroup set functions are absolute. The rest don’t really need relative equivalents so much – I can see those as being far more of a niche function.
And a somewhat related question – right now I’m playing with doing some time scaling effects, multiplying animation speeds and sound frequencies by a constant, etc. So far, I just have a hardcoded ‘base’ frequency that all the sound effects use (I think they’re all either 22khz or 44khz), and I multiply that by the constant and set it using a channelgroup. A relative method could be useful here, since I could just halve or double all the frequencies, but if I want to interpolate smoothly from one frequency to another, I need to do it manually. It seems that I can get the ‘default’ frequency for a sound using getDefaults, but the docs say that the default frequency for a sound is always 44khz. Does this mean that getDefaults is always going to give me a frequency of 44khz, or can I count on it to tell me what a sound’s original frequency was?
Is there any way I can perform a relative modification of the attributes in a channelgroup instead of an absolute one? It seems like the removal of the MasterVolume value was a bit of a mistake based on the fact that all the channelgroup attributes seem to just override the attributes of the individual channels, while the old MasterVolume multiplied the volume of all the individual channels.
It’d be nice to be able to halve the frequency of all the channels in a group or double their volume, etc. Setting absolute values is good enough but it definitely limits the usefulness of ChannelGroups, maybe even more than the one-group-per-channel limitation.
Edit: My bad, I see that volume for channelgroups behaves like the old MasterVolume option did. This is kind of unintuitive, though, since it means that I can’t directly override the volumes of my channels (or scale them up).
[quote="brett":34yjfbjw]if you had channels in 2 different groups then how would half of the channel group functions work? What about ChannelGroup::addDSP?
The channel is still in the channelgroup if it is ended or refcounted. Just take it out if you don’t need it.
The things you’re asking for are different, especially when you ask for things like ‘halve the frequency’. What if all of the sounds are based on different frequencies? I think what you mean is something like ChannelGroup::setPitch which is based on 1.0.
Also for overriding the volumes instead of scaling them, why is this even useful? you can leave them all at 1.0 and use the normal setvolume if you want them all to have the same volume. I could add another function like ChannelGroup::overrideVolume or something which could do that, but i’m not sure why people would use it.[/quote:34yjfbjw]Most of these questions are just mostly out of curiosity, and some of the earlier ones in the thread were from before I totally understood how the ChannelGroup stuff worked. I imagine some of the things I want to do can always be done manually with a for() loop, so it’s not a big deal. Adding a DSP to a channel group is something i hadn’t thought about – that definitely makes it obvious why you only allow a channel to be in one group at once.
Please login first to submit.