Mail Archives: djgpp/1996/09/24/02:18:44
From: | takahiro AT ix DOT netcom DOT com (Takahiro Horie)
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | Using MikAllegro2.1 (doesn't play!)
|
Date: | 23 Sep 1996 16:16:45 GMT
|
Organization: | Netcom
|
Lines: | 87
|
Message-ID: | <526d5d$edv@dfw-ixnews9.ix.netcom.com>
|
NNTP-Posting-Host: | sjx-ca29-21.ix.netcom.com
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Thanks for looking at my query!
Dear Programmers,
I created a program named PLAYSONG.C and it compiled without
any errors. BUT, when I ran the program, I got a list of all
the samples, then was kicked out of the program without even
hearing one note of the music. Can anyone help?
-[invoked]-------------------------------------------------
gcc playsong.c liballeg.a
-[source]---------------------------------------------------
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <time.h>
#include <conio.h>
#include "allegro.h"
#include "mikmod.h"
#define SONG1 "synmagic.s3m"
UNIMOD *mf;
void tickhandler(void)
{
MP_HandleTick();
MD_SetBPM(mp_bpm);
}
void main(void)
{
md_mixfreq=22050;
md_dmabufsize=20000;
md_mode=1;
md_device=0;
ML_RegisterLoader(&load_uni);
MD_RegisterDriver(&drv_nos);
MD_RegisterDriver(&drv_sb);
MD_RegisterDriver(&drv_gus);
MD_RegisterPlayer(tickhandler); // what does this do anyways?
if(!MD_Init()) // init the sound
{
allegro_exit();
printf("Driver error: %s\n",myerr);
exit(1);
}
mf=ML_LoadFN(SONG1);
if(mf==NULL){
allegro_exit();
printf("Mikmod error: %s\n",myerr);
MD_Exit();
exit(1);
}
MP_Init(mf);
md_numchn=mf->numchn+4; // what does this command do?
MD_PlayStart();
readkey(); // wait until user presses a key
MD_PlayStop();
ML_Free(mf);
allegro_exit();
MD_Exit(); // get rid of all sounds
exit(0);
}
---------------------------------------------------------------
Sorry about the long source code! When the program is run, it
lists all of the instruments in the s3m file, pauses, then dumps
me out into dos with all the values of the registers. :(
What's wrong with the code?
Thanks in advance,
Takahiro Horie (takahiro AT ix DOT netcom DOT com)
- Raw text -