createStream sound and FMOD studio groups/bus

We are currently succesfully creating a stream. The stream is fed with another function that renders audio. Everything works fine and the audio is played fine. The issue that we are having now is that we would want it to be part of a group/bus that is previously set on FMOD Studio. For example we got a group called Music, and a global variable that controls that volume.
Is there any way to do this with c++? we are using UE4
Also, we did try using programmer sounds but it the result is not very good on some platforms so we are trying to stop using that approach

Found out that if i force playing the original fmod event i had with the programmer instrument (but don’t feed it) and then try to get on tick the channel group i can finally set it to my own stream. This works but feels really hacky. The original fmod event is the onlyone that exists on that group.
Edit: Ended up binding to the FMOD_STUDIO_EVENT_CALLBACK_CREATED callback type, inside that i create my stream and use the channel group of that event. However i still feel hacky that i need to start the event. Channel groups are not initialized if no event is active?

	if (FMOD::Studio::System* StudioSystem = IFMODStudioModule::Get().GetStudioSystem(EFMODSystemContext::Runtime))
	{
		FMOD::ChannelGroup* currentGroup;
		FMODChannel->getChannelGroup(&currentGroup);
		FMOD::ChannelGroup* musicGroup;
		FMOD::Studio::Bus* bus;
		FMOD_RESULT result = StudioSystem->getBus("bus:/Music", &bus);
		bus->getChannelGroup(&musicGroup);
		if (musicGroup != currentGroup)
		{
			FMODChannel->setChannelGroup(musicGroup);
		}
	}

Good to hear you found a way to implement this, even though it feels hacky. You can ensure Channel groups are initialized without an event by calling Studio::Bus::lockChannelGroup. Because this is all done asynchronously you will need to call Studio::System::flushCommands for it to be created immediately.

flushCommands was all that i was missing, thanks!

1 Like