In this section we explain how to use a number of sound effect banks. As already explained, the first thing that needs to be done is to initialize all of the sound effect banks. It does not matter how many sound effect banks are going to be initialized with MusFxBankInitialize. At the time of initialization, the sound effect bank specified the first time by MusFxBankInitialize is automatically set as the default sound effect bank. Sound effect banks initialized on the second and subsequent times are not set as the default, but this can be changed and one of these sound effect banks can be set as the default using MusFxBankSetCurrent. When a bank is set as the default, any sound effect started after that point will make use of that bank.
Set initialized sound effect bank as the default
Function name: | MusFxBankSetCurrent | |
Syntax: | void MusFxBankSetCurrent(void *ifxbank) | |
Arguments: | ifxbank | Address of the initialized sound effect bank |
Return value: | None | |
You can make use of a number of sound effect banks with just MusFxBankSetCurrent, but there is another function with different characteristics called, MusFxBankSetSingle, that you can also use. This function sets an override that is different from the default. The override has higher priority than the default, but it is cleared after one use. Thus, you can utilize this function to make temporary use of a different sound effect bank when the need arises.
Temporarily set the next sound effect bank to use
Function name: | MusFxBankSetSingle | |
Syntax: | void MusFxBankSetSingle(void *ifxbank) | |
Arguments: | ifxbank | Address of the initialized sound effect bank |
Return value: | None | |
The following is an example of how these two functions can be combined to make use of a number of sound effect banks.
|
There is one point you need to be careful about, as the next example demonstrates:
|
In other words, the override is cleared at the time when the sound effect starts, and not when the only thing that has been executed is MusFxBankSetCurrent. For this reason, you should execute MusFxBankSetSingle immediately before starting the sound effect. You can forcefully clear the override by setting NULL in the argument of MusFxBankSetSingle.
You have no doubt noticed that all of the sample banks have been the same in the explanations up until now. However, when multiple sample banks and multiple sound-effect banks are being used, sound effects and songs can get mixed up, and controlling them all can become a difficult task. Control becomes a much easier task if you use MusFxBankSetPtrBank to set a certain default sample bank in the sound effect bank, since when this is done the default value set in MusPtrBankSetCurrent will only be used for songs. The order of priority of sample banks, from highest to lowest, is MusPtrBankSetSingle > MusFxBankSetPtrBank > MusPtrBankSetCurrent.
Set the sound effect bank's sample bank
Function name: | MusFxBankSetPtrBank | |
Syntax: | void MusFxBankSetPtrBank(void *ifxbank, void *ipbank) | |
Arguments: | ifxbank | Address of an initialized sound effect bank |
ipbank | Address of an initialized sample bank | |
Return value: | None | |