Jump to content
  • Advertisement
Sign in to follow this  
DarioMicera

[DirectX][XACT] No global settings have been loaded

This topic is 2533 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, it's me again.

I've managed to successfully use the XACT API to play sounds/music for my game. I was not happy with the volume of the background music, so i tryed to use the SetVolume Method. This is my code



CoInitializeEx(NULL,COINIT_MULTITHREADED);
if(FAILED(XACT3CreateEngine(0,&audio)))
return -1;

VOID* pGlobalSettingsData = NULL;
DWORD dwGlobalSettingsFileSize = 0;
DWORD dwBytesRead;
HANDLE fil=CreateFile("soundtrack.xgs",GENERIC_READ,FILE_SHARE_READ,NULL,OPEN_EXISTING,0,NULL);
dwGlobalSettingsFileSize=GetFileSize(fil,NULL);
if( dwGlobalSettingsFileSize != INVALID_FILE_SIZE )
{
pGlobalSettingsData = CoTaskMemAlloc(dwGlobalSettingsFileSize);
if( pGlobalSettingsData )
{
ReadFile(fil, pGlobalSettingsData, dwGlobalSettingsFileSize, &dwBytesRead, NULL) )

}
}
CloseHandle(fil);
if( pGlobalSettingsData )
CoTaskMemFree(pGlobalSettingsData);
pGlobalSettingsData = NULL;
dwGlobalSettingsFileSize = 0;

XACT_RUNTIME_PARAMETERS EngineParameters={0};

EngineParameters.pGlobalSettingsBuffer = pGlobalSettingsData;
EngineParameters.globalSettingsBufferSize = dwGlobalSettingsFileSize;
EngineParameters.globalSettingsFlags = XACT_FLAG_GLOBAL_SETTINGS_MANAGEDATA;

audio->Initialize(&EngineParameters);


HANDLE hFile=CreateFile("WaveBank.xwb",GENERIC_READ,FILE_SHARE_READ,NULL,OPEN_EXISTING,0,NULL);
if(hFile==INVALID_HANDLE_VALUE)
return -2;
DWORD FileSize=GetFileSize(hFile,NULL);
if(FileSize==-1)
return -3;

HANDLE MapFile= CreateFileMapping(hFile,NULL,PAGE_READONLY,0,FileSize,NULL);
if(!MapFile)
return -4;
waveBankMapping=MapViewOfFile(MapFile,FILE_MAP_READ,0,0,0);
if(!waveBankMapping)
return -5;

audio->CreateInMemoryWaveBank(waveBankMapping,FileSize,0,0,&waveBank);
CloseHandle(MapFile);
CloseHandle(hFile);

HANDLE File=CreateFile("SoundBank.xsb",GENERIC_READ,FILE_SHARE_READ,NULL,OPEN_EXISTING,0,NULL);
DWORD hFileSize=GetFileSize(File,NULL);
soundBankMemory=new BYTE[hFileSize];
DWORD bytesRead;

if(ReadFile(File,soundBankMemory,hFileSize,&bytesRead,NULL)!=0)
audio->CreateSoundBank(soundBankMemory,hFileSize,0,0,&soundBank);
CloseHandle(File);

XACTINDEX cueIndex=soundBank->GetCueIndex("Soundtrack");
XACTINDEX cueIndex1=soundBank->GetCueIndex("Laser");
XACTCATEGORY category=audio->GetCategory("Soundtrack");
audio->SetVolume(category,0.0f);



This is the code regarding the XACT initialization and setup that is currently situated in my main (the play methods are in the game loop). The sound keeps playing normally, but it's uneffected by the SetVolume.

My problem seems to be the error like this "[XACT][SetVolume] no global settings have been loaded" that is displayed in my debug. By checking if the call of the SetVolume was actually successful, i've noticed that it was not.

Also from the error, i've supposed it was a problem with initialization and the xgs file that contains the settings, but none of the methods fails.

Any thoughts?

Searched on the web but found no specific answer.

Thanks in advance.

Regards smile.gif

Share this post


Link to post
Share on other sites
Advertisement
[font=arial, verdana, tahoma, sans-serif][size=2]k got an update:

Tried to use XACTENGINE_E_NOGLOBALSETTINGS error to verify if my global settings were loaded.

The result: they are not!

So the problem now is:

How do i load XACT global settings (since i seem to have not done it in the right way) ?

Your help it's still welcome :P

Thanks in advance[/font]

Share this post


Link to post
Share on other sites
It's been a while since I've messed with XACT, but IIRC you're going to need to set up a category or variable in the XACT GUI to handle that. Googling for "XACT3 dynamic sound" provided some promising-looking results. I don't have access to my pc at the moment, so I can't check how I handled it.

Share this post


Link to post
Share on other sites

It's been a while since I've messed with XACT, but IIRC you're going to need to set up a category or variable in the XACT GUI to handle that. Googling for "XACT3 dynamic sound" provided some promising-looking results. I don't have access to my pc at the moment, so I can't check how I handled it.


Thanks for the answer :D


I've tried to create and manage the volume with a category/global variable but i still get the same result (the above error). Will try to follow your direction and seek for a solution. Will edit if i will find what i need

Thanks :D

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!