0
0

Are there any function to load a song from the resource in minifmod… maybe someone have remade the lib with that support?!
any clues?!

or are there any other xm libs with that support and without DLL.

  • You must to post comments
0
0

Tell me how you did it. please =)

  • You must to post comments
0
0

Well not sure this will help, but in VB somtimes i need to store jpg’s and what not into a resrouce file. As we all know BMP’s are quite large so I prefer something smaller and what not such as jpg, or png, ect…

Anyhow the problem is that in order to add these formats i need to add them as a binary data file, which of course does not allow me to them into a pictures property. So I get around it by litterlly writting the file to a temp path reading it and then killing it.

I see no reason why this could not be modified to work for you.

Here is my source snip, hope it helps.

<pre>
Public Function LoadPictureResource(ByVal ResourceID As String, ByVal sResourceType As String) As Picture
On Error Resume Next

Dim sFileName           As String
Dim bytResourceData()   As Byte
Dim iFileNumOut         As Integer

sFileName = strPath & "x.jpg"
Kill sFileName

bytResourceData = LoadResData(ResourceID, sResourceType)

iFileNumOut = FreeFile
Open sFileName For Binary Access Write As #iFileNumOut
    Put #iFileNumOut, , bytResourceData
Close #iFileNumOut

Set LoadPictureResource = LoadPicture(sFileName)

Kill sFileName

On Error GoTo 0

End Function
</pre>

  • You must to post comments
0
0

… thanks man… i havn´t thought like that… but it´s smart… :smile:

Iám in C++, but i´ll try to figure your code…

  • You must to post comments
0
0

Andy andy..

Do yourself a favour and check out the bloody source code! Theres an example of loading a song from a resource if you look close enough.. Kids today.. I dunno……

  • You must to post comments
0
0

Who want to use minifmod when you can use Tinnitus(TM) (uses FMOD, but need to be haxxored to dsound for intros)

  • You must to post comments
0
0

hums.

your sound system left ringing in my ears!!!

  • You must to post comments
0
0

Hey,

sure u can load with MiniFmod (memory).
first thing, u need “Bin2C.exe”
this utile will create for u a *.h file of ur xm sound.
that means it will translate it to HEX values.
next u can use Fexp.exe to optimize effects.h of the original miniFmod that include, optimization is only for the created *.h file with bin2c.
next that u have the let say “music.h” (ya u created that with: “bin2c *.xm music music” command line).
next of course u need to implemnt the MiniFmod source that came with the zip from Fmod.org.
than well, u need to change some code around to make a new memory loading c file (edit copy etc from the source).
than what u do is to add the music.h to ur resource (vc): insert->resouce->import
find u file and add it, call the reource XM or something ;P
once its added u need to load that file from resource straight to memory:
let say u have “play button” u use this code:
if (mod == NULL)
{ loadmusic();
FSOUND_Init(44100, 0);
mod = FMUSIC_LoadSong(NULL, NULL);
FMUSIC_PlaySong(mod);
}

now, as i said the “loadmusic.c” u need to create (copy and paste from the open source of minifmod, the memory load/read etc functions), also include the “music.h” in the header (#include music.h) and edit the code to read from it (in the memopen function).
now if everything goes ok, u have a loaded xm file playing from resource, with no dlls what so ever.
and for Stoping the file to play use this code :
if (mod != NULL)
{
FMUSIC_FreeSong(mod);
FSOUND_Close();
mod=NULL;
}
* if u wont use that code for loading/playing u will face serious crashes over xp :smile:

few words:
bin2c will take x file and will generate an hex values, and it will increase size:
20k xm file -> 140 *.h file.
but with upx/aspack u can minimize and compress the exe files :smile:

i hope everything is kinda clear now as u got alittle more backround on how to use minifmod with no dlls and loading from resource.

cya, Ben

<font size=-1>[ This Message was edited by: Bengaly on 2002-03-13 04:15 ]</font>

  • You must to post comments
0
0

mmhh it didn’t work for me … The FindResource return me always 0, but why ? I ve converted an xm file to hex with bin2c (sound.h), added it as a resource file ( new type “song” –> IDR_SONG1 ), added #include “sound.h” to my main file, called LoadSong with NULL parameters and FindResource with :

rec = FindResource(NULL, MAKEINTRESOURCE(IDR_SONG1), RT_RCDATA);

I ve also tested with reading the file as a raw file :

  int x;
memfile-&gt;length = SOUND_LEN; // SOUND_LEN = 18947
memfile-&gt;data = calloc(memfile-&gt;length,1);
memfile-&gt;pos = 0;
for (x= 0; x &lt; SOUND_LEN; x++)
    memfile-&gt;data = &sound[x]; // sound is an array of static char representing raw data of the music

Where i am wrong ?? U ll be very helpfull if you find a solution …
Thanx in advance 😉

  • You must to post comments
0
0

Oups, sorry ! It was a KarLKoX’s bug and not MiniFmod’s one, now it works great ! And without converting to hex, directly from the ressource like any other app :smile:
C rulez for ever ! Win32 Api must go to hell !!!

  • You must to post comments
Showing 9 results
Your Answer

Please first to submit.