linuxsampler 2.3.1
InstrumentManager.h
Go to the documentation of this file.
1/***************************************************************************
2 * *
3 * LinuxSampler - modular, streaming capable sampler *
4 * *
5 * Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck *
6 * Copyright (C) 2005 - 2015 Christian Schoenebeck *
7 * *
8 * This library 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 library 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 library; 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_INSTRUMENTMANAGER_H__
25#define __LS_INSTRUMENTMANAGER_H__
26
27#include "../common/global.h"
28#include "../common/Exception.h"
29
30#include <vector>
31
32namespace LinuxSampler {
33
34 // just symbol prototyping
35 class EngineChannel;
36 class InstrumentEditor;
37
45
53 public:
62
69
70 // TODO: we should extend operator<() so it will be able to detect that file x and file y are actually the same files, e.g. because one of them is a symlink / share the same inode
71 bool operator<(const instrument_id_t& o) const {
72 return (Index < o.Index || (Index == o.Index && FileName < o.FileName));
73 }
74
75 bool operator==(const instrument_id_t& o) const {
76 return (Index == o.Index && FileName == o.FileName);
77 }
78 };
79
91
97 virtual std::vector<instrument_id_t> Instruments() = 0;
98
105 virtual mode_t GetMode(const instrument_id_t& ID) = 0;
106
113 virtual void SetMode(const instrument_id_t& ID, mode_t Mode) = 0;
114
120
131
136 static void StopBackgroundThread();
137
145
154
163
191
199 virtual std::vector<instrument_id_t> GetInstrumentFileContent(String File) throw (InstrumentManagerException) = 0;
200
208 };
209
210}
211
212#endif // __LS_INSTRUMENTMANAGER_H__
Channel Interface for LinuxSampler Sampler Engines.
Exception that will be thrown in NON REAL TIME PARTS of the LinuxSampler application.
Definition Exception.h:37
Instrument Editor Interface (external plugin)
Will be thrown by InstrumentManager implementations on errors.
Abstract interface class for InstrumentManagers.
virtual String GetInstrumentDataStructureName(instrument_id_t ID)=0
Returns a textual identifier of the data structure for the given loaded instrument,...
virtual InstrumentEditor * LaunchInstrumentEditor(EngineChannel *pEngineChannel, instrument_id_t ID, void *pUserData=NULL)=0
Spawn an appropriate editor for the given instrument that is actually capable to handle the instrumen...
virtual void SetMode(const instrument_id_t &ID, mode_t Mode)=0
Change the current life-time strategy for the given instrument.
static void LoadInstrumentInBackground(instrument_id_t ID, EngineChannel *pEngineChannel)
Same as loading the given instrument directly on the given EngineChannel, but this method will not bl...
static void StopBackgroundThread()
Stops the background thread that has been started by LoadInstrumentInBackground.
mode_t
Defines life-time of an instrument.
@ ON_DEMAND_HOLD
Instrument will be loaded when needed and kept even if not needed anymore.
@ ON_DEMAND
Instrument will be loaded when needed, freed once not needed anymore.
@ PERSISTENT
Instrument will immediately be loaded and kept all the time.
virtual String GetInstrumentDataStructureVersion(instrument_id_t ID)=0
Returns the version of the data structure for the given loaded instrument, which usually reflects the...
virtual mode_t GetMode(const instrument_id_t &ID)=0
Returns the current life-time strategy for the given instrument.
virtual instrument_info_t GetInstrumentInfo(instrument_id_t ID)=0
Get detailed informations about the provided instrument file.
void SetModeInBackground(const instrument_id_t &ID, mode_t Mode)
Same as SetMode(), but with the difference that this method won't block.
virtual String GetInstrumentName(instrument_id_t ID)=0
Returns the name of the given instrument as reflected by its file.
virtual std::vector< instrument_id_t > Instruments()=0
Returns all managed instruments.
virtual std::vector< instrument_id_t > GetInstrumentFileContent(String File)=0
Returns a list of instrument IDs of the provided instrument file in case the provided file's format i...
Wraps as a kind of pointer class some data object shared with other threads, to protect / synchronize...
std::string String
Definition global.h:44
Reflects unique ID of an instrument.
bool operator==(const instrument_id_t &o) const
bool operator<(const instrument_id_t &o) const
uint Index
Index of the instrument within the file.
String FileName
File name of the instrument.
Rather abstract informations about an instrument.