00001
00002
00003
00004
00005 #ifndef __6581_SAMPLES_H
00006 #define __6581_SAMPLES_H
00007
00008
00009 #include "mytypes.h"
00010 #include "myendian.h"
00011
00012 class sidEmu;
00013 class C6510;
00014
00015
00016
00017 struct sampleChannel
00018 {
00019 bool Active;
00020 char Mode;
00021 ubyte Counter;
00022 ubyte Repeat;
00023 ubyte Scale;
00024 ubyte SampleOrder;
00025 sbyte VolShift;
00026
00027 uword Address;
00028 uword EndAddr;
00029 uword RepAddr;
00030
00031 uword SamAddr;
00032 uword SamLen;
00033 uword LoopWait;
00034 uword NullWait;
00035
00036 uword Period;
00037 #if defined(DIRECT_FIXPOINT)
00038 cpuLword Period_stp;
00039 cpuLword Pos_stp;
00040 cpuLword PosAdd_stp;
00041 #elif defined(PORTABLE_FIXPOINT)
00042 uword Period_stp, Period_pnt;
00043 uword Pos_stp, Pos_pnt;
00044 uword PosAdd_stp, PosAdd_pnt;
00045 #else
00046 udword Period_stp;
00047 udword Pos_stp;
00048 udword PosAdd_stp;
00049 #endif
00050 };
00051
00052 class Mixer;
00053
00054
00055
00059 class Sample
00060 {
00061
00062 friend Mixer;
00063
00064 enum
00065 {
00066 FM_NONE,
00067 FM_GALWAYON,
00068 FM_GALWAYOFF,
00069 FM_HUELSON,
00070 FM_HUELSOFF
00071 };
00072 public:
00073 Sample(C6510* a6510);
00074 ~Sample();
00075 void sampleEmuInit(sidEmu* aTheSidEmu);
00076 void sampleEmuCheckForInit();
00077 void sampleEmuReset(sidEmu* aTheSidEmu);
00078
00079 private:
00080 void channelReset(sampleChannel& ch);
00081 inline void channelFree(sampleChannel& ch, const uword regBase);
00082 inline void channelTryInit(sampleChannel& ch, const uword regBase);
00083 inline ubyte channelProcess(sampleChannel& ch, const uword regBase);
00084
00085 inline void sampleEmuTryStopAll();
00086 sbyte sampleEmuSilence();
00087 sbyte sampleEmu();
00088 sbyte sampleEmuTwo();
00089
00090 void GalwayInit();
00091 sbyte GalwayReturnSample();
00092 inline void GetNextFour();
00093
00094
00095 private:
00096 udword sampleClock;
00097 sampleChannel ch4, ch5;
00098 ubyte galwayNoiseTab2[64*16];
00099
00100 sbyte (Sample::*sampleEmuRout)();
00101
00102 ubyte* c64mem1;
00103 ubyte* c64mem2;
00104 };
00105
00106
00107 #endif // __6581_SAMPLES_H