Author Topic: Playing tunes from the resource  (Read 3465 times)

!artem!

  • Guest
Playing tunes from the resource
« on: 18 Jun '11 - 16:08 »
I have to share some *. wav files
how to play a *. wav file located in the resource?

PS
I write with the aid of google translator, I'm sorry if there are errors

Ian @ un4seen

  • Administrator
  • Posts: 26173
Re: Playing tunes from the resource
« Reply #1 on: 20 Jun '11 - 15:34 »
You can use the FindResource and LoadResource functions to "load" the resource, and then use LockResource and SizeofResource to get the address and size of it, which you can then use in a BASS_StreamCreateFile call. Something like this...

Code: [Select]
HRSRC rsrc=FindResource(NULL, resourcename, RT_RCDATA);
HGLOBAL global=LoadResource(NULL, rsrc);
HSTREAM stream=BASS_StreamCreateFile(TRUE, LockResource(global), 0, SizeofResource(NULL, rsrc), 0);
BASS_ChannelPlay(stream, FALSE);