首页 > 学院 > 开发设计 > 正文

取得WAV文件信息

2019-11-18 17:37:20
字体:
来源:转载
供稿:网友
WAV文件基本信息包括如是否立体声,采样频率等。
声明:
PublicConstRIFF_ID=1179011410
PublicConstRIFF_WAVE=1163280727
PublicConstRIFF_FMT=544501094
'TypicalheaderofasimpleRIFFWAVEfile
PublicTypeWAVInfo
Riff_FormatAsLong
chunk_sizeAsLong
ChunkIDAsLongfmtAsLong
Wave_FormatAsInteger
ChannelsAsInteger'0=单声道,1=立体声
SamplesPerSecondAsLong
AverageBytesPerSecondAsLong'11.025kHz,22.05kHz,等
BlockAlignAsInteger'Sizeofblocksforlowlevelplayback
EndType
函数:
PublicFunctionGetWaveInfo(ByvalfilenameAsString,ByrefwAsWAVInfo)_
AsBoolean

DimffAsInteger
ff=FreeFile

OnErrorGoToehandler
OpenfilenameForBinaryaccessReadAs#ff

OnErrorGoToehandler_fo
Get#ff,,w
Close#ff

OnErrorGoToehandler

Ifw.Riff_Format=RIFF_IDAndw.ChunkID=_
RIFF_WAVEAndw.fmt=RIFF_FMTThen

GetWaveInfo=True
Else
GetWaveInfo=False
EndIf

ExitFunction

ehandler_fo:
Close#ff
ehandler:
GetWaveInfo=False
EndFunction->


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表