1
0
Fork 0

Merge branch 'svn/trunk' r4282

This commit is contained in:
Patryk Obara 2019-11-12 08:56:37 +01:00
commit 34112dd2da
5 changed files with 49 additions and 13 deletions

View file

@ -204,6 +204,33 @@ CXXFLAGS="$CXXFLAGS -mno-ms-bitfields"
],[AC_MSG_RESULT([no])])
CFLAGS="$BACKUP_CFLAGS"
dnl When on macOS, enable support for Apple's Core MIDI and/or Core Audio if our compiler can #include their headers
case "$host" in
*-*-darwin*)
AC_MSG_CHECKING(if compiler supports Apple's Core MIDI headers)
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
#include <CoreMIDI/MIDIServices.h>
int blah() { return 0; }
]])], [AC_MSG_RESULT(yes);LIBS="$LIBS -framework CoreMIDI";AC_DEFINE([C_SUPPORTS_COREMIDI], [],
[Compiler supports Core MIDI headers])],
AC_MSG_RESULT(no);AC_MSG_WARN([Compiler can't compile Apple headers. CoreMIDI functionality disabled. Please use the Apple compiler!]))
AC_MSG_CHECKING(if compiler supports Apple's Core Audio headers)
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
#include <AudioToolbox/AUGraph.h>
#include <CoreServices/CoreServices.h>
int blah() { return 0; }
]])], [AC_MSG_RESULT(yes);LIBS="$LIBS -framework AudioUnit -framework AudioToolbox";AC_DEFINE([C_SUPPORTS_COREAUDIO], [],
[Compiler supports Core Audio headers])],
AC_MSG_RESULT(no);AC_MSG_WARN([Compiler can't compile Apple headers. CoreAudio functionality disabled. Please use the Apple compiler!]))
;;
*)
AC_MSG_CHECKING(if compiler supports Apple's MIDI headers)
AC_MSG_RESULT([no, not on Apple])
;;
esac
dnl enable disable alsa and pass it's cflags to CXXFLAGS
AC_ARG_ENABLE(alsa-midi,
AC_HELP_STRING([--enable-alsa-midi],[compile with alsa midi support (default yes)]),
@ -570,7 +597,6 @@ case "$host" in
dnl to do more to distinguish them.
dnl For now I am lazy and do not add proper detection code.
AC_DEFINE(MACOSX, 1, [Compiling on Mac OS X])
LIBS="$LIBS -framework CoreMIDI -framework AudioUnit -framework AudioToolbox"
AC_DEFINE(C_DIRECTSERIAL, 1, [ Define to 1 if you want serial passthrough support (Win32, Posix and OS/2).])
;;
*-*-linux*)

View file

@ -20,6 +20,10 @@
#ifndef DOSBOX_MIDI_H
#define DOSBOX_MIDI_H
#ifndef DOSBOX_DOSBOX_H
#include "dosbox.h"
#endif
#ifndef DOSBOX_PROGRAMS_H
#include "programs.h"
#endif
@ -27,7 +31,10 @@
class MidiHandler {
public:
MidiHandler();
virtual bool Open(const char * /*conf*/) { return true; };
virtual bool Open(const char * /*conf*/) {
LOG_MSG("No working midi device found/selected! Please check your settings and/or compilation environment.");
return true;
};
virtual void Close(void) {};
virtual void PlayMsg(Bit8u * /*msg*/) {};
virtual void PlaySysex(Bit8u * /*sysex*/,Bitu /*len*/) {};

View file

@ -68,12 +68,18 @@ MidiHandler::MidiHandler(){
MidiHandler Midi_none;
/* Include different midi drivers, lowest ones get checked first for default */
/* Include different midi drivers, lowest ones get checked first for default.
Each header provides an independent midi interface. */
#if defined(MACOSX)
#if defined(C_SUPPORTS_COREMIDI)
#include "midi_coremidi.h"
#endif
#if defined(C_SUPPORTS_COREAUDIO)
#include "midi_coreaudio.h"
#endif
#elif defined (WIN32)

View file

@ -37,6 +37,7 @@
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <stddef.h>
#include "dosbox.h"
#include "dbopl.h"
@ -1430,7 +1431,6 @@ void InitTables( void ) {
TremoloTable[TREMOLO_TABLE - 1 - i] = val;
}
//Create a table with offsets of the channels from the start of the chip
DBOPL::Chip* chip = 0;
for ( Bitu i = 0; i < 32; i++ ) {
Bitu index = i & 0xf;
if ( index >= 9 ) {
@ -1444,8 +1444,7 @@ void InitTables( void ) {
//Add back the bits for highest ones
if ( i >= 16 )
index += 9;
Bitu blah = reinterpret_cast<Bitu>( &(chip->chan[ index ]) );
ChanOffsetTable[i] = blah;
ChanOffsetTable[i] = (Bit16u)(index*sizeof(DBOPL::Channel));
}
//Same for operators
for ( Bitu i = 0; i < 64; i++ ) {
@ -1458,9 +1457,7 @@ void InitTables( void ) {
if ( chNum >= 12 )
chNum += 16 - 12;
Bitu opNum = ( i % 8 ) / 3;
DBOPL::Channel* chan = 0;
Bitu blah = reinterpret_cast<Bitu>( &(chan->op[opNum]) );
OpOffsetTable[i] = ChanOffsetTable[ chNum ] + blah;
OpOffsetTable[i] = ChanOffsetTable[chNum]+(Bit16u)(opNum*sizeof(DBOPL::Operator));
}
#if 0
//Stupid checks if table's are correct

View file

@ -156,7 +156,7 @@ public:
};
struct Channel {
Operator op[2];
Operator op[2]; //Leave on top of struct for simpler pointer math.
inline Operator* Op( Bitu index ) {
return &( ( this + (index >> 1) )->op[ index & 1 ]);
}
@ -192,6 +192,9 @@ struct Channel {
};
struct Chip {
//18 channels with 2 operators each. Leave on top of struct for simpler pointer math.
Channel chan[18];
//This is used as the base counter for vibrato and tremolo
Bit32u lfoCounter;
Bit32u lfoAdd;
@ -208,9 +211,6 @@ struct Chip {
//Best match attack rates for the rate of this chip
Bit32u attackRates[76];
//18 channels with 2 operators each
Channel chan[18];
Bit8u reg104;
Bit8u reg08;
Bit8u reg04;