﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>C++博客-swo2006-文章分类-fmod</title><link>http://www.cppblog.com/swo2006/category/3202.html</link><description /><language>zh-cn</language><lastBuildDate>Wed, 21 May 2008 09:57:57 GMT</lastBuildDate><pubDate>Wed, 21 May 2008 09:57:57 GMT</pubDate><ttl>60</ttl><item><title>ＦＭＯＤ音乐播放</title><link>http://www.cppblog.com/swo2006/articles/15129.html</link><dc:creator>swo</dc:creator><author>swo</author><pubDate>Mon, 13 Nov 2006 07:42:00 GMT</pubDate><guid>http://www.cppblog.com/swo2006/articles/15129.html</guid><wfw:comment>http://www.cppblog.com/swo2006/comments/15129.html</wfw:comment><comments>http://www.cppblog.com/swo2006/articles/15129.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/swo2006/comments/commentRss/15129.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/swo2006/services/trackbacks/15129.html</trackback:ping><description><![CDATA[
		<div class="style4 style8" align="center">ＦＭＯＤ</div>
  
  
    　<p>三、音乐播放</p><p>Ａ、<strong>FMUSIC_PlaySong</strong></p><p><strong>　例子：FMUSIC_MODULE *mod = 0;／／初始化</strong></p><p><strong>　　　　　。。。</strong></p><strong>mod = FMUSIC_LoadSong("canyon.mid");／／加载音乐</strong><p><strong>　　　　　。。。</strong></p><p><strong>　FMUSIC_PlaySong(mod);　　　／／播放</strong></p><p><strong>以下是此函数详细资料</strong></p><p><strong>／／／／／／／／／／／／／／／／／</strong></p><h2><a name="FMUSIC_PlaySong">FMUSIC_PlaySong</a></h2><p>Starts a song playing.<br /></p><p><b>signed char F_API </b><b>FMUSIC_PlaySong</b><b>(</b><br /><b>FMUSIC_MODULE *</b><i>mod</i><br /><b>);</b><br /></p><h3>Parameters</h3><p></p><table><tbody><tr valign="top"><td><i>mod</i></td><td>Pointer to the song to be played.<br />／／要播放歌曲指针</td></tr></tbody></table><h3>Return Value</h3><p>TRUE song succeeded playing<br />FALSE song failed playing</p><p>／／／／／／／／／／／／／／／／／／／／／／／／／／／／／</p><p>Ｂ、<strong>FSOUND_PlaySound</strong></p><p><strong>例子：FSOUND_SAMPLE　* notre_son；／／初始化</strong></p><p><strong>　　　　。。。。</strong></p><p><strong>　　　notre_son = FSOUND_Sample_Load(FSOUND_FREE, "sound\\bgsound.mp3", FSOUND_NORMAL, 0, 0);／／加载</strong></p><p><strong>　　　。。。。</strong></p><p><strong>　　FSOUND_PlaySound(0, notre_son);／／播放</strong></p><p><strong>以下是关于此函数的详细说明</strong></p><p>／／／／／／／／／／／／／／／／／／／／／／／／／／／／／／／／／／／</p><h2><a name="FSOUND_PlaySound">FSOUND_PlaySound</a></h2><p>Plays a sample in a specified channel, using the sample's default frequency, volume<br />and pan settings.<br />／／用一个指定通道来播放例子，使用默认的频率，音量，pan设置</p><p><b>int F_API </b><b>FSOUND_PlaySound</b><b>(</b><br /><b>int </b><i>channel</i><b>,</b><br /><b>FSOUND_SAMPLE *</b><i>sptr</i><br /><b>);</b><br /></p><h3>Parameters</h3><p></p><table><tbody><tr valign="top"><td><i>channel</i></td><td><p>0+ <br />The absolute channel number in the channel pool. </p><p>／／通道pool里的绝对通道号。<br />Remember software channels come first, followed by hardware channels. </p><p>／／记住软通道使用在前，再接才是硬通道<br />You cannot play a software sample on a hardware channel and vice versa.</p><p>／／你不可以用一个硬通道来播放一个软例子，反过来也一样。<br />FSOUND_FREE<br />Chooses a free channel to play in. </p><p>／／选择一个空闲通道来播放</p><p>If all channels are used then it<br />selects a channel with a sample playing that has an EQUAL or LOWER priority <br />than the sample to be played.</p><p>／／如果所有通道都被使用，则会选择一个有EQUAL（平等） 或 LOWER（更低）优先权的通道来播放。<br />FSOUND_ALL<br />Passing this will cause ALL channels to play. (note this will make things<br />VERY noisy!)</p><p>／／使用它会导致所以通道播放。（这样会很噪音）<br />If FSOUND_ALL is used the last channel success flag will be returned.<br />／／如果使用的是FSOUND_ALL ，返回的会是最后一个通道的成功标志。</p></td></tr><tr valign="top"><td><i>sptr</i></td><td>Pointer to the sample to be played.<br />／／要播放例子的指针</td></tr></tbody></table><h3>Return Value</h3><p>On success, the channel handle that was selected is returned.<br />On failure, -1 is returned.<br /></p><h3>Remarks</h3><p>If you play a FSOUND_HW3D declared sample with this function, then the position and velocity<br />are set to those of the listener. </p><p>／／如果用这个函数播放一个FSOUND_HW3D声明例子，位置和速度被设置给倾听者 </p><p>Other attributes such as volume, frequency and pan are taken<br />from the sample's default volume, frequency, pan etc.</p><p>／／其他属性如音量，频率和pan从默认中获取。<br />----------<br />The channel handle :<br />The return value is reference counted. This stops the user from updating a stolen channel.<br />Basically
it means the only sound you can change the attributes (ie
volume/pan/frequency/3d position) for are the one you specifically
called playsound for. If another sound steals that channel, and you
keep trying to change its attributes (ie volume/pan/frequency/3d
position), it will do nothing.<br />This is great if you have sounds being updated from tasks and you just forget about it.<br />You
can keep updating the sound attributes and if another task steals that
channel, your original task wont change the attributes of the new
sound!!!<br />The lower 12 bits contain the channel number. (yes this means a 4096 channel limit for FMOD :)<br />The upper 19 bits contain the reference count.<br />The top 1 bit is the sign bit.<br />ie<br />S RRRRRRRRRRRRRRRRRRR CCCCCCCCCCCC<br />----------<br />Remember if not using FSOUND_FREE, then the channel pool is split up into software and hardware channels.</p><p>／／记住如果没有正在使用FSOUND_FREE，之后通道pool会被分为软件和硬件通道。<br />Software channels occupy the first n indicies specified by the value passed into FSOUND_Init.<br />Hardware channels occupy the next n indicies after this, and can be a variable amount, depending on the hardware.</p><p>／／软通道占据用FSOUND_Init指定的Ｎ个 indicies 。硬通道分到之后Ｎ个 indicies ，可以有个有效量，取决于硬件<br />Use FSOUND_GetNumHardwareChannels to query how many channels are available in hardware.<br /><br />／／可以使用FSOUND_GetNumHardwareChannels 去质问有多少通道在硬件中有效。</p><p>／／／／／／／／／／／／／／／／／／／／／／／／／／／／／／／／／／／／／／</p><p>另：<strong>FSOUND_PlaySoundEx</strong></p><p>例如：</p><p>channel = FSOUND_PlaySoundEx(FSOUND_FREE, samp2, NULL, TRUE);</p><p>以下是此函数的详细资料</p><p>／／／／／／／／／／／／／／／／／／／／／／／／／／／／／／</p><h2><a name="FSOUND_PlaySoundEx">FSOUND_PlaySoundEx</a></h2><p>Extended featured version of FSOUND_PlaySound.</p><p>／／FSOUND_PlaySound的扩展版本<br />New functionality includes the ability to start the sound paused. </p><p>／／新函数包含开始声音暂停的功能。<br />This allows attributes of a channel to be set
freely before the sound actually starts playing, until
FSOUND_SetPaused(FALSE) is used.</p><p>／／这个通道允许属性在声音真正播放前被设为自由。直到使用FSOUND_SetPaused(FALSE)。<br />Also added is the ability to associate the channel to a specified DSP unit. </p><p>／／同样增加了分配通道到一个指定ＤＳＰ单元的功能。</p><p>This allows the user to 'group' channels into seperate DSP units,
which allows effects to be inserted between these 'groups', and allow
various things like having one group affected by reverb (wet mix) and
another group of channels unaffected (dry). </p><p>／／允许用户把 'group' 通道分到可以把效果插入这些'group' 中的ＤＳＰ单元中，允许像有一组湿声和另一组干声明通道的各种方式。</p><p>This is useful to seperate things like music from being affected by DSP effects, while other sound effects are.<br />／／通常把如音乐的东西从ＤＳＰ效果分离。</p><p><b>int F_API </b><b>FSOUND_PlaySoundEx</b><b>(</b><br /><b>int </b><i>channel</i><b>,</b><br /><b>FSOUND_SAMPLE *</b><i>sptr</i><b>,</b><br /><b>FSOUND_DSPUNIT *</b><i>dspunit</i><b>,</b><br /><b>signed char </b><i>startpaused</i><br /><b>);</b><br /></p><h3>Parameters</h3><p></p><table><tbody><tr valign="top"><td><i>channel</i></td><td>0+ <br />The absolute channel number in the channel pool. <br />Remember software channels come first, followed by hardware channels. <br />You cannot play a software sample on a hardware channel and vice versa.<br />FSOUND_FREE<br />Chooses a free channel to play in. If all channels are used then it<br />selects a channel with a sample playing that has an EQUAL or LOWER priority <br />than the sample to be played.<br />FSOUND_ALL <br />Plays the sound on all channels.<br />／／同上</td></tr><tr valign="top"><td><i>sptr</i></td><td>Pointer to the sample to be played.<br />／／同上</td></tr><tr valign="top"><td><i>dspunit</i></td><td>Optional. NULL by default. Pointer to a dsp unit to attach the
channel to for channel grouping. Only attach a sound to a user created
DSP unit, and not a system DSP unit.<br />／／可选。默认为空。把一个dsp单元附加在通道上的指针。只有把声音附加在一个用户自建DSP单元，不是一个系统ＤＳＰ单元。</td></tr><tr valign="top"><td><i>paused</i></td><td>Start the sound paused or not. Pausing the sound allows attributes to be set before the sound starts.<br />／／是否开始声音暂停。在声音开始之前可以设置是否允许暂停。</td></tr></tbody></table><h3>Return Value</h3><p>On success, the channel handle that was selected is returned.<br />On failure, -1 is returned.<br /></p><h3>Remarks</h3><p>FSOUND_ALL is supported. Passing this will cause ALL channels to play. (note this could make things VERY noisy!)／／同上<br />If
FSOUND_ALL is used the last channel success flag will be returned. This
return value is not useful in most circumstances.／／如果是使用FSOUND_ALL
，返回的是最后通道值。返回值在大多情况下都没有用。<br />----------<br />The channel handle :<br />The return value is reference counted. This stops the user from updating a stolen channel.<br />This means the only sound you can change the attributes (ie volume/pan/frequency/3d position) for are the <br />one you specifically called playsound for. If another sound steals that channel, and you keep trying to <br />change its attributes (ie volume/pan/frequency/3d position), it will do nothing.<br />This is great if you have sounds being updated from tasks and you just forget about it.<br />You can keep updating the sound attributes and if another task steals that channel, your original task <br />wont change the attributes of the new sound!!!<br />The lower 12 bits contain the channel number. (yes this means a 4096 channel limit for FMOD :)<br />The upper 19 bits contain the reference count.<br />The top 1 bit is the sign bit.<br />ie<br />S RRRRRRRRRRRRRRRRRRR CCCCCCCCCCCC<br />----------<br />Remember if not using FSOUND_FREE, then the channel pool is split up into software and hardware channels.<br />Software channels occupy the first n indicies specified by the value passed into FSOUND_Init.<br />Hardware channels occupy the next n indicies after this, and can be a variable amount, depending on the hardware.<br />Use FSOUND_GetNumHardwareChannels to query how many channels are available in hardware.</p><p>／／同上<br />----------<br />If you attach a sound to a DSP unit (for
grouping purposes), the callback for the DSP unit will be overwritten
with fmod's internal mixer callback, so the callback the user supplied
is rendered obsolete and is not called.<br />Also, do not attach sounds to system DSP units, the assignment will be ignored if you do.</p><p>／／如果你把一个声音附加在一个ＤＳＰ单元上，ＤＳＰ单元的回调将会被fmod的内在混合回调覆盖，所以用户提供的回调会作废和不被调用，同时，不把声音附加在系统ＤＳＰ单元，这个任务将会忽略。</p><p>／／／／／／／／／／／／／／／／／／／／／／／／／／／／／／／／／／／／</p><p>Ｃ、<strong>FSOUND_Stream_Play</strong></p><p><strong>例子：FSOUND_Stream_Play(FSOUND_FREE, stream) </strong></p><p><strong>以下是此函数的详细说明</strong></p><p><strong>／／／／／／／／／／／／／／／／／／／／／／／／／／／／／／</strong></p><h2><a name="FSOUND_Stream_Play">FSOUND_Stream_Play</a></h2><p>Starts a pre-opened stream playing.<br /></p><p><b>int F_API </b><b>FSOUND_Stream_Play</b><b>(</b><br /><b>int </b><i>channel</i><b>,</b><br /><b>FSOUND_STREAM *</b><i>stream</i><br /><b>);</b><br /></p><h3>Parameters</h3><p></p><table><tbody><tr valign="top"><td><i>channel</i></td><td>0+ The channel index in the channel pool. This must not exceed the maximum number of channels allocated with FSOUND_Init <br />FSOUND_FREE<br />Chooses a free channel to play in. If all channels are used then it<br />selects a channel with a sample playing that has a lower priority than the <br />sample to be played.<br />／／同上</td></tr><tr valign="top"><td><i>stream</i></td><td>Pointer to the already opened stream to be played.<br />／／要播放的已经打开的指针</td></tr></tbody></table><h3>Return Value</h3><p>On success, the channel handle the stream is playing in is returned.<br />On failure, -1 is returned.<br /></p><h3>Remarks</h3><p>When a stream starts to play, it inherits a special high priority (256). </p><p>／／当一个stream开始播放时，它继承一个特别高的优先权（２５６）。<br />It cannot be rejected by
other sound effect channels in the normal fashion as the user can never
set a priority above 255 normally. </p><p>／／当用户没有设置一个低于256的正常优先权时，它不能被其他声效通道以正常方式拒绝。<br />--------------<br />If the stream has been opened with FSOUND_NONBLOCKING, this function will not succeed until the stream is ready.<br />--------------<br />FSB
streaming is not supported if the format from FSBank is 'Retain
original format'. On PC platforms, only PCM and ADPCM FSB files are
allowed.</p><p>／／同前<br />--------------<br />FSOUND_STEREOPAN is recommended for stereo
streams if you call FSOUND_SetPan. This puts the left and right channel
to full volume.</p><p>／／如果你调用FSOUND_SetPan，FSOUND_STEREOPAN会被推荐给立体声。他可以把左右声道都调为最大音量。 <br />Otherwise a normal pan will give half volume for left and right. See FSOUND_SetPan for more information on this.</p><p>／／相反一个正常pan会带一半音量给左和右。查看FSOUND_SetPan 去了解更多信息。<br />--------------<br />You can use normal channel based commands (such as FSOUND_SetVolume etc) on the return handle, as it is a channel handle.</p><p>／／你可以用正常通道的基本命令到返回句柄上，当它是一个通道句柄时</p><p>另：<strong>FSOUND_Stream_PlayEx</strong></p><p><strong>例如：  channel = FSOUND_Stream_PlayEx(FSOUND_FREE, stream, NULL, TRUE);</strong></p><p><strong>以下是此函数的详细说明</strong></p><p><strong>／／／／／／／／／／／／／／／／／／／／／／／</strong></p><h2><a name="FSOUND_Stream_PlayEx">FSOUND_Stream_PlayEx</a></h2><p>Extended featured version of FSOUND_Stream_Play.<br />Added functionality includes the ability to start the stream paused. This allows attributes<br />of a stream channel to be set freely before the stream actually starts playing, until FSOUND_SetPaused(FALSE) is used.<br />Also added is the ability to associate the stream channel to a specified DSP unit. This allows<br />the user to 'group' channels into seperate DSP units, which allows effects to be inserted<br />between these 'groups', and allow various things like having one group affected by reverb (wet mix) and another group of <br />channels unaffected (dry). This is useful to seperate things like music from being affected<br />by DSP effects, while other sound effects are.<br />／／同上</p><p><b>int F_API </b><b>FSOUND_Stream_PlayEx</b><b>(</b><br /><b>int </b><i>channel</i><b>,</b><br /><b>FSOUND_STREAM *</b><i>stream</i><b>,</b><br /><b>FSOUND_DSPUNIT *</b><i>dspunit</i><b>,</b><br /><b>signed char </b><i>paused</i><br /><b>);</b><br /></p><h3>Parameters</h3><p></p><table><tbody><tr valign="top"><td><i>channel</i></td><td>0+ <br />The absolute channel number in the channel pool. <br />Remember software channels come first, followed by hardware channels. <br />You cannot play a software sample on a hardware channel and vice versa.<br />FSOUND_FREE<br />Chooses a free channel to play in. If all channels are used then it<br />selects a channel with a sample playing that has an EQUAL or LOWER priority <br />than the sample to be played.<br />／／同上</td></tr><tr valign="top"><td><i>stream</i></td><td>Pointer to the already opened stream to be played.<br />／／同上</td></tr><tr valign="top"><td><i>dspunit</i></td><td>Pointer to a dsp unit to attach the channel to.<br />／／同上</td></tr><tr valign="top"><td><i>paused</i></td><td>Start the stream paused or not. Pausing the stream channel allows attributes to be set before it is unpaused.<br />／／同上</td></tr></tbody></table><h3>Return Value</h3><p>On success, a channel handle the stream is playing in is returned.<br />On failure, -1 is returned.<br /></p><h3>Remarks</h3><p>When a stream starts to play, it inherits a special high priority (256). </p><p>／／同上<br />It cannot be rejected by other sound effect channels in the
normal fashion as the user can never set a priority above 255 normally.
</p><p>／／同上<br />--------<br />FSOUND_STEREOPAN is recommended for stereo
streams if you call FSOUND_SetPan. This puts the left and right channel
to full volume.<br />Otherwise a normal pan will give half volume for left and right. See FSOUND_SetPan for more information on this.</p><p>／／同上<br />--------<br />You can use normal channel based commands (such as FSOUND_SetVolume etc) on the return handle, as it is a channel handle.<br /><br />／／同上</p><img src ="http://www.cppblog.com/swo2006/aggbug/15129.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/swo2006/" target="_blank">swo</a> 2006-11-13 15:42 <a href="http://www.cppblog.com/swo2006/articles/15129.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>FMOD.dll的介绍</title><link>http://www.cppblog.com/swo2006/articles/15128.html</link><dc:creator>swo</dc:creator><author>swo</author><pubDate>Mon, 13 Nov 2006 07:41:00 GMT</pubDate><guid>http://www.cppblog.com/swo2006/articles/15128.html</guid><wfw:comment>http://www.cppblog.com/swo2006/comments/15128.html</wfw:comment><comments>http://www.cppblog.com/swo2006/articles/15128.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/swo2006/comments/commentRss/15128.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/swo2006/services/trackbacks/15128.html</trackback:ping><description><![CDATA[
		<p>FMOD.dll的介绍<br />翻译(Robin)<br />Email:eway365@hotmail.com</p>
		<p>什么是FMOD?<br />FMOD是一个非常简单通用的audio引擎,可以在windows,winCE,Linux,GameCube Xbox等平台上很好运行.<br />FMOD是一个共享软件,如果不用于商业用途可以免费使用,商业用途需要付费100美金.详细情况请关注<a href="http://www.fomod.org/">www.fomod.org</a></p>
		<p>下载后将fmod.dll和fmodvc.lib加入你的工程中.并引用头文件fmod.h<br />在使用fmod播入音乐之前,首先要初始化,代码如下:<br />FSOUND_Init(44100,32,0);<br />第一个参数为单乐输出的rate,单位为赫兹,在这里我们设置为44100.<br />第二个参数为设置最大的通道数量<br />第三个参数,可以指定一些标识,如果我们想的话.这里暂时置它为0.</p>
		<p>好了,现在我们准备开始播放单乐了,可FMOD道底支持什么样的单乐格式呢?<br />歌曲,采样或是文件流(song,sample and stream)?<br />FMOD将它细分在两个API中.他们分别是FSOUND和FMUSIC</p>
		<p>所有的music如:mod,s3m,xm,it,mid,rmi,sgt,fsb 都通过FMUSIC 这个API来播放<br />FSOUND API是提供给压缩格式使用的.文件一般如:wav,mp3,ogg,raw等<br />这些格式,你都可以通过别的软件进行互相转换.<br />如果你要播放的单乐是像炮弹发射一样的短小的声音,那么你可以将这些声间转成sample<br />Samples将在播放前先解压到内存,而且可以多次播放.<br />如果你要播放的是象背景音乐一样的较长的音乐,你可以得到这个音乐转化为流,这将导致<br />使用一些CPU和内存,因为文件从磁盘读取然后转成流需要一个过程.同时需要注意一点,在<br />同一时间不能多次播放</p>
		<p>FMUSIC:<br />用FMUSIC播放需要一个handle,看如下代码:<br />handle = FMUSIC_LoadSong("YourFileName");<br />FMUSIC_PlaySong(handle);<br />现在你可能注意到,几乎每个function的第一个参数都需要一个handle;</p>
		<p>设置单量<br />FMUSIC_SetMasterVolume(handle,256);<br />256是最高音,0表示静音</p>
		<p>暂定单乐<br />FMUSIC_SetPaused(handle,true);<br />FMUSIC_SetPaused(handle,false);</p>
		<p>循环播放<br />FMUSIC_SetLooping(handle,true);</p>
		<p>停止音乐<br />FMUSIC_StopSong(handle);</p>
		<p>free内存<br />FMUSIC_FreeSong(handle);</p>
		<p>一个例子:<br />#include &lt;conio.h&gt;<br />#include "inc/fmod.h"</p>
		<p>FMUSIC_MODULE* handle;</p>
		<p>int main ()<br />{<br /> // init FMOD sound system<br /> FSOUND_Init (44100, 32, 0);</p>
		<p> // load song<br /> handle=FMUSIC_LoadSong ("canyon.mid");</p>
		<p> // play song only once<br /> // when you want to play a midi file you have to disable looping<br /> // BEFORE playing the song else this command has no effect!<br /> FMUSIC_SetLooping (handle, false);</p>
		<p> // play song<br /> FMUSIC_PlaySong (handle);</p>
		<p> // wait until the users hits a key to end the app<br /> while (!_kbhit())<br /> {<br /> }</p>
		<p> //clean up<br /> FMUSIC_FreeSong (handle);<br /> FSOUND_Close();<br />}</p>
		<p>
				<br />下面开始介绍FSOUND<br />得到FSOUND的句柄:<br />handle = FSOUND_Sample_Load(0,"yourFileName",0,0,0);<br />FSOUND_PlaySound(0,handle);<br />这些音效在播放前将被载入内存,所以可能需要一点点时间.<br />第二行命令的第一个参数是播放时使用的通道.</p>
		<p>设置音量<br />FSOUND_SetVolume(handle,255);<br />255为最大音量,0表示静音</p>
		<p>暂停音乐<br />FSOUND_SetPaused(handle,true);<br />FSOUND_SetPaused(handle,false);</p>
		<p>停止音乐<br />FSOUND_StopSound (handle);</p>
		<p>清除内存<br />FSOUND_Sample_Free(handle);</p>
		<p>看一个例子:<br />#include &lt;conio.h&gt;<br />#include "inc/fmod.h"</p>
		<p>FSOUND_SAMPLE* handle;</p>
		<p>int main ()<br />{<br /> // init FMOD sound system<br /> FSOUND_Init (44100, 32, 0);</p>
		<p> // load and play sample<br /> handle=FSOUND_Sample_Load (0,"sample.mp3",0, 0, 0);<br /> FSOUND_PlaySound (0,handle);</p>
		<p> // wait until the users hits a key to end the app<br /> while (!_kbhit())<br /> {<br /> }</p>
		<p> // clean up<br /> FSOUND_Sample_Free (handle);<br /> FSOUND_Close();<br />}</p>
		<p>Streams:<br />handle=FSOUND_Stream_Open("YourFileName",0, 0, 0);<br />FSOUND_Stream_Play (0,handle);</p>
		<p>停止音乐<br />FSOUND_Stream_Stop(handle);<br />清除<br />FSOUND_Stream_Close(handle);</p>
		<p>一个例子:<br />#include &lt;conio.h&gt;<br />#include "inc/fmod.h"</p>
		<p>FSOUND_STREAM* handle;</p>
		<p>void main ()<br />{<br /> //init FMOD sound system<br /> FSOUND_Init (44100, 32, 0);</p>
		<p> //load and play sample<br /> handle=FSOUND_Stream_Open("sample.mp3",0, 0, 0);<br /> FSOUND_Stream_Play (0,handle);</p>
		<p> //wait until the users hits a key to end the app<br /> while (!_kbhit())<br /> {<br /> }</p>
		<p> //clean up<br /> FSOUND_Stream_Close(handle);<br /> FSOUND_Close();<br />}</p>
<img src ="http://www.cppblog.com/swo2006/aggbug/15128.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/swo2006/" target="_blank">swo</a> 2006-11-13 15:41 <a href="http://www.cppblog.com/swo2006/articles/15128.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>