/[svn]/linuxsampler/trunk/src/engines/Engine.h
ViewVC logotype

Contents of /linuxsampler/trunk/src/engines/Engine.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1012 - (show annotations) (download) (as text)
Sun Jan 7 15:52:36 2007 UTC (17 years, 3 months ago) by capela
File MIME type: text/x-c++hdr
File size: 3847 byte(s)
* Fixed a memory leak due to EngineFactory::Destroy() not doing it
as an actual destructor and just removing the engine instance from
factory stock and all instances allocated via EngineFactory::Create()
never got delete'd and thus their destructors never called. This bug
was evident while having many mapped instruments and querying the
instrument status via GET MIDI_INSTRUMENT INFO command, eating up
system memory very quickly and never let it go.

1 /***************************************************************************
2 * *
3 * LinuxSampler - modular, streaming capable sampler *
4 * *
5 * Copyright (C) 2003,2004 by Benno Senoner and Christian Schoenebeck *
6 * Copyright (C) 2005-2007 Christian Schoenebeck *
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., 59 Temple Place, Suite 330, Boston, *
21 * MA 02111-1307 USA *
22 ***************************************************************************/
23
24 #ifndef __LS_ENGINE_H__
25 #define __LS_ENGINE_H__
26
27 #include "../common/global.h"
28 #include "InstrumentManager.h"
29
30 namespace LinuxSampler {
31
32 /** @brief LinuxSampler Sampler Engine Interface
33 *
34 * Abstract base interface class for all LinuxSampler engines which
35 * defines all mandatory methods which have to be implemented by all
36 * sampler engine implementations.
37 */
38 class Engine {
39 public:
40
41 /////////////////////////////////////////////////////////////////
42 // abstract methods
43 // (these have to be implemented by the descendant)
44
45 virtual int RenderAudio(uint Samples) = 0;
46 virtual void SendSysex(void* pData, uint Size) = 0;
47 virtual void Reset() = 0;
48 virtual void Enable() = 0;
49 virtual void Disable() = 0;
50 virtual uint VoiceCount() = 0;
51 virtual uint VoiceCountMax() = 0;
52 virtual bool DiskStreamSupported() = 0;
53 virtual uint DiskStreamCount() = 0;
54 virtual uint DiskStreamCountMax() = 0;
55 virtual String DiskStreamBufferFillBytes() = 0;
56 virtual String DiskStreamBufferFillPercentage() = 0;
57 virtual String Description() = 0;
58 virtual String Version() = 0;
59 virtual String EngineName() = 0;
60
61 /**
62 * Returns pointer to the Engine's InstrumentManager or NULL if
63 * the Engine does not provide an InstrumentManager.
64 *
65 * <b>Important:</b> All engine instances of the same engine
66 * type have to return the same InstrumentManager, that is all
67 * instances of the same engine type have to share one and
68 * the same InstrumentManager object.
69 */
70 virtual InstrumentManager* GetInstrumentManager() = 0;
71
72 protected:
73 virtual ~Engine() {}; // MUST only be destroyed by EngineFactory
74 void Unregister(); // Remove self from EngineFactory.
75 friend class EngineFactory;
76 };
77
78 } // namespace LinuxSampler
79
80 #endif // __LS_ENGINE_H__

  ViewVC Help
Powered by ViewVC