DOSBox-X
|
00001 #include "np2glue.h" 00002 //#include "compiler.h" 00003 #include "getsnd.h" 00004 00005 00006 #define DNBASEBITS 12 00007 #define DNMIXBASE (1 << DNBASEBITS) 00008 00009 #define UPBASEBITS 12 00010 #define UPMIXBASE (1 << UPBASEBITS) 00011 00012 00013 // 偽物てんぷれーと 00014 // マイクロソフトはマクロ展開下手だから動作チェキするように。 00015 00016 // ---- モノラル出力 00017 00018 #define MIX_INPUTBIT 8 00019 #define MIX_OUTPUTBIT 16 00020 #define MIX_CHANNELS 1 00021 #define FUNC_NOR m8m16nr 00022 #define FUNC_DOWN m8m16dn 00023 #define FUNC_UP m8m16up 00024 #include "getsndmn.mcr" 00025 00026 #define MIX_INPUTBIT 8 00027 #define MIX_OUTPUTBIT 16 00028 #define MIX_CHANNELS 2 00029 #define FUNC_NOR s8m16nr 00030 #define FUNC_DOWN s8m16dn 00031 #define FUNC_UP s8m16up 00032 #include "getsndmn.mcr" 00033 00034 #define MIX_INPUTBIT 16 00035 #define MIX_OUTPUTBIT 16 00036 #define MIX_CHANNELS 1 00037 #define FUNC_NOR m16m16nr 00038 #define FUNC_DOWN m16m16dn 00039 #define FUNC_UP m16m16up 00040 #include "getsndmn.mcr" 00041 00042 #define MIX_INPUTBIT 16 00043 #define MIX_OUTPUTBIT 16 00044 #define MIX_CHANNELS 2 00045 #define FUNC_NOR s16m16nr 00046 #define FUNC_DOWN s16m16dn 00047 #define FUNC_UP s16m16up 00048 #include "getsndmn.mcr" 00049 00050 00051 // ---- ステレオ出力 00052 00053 #define MIX_INPUTBIT 8 00054 #define MIX_OUTPUTBIT 16 00055 #define MIX_CHANNELS 1 00056 #define FUNC_NOR m8s16nr 00057 #define FUNC_DOWN m8s16dn 00058 #define FUNC_UP m8s16up 00059 #include "getsndst.mcr" 00060 00061 #define MIX_INPUTBIT 8 00062 #define MIX_OUTPUTBIT 16 00063 #define MIX_CHANNELS 2 00064 #define FUNC_NOR s8s16nr 00065 #define FUNC_DOWN s8s16dn 00066 #define FUNC_UP s8s16up 00067 #include "getsndst.mcr" 00068 00069 #define MIX_INPUTBIT 16 00070 #define MIX_OUTPUTBIT 16 00071 #define MIX_CHANNELS 1 00072 #define FUNC_NOR m16s16nr 00073 #define FUNC_DOWN m16s16dn 00074 #define FUNC_UP m16s16up 00075 #include "getsndst.mcr" 00076 00077 #define MIX_INPUTBIT 16 00078 #define MIX_OUTPUTBIT 16 00079 #define MIX_CHANNELS 2 00080 #define FUNC_NOR s16s16nr 00081 #define FUNC_DOWN s16s16dn 00082 #define FUNC_UP s16s16up 00083 #include "getsndst.mcr" 00084 00085 00086 static const GSCNV cnvfunc[] = { 00087 (GSCNV)m8m16nr, (GSCNV)m8m16dn, (GSCNV)m8m16up, 00088 (GSCNV)s8m16nr, (GSCNV)s8m16dn, (GSCNV)s8m16up, 00089 (GSCNV)m16m16nr, (GSCNV)m16m16dn, (GSCNV)m16m16up, 00090 (GSCNV)s16m16nr, (GSCNV)s16m16dn, (GSCNV)s16m16up, 00091 00092 (GSCNV)m8s16nr, (GSCNV)m8s16dn, (GSCNV)m8s16up, 00093 (GSCNV)s8s16nr, (GSCNV)s8s16dn, (GSCNV)s8s16up, 00094 (GSCNV)m16s16nr, (GSCNV)m16s16dn, (GSCNV)m16s16up, 00095 (GSCNV)s16s16nr, (GSCNV)s16s16dn, (GSCNV)s16s16up}; 00096 00097 00098 BOOL getsnd_setmixproc(GETSND snd, UINT samprate, UINT channles) { 00099 00100 int funcnum; 00101 00102 if ((snd->samplingrate < 8000) || (snd->samplingrate > 96000)) { 00103 goto gssmp_err; 00104 } 00105 if ((samprate < 8000) || (samprate > 96000)) { 00106 goto gssmp_err; 00107 } 00108 00109 funcnum = 0; 00110 if (snd->channels == 1) { 00111 } 00112 else if (snd->channels == 2) { 00113 funcnum |= 1; 00114 } 00115 else { 00116 goto gssmp_err; 00117 } 00118 00119 if (snd->bit == 8) { 00120 } 00121 else if (snd->bit == 16) { 00122 funcnum |= 2; 00123 } 00124 else { 00125 goto gssmp_err; 00126 } 00127 00128 if (channles == 1) { 00129 } 00130 else if (channles == 2) { 00131 funcnum |= 4; 00132 } 00133 else { 00134 goto gssmp_err; 00135 } 00136 00137 funcnum *= 3; 00138 00139 if (snd->samplingrate > samprate) { 00140 snd->mrate = (DNMIXBASE * samprate) / snd->samplingrate; 00141 snd->rem = DNMIXBASE; 00142 funcnum += 1; 00143 } 00144 else if (snd->samplingrate < samprate) { 00145 snd->mrate = (UPMIXBASE * samprate) / snd->samplingrate; 00146 funcnum += 2; 00147 } 00148 snd->cnv = cnvfunc[funcnum]; 00149 return(SUCCESS); 00150 00151 gssmp_err: 00152 return(FAILURE); 00153 } 00154