1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 2<html xml:lang="en-US" lang="en-US"> 3 <head> 4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 5 <meta http-equiv="Content-Style-Type" content="text/css" /> 6 <link rel="stylesheet" href="../../../css/manpage.css" type="text/css" /> 7 <title>Sound (snd) Sample Demo</title> 8 </head> 9 <body> 10 <h1>labelString</h1> 11 12 <h2>Overview</h2> 13 <div class="section"> 14 <p> 15 Demonstrates how to use label strings instead of sound IDs. 16 </p> 17 </div> 18 19 <h2>How to Use</h2> 20 <div class="section"> 21 <p> 22 <ul> 23 <li>A Button: Plays the sequence sound</li> 24 <li>X Button: Plays the wave sound</li> 25 <li>Y Button: Plays the stream sound</li> 26 <li>B Button: Stops the sound</li> 27 </ul> 28 </p> 29 </div> 30 31 <h2>Description</h2> 32 <div class="section"> 33 <p> 34 Allows sounds to be played using label strings (const char*) rather than sound IDs. 35 </p> 36 <p> 37 A string table must already be loaded from a sound archive to do this. 38 </p> 39 <pre> 40 // Loads the STRING block 41 { 42 u32 stringBlockSize = m_Archive.GetLabelStringDataSize(); 43 m_pMemoryForStringBlock = MemAlloc( stringBlockSize ); 44 if ( ! m_Archive.LoadLabelStringData( m_pMemoryForStringBlock, stringBlockSize ) ) 45 { 46 NW_ASSERTMSG( 0, "cannot load stringBlock(%s)", SOUND_ARC_PATH ); 47 } 48 } 49 </pre> 50 <p> 51 Label strings can also be used for loading data, not just for playing sounds. 52 </p> 53 <pre> 54 // Loads sound data 55 if ( ! m_DataManager.LoadData( "SEQ_MARIOKART", &m_Heap ) ) 56 { 57 NW_ASSERTMSG( false, "LoadData(SEQ_MARIOKART) failed." ); 58 } 59 if ( ! m_DataManager.LoadData( "SE_YOSHI", &m_Heap ) ) 60 { 61 NW_ASSERTMSG( false, "LoadData(SE_YOSHI) failed." ); 62 } 63 64 // Plays the sound 65 bool result = m_ArchivePlayer.StartSound( &m_Handle, "SEQ_MARIOKART" ).IsSuccess(); 66 </pre> 67 <p> 68 Loading is not required when using <a href="../MemorySoundArchive/Overview.html">nw::snd::MemorySoundArchive</a>. Furthermore, playback using label strings is impossible if the sound archive does not include a string table. 69 </p> 70 <p> 71 Whether a sound archive file includes string information can be specified by selecting Project Settings from the SoundMaker Projects menu, and then on the Sound Archive tab, selecting the "Ouput the string table" checkbox. 72 </p> 73 </div> 74 75 <h2>Revision History</h2> 76 <div class="section"> 77 <dl class="history"> 78 <dt>2010/09/27</dt> 79 <dd>Initial version.<br /> 80 </dd> 81 </dl> 82 </div> 83 84 <hr><p>CONFIDENTIAL</p></body> 85</html> 86 87