0
0

i use minifmod1.7 in my program and i did this(xm file was in the resource):

[code:1m6olzp7]#include <windows.h>

include "resource.h"

include "minifmod.h"

HINSTANCE hInst;

typedef struct
{
int length;
int pos;
void *data;
} MEMFILE;

unsigned int memopen(char *name)
{
MEMFILE *memfile;

memfile = (MEMFILE *)calloc(sizeof(MEMFILE),1);

{
HRSRC rec;
HGLOBAL handle;

  rec = FindResource(NULL, MAKEINTRESOURCE(IDR_MUSIC1),&quot;MUSIC&quot;); 

  handle = LoadResource(NULL, rec); 

  memfile-&gt;data = LockResource(handle); 
  memfile-&gt;length = SizeofResource(NULL, rec); 
  memfile-&gt;pos = 0; 

}

return (unsigned int)memfile;
}

void memclose(unsigned int handle)
{
MEMFILE *memfile = (MEMFILE *)handle;

free(memfile);
}

int memread(void *buffer, int size, unsigned int handle)
{
MEMFILE *memfile = (MEMFILE *)handle;

if (memfile->pos + size >= memfile->length)
size = memfile->length – memfile->pos;

memcpy(buffer, (char *)memfile->data+memfile->pos, size);
memfile->pos += size;

return size;
}

void memseek(unsigned int handle, int pos, signed char mode)
{
MEMFILE *memfile = (MEMFILE *)handle;

if (mode == SEEK_SET)
memfile->pos = pos;
else if (mode == SEEK_CUR)
memfile->pos += pos;
else if (mode == SEEK_END)
memfile->pos = memfile->length + pos;

if (memfile->pos > memfile->length)
memfile->pos = memfile->length;
}

int memtell(unsigned int handle)
{
MEMFILE *memfile = (MEMFILE *)handle;

return memfile->pos;
}[/code:1m6olzp7]

when play the xm file i used:

[code:1m6olzp7]
FSOUND_File_SetCallbacks(memopen, memclose, memread, memseek, memtell);
FMUSIC_PlaySong(FMUSIC_LoadSong(???,NULL));
[/code:1m6olzp7]

what should i replace the “???” :(

THX

  • You must to post comments
0
0

thx, but in my example, it should be what? please give me the code!

  • You must to post comments
0
0

I would also like to know what, can someone pls answer this.

  • You must to post comments
0
0

You pass it whatever your file open callback is expecting to receive.

  • You must to post comments
Showing 3 results
Your Answer

Please first to submit.