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      <p>
14        Demonstrates how to use label strings instead of sound IDs.
15      </p>
16
17      <h2>How to Use</h2>
18      <p>
19        <ul>
20          <li>A Button: Plays the sequence sound</li>
21          <li>X Button: Plays the wave sound</li>
22          <li>Y Button: Plays the stream sound</li>
23          <li>B Button: Stops the sound</li>
24        </ul>
25      </p>
26
27      <h2>Description</h2>
28      <p>
29        Allows sounds to be played using label strings (const char*) rather than sound IDs.
30      </p>
31      <p>
32      A string table must already be loaded from a sound archive to do this.
33      </p>
34      <pre>
35    // Loads the STRING block
36    {
37        u32 stringBlockSize = m_Archive.GetLabelStringDataSize();
38        m_pMemoryForStringBlock = MemAlloc( stringBlockSize );
39        if ( ! m_Archive.LoadLabelStringData( m_pMemoryForStringBlock, stringBlockSize ) )
40        {
41            NW_ASSERTMSG( 0, &quot;cannot load stringBlock(%s)&quot;, SOUND_ARC_PATH );
42        }
43    }
44      </pre>
45      <p>
46      Label strings can also be used for loading data, not just for playing sounds.
47      </p>
48      <pre>
49    // Loads sound data
50    if ( ! m_DataManager.LoadData( &quot;SEQ_MARIOKART&quot;, &m_Heap ) )
51    {
52        NW_ASSERTMSG( false, &quot;LoadData(SEQ_MARIOKART) failed.&quot; );
53    }
54    if ( ! m_DataManager.LoadData( &quot;SE_YOSHI&quot;, &m_Heap ) )
55    {
56        NW_ASSERTMSG( false, &quot;LoadData(SE_YOSHI) failed.&quot; );
57    }
58
59    // Plays the sound
60    bool result = m_ArchivePlayer.StartSound( &m_Handle, &quot;SEQ_MARIOKART&quot; ).IsSuccess();
61      </pre>
62      <p>
63      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.
64      </p>
65      <p>
66      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 &quot;Ouput the string table&quot; checkbox.
67      </p>
68
69    <h2>Revision History</h2>
70    <div class="section">
71      <dl class="history">
72        <dt>2010/09/27</dt>
73        <dd>Initial version.<br />
74        </dd>
75      </dl>
76    </div>
77
78  <hr><p>CONFIDENTIAL</p></body>
79</html>
80
81