#~module AudioEx
#--------------------------------------------------------------------------
# ● 发送 open 命令,从文件打开一个设备
# device : 设备名称(标识)
# filename : 文件路径
#--------------------------------------------------------------------------
def self.open(device, filename)
error = $mciSendString.call("open \"#{filename}\" type mpegvideo alias #{device} wait".to_unicode, 0, 0, 0)
raise AudioExException.new(error) if error != 0
set(device, "time format milliseconds")
# 准备播放
cue(device)
end
#~module AudioEx
#--------------------------------------------------------------------------
# ● 发送 open 命令,从文件打开一个设备
# device : 设备名称(标识)
# filename : 文件路径
#--------------------------------------------------------------------------
def self.open(device, filename)
error = $mciSendString.call("open \"#{filename}\" type mpegvideo alias #{device} wait".to_unicode, 0, 0, 0)
raise AudioExException.new(error) if error != 0
set(device, "time format milliseconds")
# 准备播放
cue(device)
end