void * SoundManager::playSoundOnce(const char * soundId, const bool isMusic, const bool update)
{
    if (0 == strcmp(soundId, "")) return nullptr;
    
#ifdef FMOD_ACTIVE
    FMOD::Studio::ID sndID = {0};
    ERRCHECK(_system->lookupID(soundId, &sndID));
    FMOD::Studio::EventDescription* sndDescription = NULL;
    ERRCHECK(_system->getEventByID(&sndID, &sndDescription) );
    
    bool isOneShot;
    sndDescription->isOneshot(&isOneShot);
    if (!isOneShot)
    {
        CCLOG("ATTENZIONE: Il suono non è fire and forget");
    }
    
    FMOD::Studio::EventInstance* instance = NULL;
    ERRCHECK(sndDescription->createInstance(&instance));
    
    this->setVolumeForSound(instance, isMusic);
    
    ERRCHECK(instance->start());
    ERRCHECK(instance->release());
    if (update)
    {
        ERRCHECK(_system->update());
    }
    
    return instance;
#else
    return nullptr;
#endif
}
Beispiel #2
0
/** Get tags to show in content view */
void UFMODEvent::GetAssetRegistryTags(TArray<FAssetRegistryTag>& OutTags) const
{
	Super::GetAssetRegistryTags(OutTags);
	FMOD::Studio::EventDescription* EventDesc = IFMODStudioModule::Get().GetEventDescription(this, EFMODSystemContext::Auditioning);
	
	bool bOneshot = false;
	bool bStream = false;
	bool b3D = false;
	if (EventDesc)
	{
		EventDesc->isOneshot(&bOneshot);
		EventDesc->isStream(&bStream);
		EventDesc->is3D(&b3D);
	}

	OutTags.Add(UObject::FAssetRegistryTag("Oneshot", bOneshot ? TEXT("True") : TEXT("False"), UObject::FAssetRegistryTag::TT_Alphabetical));
	OutTags.Add(UObject::FAssetRegistryTag("Streaming", bStream ? TEXT("True") : TEXT("False"), UObject::FAssetRegistryTag::TT_Alphabetical));
	OutTags.Add(UObject::FAssetRegistryTag("3D", b3D ? TEXT("True") : TEXT("False"), UObject::FAssetRegistryTag::TT_Alphabetical));
}