取得WAV文件信息
2006-02-27 11:54:31 来源:WEB开发网核心提示:WAV文件基本信息包括如是否立体声,采样频率等,取得WAV文件信息,声明:PublicConstRIFF_ID=1179011410PublicConstRIFF_WAVE=1163280727PublicConstRIFF_FMT=544501094'TypicalheaderofasimpleRIFFWAV
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->
声明:
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->
[]
更多精彩
赞助商链接