• Welcome to Valhalla Legends Archive.
 

Audio and WINE

Started by Barabajagal, March 25, 2008, 05:34 PM

Previous topic - Next topic

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...

brew

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.
<3 Zorm
Quote[01:08:05 AM] <@Zorm> haha, me get pussy? don't kid yourself quik
Scio te esse, sed quid sumne? :P

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.

Ringo

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

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...

NicoQwertyu

#5
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.

Barabajagal

I know how to use winmm/mci, directshow, fmod, etc...


I just don't know which would be best for WINE compatibility...


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:
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.