changeset 16:e5529b6e3b1c

Inistal commit of the Cheesy Mod Player (tm)
author darius
date Thu, 23 Apr 1998 07:35:49 +0000
parents ca72d2b59bf4
children 80fa6dd10e14
files frontend/Makefile frontend/mikmodux.c frontend/mikmodux.h
diffstat 3 files changed, 226 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/frontend/Makefile	Thu Apr 23 07:35:49 1998 +0000
@@ -0,0 +1,18 @@
+#OBJS = mikmodux.o mlist.o display.o marchive.o
+OBJS = mikmodux.o mlist.o
+LIBDIR = ../lib
+INCLUDEDIR = ../include
+
+CFLAGS = -g -I$(INCLUDEDIR)
+
+mikmod: $(OBJS) $(LIBDIR)/libmikmod.a $(LIBDIR)/libmmio.a
+	gcc -o mikmod $(OBJS) -L$(LIBDIR) -lmikmod -lmmio -lncurses
+
+mikmodux.o: mikmodux.c
+	gcc -c -o mikmodux.o $(CFLAGS) mikmodux.c
+
+mlist.o: mlist.c
+	gcc -c -o mlist.o $(CFLAGS) mlist.c
+
+clean: 
+	rm $(OBJS) mikmod
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/frontend/mikmodux.c	Thu Apr 23 07:35:49 1998 +0000
@@ -0,0 +1,101 @@
+/*
+ * Basic mod player. Just takes the name of the mod to play
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <fnmatch.h>
+#include <signal.h>
+#include "mikmod.h"
+#include "mikmodux.h"
+#include "mmio.h"
+
+
+int 
+main(int argc, char *argv[])
+{
+    static          BOOL
+                    cfg_extspd = 1,		/* Extended Speed enable */
+                    cfg_panning = 1,	/* DMP panning enable (8xx effects) */
+                    cfg_loop = 0;		/* auto song-looping disable */
+    int
+                    cfg_maxchn = 64, c;
+
+    UNIMOD         *mf = NULL;
+
+    if (argc != 2) {
+		printf("Usage is mikmod <mod name>\n");
+		exit(1);
+    }
+
+	init_mikmod();
+
+    if ((mf = MikMod_LoadSong(argv[1], cfg_maxchn)) != NULL) {
+		mf->extspd = cfg_extspd;
+		mf->panflag = cfg_panning;
+		mf->loop = cfg_loop;
+
+		Player_Start(mf);
+
+		/*
+		 * set the number of voices to use.. you could add extra channels
+		 * here (e.g. md_numchn=mf->numchn+4; ) to use for your own
+		 * soundeffects:
+		 */
+
+		while (Player_Active()) {	/* if we have a quit signal, exit
+									 * loop */
+			MikMod_Update();
+
+			usleep(500);
+		}
+
+		Player_Stop();		/* stop playing */
+		MikMod_FreeSong(mf);	/* and free the module */
+    } else {
+		/* didn't work -> exit with errormsg. */
+		printf("MikMod Error\n");
+    }
+
+    MikMod_Exit();
+}
+
+void
+init_mikmod(void)
+{
+    /*
+     * Initialize soundcard parameters.. you _have_ to do this before calling
+     * MD_Init(), and it's illegal to change them after you've called
+     * MD_Init()
+     */
+
+    md_mixfreq = 44100;		/* standard mixing freq */
+    md_dmabufsize = 32768;	/* standard dma buf size (max 32000) */
+    md_device = 0;			/* standard device: autodetect */
+    md_volume = 96;			/* driver volume (max 128) */
+    md_musicvolume = 128;	/* music volume (max 128) */
+    md_sndfxvolume = 128;	/* sound effects volume (max 128) */
+    md_pansep = 128;		/* panning separation (0 = mono, 128 = full
+							 * stereo) */
+    /* md_stereodelay  = 10;               /* Stereo Delay (max 15) */
+    md_reverb = 0;			/* Reverb (max 15) */
+    md_mode =
+	DMODE_16BITS |
+	DMODE_STEREO |
+	DMODE_SOFT_MUSIC;		/* default mixing mode */
+
+    /* Register the loaders we want to use..  */
+    MikMod_RegisterAllLoaders();
+
+    /* Register the drivers we want to use: */
+    MikMod_RegisterAllDrivers();
+
+    MikMod_RegisterDriver(drv_wav);
+    MikMod_RegisterDriver(drv_raw);
+    MikMod_RegisterDriver(drv_nos);
+
+    MikMod_Init();
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/frontend/mikmodux.h	Thu Apr 23 07:35:49 1998 +0000
@@ -0,0 +1,107 @@
+#ifndef MIKMODUX_H
+#define MIKMODUX_H
+
+#define mikversion "-= MikMod *For Unix* 3.0 =-\n"
+
+#define mikbannerhead "\n" mikversion \
+" - main code by MikMak <mikmak@via.nl>\n" \
+" - lotsa stuff by Jake Stine <dracoirs@epix.net>\n" 
+
+#define mikbannertail \
+" - interface / zip code by Steve McIntyre <stevem@chiark.greenend.org.uk>\n" \
+" - playlist code, much other stuff by Peter Amstutz <amstpi@freenet.tlh.lf.us>\n" \
+" - This program is SHAREWARE - Read MIKMOD.TXT for more info \n" \
+" - Binary built on " __DATE__ " at " __TIME__
+
+#ifdef OSS
+#define mikbannerdriver1 \
+" - linux driver by Chris Conn <cconn@tohs.abacom.com>\n"
+#ifdef ULTRA
+#define mikbannerdriver mikbannerdriver1 "" \
+" - ultra driver by Andy Lo A Foe <arloafoe@cs.vu.nl>\n"
+#else 
+#define mikbannerdriver mikbannerdriver1 
+#endif /* ULTRA */
+
+#elif defined(SUN) 
+#define mikbannerdriver \
+" - Sun/Solaris driver by Valtteri Vuorikoski <vuori@sci.fi>\n"
+
+#elif defined(SOLARIS)
+#define mikbannerdriver \
+" - Sun/Solaris driver by Valtteri Vuorikoski <vuori@sci.fi>\n"
+
+#elif defined(__alpha)
+#define mikbannerdriver \
+" - AudioFile driver by Roine Gustafsson <e93_rog@e.kth.se>\n"
+
+#elif defined(__hpux)
+#define mikbannerdriver \
+" - HP-UX driver by Lutz Vieweg <lkv@mania.robin.de>\n"
+
+#elif defined(SGI)
+#define mikbannerdriver \
+" - SGI driver by Stephan Kanthak <kanthak@i6.informatik.rwth-aachen.de>\n"
+
+#elif defined(AIX)
+#define mikbannerdriver \
+" - AIX driver by Lutz Vieweg <lkv@mania.robin.de>\n"
+
+#endif /* driver definitions */
+
+#define mikbanner mikbannerhead mikbannerdriver mikbannertail
+#define pausebanner \
+"'||''|.    |   '||'  '|' .|'''.| '||''''| '||''|.\n" \
+" ||   ||  |||   ||    |  ||..  '  ||  .    ||   || \n" \
+" ||...|' |  ||  ||    |   ''|||.  ||''|    ||    ||\n" \
+" ||     .''''|. ||    | .     '|| ||       ||    ||\n" \
+".||.   .|.  .||. '|..'  |'....|' .||.....|.||...|'\n"
+
+#define extractbanner \
+"'||''''|          .                         .   ||\n" \
+" ||  .   ... ....||. ... ..  ....    .... .||. ... .. ...   ... . \n" \
+" ||''|    '|..'  ||   ||' '''' .|| .|   '' ||   ||  ||  || || || \n" \
+" ||        .|.   ||   ||    .|' || ||      ||   ||  ||  ||  |'' \n" \
+".||.....|.|  ||. '|.'.||.   '|..'|' '|...' '|.'.||..||. ||.'||||. \n" \
+"                                                          .|....'\n"
+#define loadbanner \
+"'||'                          '||   ||\n" \
+" ||         ...    ....     .. ||  ...  .. ...    ... . \n" \
+" ||       .|  '|. '' .||  .'  '||   ||   ||  ||  || ||  \n" \
+" ||       ||   || .|' ||  |.   ||   ||   ||  ||   |''   \n" \
+".||.....|  '|..|' '|..'|' '|..'||. .||. .||. || .'||||. \n" \
+"                                                .|....'\n"
+
+typedef struct {
+  unsigned int location;
+  char  *marker;
+  char  *command;
+  char  *listcmd;
+  unsigned int nameoffset;
+} ARCHIVE;
+
+extern int firstinst, dispsamp;
+
+/**************************************************************************
+****** Playlist stuff: ****************************************************
+**************************************************************************/
+
+typedef struct {
+    char *modname;	/* The name of the module, either its filename, or name in an archive */
+    char *archive;	/* The filename of the archive if the mod is in one. NULL if not */
+    
+} MODULES;
+
+typedef struct {
+    int current; 	/* Currenct playing mod */
+    int total;		/* Total number of mods */
+    int status;		/* Paused, playing etc */
+#define	PL_PAUSED 	0;
+#define PL_PLAYING 	1;
+#define PL_STOPPED	2;
+
+    MODULE *modules;	/* Array of mods */
+} PLAYLIST;
+
+
+#endif