I’m trying to get the raw pcm data of an event. The event uses only one sound and no parameters or any other sophisticated stuff.
What I do is the following:
I start the event, then get it’s channelgroup. At this point, I expect there to be one channelgroup. When calling channelGroup->getNumChannels(), it says there are no channels playing. That’s bad, since I need to get the (one and only) channel in order to call channel->getCurrentSound, since I think I need the sound to get the pcm data via sound->lock().
As I said, the events channelgroup says it has no channels in it – but the event tells me that it has one instance and one channel playing (using event->getInfo()).
All this happens in only one frame, so there is virtually no time between the call to start() and the subsequent stuff.
Is there any chance that this should to work at all? Is there any other way to get the pcm data of an event ?
- Agrokonz asked 10 years ago
an event’s main channel group is not necessarily going to have any active channel in it. the main group will contain more channel groups, one of which will eventaully contain the active channel. i can’t tell you exactly the way the channel groups are organized, but to get to the active channel, you have to recurse through the sub groups contained in the event’s main channel group until you find the active channel.
btw i think this should be in the designer forum. 8)
- dave7L answered 10 years ago
just for info, an event contains a channelgroup.
events contain layers, and layers contian a channelgroup each as well.
That means there is a channelgroup for each layer inside the event’s channelgroup.
As a layer can have multiple sounds playing at once on them (ie overlap/crossfades), then the channels will be in the layer channelgroup.
To simply get the wavedata for the highest level – the event channelgroup – you can use ChannelGroup::getWaveData on the event’s channelgroup.
Categories also contain channelgroups, which contain more subcategories etc, then you get events inside categories.
You get the idea now that there is a tree of channelgroups
i just ran into another issue:
Some of the events from whom I want to get the data are compressed files. Is there a way to get this data in uncompressed form? Sound::Lock() gives me a pointer to the compressed data in case of compressed files, right? Is there maybe a way to manually decompress the data?
Another problem is that I can find no way to get the wav data from streamed wavebanks. Am I overlooking something?
For each of these problems, getWaveData() is not an option, since I need the whole data immediately…
Please login first to submit.