Game Development Reference
In-Depth Information
// to the update buffer.
SoundCategory *category = SoundEngine::getFirstCategory();
for ( ;category; category = category->getNextCategory() )
{
buff->addCategoryInfo(category->getName(),
category->getVolume());
}
// Send the buffer over to the GUI Tool!
SendBufferToGUITool(buff);
}
Listing 11.2. Sending the game's audio state to the GUI tool.
As well as sending audio state information, the game-side tool must receive
information on which of the sound categories the sound designer wishes to mute.
Listing 11.3 shows an example of how we might receive this information from a
buffer sent from the GUI tool.
Because the GUI portion of the tool has all audio state information from the
game, it can choose how to render that information. This allows us to have the
lightweight rendering of the sound instance info, such as the name, and a few
parameters. When the event is selected for further investigation from the designer,
we can display the full set of information.
// Function called once per frame to update UI tool.
void SnapShot::receiveUpdateFromGUITool(Buffer * buff)
{
// The category info is pulled from the buffer
// sent over from the GUI tool. We register the category
// mute state with the game side SnapShot class.
// This state is tested before playing a sound.
while ( buff->dataRemaining())
{
const char * name = buff->getNextCategoryName();
bool is_active = buff->getBool();
SoundCategory * cat = SoundEngine::getCategory(name);
registerCategoryMuteState( cat, is_active );
}
}
Listing 11.3. Receiving information from the GUI Tool.
11.2.2 Visualizing Sound Data
Another common requirement is for the sound designer to be able to visualize sounds
(and sound data) within the game world while the game is running. Although we
can create and use the snapshot tool to generate a list of all the sounds currently
playing, there are times when we need to see where a sound is in the game world.
This allows the sound designer to see exactly which bottle smashing on the floor
Search WWH ::




Custom Search