'======================================================
'设置声道
'======================================================
public function setaudiosource(saudiosource as audiosource) as boolean
dim refint as long
dim strsource as string
select case saudiosource
case 1: strsource = "left"
case 2: strsource = "right"
case 0: strsource = "stereo"
end select
setaudiosource = false
refint = mcisendstring("setaudio nowmusic source to " & strsource, vbnull, 0, 0)
if refint = 0 then setaudiosource = true
end function
'======================================================
'全屏播放
'======================================================
public function playfullscreen() as boolean
dim refint as long
playfullscreen = false
refint = mcisendstring("play nowmusic fullscreen", vbnull, 0, 0)
if refint = 0 then playfullscreen = true
end function
'=====================================================
'设置声音大小
'=====================================================
public function setvolume(volume as long) as boolean
dim refint as long
setvolume = false
refint = mcisendstring("setaudio nowmusic volume to " & volume, vbnull, 0, 0)
if refint = 0 then setvolume = true
end function
'=====================================================
'设置播放速度
'=====================================================
public function setspeed(speed as long) as boolean
dim refint as long
setspeed = false
refint = mcisendstring("set nowmusic speed " & speed, vbnull, 0, 0)
if refint = 0 then setspeed = true
end function
'====================================================
'静音true为静音,false为取消静音
'====================================================
public function setaudioonoff(audiooff as boolean) as boolean
dim refint as long
dim onoff as string
setaudiooff = false
if audiooff then onoff = "off" else onoff = "on"
refint = mcisendstring("setaudio nowmusic " & onoff, vbnull, 0, 0)
if refint = 0 then setaudiooff = true
end function
'====================================================
'是否有画面true为有,false为取消
'====================================================
public function setwindowshow(windowoff as boolean) as boolean
dim refint as long
dim onoff as string
setwindowshow = false
if windowoff then onoff = "show" else onoff = "hide"
refint = mcisendstring("window nowmusic state " & onoff, vbnull, 0, 0)
if refint = 0 then setwindowshow = true
end function
'====================================================
'获得当前媒体的状态是不是在播放
'====================================================
public function isplaying() as boolean
dim sl as string * 255
mcisendstring "status nowmusic mode", sl, len(sl), 0
if left(sl, 7) = "playing" or left(sl, 2) = "播放" then
isplaying = true
else
isplaying = false
end if
end function
'====================================================
'获得播放窗口的handle
'====================================================
public function getwindowhandle() as long
dim refstr as string * 160
mcisendstring "status nowmusic window handle", refstr, 80, 0
getwindowhandle = val(refstr)
end function
'====================================================
'获取deviceid
'====================================================
public function getdeviceid() as long
getdeviceid = mcigetdeviceid("nowmusic")
end function