Well, thanks to the newest update of WINE, I got VB6 running on Linux, so I decided to see if I could run my bot in the IDE. However, Quratz.dll, which I use to play sound effects, won't correctly register. What API/DLL/whatever do you all recommend for playing WAV and MIDI files? I somehow doubt MCI will work on Linux, but I suppose I could try...
Quote from: Andy on March 25, 2008, 05:34 PM
Well, thanks to the newest update of WINE, I got VB6 running on Linux, so I decided to see if I could run my bot in the IDE. However, Quratz.dll, which I use to play sound effects, won't correctly register. What API/DLL/whatever do you all recommend for playing WAV and MIDI files? I somehow doubt MCI will work on Linux, but I suppose I could try...
Quratz.dll? Uh, do you mean quartz.dll? and there is no reason why MCI shouldn't work: winmm.dll is right there too.
Ya, sorry. Not 100% awake today. I suppose MCI will work fine for sound effects... I really wish I could send data directly to the sound card, but whatever. Maybe I'll figure that out some day.
Quote from: Andy on March 25, 2008, 08:53 PM
Ya, sorry. Not 100% awake today. I suppose MCI will work fine for sound effects... I really wish I could send data directly to the sound card, but whatever. Maybe I'll figure that out some day.
IIRC, you can send/recv wave stream data with winmm.dll.
You can also do it with DX, was just the other week I wrote a vb6 app for a voice chat network with DX DirectSoundBuffer and DirectSoundCaptureBuffer objects
I've never learned to handle streaming data... It's been something I've been meaning to learn, so maybe I will for this...
http://source.winehq.org/WineAPI/winmm.html
http://msdn2.microsoft.com/en-us/library/ms712879(VS.85).aspx
Private Const SND_ASYNC = &H1
Private Const SND_FILENAME = &H20000
Private Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" (ByVal lpszName As String, _
ByVal hModule As Long, ByVal dwFlags As Long) As Long
Quote from: Andy on March 25, 2008, 08:53 PM
I really wish I could send data directly to the sound card, but whatever.
I don't think I'd want/trust a program on my computer that tried to directly access my hardware. I'd rather let my operating system and drivers handle that mess.
I know how to use winmm/mci, directshow, fmod, etc...
I just don't know which would be best for WINE compatibility...
Quote from: Andy on March 26, 2008, 05:00 AM
I just don't know which would be best for WINE compatibility...
Both quartz and winmm are supported by WINE, but I would personally go with winmm.dll--it seems to have more implemented.
quartz doesn't seem to be. Not only will the VB6 IDE not find it under References, but a compiled application won't run it.
My current media code is:
Option Explicit
Private mAud As IMediaControl
Private mVol As IBasicAudio
Private mPos As IMediaPosition
Private sAud As String
Private Sub ExtractFile(ByVal lID As Long, ByVal sType As String)
Dim bData() As Byte
Dim nFile As Integer
On Error GoTo Erred
bData = LoadResData(lID, sType)
nFile = FreeFile
If sType = "MIDI" Then
sAud = GetTempName("MID")
ElseIf sType = "WAVE" Then
sAud = GetTempName("WAV")
End If
Open sAud For Binary Access Write As #nFile
Put #nFile, , bData
Close #nFile
Exit Sub
Erred:
ErrorHandler "clsAudio", "ExtractFile"
Resume Next
End Sub
Public Function LoadFile(ByVal lID As Long, ByVal sType As String) As Boolean
On Error GoTo Erred
ExtractFile lID, sType
If ObjPtr(mAud) > 0 Then
On Error GoTo NoSound
mAud.RenderFile sAud
On Error GoTo Erred
Set mVol = mAud
Set mPos = mAud
LoadFile = True
Else
LoadFile = False
End If
Exit Function
Erred:
ErrorHandler "clsAudio", "LoadFile"
Resume Next
Exit Function
NoSound:
LoadFile = False
End Function
Public Sub mPlay()
On Error GoTo Erred
If ObjPtr(mAud) > 0 Then mAud.Run
Exit Sub
Erred:
ErrorHandler "clsAudio", "mPlay"
Resume Next
End Sub
Public Sub mStop()
On Error GoTo Erred
If ObjPtr(mAud) > 0 Then mAud.Stop
If ObjPtr(mPos) > 0 Then mPos.CurrentPosition = 0
Exit Sub
Erred:
ErrorHandler "clsAudio", "mStop"
Resume Next
End Sub
Public Property Get Volume() As Long
On Error GoTo Erred
If ObjPtr(mVol) > 0 Then Volume = mVol.Volume
Exit Property
Erred:
Volume = 0
End Property
Public Property Let Volume(ByVal lVal As Long)
On Error GoTo Erred
If ObjPtr(mVol) > 0 Then mVol.Volume = lVal
Exit Property
Erred:
Volume = 0
End Property
Private Sub Class_Initialize()
On Error GoTo Erred
Set mAud = New FilgraphManager
Exit Sub
Erred:
ErrorHandler "clsAudio", "Initialize"
Resume Next
End Sub
Private Sub Class_Terminate()
On Error GoTo Erred
If ObjPtr(mAud) > 0 Then Set mAud = Nothing
If ObjPtr(mVol) > 0 Then Set mVol = Nothing
If ObjPtr(mPos) > 0 Then Set mPos = Nothing
Kill sAud
Exit Sub
Erred:
ErrorHandler "clsAudio", "Terminate"
Resume Next
End Sub
I've tried both native and built in quartz.dlls and neither works. I'll switch to MCI i suppose.