libsidplayfp  2.12.0
sidbuilder.h
1 /*
2  * This file is part of libsidplayfp, a SID player engine.
3  *
4  * Copyright 2011-2024 Leandro Nini <drfiemost@users.sourceforge.net>
5  * Copyright 2007-2010 Antti Lankila
6  * Copyright 2000-2001 Simon White
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21  */
22 
23 #ifndef SIDBUILDER_H
24 #define SIDBUILDER_H
25 
26 #include <set>
27 #include <string>
28 
29 #include "sidplayfp/SidConfig.h"
30 
31 namespace libsidplayfp
32 {
33 class sidemu;
34 class EventScheduler;
35 }
36 
41 {
42 protected:
43  typedef std::set<libsidplayfp::sidemu*> emuset_t;
44 
45 private:
46  const char * const m_name;
47 
48 protected:
49  std::string m_errorBuffer;
50 
51  emuset_t sidobjs;
52 
53  bool m_status;
54 
55 public:
56  sidbuilder(const char * const name) :
57  m_name(name),
58  m_errorBuffer("N/A"),
59  m_status(true) {}
60  virtual ~sidbuilder() {}
61 
67  unsigned int usedDevices() const { return sidobjs.size(); }
68 
74  virtual unsigned int availDevices() const = 0;
75 
82  virtual unsigned int create(unsigned int sids) = 0;
83 
93 
99  void unlock(libsidplayfp::sidemu *device);
100 
104  void remove();
105 
111  const char *name() const { return m_name; }
112 
118  const char *error() const { return m_errorBuffer.c_str(); }
119 
125  bool getStatus() const { return m_status; }
126 
132  virtual const char *credits() const = 0;
133 
140  SID_DEPRECATED
141  virtual void filter(bool enable) = 0;
142 };
143 
144 #endif // SIDBUILDER_H
sid_model_t
SID chip model.
Definition: SidConfig.h:51
Definition: EventScheduler.h:62
Definition: sidemu.h:47
Definition: sidbuilder.h:41
const char * name() const
Definition: sidbuilder.h:111
bool getStatus() const
Definition: sidbuilder.h:125
virtual unsigned int create(unsigned int sids)=0
virtual const char * credits() const =0
void unlock(libsidplayfp::sidemu *device)
Definition: sidbuilder.cpp:49
unsigned int usedDevices() const
Definition: sidbuilder.h:67
libsidplayfp::sidemu * lock(libsidplayfp::EventScheduler *scheduler, SidConfig::sid_model_t model, bool digiboost)
Definition: sidbuilder.cpp:29
virtual unsigned int availDevices() const =0
void remove()
Definition: sidbuilder.cpp:58
const char * error() const
Definition: sidbuilder.h:118
virtual SID_DEPRECATED void filter(bool enable)=0