本文整理汇总了C++中fmod::System::loadBankFile方法的典型用法代码示例。如果您正苦于以下问题:C++ System::loadBankFile方法的具体用法?C++ System::loadBankFile怎么用?C++ System::loadBankFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fmod::System
的用法示例。
在下文中一共展示了System::loadBankFile方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Audio
// Initializes FMOD Studio and loads all sound banks.
Audio() :
Listener(system)
{
// Create the FMOD Studio system.
FmodCall(fmod::System::create(&system));
// Initialize the system.
FmodCall(system->initialize(
maxChannels, // max channels capable of playing audio
FMOD_STUDIO_INIT_NORMAL, // studio-specific flags
FMOD_INIT_3D_RIGHTHANDED, // regular flags
nullptr)); // extra driver data
vector<fmod::Bank*> banks;
// For each file in the Sounds directory with a *.bank extension:
for (const string& file : PathInfo(config::Sounds).FilesWithExtension("bank"))
{
// Load the sound bank from file.
fmod::Bank* bank = nullptr;
FmodCall(system->loadBankFile(file.c_str(), FMOD_STUDIO_LOAD_BANK_NORMAL, &bank));
banks.push_back(bank);
}
for (fmod::Bank* bank : banks)
{
// Get the number of events in the bank.
int eventCount = 0;
FmodCall(bank->getEventCount(&eventCount));
if (eventCount == 0) continue;
// Get the list of event descriptions from the bank.
auto eventArray = vector<fmod::EventDescription*>(static_cast<size_t>(eventCount), nullptr);
FmodCall(bank->getEventList(eventArray.data(), eventArray.size(), nullptr));
// For each event description:
for (fmod::EventDescription* eventDescription : eventArray)
{
// Get the path to the event, e.g. "event:/Ambience/Country"
auto path = string(512, ' ');
int retrieved = 0;
FmodCall(eventDescription->getPath(&path[0], path.size(), &retrieved));
path.resize(static_cast<size_t>(retrieved - 1)); // - 1 to account for null character
// Save the event description in the event map.
eventDescriptionMap.emplace(path, EventDescription(eventDescription, path));
}
}
Note(*this);
}