Valhalla Legends Forums Archive | Visual Basic Programming | Audio and WINE

AuthorMessageTime
Barabajagal
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...
March 25, 2008, 10:34 PM
BreW
[quote author=Andy link=topic=17410.msg177269#msg177269 date=1206484473]
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]
Quratz.dll? Uh, do you mean quartz.dll? and there is no reason why MCI shouldn't work: winmm.dll is right there too.
March 26, 2008, 12:20 AM
Barabajagal
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.
March 26, 2008, 1:53 AM
Ringo
[quote author=Andy link=topic=17410.msg177273#msg177273 date=1206496399]
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]
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
March 26, 2008, 2:21 AM
Barabajagal
I've never learned to handle streaming data... It's been something I've been meaning to learn, so maybe I will for this...
March 26, 2008, 3:05 AM
NicoQwertyu
http://source.winehq.org/WineAPI/winmm.html
http://msdn2.microsoft.com/en-us/library/ms712879(VS.85).aspx
[code]
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
[/code][quote author=Andy link=topic=17410.msg177273#msg177273 date=1206496399]
I really wish I could send data directly to the sound card, but whatever.
[/quote]
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.
March 26, 2008, 3:30 AM
Barabajagal
I know how to use winmm/mci, directshow, fmod, etc...


I just don't know which would be best for WINE compatibility...
March 26, 2008, 10:00 AM
NicoQwertyu
[quote author=Andy link=topic=17410.msg177279#msg177279 date=1206525647]
I just don't know which would be best for WINE compatibility...
[/quote]

Both quartz and winmm are supported by WINE, but I would personally go with winmm.dll--it seems to have more implemented.
March 26, 2008, 5:59 PM
Barabajagal
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:
[code]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[/code]

I've tried both native and built in quartz.dlls and neither works. I'll switch to MCI i suppose.
March 27, 2008, 1:27 AM

Search