/[svn]/linuxsampler/trunk/src/common/IDGenerator.cpp
ViewVC logotype

Contents of /linuxsampler/trunk/src/common/IDGenerator.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2135 - (show annotations) (download)
Thu Sep 30 20:00:43 2010 UTC (13 years, 7 months ago) by schoenebeck
File size: 1006 byte(s)
* added and implemented a set of 19 new LSCP commands for controlling
  internal effects:
  - added LSCP command "GET AVAILABLE_EFFECTS"
  - added LSCP command "LIST AVAILABLE_EFFECTS"
  - added LSCP command "GET EFFECT INFO <effect-index>"
  - added LSCP command "CREATE EFFECT_INSTANCE <effect-index>"
  - added LSCP command
    "CREATE EFFECT_INSTANCE <effect-system> <module> <effect-name>"
  - added LSCP command "DESTROY EFFECT_INSTANCE <effect-instance>"
  - added LSCP command "GET EFFECT_INSTANCES"
  - added LSCP command "LIST EFFECT_INSTANCES"
  - added LSCP command "GET EFFECT_INSTANCE INFO <effect-instance>"
  - added LSCP command "GET EFFECT_INSTANCE_INPUT_CONTROL INFO
    <effect-instance> <input-control>"
  - added LSCP command "SET EFFECT_INSTANCE_INPUT_CONTROL <effect-instance>
    <input-control> <value>"
  - added LSCP command "GET MASTER_EFFECT_CHAINS <audio-device>"
  - added LSCP command "LIST MASTER_EFFECT_CHAINS <audio-device>"
  - added LSCP command "ADD MASTER_EFFECT_CHAIN <audio-device>"
  - added LSCP command
    "REMOVE MASTER_EFFECT_CHAIN <audio-device> <effect-chain>"
  - added LSCP command
    "GET MASTER_EFFECT_CHAIN INFO <audio-device> <effect-chain>"
  - added LSCP command "APPEND MASTER_EFFECT_CHAIN EFFECT <audio-device>
    <effect-chain> <effect-instance>"
  - added LSCP command "INSERT MASTER_EFFECT_CHAIN EFFECT <audio-device>
    <effect-chain> <effect-instance> <effect-chain-pos>"
  - added LSCP command "REMOVE MASTER_EFFECT_CHAIN EFFECT <audio-device>
    <effect-chain> <effect-instance>"
* bumped version to 1.0.0.cvs7

1 #include "IDGenerator.h"
2
3 namespace LinuxSampler {
4
5 IDGenerator::IDGenerator(bool simpleAlgorithm) {
6 previousId = -1;
7 simple = simpleAlgorithm;
8 }
9
10 int IDGenerator::create() {
11 int newId = previousId + 1;
12 if (newId < 0 /*reached upper value range limit*/ ||
13 ids.find(newId) != ids.end() /*already in use*/)
14 {
15 if (simple) return -1; // whole value range was used, and we dont know what we could pick next
16
17 newId = -1;
18 for (int i = 0; i >= 0; i++) {
19 if (ids.find(i) == ids.end()) {
20 // we found an unused id ...
21 newId = i;
22 break;
23 }
24 }
25 if (newId < 0) {
26 // we didn't find a free ID, the whole value range is full!
27 return -1;
28 }
29 }
30
31 if (!simple) ids.insert(newId);
32 previousId = newId;
33 return newId;
34 }
35
36 void IDGenerator::destroy(int id) {
37 if (simple) return; // nothing to do
38 ids.erase(id);
39 }
40
41 } // namespace LinuxSampler

  ViewVC Help
Powered by ViewVC