Preventing copyrighted music from being captured by GameDVR

Hi Guys,
I have a problem about automatically mute game music, I tested the low level sample codes (output_ports), it works fines. But I want to play sound with eventInstance, so I wrote some codes to your studio sample cdoes(simple_event) to test the attachChannelGroupToPort interface, unfortunately it is not working, I can hear the voice form the video captured by GameDVR. This is my codes below, do you have any ideas about it ?

 // Get the Single Explosion event
FMOD::Studio::EventDescription* explosionDescription = NULL;
ERRCHECK( system->getEvent("event:/Explosions/Single Explosion", &explosionDescription) );

// Start loading explosion sample data and keep it in memory
ERRCHECK( explosionDescription->loadSampleData() );

////////// Begin mod 
ERRCHECK(system->flushCommands());

FMOD::ChannelGroup * loopingAmbience;
FMOD_RESULT result = loopingAmbienceInstance->getChannelGroup(&loopingAmbience);
ERRCHECK(result);

result = lowLevelSystem->attachChannelGroupToPort(FMOD_DURANGO_PORT_TYPE_MUSIC, FMOD_PORT_INDEX_NONE, loopingAmbience);
ERRCHECK(result);

/////////End mod

do
{
    Common_Update();
   
    if (Common_BtnPress(BTN_ACTION1))

I cannot see where you have created loopingAmbienceInstance or where you call playSound, but be aware you cannot attach the master bus to a port. Have you tried creating a new channelgroup for the event?

Also make sure the event isn’t also being routed through another effect/bus that isn’t using that port.

Hi,

I put my codes below, it is similar to your simple codes(FMOD Studio API Xbox One\api\studio\examples\simple_event.cpp). But I didn’t call playSound to play sound, I use the EventInstance::start to play, is it possible to automatically mute game music when we use EventInstance::start interface to play sound?

If an event in a bus, how to play it to the music port? Could you send me a demo?

This is my codes, could you help me to check if there are some issues in it ?

 int FMOD_Main()
{
void *extraDriverData = NULL;
Common_Init(&extraDriverData);

FMOD::Studio::System* system = NULL;
ERRCHECK( FMOD::Studio::System::create(&system) );

// The example Studio project is authored for 5.1 sound, so set up the system output mode to match
FMOD::System* lowLevelSystem = NULL;
ERRCHECK( system->getLowLevelSystem(&lowLevelSystem) );

FMOD_SPEAKERMODE speakermode;
FMOD_RESULT result = lowLevelSystem->getSoftwareFormat(0, &speakermode, 0);

 ERRCHECK( lowLevelSystem->setSoftwareFormat(0, FMOD_SPEAKERMODE_5POINT1, 0) );

ERRCHECK( system->initialize(1024, FMOD_STUDIO_INIT_NORMAL, FMOD_INIT_NORMAL, extraDriverData) );

FMOD::Studio::Bank* masterBank = NULL;
ERRCHECK( system->loadBankFile(Common_MediaPath("Master Bank.bank"), FMOD_STUDIO_LOAD_BANK_NORMAL, &masterBank) );

FMOD::Studio::Bank* stringsBank = NULL;
ERRCHECK( system->loadBankFile(Common_MediaPath("Master Bank.strings.bank"), FMOD_STUDIO_LOAD_BANK_NORMAL, &stringsBank) );

FMOD::Studio::Bank* ambienceBank = NULL;
ERRCHECK( system->loadBankFile(Common_MediaPath("Surround_Ambience.bank"), FMOD_STUDIO_LOAD_BANK_NORMAL, &ambienceBank) );

FMOD::Studio::Bank* menuBank = NULL;
ERRCHECK( system->loadBankFile(Common_MediaPath("UI_Menu.bank"), FMOD_STUDIO_LOAD_BANK_NORMAL, &menuBank) );

FMOD::Studio::Bank* weaponsBank = NULL;
ERRCHECK( system->loadBankFile(Common_MediaPath("Weapons.bank"), FMOD_STUDIO_LOAD_BANK_NORMAL, &weaponsBank) );



// Get the Looping Ambience event
FMOD::Studio::EventDescription* loopingAmbienceDescription = NULL;
ERRCHECK( system->getEvent("event:/Ambience/Country", &loopingAmbienceDescription) );

FMOD::Studio::EventInstance* loopingAmbienceInstance = NULL;
ERRCHECK( loopingAmbienceDescription->createInstance(&loopingAmbienceInstance) );




// Get the 4 Second Surge event
FMOD::Studio::EventDescription* cancelDescription = NULL;
ERRCHECK( system->getEvent("event:/UI/Cancel", &cancelDescription) );

FMOD::Studio::EventInstance* cancelInstance = NULL;
ERRCHECK( cancelDescription->createInstance(&cancelInstance) );

// Get the Single Explosion event
FMOD::Studio::EventDescription* explosionDescription = NULL;
ERRCHECK( system->getEvent("event:/Explosions/Single Explosion", &explosionDescription) );

// Start loading explosion sample data and keep it in memory
ERRCHECK( explosionDescription->loadSampleData() );


////////// Begin mod 
ERRCHECK(system->flushCommands());

FMOD::ChannelGroup * loopingAmbience;
result = loopingAmbienceInstance->getChannelGroup(&loopingAmbience);
ERRCHECK(result);
char name[256];
loopingAmbience->getName(name, 256);
result = lowLevelSystem->attachChannelGroupToPort(FMOD_DURANGO_PORT_TYPE_MUSIC, FMOD_PORT_INDEX_NONE, loopingAmbience);
ERRCHECK(result);

ERRCHECK(system->flushCommands());

/////////End mod

do
{
    Common_Update();
   
    if (Common_BtnPress(BTN_ACTION1))
    {
        // One-shot event
        FMOD::Studio::EventInstance* eventInstance = NULL;
        ERRCHECK( explosionDescription->createInstance(&eventInstance) );

        ERRCHECK( eventInstance->start() );

        // Release will clean up the instance when it completes
        ERRCHECK( eventInstance->release() );
    }

    if (Common_BtnPress(BTN_ACTION2))
    {
        ERRCHECK( loopingAmbienceInstance->start() );
    }

    if (Common_BtnPress(BTN_ACTION3))
    {
        ERRCHECK( loopingAmbienceInstance->stop(FMOD_STUDIO_STOP_IMMEDIATE) );
    }

    if (Common_BtnPress(BTN_ACTION4))
    {
        // Calling start on an instance will cause it to restart if it's already playing
        ERRCHECK( cancelInstance->start() );
    }

    ERRCHECK( system->update() );

    Common_Draw("==================================================");
    Common_Draw("Simple Event Example.");
    Common_Draw("Copyright (c) Firelight Technologies 2012-2017.");
    Common_Draw("==================================================");
    Common_Draw("");
    Common_Draw("Press %s to fire and forget the explosion", Common_BtnStr(BTN_ACTION1));
    Common_Draw("Press %s to start the looping ambience", Common_BtnStr(BTN_ACTION2));
    Common_Draw("Press %s to stop the looping ambience", Common_BtnStr(BTN_ACTION3));
    Common_Draw("Press %s to start/restart the cancel sound", Common_BtnStr(BTN_ACTION4));
    Common_Draw("Press %s to quit", Common_BtnStr(BTN_QUIT));

    Common_Sleep(50);
} while (!Common_BtnPress(BTN_QUIT));

ERRCHECK( weaponsBank->unload() );
ERRCHECK( menuBank->unload() );
ERRCHECK( ambienceBank->unload() );
ERRCHECK( stringsBank->unload() );
ERRCHECK( masterBank->unload() );

ERRCHECK( system->release() );

Common_Close();

return 0;

}

Hi Cameron,
It looks I attached the master bug to a port. Could you send me a demo?
my e-mail: lisenlin668@virtuos.com.cn

Thanks.

Hi Cameron,

We try to attach the ChannelGroup to FMOD_DURANGO_PORT_TYPE_MUSIC port,

but every times, the ChannelGroup is on Master bus.

We checked the whole API, and didn’t find any functionnalities to initialize an EventInstance or EventDesriptor, with a custom ChannelGroup

Can you indicate us the correct way to do it, either by code or on FMOD Studio ?

Thanks

Hi Faure,

You don’t touch the channel group of the event but the group bus it is under. It’s recommended to have a group bus in your FMOD Studio project that you then change in the way mentioned above:

http://www.fmod.org/questions/answers/46533/

Thanks,
Richard

The problem is with using the event instances channelgroup.

We recommend having a dedicated Bus, setup in Studio, to contain any and all events you want playing through a specific port. This will allow you to call [Bus::lockChannelGroup][1], which will force the channelgroup to be created and persist until [Bus::unlockChannelGroup][2] is called. Then get the channelgroup from the Bus and continue as you had previously.

FMOD::Studio::Bus* ambienceBus = NULL; ERRCHECK( system->getBus("bus:/SFX/Ambience", &ambienceBus) ); ERRCHECK( ambienceBus->lockChannelGroup() );

ERRCHECK(system->flushCommands());
FMOD::ChannelGroup * loopingAmbience;
ERRCHECK( ambienceBus->getChannelGroup(&loopingAmbience) );
…

We really should have some examples for using ports with the Studio API, I have added this to our tracker as well as looking into whether or not attachChannelGroupToPort should be part of the bus or channelgroup API instead of system.
[1]: https://www.fmod.org/docs/content/generated/FMOD_Studio_Bus_LockChannelGroup.html
[2]: https://www.fmod.org/docs/content/generated/FMOD_Studio_Bus_UnlockChannelGroup.html

2 Likes

Hi Cameron,

We tested on simple_event, using your code drop and it works fine.

When we apply it in our game, all the musics are mute, all the time
The others kind of sounds are working correctly.

the Bus is declared inside the MasterBank, can it be the reason?

Make sure you are using the correct FMOD_PORT_TYPE for each platform, PS4 & Xbox One use different values and on PC (if you are building for it) you will want to bypass it all.

As long as it’s not the Master Bus it is fine.

When enabe Debug output,
we got the following message when call attachChannelGroupToPort:

[LOG] OutputWASAPI::mixerThread : Background music port desynced from main.

this message doesn’t appear when using simple_event

it maybe the reason why we donesn’t ear the background music anymore.

could it be due to some invalid configuration in the FMod Studio project we setup?

Hi,

Until now, we tested on XBoxOne, as the upgrade of the PS4 version was not completed.

We just finished the upgrade of the PS4, and tested it.
and everything work fine.
copyright musics are played during gameplay, but not when recording a video using the share button.

On XBox one it still doesn’t work.

It seems strange that it works on PS4 but not Xbox One while no errors occur.
Are you able to attach the debug output log after setting the following (either before or after system init):

FMOD::Debug_Initialize(FMOD_DEBUG_LEVEL_LOG | FMOD_DEBUG_TYPE_TRACE | FMOD_DEBUG_DISPLAY_LINENUMBERS);

When enabe Debug output,
we got the following message when call attachChannelGroupToPort:

[LOG] OutputWASAPI::mixerThread : Background music port desynced from main.

this message doesn’t appear when using simple_event

Can you attach or send us the full log file?

we prepared 2 log.
one using attachToPort, and the other without.
how to send it to you?

can you provide a private address
even if we pass through it, it may still remain some confidencial informations

You can send the logs to support@fmod.com.