Mail Archives: djgpp/1997/04/02/10:03:05
Here ya go:
#include <...stdstuff....h>
#include "mikmod.h"
void ticker(void)
{
	MP_HandleTick();
	MD_SetBPM(mp_bpm);
}
int main(void)
{
	UNIMOD *modfile;
	md_mixfreq=44100;		//check the readme's
	md_dmabufsize=20000;		//same here!
	md_mode=7;			//16bit,stereo,interp
	md_device=0			//autodetect
	ML_RegisterLoader(&load_xm);
	MD_RegisterDriver(&drv_sb);	//i am assuming soundblaster
	MD_RegisterPlayer(ticker);	//control timing of playback
	assert(MD_Init()!=NULL);
	modfile=MF_LoadFN("yourmusic.xm");
	assert(modfile!=NULL);
	MP_Init(modfile);
	md_numchn=modfile->numchn;
	MD_PlayStart();
	while(!MP_Ready())
		MD_Update();
	MD_PlayStop();
	ML_Free(modfile);
	MD_Exit()
	return 0;
}
This will work.  If you have anymore questions, mail me.  I have torn
apart Mikmod a lot trying to figure out everything.
cya,
Patrick
On 2 Apr 1997, Stefan Braunewell wrote:
> I have been looking at the MikMod library for DJGPP and could just not
> figure out how to put a _really_ simple xm-player routine in a program.
> Have I missed some kind of an explanation file for this library (I know the
> mloader, mplayer, etc. text files) ?
> 
> I would be very thankful if somebody here could either tell me a place to
> find a tutorial or write down the source-code that I need to implement.
> 
> This is what I want to do:
> 
> - Load one specific file (I don't need any user-input, just a file that I
> specify in the code)
>   in xm-format (mod or uni would be all right too, but it shouldn't make a
> difference anyway, should it?)
> 
> - Play it.
> 
> How do I do it?
> 
> 
> Greetings,
> 
> 
> Stefan Braunewell
> 
---------------------------------------------------------------------------
Patrick         email:                      url:
Jenkins         pjenki1 AT gl DOT umbc DOT edu         http://www.gl.umbc.edu/~pjenki1
---------------------------------------------------------------------------
- Raw text -