锘??xml version="1.0" encoding="utf-8" standalone="yes"?> 涓夈侀煶涔愭挱鏀?/p> 錛°?strong>FMUSIC_PlaySong 銆渚嬪瓙錛欶MUSIC_MODULE *mod = 0;錛忥紡鍒濆鍖?/strong> 銆銆銆銆銆銆傘傘?/strong> 銆銆銆銆銆銆傘傘?/strong> 銆FMUSIC_PlaySong(mod);銆銆銆錛忥紡鎾斁 浠ヤ笅鏄鍑芥暟璇︾粏璧勬枡 錛忥紡錛忥紡錛忥紡錛忥紡錛忥紡錛忥紡錛忥紡錛忥紡錛?/strong> Starts a song playing. signed char F_API FMUSIC_PlaySong( TRUE song succeeded playing 錛忥紡錛忥紡錛忥紡錛忥紡錛忥紡錛忥紡錛忥紡錛忥紡錛忥紡錛忥紡錛忥紡錛忥紡錛忥紡錛忥紡錛?/p> 錛€?strong>FSOUND_PlaySound 渚嬪瓙錛欶SOUND_SAMPLE銆* notre_son錛涳紡錛忓垵濮嬪寲 銆銆銆銆銆傘傘傘?/strong> 銆銆銆notre_son = FSOUND_Sample_Load(FSOUND_FREE, "sound\\bgsound.mp3", FSOUND_NORMAL, 0, 0);錛忥紡鍔犺澆 銆銆銆銆傘傘傘?/strong> 銆銆FSOUND_PlaySound(0, notre_son);錛忥紡鎾斁 浠ヤ笅鏄叧浜庢鍑芥暟鐨勮緇嗚鏄?/strong> 錛忥紡錛忥紡錛忥紡錛忥紡錛忥紡錛忥紡錛忥紡錛忥紡錛忥紡錛忥紡錛忥紡錛忥紡錛忥紡錛忥紡錛忥紡錛忥紡錛忥紡錛?/p> Plays a sample in a specified channel, using the sample's default frequency, volume int F_API FSOUND_PlaySound( 0+ 錛忥紡閫氶亾pool閲岀殑緇濆閫氶亾鍙楓?br />Remember software channels come first, followed by hardware channels. 錛忥紡璁頒綇杞氶亾浣跨敤鍦ㄥ墠錛屽啀鎺ユ墠鏄‖閫氶亾 錛忥紡浣犱笉鍙互鐢ㄤ竴涓‖閫氶亾鏉ユ挱鏀句竴涓蔣渚嬪瓙錛屽弽榪囨潵涔熶竴鏍楓?br />FSOUND_FREE 錛忥紡閫夋嫨涓涓┖闂查氶亾鏉ユ挱鏀?/p> If all channels are used then it 錛忥紡濡傛灉鎵鏈夐氶亾閮借浣跨敤錛屽垯浼氶夋嫨涓涓湁EQUAL錛堝鉤絳夛級聽鎴?LOWER錛堟洿浣庯級浼樺厛鏉冪殑閫氶亾鏉ユ挱鏀俱?br />FSOUND_ALL 錛忥紡浣跨敤瀹冧細瀵艱嚧鎵浠ラ氶亾鎾斁銆傦紙榪欐牱浼氬緢鍣煶錛?br />If FSOUND_ALL is used the last channel success flag will be returned. On success, the channel handle that was selected is returned. If you play a FSOUND_HW3D declared sample with this function, then the position and velocity 錛忥紡濡傛灉鐢ㄨ繖涓嚱鏁版挱鏀句竴涓狥SOUND_HW3D澹版槑渚嬪瓙錛屼綅緗拰閫熷害琚緗粰鍊懼惉鑰? Other attributes such as volume, frequency and pan are taken 錛忥紡鍏朵粬灞炴у闊抽噺錛岄鐜囧拰pan浠庨粯璁や腑鑾峰彇銆?br />---------- 錛忥紡璁頒綇濡傛灉娌℃湁姝e湪浣跨敤FSOUND_FREE錛屼箣鍚庨氶亾pool浼氳鍒嗕負杞歡鍜岀‖浠墮氶亾銆?br />Software channels occupy the first n indicies specified by the value passed into FSOUND_Init. 錛忥紡杞氶亾鍗犳嵁鐢‵SOUND_Init鎸囧畾鐨勶籍涓?indicies 銆傜‖閫氶亾鍒嗗埌涔嬪悗錛釜 indicies 錛屽彲浠ユ湁涓湁鏁堥噺錛屽彇鍐充簬紜歡 錛忥紡錛忥紡錛忥紡錛忥紡錛忥紡錛忥紡錛忥紡錛忥紡錛忥紡錛忥紡錛忥紡錛忥紡錛忥紡錛忥紡錛忥紡錛忥紡錛忥紡錛忥紡錛忥紡 鍙︼細FSOUND_PlaySoundEx 渚嬪錛?/p> channel = FSOUND_PlaySoundEx(FSOUND_FREE, samp2, NULL, TRUE); 浠ヤ笅鏄鍑芥暟鐨勮緇嗚祫鏂?/p> 錛忥紡錛忥紡錛忥紡錛忥紡錛忥紡錛忥紡錛忥紡錛忥紡錛忥紡錛忥紡錛忥紡錛忥紡錛忥紡錛忥紡錛忥紡 Extended featured version of FSOUND_PlaySound. 錛忥紡FSOUND_PlaySound鐨勬墿灞曠増鏈?br />New functionality includes the ability to start the sound paused. 錛忥紡鏂板嚱鏁板寘鍚紑濮嬪0闊蟲殏鍋滅殑鍔熻兘銆?br />This allows attributes of a channel to be set
freely before the sound actually starts playing, until
FSOUND_SetPaused(FALSE) is used. 錛忥紡榪欎釜閫氶亾鍏佽灞炴у湪澹伴煶鐪熸鎾斁鍓嶈璁句負鑷敱銆傜洿鍒頒嬌鐢‵SOUND_SetPaused(FALSE)銆?br />Also added is the ability to associate the channel to a specified DSP unit. 錛忥紡鍚屾牱澧炲姞浜嗗垎閰嶉氶亾鍒頒竴涓寚瀹氾激錛籌及鍗曞厓鐨勫姛鑳姐?/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). 錛忥紡鍏佽鐢ㄦ埛鎶?'group' 閫氶亾鍒嗗埌鍙互鎶婃晥鏋滄彃鍏ヨ繖浜?group' 涓殑錛わ汲錛板崟鍏冧腑錛屽厑璁稿儚鏈変竴緇勬箍澹板拰鍙︿竴緇勫共澹版槑閫氶亾鐨勫悇縐嶆柟寮忋?/p> This is useful to seperate things like music from being affected by DSP effects, while other sound effects are. int F_API FSOUND_PlaySoundEx( On success, the channel handle that was selected is returned. FSOUND_ALL is supported. Passing this will cause ALL channels to play. (note this could make things VERY noisy!)錛忥紡鍚屼笂 錛忥紡鍚屼笂 錛忥紡濡傛灉浣犳妸涓涓0闊抽檮鍔犲湪涓涓激錛籌及鍗曞厓涓婏紝錛わ汲錛板崟鍏冪殑鍥炶皟灝嗕細琚玣mod鐨勫唴鍦ㄦ販鍚堝洖璋冭鐩栵紝鎵浠ョ敤鎴鋒彁渚涚殑鍥炶皟浼氫綔搴熷拰涓嶈璋冪敤錛屽悓鏃訛紝涓嶆妸澹伴煶闄勫姞鍦ㄧ郴緇燂激錛籌及鍗曞厓錛岃繖涓換鍔″皢浼氬拷鐣ャ?/p> 錛忥紡錛忥紡錛忥紡錛忥紡錛忥紡錛忥紡錛忥紡錛忥紡錛忥紡錛忥紡錛忥紡錛忥紡錛忥紡錛忥紡錛忥紡錛忥紡錛忥紡錛忥紡 錛c?strong>FSOUND_Stream_Play 渚嬪瓙錛欶SOUND_Stream_Play(FSOUND_FREE, stream) 浠ヤ笅鏄鍑芥暟鐨勮緇嗚鏄?/strong> 錛忥紡錛忥紡錛忥紡錛忥紡錛忥紡錛忥紡錛忥紡錛忥紡錛忥紡錛忥紡錛忥紡錛忥紡錛忥紡錛忥紡錛忥紡 Starts a pre-opened stream playing. int F_API FSOUND_Stream_Play( On success, the channel handle the stream is playing in is returned. When a stream starts to play, it inherits a special high priority (256). 錛忥紡褰撲竴涓猻tream寮濮嬫挱鏀炬椂錛屽畠緇ф壙涓涓壒鍒珮鐨勪紭鍏堟潈錛堬紥錛曪紪錛夈?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. 錛忥紡褰撶敤鎴鋒病鏈夎緗竴涓綆浜?56鐨勬甯鎬紭鍏堟潈鏃訛紝瀹冧笉鑳借鍏朵粬澹版晥閫氶亾浠ユ甯告柟寮忔嫆緇濄?br />-------------- 錛忥紡鍚屽墠 錛忥紡濡傛灉浣犺皟鐢‵SOUND_SetPan錛孎SOUND_STEREOPAN浼氳鎺ㄨ崘緇欑珛浣撳0銆備粬鍙互鎶婂乏鍙沖0閬撻兘璋冧負鏈澶ч煶閲忋? 錛忥紡鐩稿弽涓涓甯竝an浼氬甫涓鍗婇煶閲忕粰宸﹀拰鍙熾傛煡鐪婩SOUND_SetPan 鍘諱簡瑙f洿澶氫俊鎭?br />-------------- 錛忥紡浣犲彲浠ョ敤姝e父閫氶亾鐨勫熀鏈懡浠ゅ埌榪斿洖鍙ユ焺涓婏紝褰撳畠鏄竴涓氶亾鍙ユ焺鏃?/p> 鍙︼細FSOUND_Stream_PlayEx 渚嬪錛毬?channel = FSOUND_Stream_PlayEx(FSOUND_FREE, stream, NULL, TRUE); 浠ヤ笅鏄鍑芥暟鐨勮緇嗚鏄?/strong> 錛忥紡錛忥紡錛忥紡錛忥紡錛忥紡錛忥紡錛忥紡錛忥紡錛忥紡錛忥紡錛忥紡錛?/strong> Extended featured version of FSOUND_Stream_Play. int F_API FSOUND_Stream_PlayEx( On success, a channel handle the stream is playing in is returned. When a stream starts to play, it inherits a special high priority (256). 錛忥紡鍚屼笂 錛忥紡鍚屼笂 錛忥紡鍚屼笂FMUSIC_PlaySong
FMUSIC_MODULE *mod
);Parameters
mod Pointer to the song to be played.
錛忥紡瑕佹挱鏀炬瓕鏇叉寚閽?/td>Return Value
FALSE song failed playingFSOUND_PlaySound
and pan settings.
錛忥紡鐢ㄤ竴涓寚瀹氶氶亾鏉ユ挱鏀句緥瀛愶紝浣跨敤榛樿鐨勯鐜囷紝闊抽噺錛宲an璁劇疆
int channel,
FSOUND_SAMPLE *sptr
);Parameters
channel
The absolute channel number in the channel pool.
You cannot play a software sample on a hardware channel and vice versa.
Chooses a free channel to play in.
selects a channel with a sample playing that has an EQUAL or LOWER priority
than the sample to be played.
Passing this will cause ALL channels to play. (note this will make things
VERY noisy!)
錛忥紡濡傛灉浣跨敤鐨勬槸FSOUND_ALL 錛岃繑鍥炵殑浼氭槸鏈鍚庝竴涓氶亾鐨勬垚鍔熸爣蹇椼?/p>sptr Pointer to the sample to be played.
錛忥紡瑕佹挱鏀句緥瀛愮殑鎸囬拡Return Value
On failure, -1 is returned.Remarks
are set to those of the listener.
from the sample's default volume, frequency, pan etc.
The channel handle :
The return value is reference counted. This stops the user from updating a stolen channel.
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.
This is great if you have sounds being updated from tasks and you just forget about it.
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!!!
The lower 12 bits contain the channel number. (yes this means a 4096 channel limit for FMOD :)
The upper 19 bits contain the reference count.
The top 1 bit is the sign bit.
ie
S RRRRRRRRRRRRRRRRRRR CCCCCCCCCCCC
----------
Remember if not using FSOUND_FREE, then the channel pool is split up into software and hardware channels.
Hardware channels occupy the next n indicies after this, and can be a variable amount, depending on the hardware.
Use FSOUND_GetNumHardwareChannels to query how many channels are available in hardware.
錛忥紡鍙互浣跨敤FSOUND_GetNumHardwareChannels 鍘昏川闂湁澶氬皯閫氶亾鍦ㄧ‖浠朵腑鏈夋晥銆?/p>FSOUND_PlaySoundEx
錛忥紡閫氬父鎶婂闊充箰鐨勪笢瑗夸粠錛わ汲錛版晥鏋滃垎紱匯?/p>
int channel,
FSOUND_SAMPLE *sptr,
FSOUND_DSPUNIT *dspunit,
signed char startpaused
);Parameters
channel 0+
The absolute channel number in the channel pool.
Remember software channels come first, followed by hardware channels.
You cannot play a software sample on a hardware channel and vice versa.
FSOUND_FREE
Chooses a free channel to play in. If all channels are used then it
selects a channel with a sample playing that has an EQUAL or LOWER priority
than the sample to be played.
FSOUND_ALL
Plays the sound on all channels.
錛忥紡鍚屼笂sptr Pointer to the sample to be played.
錛忥紡鍚屼笂dspunit 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.
錛忥紡鍙夈傞粯璁や負絀恒傛妸涓涓猟sp鍗曞厓闄勫姞鍦ㄩ氶亾涓婄殑鎸囬拡銆傚彧鏈夋妸澹伴煶闄勫姞鍦ㄤ竴涓敤鎴瘋嚜寤篋SP鍗曞厓錛屼笉鏄竴涓郴緇燂激錛籌及鍗曞厓銆?/td>paused Start the sound paused or not. Pausing the sound allows attributes to be set before the sound starts.
錛忥紡鏄惁寮濮嬪0闊蟲殏鍋溿傚湪澹伴煶寮濮嬩箣鍓嶅彲浠ヨ緗槸鍚﹀厑璁告殏鍋溿?/td>Return Value
On failure, -1 is returned.Remarks
If
FSOUND_ALL is used the last channel success flag will be returned. This
return value is not useful in most circumstances.錛忥紡濡傛灉鏄嬌鐢‵SOUND_ALL
錛岃繑鍥炵殑鏄渶鍚庨氶亾鍊箋傝繑鍥炲煎湪澶у鎯呭喌涓嬮兘娌℃湁鐢ㄣ?br />----------
The channel handle :
The return value is reference counted. This stops the user from updating a stolen channel.
This 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.
This is great if you have sounds being updated from tasks and you just forget about it.
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!!!
The lower 12 bits contain the channel number. (yes this means a 4096 channel limit for FMOD :)
The upper 19 bits contain the reference count.
The top 1 bit is the sign bit.
ie
S RRRRRRRRRRRRRRRRRRR CCCCCCCCCCCC
----------
Remember if not using FSOUND_FREE, then the channel pool is split up into software and hardware channels.
Software channels occupy the first n indicies specified by the value passed into FSOUND_Init.
Hardware channels occupy the next n indicies after this, and can be a variable amount, depending on the hardware.
Use FSOUND_GetNumHardwareChannels to query how many channels are available in hardware.
----------
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.
Also, do not attach sounds to system DSP units, the assignment will be ignored if you do.FSOUND_Stream_Play
int channel,
FSOUND_STREAM *stream
);Parameters
channel 0+ The channel index in the channel pool. This must not exceed the maximum number of channels allocated with FSOUND_Init
FSOUND_FREE
Chooses a free channel to play in. If all channels are used then it
selects a channel with a sample playing that has a lower priority than the
sample to be played.
錛忥紡鍚屼笂stream Pointer to the already opened stream to be played.
錛忥紡瑕佹挱鏀劇殑宸茬粡鎵撳紑鐨勬寚閽?/td>Return Value
On failure, -1 is returned.Remarks
If the stream has been opened with FSOUND_NONBLOCKING, this function will not succeed until the stream is ready.
--------------
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.
--------------
FSOUND_STEREOPAN is recommended for stereo
streams if you call FSOUND_SetPan. This puts the left and right channel
to full volume.
Otherwise a normal pan will give half volume for left and right. See FSOUND_SetPan for more information on this.
You can use normal channel based commands (such as FSOUND_SetVolume etc) on the return handle, as it is a channel handle.FSOUND_Stream_PlayEx
Added functionality includes the ability to start the stream paused. This allows attributes
of a stream channel to be set freely before the stream actually starts playing, until FSOUND_SetPaused(FALSE) is used.
Also added is the ability to associate the stream channel to a specified DSP unit. 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). This is useful to seperate things like music from being affected
by DSP effects, while other sound effects are.
錛忥紡鍚屼笂
int channel,
FSOUND_STREAM *stream,
FSOUND_DSPUNIT *dspunit,
signed char paused
);Parameters
channel 0+
The absolute channel number in the channel pool.
Remember software channels come first, followed by hardware channels.
You cannot play a software sample on a hardware channel and vice versa.
FSOUND_FREE
Chooses a free channel to play in. If all channels are used then it
selects a channel with a sample playing that has an EQUAL or LOWER priority
than the sample to be played.
錛忥紡鍚屼笂stream Pointer to the already opened stream to be played.
錛忥紡鍚屼笂dspunit Pointer to a dsp unit to attach the channel to.
錛忥紡鍚屼笂paused Start the stream paused or not. Pausing the stream channel allows attributes to be set before it is unpaused.
錛忥紡鍚屼笂Return Value
On failure, -1 is returned.Remarks
It cannot be rejected by other sound effect channels in the
normal fashion as the user can never set a priority above 255 normally.
--------
FSOUND_STEREOPAN is recommended for stereo
streams if you call FSOUND_SetPan. This puts the left and right channel
to full volume.
Otherwise a normal pan will give half volume for left and right. See FSOUND_SetPan for more information on this.
--------
You can use normal channel based commands (such as FSOUND_SetVolume etc) on the return handle, as it is a channel handle.
錛忥紡鍚屼笂
]]>
Email:eway365@hotmail.com
浠涔堟槸FMOD?
FMOD鏄竴涓潪甯哥畝鍗曢氱敤鐨刟udio寮曟搸,鍙互鍦╳indows,winCE,Linux,GameCube Xbox絳夊鉤鍙頒笂寰堝ソ榪愯.
FMOD鏄竴涓叡浜蔣浠?濡傛灉涓嶇敤浜庡晢涓氱敤閫斿彲浠ュ厤璐逛嬌鐢?鍟嗕笟鐢ㄩ旈渶瑕佷粯璐?00緹庨噾.璇︾粏鎯呭喌璇峰叧娉?a >www.fomod.org
涓嬭澆鍚庡皢fmod.dll鍜宖modvc.lib鍔犲叆浣犵殑宸ョ▼涓?騫跺紩鐢ㄥご鏂囦歡fmod.h
鍦ㄤ嬌鐢╢mod鎾叆闊充箰涔嬪墠,棣栧厛瑕佸垵濮嬪寲,浠g爜濡備笅:
FSOUND_Init(44100,32,0);
絎竴涓弬鏁頒負鍗曚箰杈撳嚭鐨剅ate,鍗曚綅涓鴻但鍏?鍦ㄨ繖閲屾垜浠緗負44100.
絎簩涓弬鏁頒負璁劇疆鏈澶х殑閫氶亾鏁伴噺
絎笁涓弬鏁?鍙互鎸囧畾涓浜涙爣璇?濡傛灉鎴戜滑鎯崇殑璇?榪欓噷鏆傛椂緗畠涓?.
濂戒簡,鐜板湪鎴戜滑鍑嗗寮濮嬫挱鏀懼崟涔愪簡,鍙疐MOD閬撳簳鏀寔浠涔堟牱鐨勫崟涔愭牸寮忓憿?
姝屾洸,閲囨牱鎴栨槸鏂囦歡嫻?song,sample and stream)?
FMOD灝嗗畠緇嗗垎鍦ㄤ袱涓狝PI涓?浠栦滑鍒嗗埆鏄疐SOUND鍜孎MUSIC
鎵鏈夌殑music濡?mod,s3m,xm,it,mid,rmi,sgt,fsb 閮介氳繃FMUSIC 榪欎釜API鏉ユ挱鏀?br />FSOUND API鏄彁渚涚粰鍘嬬緝鏍煎紡浣跨敤鐨?鏂囦歡涓鑸:wav,mp3,ogg,raw絳?br />榪欎簺鏍煎紡,浣犻兘鍙互閫氳繃鍒殑杞歡榪涜浜掔浉杞崲.
濡傛灉浣犺鎾斁鐨勫崟涔愭槸鍍忕偖寮瑰彂灝勪竴鏍風殑鐭皬鐨勫0闊?閭d箞浣犲彲浠ュ皢榪欎簺澹伴棿杞垚sample
Samples灝嗗湪鎾斁鍓嶅厛瑙e帇鍒板唴瀛?鑰屼笖鍙互澶氭鎾斁.
濡傛灉浣犺鎾斁鐨勬槸璞¤儗鏅煶涔愪竴鏍風殑杈冮暱鐨勯煶涔?浣犲彲浠ュ緱鍒拌繖涓煶涔愯漿鍖栦負嫻?榪欏皢瀵艱嚧
浣跨敤涓浜汣PU鍜屽唴瀛?鍥犱負鏂囦歡浠庣鐩樿鍙栫劧鍚庤漿鎴愭祦闇瑕佷竴涓繃紼?鍚屾椂闇瑕佹敞鎰忎竴鐐?鍦?br />鍚屼竴鏃墮棿涓嶈兘澶氭鎾斁
FMUSIC:
鐢‵MUSIC鎾斁闇瑕佷竴涓猦andle,鐪嬪涓嬩唬鐮?
handle = FMUSIC_LoadSong("YourFileName");
FMUSIC_PlaySong(handle);
鐜板湪浣犲彲鑳芥敞鎰忓埌,鍑犱箮姣忎釜function鐨勭涓涓弬鏁伴兘闇瑕佷竴涓猦andle;
璁劇疆鍗曢噺
FMUSIC_SetMasterVolume(handle,256);
256鏄渶楂橀煶,0琛ㄧず闈欓煶
鏆傚畾鍗曚箰
FMUSIC_SetPaused(handle,true);
FMUSIC_SetPaused(handle,false);
寰幆鎾斁
FMUSIC_SetLooping(handle,true);
鍋滄闊充箰
FMUSIC_StopSong(handle);
free鍐呭瓨
FMUSIC_FreeSong(handle);
涓涓緥瀛?
#include <conio.h>
#include "inc/fmod.h"
FMUSIC_MODULE* handle;
int main ()
{
聽// init FMOD sound system
聽FSOUND_Init (44100, 32, 0);
聽// load song
聽handle=FMUSIC_LoadSong ("canyon.mid");
聽// play song only once
聽// when you want to play a midi file you have to disable looping
聽// BEFORE playing the song else this command has no effect!
聽FMUSIC_SetLooping (handle, false);
聽// play song
聽FMUSIC_PlaySong (handle);
聽// wait until the users hits a key to end the app
聽while (!_kbhit())
聽{
聽}
聽//clean up
聽FMUSIC_FreeSong (handle);
聽FSOUND_Close();
}
涓嬮潰寮濮嬩粙緇岶SOUND
寰楀埌FSOUND鐨勫彞鏌?
handle = FSOUND_Sample_Load(0,"yourFileName",0,0,0);
FSOUND_PlaySound(0,handle);
榪欎簺闊蟲晥鍦ㄦ挱鏀懼墠灝嗚杞藉叆鍐呭瓨,鎵浠ュ彲鑳介渶瑕佷竴鐐圭偣鏃墮棿.
絎簩琛屽懡浠ょ殑絎竴涓弬鏁版槸鎾斁鏃朵嬌鐢ㄧ殑閫氶亾.
璁劇疆闊抽噺
FSOUND_SetVolume(handle,255);
255涓烘渶澶ч煶閲?0琛ㄧず闈欓煶
鏆傚仠闊充箰
FSOUND_SetPaused(handle,true);
FSOUND_SetPaused(handle,false);
鍋滄闊充箰
FSOUND_StopSound (handle);
娓呴櫎鍐呭瓨
FSOUND_Sample_Free(handle);
鐪嬩竴涓緥瀛?
#include <conio.h>
#include "inc/fmod.h"
FSOUND_SAMPLE* handle;
int main ()
{
聽// init FMOD sound system
聽FSOUND_Init (44100, 32, 0);
聽// load and play sample
聽handle=FSOUND_Sample_Load (0,"sample.mp3",0, 0, 0);
聽FSOUND_PlaySound (0,handle);
聽// wait until the users hits a key to end the app
聽while (!_kbhit())
聽{
聽}
聽// clean up
聽FSOUND_Sample_Free (handle);
聽FSOUND_Close();
}
Streams:
handle=FSOUND_Stream_Open("YourFileName",0, 0, 0);
FSOUND_Stream_Play (0,handle);
鍋滄闊充箰
FSOUND_Stream_Stop(handle);
娓呴櫎
FSOUND_Stream_Close(handle);
涓涓緥瀛?
#include <conio.h>
#include "inc/fmod.h"
FSOUND_STREAM* handle;
void main ()
{
聽//init FMOD sound system
聽FSOUND_Init (44100, 32, 0);
聽//load and play sample
聽handle=FSOUND_Stream_Open("sample.mp3",0, 0, 0);
聽FSOUND_Stream_Play (0,handle);
聽//wait until the users hits a key to end the app
聽while (!_kbhit())
聽{
聽}
聽//clean up
聽FSOUND_Stream_Close(handle);
聽FSOUND_Close();
}