Sophie

Sophie

distrib > Mandriva > 9.1 > ppc > by-pkgid > f3dfa22869f9cbc8258f8de2f086ee44 > files > 38

libkxl1.1.6_0-devel-1.1.6-3mdk.ppc.rpm

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
   <meta http-equiv="Content-Type" content="text/html; charset=euc-jp">
   <meta name="GENERATOR" content="emacs">
   <meta name="Author" content="kacchan">
   <title>KXL_PlaySound</title>
</head>
<body text="#000000" bgcolor="#f0f0dc" link="#3366FF" vlink="#3366FF" alink="#FF0000">

<a href="kxlinitsound.html">Prev</a>
<a href="KXL.html">Top</a>
<a href="kxlendsound.html">Next</a>
<hr>

<b>Name</b><br><br>
<font size=+2>KXL_PlaySound</font><br><br>

<b>Synopsis</b><br>
<pre>KXL_PlaySound -- A sound is controlled.
</pre><br>

<b>Description</b><br>
<pre>void KXL_PlaySound(Uint16 no, KXL_Command command);</pre><br>

<b>Arguments</b><br><br>
<table border="1">
<tr><td>no</td><td>The number of a sound.</td></tr>
<tr><td>command</td><td>Control command<br>
<table border="1">
<tr><td>KXL_SOUND_PLAY</td><td>play of a sound.</td></tr>
<tr><td>KXL_SOUND_PLAY_LOOP</td><td>repetition play of a sound.</td></tr>
<tr><td>KXL_SOUND_STOP</td><td>stop of a sound.</td></tr>
<tr><td>KXL_SOUND_STOP_ALL</td><td>all stop of a sound.</td></tr>
</table>
</td></tr>
</table>
<br><br>

<b>Return Value</b><br><br>
Nothing.
<br><br><br>

<b>Exsample</b><br>
<pre>
<a href="./sound1.wav">sound1.wav</a>
<a href="./sound2.wav">sound1.wav</a>
<a href="./sound3.wav">sound1.wav</a>

#include &lt;KXL.h&gt;

int main(void)
{
  Bool flag = False;
  <b>Uint8 *wavlist[] = {
    "sound1", // The sound of No. 0
    "sound2", // The sound of No. 1
    "sound3", // The sound of No. 2
    ""        // Indispensable
  };</b>

  KXL_CreateWindow(200, 100, "kxl.org",
		   KXL_EVENT_EXPOSURE_MASK |
		   KXL_EVENT_KEY_PRESS_MASK);
  KXL_InitSound(".", wavlist);

  while (flag == False) {
    while (KXL_CheckEvents() == False);  
    switch (KXL_GetEvents()) {
    case KXL_EVENT_EXPOSE:
      KXL_ClearFrameImm(0, 0, 200, 100);
      KXL_PutText(8, 20, "[1] - sound1");
      KXL_PutText(8, 40, "[2] - sound2");
      KXL_PutText(8, 60, "[3] - sound3");
      KXL_PutText(8, 99, "[4] - exit");
      KXL_UpDateImm(0, 0, 200, 100);
      break;;
    case KXL_EVENT_KEY_PRESS:
      switch (KXL_GetKey()) {
      case KXL_KEY_1:
	<b>KXL_PlaySound(0, KXL_SOUND_PLAY);</b>
	break;
      case KXL_KEY_2:
	<b>KXL_PlaySound(1, KXL_SOUND_PLAY);</b>
	break;
      case KXL_KEY_3:
	<b>KXL_PlaySound(2, KXL_SOUND_PLAY);</b>
	break;
      case KXL_KEY_4:
	flag = True;
	break;
      }
    }
  }
  KXL_EndSound();
  KXL_DeleteWindow();
  return 0;
}
</pre>

</body>
</html>