| 1 |
<!doctype html public "-//w3c//dtd html 4.0 transitional//en"> |
| 2 |
<html> |
| 3 |
<head> |
| 4 |
<meta http-equiv="Content-Type" content="text/html; charset=euc-jp"> |
| 5 |
<meta name="GENERATOR" content="emacs"> |
| 6 |
<meta name="Author" content="kacchan"> |
| 7 |
<title>KXL_PlaySound</title> |
| 8 |
</head> |
| 9 |
<body text="#000000" bgcolor="#f0f0dc" link="#3366FF" vlink="#3366FF" alink="#FF0000"> |
| 10 |
|
| 11 |
<a href="kxlinitsound.html">Prev</a> |
| 12 |
<a href="KXL.html">Top</a> |
| 13 |
<a href="kxlendsound.html">Next</a> |
| 14 |
<hr> |
| 15 |
|
| 16 |
<b>Name</b><br><br> |
| 17 |
<font size=+2>KXL_PlaySound</font><br><br> |
| 18 |
|
| 19 |
<b>Synopsis</b><br> |
| 20 |
<pre>KXL_PlaySound -- A sound is controlled. |
| 21 |
</pre><br> |
| 22 |
|
| 23 |
<b>Description</b><br> |
| 24 |
<pre>void KXL_PlaySound(Uint16 no, KXL_Command command);</pre><br> |
| 25 |
|
| 26 |
<b>Arguments</b><br><br> |
| 27 |
<table border="1"> |
| 28 |
<tr><td>no</td><td>The number of a sound.</td></tr> |
| 29 |
<tr><td>command</td><td>Control command<br> |
| 30 |
<table border="1"> |
| 31 |
<tr><td>KXL_SOUND_PLAY</td><td>play of a sound.</td></tr> |
| 32 |
<tr><td>KXL_SOUND_PLAY_LOOP</td><td>repetition play of a sound.</td></tr> |
| 33 |
<tr><td>KXL_SOUND_STOP</td><td>stop of a sound.</td></tr> |
| 34 |
<tr><td>KXL_SOUND_STOP_ALL</td><td>all stop of a sound.</td></tr> |
| 35 |
</table> |
| 36 |
</td></tr> |
| 37 |
</table> |
| 38 |
<br><br> |
| 39 |
|
| 40 |
<b>Return Value</b><br><br> |
| 41 |
Nothing. |
| 42 |
<br><br><br> |
| 43 |
|
| 44 |
<b>Exsample</b><br> |
| 45 |
<pre> |
| 46 |
<a href="./sound1.wav">sound1.wav</a> |
| 47 |
<a href="./sound2.wav">sound1.wav</a> |
| 48 |
<a href="./sound3.wav">sound1.wav</a> |
| 49 |
|
| 50 |
#include <KXL.h> |
| 51 |
|
| 52 |
int main(void) |
| 53 |
{ |
| 54 |
Bool flag = False; |
| 55 |
<b>Uint8 *wavlist[] = { |
| 56 |
"sound1", // The sound of No. 0 |
| 57 |
"sound2", // The sound of No. 1 |
| 58 |
"sound3", // The sound of No. 2 |
| 59 |
"" // Indispensable |
| 60 |
};</b> |
| 61 |
|
| 62 |
KXL_CreateWindow(200, 100, "kxl.org", |
| 63 |
KXL_EVENT_EXPOSURE_MASK | |
| 64 |
KXL_EVENT_KEY_PRESS_MASK); |
| 65 |
KXL_InitSound(".", wavlist); |
| 66 |
|
| 67 |
while (flag == False) { |
| 68 |
while (KXL_CheckEvents() == False); |
| 69 |
switch (KXL_GetEvents()) { |
| 70 |
case KXL_EVENT_EXPOSE: |
| 71 |
KXL_ClearFrameImm(0, 0, 200, 100); |
| 72 |
KXL_PutText(8, 20, "[1] - sound1"); |
| 73 |
KXL_PutText(8, 40, "[2] - sound2"); |
| 74 |
KXL_PutText(8, 60, "[3] - sound3"); |
| 75 |
KXL_PutText(8, 99, "[4] - exit"); |
| 76 |
KXL_UpDateImm(0, 0, 200, 100); |
| 77 |
break;; |
| 78 |
case KXL_EVENT_KEY_PRESS: |
| 79 |
switch (KXL_GetKey()) { |
| 80 |
case KXL_KEY_1: |
| 81 |
<b>KXL_PlaySound(0, KXL_SOUND_PLAY);</b> |
| 82 |
break; |
| 83 |
case KXL_KEY_2: |
| 84 |
<b>KXL_PlaySound(1, KXL_SOUND_PLAY);</b> |
| 85 |
break; |
| 86 |
case KXL_KEY_3: |
| 87 |
<b>KXL_PlaySound(2, KXL_SOUND_PLAY);</b> |
| 88 |
break; |
| 89 |
case KXL_KEY_4: |
| 90 |
flag = True; |
| 91 |
break; |
| 92 |
} |
| 93 |
} |
| 94 |
} |
| 95 |
KXL_EndSound(); |
| 96 |
KXL_DeleteWindow(); |
| 97 |
return 0; |
| 98 |
} |
| 99 |
</pre> |
| 100 |
|
| 101 |
</body> |
| 102 |
</html> |