#12000/11/8 23:38:38
Audio Xtra 测试报告
Audio Xtra 是一个可以使在Driector中,直接对硬盘进行录音和播放的插件,它支持Macintosh 的*.aif 和windows的*.wav的声音格式,及8bit和16bit的11kHz到44kHz的声音采样频率 。同时,在录音后可以实时的显示声音的声波震动的曲线图。在录音操作中,系统必须生成一个临时的文件。(所有的操作需要有声卡及话筒等录音设备)
基本操作:
1、setSoundType (instance, "file", string filePath, string playOrReco
rd )——指定音文件的路径和具体的操作(录音或播放)。
filePath: 完整的路径文件名
playOrRecord: 选择 "播放" 或 "录音"
Examples:
setSoundType(audioInstance,"file","C:\TEMP\NEWFILE.WAV","record")
setSoundType(audioInstance,"file",the moviePath & "SONG.AIF","play")
2、clearSoundType ( instance)——清除声音,如果你要在director中用“puppetsound”或“playfile”播放声音,先要清除Audio Xtra的声音。
Example:
clearSoundType(audioInstance)
3、play ( instance)——播放声音(必须先设置setSoundType )
Example:
on startTheSound
global audioInstance
set result = play(audioInstance)
if result < 0 then
-- 如果result的值大于0,说明有错误
alert "播放声音有错误"
end if
end
4、record ( instance)——录音(声音文件不能大于2G)
Example:
on startRecording
global audioInstance , isRecording
set err = record(audioInstance)
if err < 0 then
alert "A recording error occurred"
else
set isRecording = TRUE
go "RecordFrame"
end if
end
on exitFrame
-- loop on a frame while recording
global audioInstance, isRecording
if status(audioInstance) = 5 then
-- still recording
go the frame
else
if status(audioInstance) = 8 then
-- a recording error occurred
set err = getError(audioInstance)
put "Error " & err into field "Recording status"
end if
set isRecording = FALSE
go "RecordingOverFrame"
end if
end
5、stop ( instance)——停止播放或录音
Example:
stop(audioInstance)
6、pause ( instance)——暂停播放或录音
Example:
pause(audioInstance)
7、setSampleRate (instance, integer sampleRate )——设置采样频率
注意:你必须把采样频率转化为整数,如 11.025 kHZ = 11025 。如果没有设置,系统将以默 认的方式输出
Example:
-- This handler will set the sampling rate to the highest possible
-- for the current input device
on SetBestSampling
global audioInstance
-- A value of 0 indicates the best sampling rate possible
setSampleRate(audioInstance,0)
end
-- This handler will try to set the sampling rate to 44kHz and if
-- not available will set to 22kHz.
on Set44Sampling
global audioInstance
-- A value of 5 indicates 44kHz sampling
set err = setSampleRate(audioInstance,44100)
-- If 44kHz isn't supported, try to go to 22.050 kHz
if err = -225 then
set err = setSampleRate(audioInstance,22050)
-- If this doesn't work, we will set it to the highest
-- rate possible
if err = -225 then
setSampleRate(audioInstance,0)
end if
end if
end
测试版本为:3.1.2
问题:我个人的感觉,此插件相对比较稳定,支持最新的USB声卡,但会和有些ISA的声卡不兼容。