I tried initializing FMOD with the FSOUND_INIT_GLOBALFOCUS flag in FSOUND_Init() function from VB6, and then open a file (stream) using FSOUND_HW2D and FSOUND_ENABLEFX flags…for using DX8 FX in VB. However, the effects work properly but FSOUND_INIT_GLOBALFOCUS does not. As soon as focus to the form is lost…the sound is mute. Please help…
- Anonymous asked 15 years ago
hmm ok whats wrong with this brett, i’am sure it should work but again, my vu readings are null when using streams
Public Const FSOUND_INIT_GPLAYER = FSOUND_INIT_ACCURATEGETCURRENTVU Or FSOUND_INIT_GLOBALFOCUS
public const FSOUND_GPLAYER = FSOUND_LOOP_OFF Or FSOUND_8BITS Or FSOUND_STEREO
Public Function Play(ByVal bolWithFFT As Boolean, ByVal strfilename As String) As String
Dim x As Long
If ReadInitData(strfilename, isStream, IsMod, strSongAuthor, strSongName, _ NumChannels, SongLenghtInMS, SongLenghtInBytes, KBPS, songType, _ BPM, Speed) = False Then Play = "Fail:ReadInitData" Exit Function End If If bolInited = True Then StopPlaying Call FSOUND_SetHWND(Form1.hwnd) Call FSOUND_SetOutput(FSOUND_OUTPUT_DSOUND) Call FSOUND_SetBufferSize(200)
‘ Call FSOUND_SetSpeakerMode(FSOUND_SPEAKERMODE_HEADPHONE)
If FSOUND_Init(44100, NumChannels, FSOUND_INIT_GPLAYER) = 0 Then Play = "Fail:Init Fmod" Exit Function End If bolInited = True If isStream = True Then lngSongHandle = FSOUND_Stream_OpenFile(strfilename, FSOUND_GPLAYER, 0) Else lngSongHandle = FMUSIC_LoadSong(strfilename) End If If lngSongHandle = 0 Then Play = "Fail:Open" bolInited = False Call FSOUND_Close Exit Function End If If isStream = True Then lngChanHandle = FSOUND_Stream_PlayEx(FSOUND_FREE, lngSongHandle, 0, 1) If lngChanHandle = -1 Then Call FSOUND_Stream_Stop(lngChanHandle) Call FSOUND_Stream_Close(lngChanHandle) Call FSOUND_Close bolInited = False Play = "Fail:PlayEx" Exit Function Else Call FSOUND_SetPaused(lngChanHandle, 0) End If Else If Not FMUSIC_PlaySong(lngSongHandle) = 1 Then Call FMUSIC_StopSong(lngSongHandle) Call FMUSIC_FreeSong(lngSongHandle) Call FSOUND_Close Play = "Fail:PlaySong" bolInited = False Exit Function End If End If If isStream = True Then Call FSOUND_SetVolume(FSOUND_ALL, MasterVolume) Else Call FMUSIC_SetMasterVolume(lngSongHandle, MasterVolume) End If If IsMod = True Then Call FMUSIC_SetPanSeperation(lngSongHandle, 1#) If bolWithFFT = True Then Call FSOUND_DSP_SetActive(FSOUND_DSP_GetFFTUnit(), 1) Call SetPan(PanLevel) Play = "Success"
I’am sure i’am doing everything right, i’am not using FX, and yet when i init with accurate VU flag, it kills the VU. I am uinsg that patched dll that you posted above.
I initialize fmod in my programs with
result = FSOUND_Init(44100, 16, FSOUND_INIT_ACCURATEGETCURRENTVU Or FSOUND_INIT_GLOBALFOCUS)
and globalfocus seems to work.
I don’t use effects though, so maybe you didn’t use Or between them or something like that?
- Adion answered 15 years ago
Hey…as u told Adion, I tried out without effects…and it works fine. The moment I enable the effects…FSOUND_INIT_GLOBALFOCUS stops working and the sound mutes as soon as focus is lost. I think there is some problem in FMod with FSOUND_ENABLEFX flag using in FSOUND_Stream_OpenFile() function.
I’ve tried using the new dll, and whenever i or the FSOUND_INIT_ACCURATEGETCURRENTVU into my init flags it completly stops me from getting a VU reading, they always default as 0.0. Everything works great, even FX’s, but like I said any calls to FSOUND_GetCurrentVU (on streams) stop returning VU readings, oddly enough on mods, xm’s, its’ the VU reading is returned correctly.
I have tried opening streams with FSOUND_NORMAL or FSOUND_2D as well as FSOUND_LOOP_OFF Or FSOUND_8BITS Or FSOUND_STEREO Or FSOUND_HW2D
Any ideas, i’am completly stumped.
Please login first to submit.