0
0

Hiya I have defined in my player a line of code which reads…

[code:2a2ba7se]
Private Const FSOUND_INIT_GPLAYER = FSOUND_INIT_GLOBALFOCUS Or FSOUND_INIT_ACCURATEVULEVELS
[/code:2a2ba7se]

I initialze fmod via the following

[code:2a2ba7se]
Call FSOUND_SetHWND(myHwnd)
Call FSOUND_SetOutput(gOutputType)
Call FSOUND_SetBufferSize(gBufferSize)
Call FSOUND_SetSpeakerMode(gSpeakerMode)

If FSOUND_Init(44100, gChannels, FSOUND_INIT_GPLAYER) = 0 Then
     Play = false
     call ShutDownFmod()

     Exit Function
End if

[/code:2a2ba7se]

Now its important to note that this works perfectly The sound plays, I see the specturm ect. However the following 2 things happen.
[b:2a2ba7se] [1][/b:2a2ba7se] If I play a module everything works PERFECTLY.
[b:2a2ba7se] [2][/b:2a2ba7se] If I play a stream the VU levels never work. If I remove the FSOUND_INIT_ACCURATEVULEVELS from my const it works.

Anyone got any idea wtf is going on?

++Cire.
[/list]

  • You must to post comments
0
0

I am using the following bit of code to play As you will notice I do use FSOUND_FREE, and I am testing my streams using MP3’s. Also I do use channel returns.

[code:1qzih0up]
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 = False

    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 = False
        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 = False
        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 = True

Exit Function
[/code:1qzih0up]

Note that I have defined FSOUND_GPLAYER as

[code:1qzih0up]
Private Const FSOUND_GPLAYER = FSOUND_LOOP_OFF Or FSOUND_8BITS Or FSOUND_STEREO
[/code:1qzih0up]

Finally in case you need it here is my VU reading function
[code:1qzih0up]
Public Function GetPeekVolume(ByRef LChan As Single, ByRef RChan As Single)
Dim i As Long
Dim X1 As Single
Dim X2 As Single

GetPeekVolume = 0#

If bolInited = False Or lngSongHandle = 0 Then Exit Function

If isStream = True Then
    Call FSOUND_GetCurrentLevels(lngChanHandle, LChan, RChan)
Else
    LChan = 0#
    RChan = 0#
    For i = 0 To NumChannels
        If FSOUND_IsPlaying(i) = 1 Then
            Call FSOUND_GetCurrentLevels(i, X1, X2)
            LChan = LChan + X1
            RChan = RChan + X2
        End If
    Next i
    If LChan > 1# Then LChan = 1#
    If RChan > 1# Then RChan = 1#
End If

End Function
[/code:1qzih0up]

Again thanks for all your help, I hope you can see my error as I’am at a loss.

++Cire.

  • You must to post comments
0
0

I was wondering if anyone else is having this problem via the flags I am initing my application with, or have you found anything conflicting Brett?

++Cire.

  • You must to post comments
0
0

I don’t use delphi, I am a visual basic/C++ programer. :)

++Cire.

  • You must to post comments
0
0

Yeah, that’d be VB code above. :)

  • You must to post comments
0
0

Streams work fine here with Global focus and accurate vu.
Have you tried debugging the line :
Call FSOUND_GetCurrentLevels(lngChanHandle, LChan, RChan)
And see if at that point lngChanHandle is a valid channel handle, and the values that LChan and RChan are after the call.

  • You must to post comments
Showing 5 results
Your Answer

Please first to submit.