0
0

I can’t get this thing to work. I’m sure I’m doing something very obvious wrong, but I can’t figure out what; Any help?

Dim btFile() As Byte
Dim stream As Long
Dim channel As Long

Private Sub Form_Load()

FSOUND_SetOutput FSOUND_OUTPUT_DSOUND
FSOUND_SetDriver 0
FSOUND_SetMixer FSOUND_MIXER_QUALITY_AUTODETECT

If FSOUND_Init(44100, 32, FSOUND_INIT_GLOBALFOCUS) > 0 Then
    ReadFile AppPath & File
    stream = FSOUND_Stream_OpenFile(VarPtr(btFile(0)), FSOUND_LOADMEMORY Or FSOUND_2D, 1024) 'I'm not really sure about this value, I just put something that sounded nice, I also tried Ubound(btFile)
    'stream = FSOUND_Stream_OpenFile(AppPath & File, FSOUND_16BITS, 0) 'This one does work
    Debug.Print "Stream" & stream
    channel = FSOUND_Stream_Play(FSOUND_FREE, stream)
    Debug.Print "Channel" & channel 'always returns -1
End If

End Sub

Private Sub ReadFile(filename As String)
Dim filenr As Integer

filenr = FreeFile

Open filename For Binary As #filenr

ReDim btFile(LOF(filenr) - 1)
Get #filenr, , btFile
Close #filenr

End Sub

Thanks

  • You must to post comments
0
0

Apparently the memlength for FSOUND_Stream_OpenFile should be Ubound(btFile)+1, just so that you don’t suggest that,…because it still won’t play.

  • You must to post comments
0
0

Sorry to bump this, but I still can’t get it to work, and I really need it…

  • You must to post comments
0
0

Maybe I should just register so that I can edit my posts…anyway:

Any working example of an mp3 playing from memory would also be great.

  • You must to post comments
0
0

Store the length of the file into another variable and pass that as the last parameter to FSOUND_Stream_OpenFile.

  • You must to post comments
0
0

[quote="Sly":2o87cubz]Store the length of the file into another variable and pass that as the last parameter to FSOUND_Stream_OpenFile.[/quote:2o87cubz]

That should be the same value as the Ubound of my ByteArray +1…
I tried it anyway, but it didn’t change anything.

  • You must to post comments
0
0

OK, I found it, and it was fairly obvious: my Byte Array wasn’t public.

  • You must to post comments
Showing 6 results
Your Answer

Please first to submit.