Demonstrates how to play sounds in a file not included in a sound archive.
Demonstrates a sample implementation that plays sounds using a file not included in a sound archive.
In this demo, when loading wave sound data, only wave sound data is loaded because nw::snd::SoundDataManager::LOAD_WSD has been specified as the third argument to the nw::snd::SoundDataManager::LoadData function. The wave archive that should be bound to WSD_YOSHI under SoundMaker is not loaded.
// Loads only wave sound data into the sound heap
if ( ! m_DataManager.LoadData( WSD_YOSHI, &m_Heap, nw::snd::SoundDataManager::LOAD_WSD ) )
However, it is possible to load another wave archive file that does not include a sound archive, and then bind it as a WARC_TEXT waveform archive bound to the original WSD_YOSHI. By doing so, you can play sounds using a waveform achive other than the one originally bound.
// Loads a waveform archive file into memory
{
nn::fs::FileReader reader( EXTERNAL_FILE_PATH );
m_LengthForExternalFile = (s32)reader.GetSize();
m_pMemoryForExternalFile = MemAlloc( m_LengthForExternalFile, 32 );
(void)reader.Read( m_pMemoryForExternalFile, m_LengthForExternalFile );
reader.Finalize();
}
// Registers the loaded wave archive as WARC_TEXT (originally bound to WSD_YOSHI).
{
u32 fileId = m_Archive.GetItemFileId( WARC_TEST );
m_DataManager.SetFileAddress( fileId, m_pMemoryForExternalFile );
}
// Unregisters SoundDataManager and frees the wave archive file from memory
// {
// m_DataManager.InvalidateSoundData(
// m_pMemoryForExternalFile, m_LengthForExternalFile );
// MemFree( m_pMemoryForExternalFile );
// }
EXTERNAL_FILE_PATH (= WARC_TEST.bcwar) which is loaded separately by this demo as a file not included in a sound archive is located in the cache folder created when converting from SoundMaker.
In this demo, it wouldn't mean much to take data originally bound under SoundMaker and bind it again in a program. However, this feature can be used to play sounds using data not contained in ROM from the beginning.
For example, sequence sound files only can be distributed and played as download content by using a bank originally included in a sound archive.
CONFIDENTIAL