00001
00002
00003
00004 #if !defined(__MIXING_H__)
00005 #define __MIXING_H__
00006
00007 #include "opstruct.h"
00008
00009 #include "6581_.h"
00010
00011
00012
00013
00014 static const int maxLogicalVoices = 4;
00015 static const int mix8monoMiddleIndex = 256*maxLogicalVoices/2;
00016 static const int mix8stereoMiddleIndex = 256*(maxLogicalVoices/2)/2;
00017 static const int mix16monoMiddleIndex = 256*maxLogicalVoices/2;
00018 static const int mix16stereoMiddleIndex = 256*(maxLogicalVoices/2)/2;
00019
00020
00021
00022
00023
00024 class Mixer
00025 {
00026
00027 friend emuEngine;
00028
00029 public:
00030 Mixer(emuEngine* aEmuEngine, sidEmu* aSidEmu);
00031 ~Mixer();
00032 void MixerInit(bool threeVoiceAmplify, ubyte zero8, uword zero16);
00033 inline void syncEm();
00034 inline void* fillFunc(void* buffer, udword bufferLen) { return (this->*sidEmuFillFunc)(buffer, bufferLen); }
00035
00036 public:
00037 void* fill8bitMono( void* buffer, udword numberOfSamples );
00038 void* fill8bitMonoControl( void* buffer, udword numberOfSamples );
00039 void* fill8bitStereo( void* buffer, udword numberOfSamples );
00040 void* fill8bitStereoControl( void* buffer, udword numberOfSamples );
00041 void* fill8bitStereoSurround( void* buffer, udword numberOfSamples );
00042 void* fill8bitsplit( void* buffer, udword numberOfSamples );
00043 void* fill16bitMono( void* buffer, udword numberOfSamples );
00044 void* fill16bitMonoControl( void* buffer, udword numberOfSamples );
00045 void* fill16bitStereo( void* buffer, udword numberOfSamples );
00046 void* fill16bitStereoControl( void* buffer, udword numberOfSamples );
00047 void* fill16bitStereoSurround( void* buffer, udword numberOfSamples );
00048 void* fill16bitsplit( void* buffer, udword numberOfSamples );
00049 public:
00050
00051
00052 void* (Mixer::*sidEmuFillFunc)(void*, udword);
00053
00054 private:
00055 sidEmu* iTheSidEmu;
00056
00057 ubyte mix8mono[256*maxLogicalVoices];
00058 ubyte mix8stereo[256*(maxLogicalVoices/2)];
00059 uword mix16mono[256*maxLogicalVoices];
00060 uword mix16stereo[256*(maxLogicalVoices/2)];
00061
00062 sbyte *signedPanMix8;
00063 sword *signedPanMix16;
00064
00065 ubyte zero8bit;
00066 uword zero16bit;
00067 udword splitBufferLen;
00068
00069 Sample* iTheSampler;
00070
00071
00072
00073
00074 };
00075
00076
00077
00078 #endif // MIXING