enabled midi on win32
This commit is contained in:
parent
1f9c40a840
commit
f89d2871ce
|
@ -1,5 +1,9 @@
|
||||||
2004-11-27 Bradley Bell <btb@icculus.org>
|
2004-11-27 Bradley Bell <btb@icculus.org>
|
||||||
|
|
||||||
|
* Makefile.am, arch/sdl/digi.c, arch/win32/Makefile.am,
|
||||||
|
arch/win32/hmpfile.c, arch/win32/midi.c, main/kludge.c: enabled
|
||||||
|
midi on win32
|
||||||
|
|
||||||
* main/bm.c, main/polyobj.c: better fix for model data freeing bug
|
* main/bm.c, main/polyobj.c: better fix for model data freeing bug
|
||||||
|
|
||||||
* main/inferno.c: enable logo screens for shareware/oem
|
* main/inferno.c: enable logo screens for shareware/oem
|
||||||
|
|
|
@ -36,9 +36,9 @@ d2x_LDADD = ${LD_KLUDGE} main/libmain.a ${EDITOR_LIBS} 3d/lib3d.a 2d/lib2d.a ${A
|
||||||
|
|
||||||
if MINGW32
|
if MINGW32
|
||||||
if USE_NETWORK
|
if USE_NETWORK
|
||||||
d2x_sdl_LDADD = ${d2x_LDADD} -lwsock32
|
d2x_sdl_LDADD = ${d2x_LDADD} -lwinmm -lwsock32
|
||||||
else
|
else
|
||||||
d2x_sdl_LDADD = ${d2x_LDADD}
|
d2x_sdl_LDADD = ${d2x_LDADD} -lwinmm
|
||||||
endif
|
endif
|
||||||
else
|
else
|
||||||
d2x_sdl_LDADD = ${d2x_LDADD} -lm
|
d2x_sdl_LDADD = ${d2x_LDADD} -lm
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: digi.c,v 1.16 2004-05-19 03:13:44 btb Exp $ */
|
/* $Id: digi.c,v 1.17 2004-11-28 05:16:38 btb Exp $ */
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
* SDL digital audio support
|
* SDL digital audio support
|
||||||
|
@ -915,7 +915,7 @@ void digi_reset_digi_sounds() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if 0 //added/killed on 11/25/98 by Matthew Mueller
|
#ifndef _WIN32
|
||||||
// MIDI stuff follows.
|
// MIDI stuff follows.
|
||||||
void digi_set_midi_volume( int mvolume ) { }
|
void digi_set_midi_volume( int mvolume ) { }
|
||||||
void digi_play_midi_song( char * filename, char * melodic_bank, char * drum_bank, int loop ) {}
|
void digi_play_midi_song( char * filename, char * melodic_bank, char * drum_bank, int loop ) {}
|
||||||
|
@ -928,4 +928,4 @@ void digi_stop_current_song()
|
||||||
send_ipc(buf);
|
send_ipc(buf);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif // end this section kill - MM
|
#endif
|
||||||
|
|
|
@ -8,12 +8,12 @@ if USE_NETWORK
|
||||||
NETWORK_SRCS = ipx_mcast4.c ipx_win.c ipx_udp.c winnet.c
|
NETWORK_SRCS = ipx_mcast4.c ipx_win.c ipx_udp.c winnet.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
libarch_win32_a_SOURCES = ${NETWORK_SRCS} findfile.c mingw_init.c
|
libarch_win32_a_SOURCES = ${NETWORK_SRCS} findfile.c hmpfile.c midi.c mingw_init.c
|
||||||
|
|
||||||
EXTRA_libarch_win32_a_SOURCES = ipx_mcast4.c ipx_win.c ipx_udp.c winnet.c
|
EXTRA_libarch_win32_a_SOURCES = ipx_mcast4.c ipx_win.c ipx_udp.c winnet.c
|
||||||
|
|
||||||
EXTRA_DIST = ${EXTRA_SUBDIRS} \
|
EXTRA_DIST = ${EXTRA_SUBDIRS} \
|
||||||
d1x.ico d1x.rc d3d.ico debug.cpp descent.ico digi.c findfile.c glinit.c gr.c \
|
d1x.ico d1x.rc d3d.ico debug.cpp descent.ico digi.c findfile.c glinit.c gr.c \
|
||||||
hmpfile.c init.c joydefs.c joyhh.c key.c mono.c mouse.c palw32.c \
|
init.c joydefs.c joyhh.c key.c mono.c mouse.c palw32.c \
|
||||||
pch.cpp scene.cpp serial.c texture.cpp timer.c win32.c winmain.cpp \
|
pch.cpp scene.cpp serial.c texture.cpp timer.c win32.c winmain.cpp \
|
||||||
ipx_drv.h
|
ipx_drv.h
|
||||||
|
|
|
@ -94,11 +94,11 @@ void hmp_stop(hmp_file *hmp) {
|
||||||
MIDIHDR *mhdr;
|
MIDIHDR *mhdr;
|
||||||
if (!hmp->stop) {
|
if (!hmp->stop) {
|
||||||
hmp->stop = 1;
|
hmp->stop = 1;
|
||||||
PumpMessages();
|
//PumpMessages();
|
||||||
midiStreamStop(hmp->hmidi);
|
midiStreamStop(hmp->hmidi);
|
||||||
while (hmp->bufs_in_mm)
|
while (hmp->bufs_in_mm)
|
||||||
{
|
{
|
||||||
PumpMessages();
|
//PumpMessages();
|
||||||
Sleep(0);
|
Sleep(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
64
arch/win32/midi.c
Normal file
64
arch/win32/midi.c
Normal file
|
@ -0,0 +1,64 @@
|
||||||
|
// MIDI stuff follows.
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include "hmpfile.h"
|
||||||
|
|
||||||
|
hmp_file *hmp = NULL;
|
||||||
|
|
||||||
|
int midi_volume = 255;
|
||||||
|
int digi_midi_song_playing = 0;
|
||||||
|
|
||||||
|
|
||||||
|
void digi_stop_current_song()
|
||||||
|
{
|
||||||
|
if (digi_midi_song_playing)
|
||||||
|
{
|
||||||
|
hmp_close(hmp);
|
||||||
|
hmp = NULL;
|
||||||
|
digi_midi_song_playing = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void digi_set_midi_volume(int n)
|
||||||
|
{
|
||||||
|
int mm_volume;
|
||||||
|
|
||||||
|
if (n < 0)
|
||||||
|
midi_volume = 0;
|
||||||
|
else if (n > 127)
|
||||||
|
midi_volume = 127;
|
||||||
|
else
|
||||||
|
midi_volume = n;
|
||||||
|
|
||||||
|
// scale up from 0-127 to 0-0xffff
|
||||||
|
mm_volume = (midi_volume << 1) | (midi_volume & 1);
|
||||||
|
mm_volume |= (mm_volume << 8);
|
||||||
|
|
||||||
|
if (hmp)
|
||||||
|
midiOutSetVolume((HMIDIOUT)hmp->hmidi, mm_volume | mm_volume << 16);
|
||||||
|
}
|
||||||
|
|
||||||
|
void digi_play_midi_song(char *filename, char *melodic_bank, char *drum_bank, int loop)
|
||||||
|
{
|
||||||
|
#if 0
|
||||||
|
if (!digi_initialised)
|
||||||
|
return;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
digi_stop_current_song();
|
||||||
|
|
||||||
|
if (filename == NULL)
|
||||||
|
return;
|
||||||
|
if (midi_volume < 1)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if ((hmp = hmp_open(filename)))
|
||||||
|
{
|
||||||
|
hmp_play(hmp);
|
||||||
|
digi_midi_song_playing = 1;
|
||||||
|
digi_set_midi_volume(midi_volume);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
printf("hmp_open failed\n");
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: kludge.c,v 1.15 2004-05-20 07:42:41 btb Exp $ */
|
/* $Id: kludge.c,v 1.16 2004-11-28 05:16:38 btb Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
|
@ -102,22 +102,6 @@ void digi_stop_digi_sounds(void)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void digi_stop_current_song(void)
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void digi_set_midi_volume(int a)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void digi_play_midi_song(void)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void digi_pause_digi_sounds()
|
void digi_pause_digi_sounds()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue