libsidplayfp
1.0.3
|
00001 /* 00002 * This file is part of libsidplayfp, a SID player engine. 00003 * 00004 * Copyright 2011-2013 Leandro Nini <drfiemost@users.sourceforge.net> 00005 * Copyright 2007-2010 Antti Lankila 00006 * Copyright 2001 Simon White 00007 * 00008 * This program is free software; you can redistribute it and/or modify 00009 * it under the terms of the GNU General Public License as published by 00010 * the Free Software Foundation; either version 2 of the License, or 00011 * (at your option) any later version. 00012 * 00013 * This program is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 * GNU General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU General Public License 00019 * along with this program; if not, write to the Free Software 00020 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00021 */ 00022 00023 #ifndef RESID_EMU_H 00024 #define RESID_EMU_H 00025 00026 #include <string> 00027 00028 #include "sidplayfp/sidemu.h" 00029 #include "sidplayfp/EventScheduler.h" 00030 #include "resid/sid.h" 00031 00032 #ifdef HAVE_CONFIG_H 00033 # include "config.h" 00034 #endif 00035 00036 //FIXME 00037 #define RESID_NAMESPACE reSID 00038 00039 #ifdef RESID_NAMESPACE 00040 # define RESID_NS ::RESID_NAMESPACE 00041 #else 00042 # define RESID_NS 00043 #endif 00044 00045 enum { 00046 OUTPUTBUFFERSIZE = 32768 00047 }; 00048 00049 class ReSID: public sidemu 00050 { 00051 private: 00052 EventContext *m_context; 00053 RESID_NS::SID &m_sid; 00054 event_clock_t m_accessClk; 00055 const char *m_error; 00056 bool m_status; 00057 bool m_locked; 00058 uint8_t m_voiceMask; 00059 00060 static std::string m_credit; 00061 00062 public: 00063 static const char* getCredits(); 00064 00065 public: 00066 ReSID(sidbuilder *builder); 00067 ~ReSID(); 00068 00069 // Standard component functions 00070 const char *credits () const { return getCredits(); } 00071 00072 void reset() { sidemu::reset (); } 00073 void reset(uint8_t volume); 00074 00075 uint8_t read(uint_least8_t addr); 00076 void write(uint_least8_t addr, uint8_t data); 00077 00078 const char *error() const { return m_error; } 00079 00080 // Standard SID functions 00081 void clock(); 00082 void filter(bool enable); 00083 void voice(unsigned int num, bool mute); 00084 00085 bool getStatus() const { return m_status; } 00086 00087 // Specific to resid 00088 void sampling(float systemclock, float freq, 00089 SidConfig::sampling_method_t method, bool fast); 00090 00091 void bias(double dac_bias); 00092 void model(SidConfig::sid_model_t model); 00093 00094 // Must lock the SID before using the standard functions. 00095 bool lock(EventContext *env); 00096 void unlock(); 00097 }; 00098 00099 #endif // RESID_EMU_H