Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/Util/Clooper
diff options
context:
space:
mode:
authorJames <olpc@localhost.localdomain>2007-02-19 08:41:55 (GMT)
committer James <olpc@localhost.localdomain>2007-02-19 08:41:55 (GMT)
commit04375f478fb5cbbe10fe3ff9aab7e1b209c00117 (patch)
treedfe7d9211106a8b4e390ca1fc14c3beb566b6d5b /Util/Clooper
parent84f92212bc0caab6323a7ded4f189526eacf8914 (diff)
quicker plugin, can edit while looping
Diffstat (limited to 'Util/Clooper')
-rw-r--r--Util/Clooper/SClient.py70
-rw-r--r--Util/Clooper/SoundClient.cpp70
-rwxr-xr-xUtil/Clooper/_SClient.sobin173881 -> 0 bytes
-rwxr-xr-xUtil/Clooper/sclient.sobin137048 -> 140577 bytes
4 files changed, 66 insertions, 74 deletions
diff --git a/Util/Clooper/SClient.py b/Util/Clooper/SClient.py
deleted file mode 100644
index 70f4e0c..0000000
--- a/Util/Clooper/SClient.py
+++ /dev/null
@@ -1,70 +0,0 @@
-# This file was automatically generated by SWIG (http://www.swig.org).
-# Version 1.3.31
-#
-# Don't modify this file, modify the SWIG interface instead.
-# This file is compatible with both classic and new-style classes.
-
-import _SClient
-import new
-new_instancemethod = new.instancemethod
-try:
- _swig_property = property
-except NameError:
- pass # Python < 2.2 doesn't have 'property'.
-def _swig_setattr_nondynamic(self,class_type,name,value,static=1):
- if (name == "thisown"): return self.this.own(value)
- if (name == "this"):
- if type(value).__name__ == 'PySwigObject':
- self.__dict__[name] = value
- return
- method = class_type.__swig_setmethods__.get(name,None)
- if method: return method(self,value)
- if (not static) or hasattr(self,name):
- self.__dict__[name] = value
- else:
- raise AttributeError("You cannot add attributes to %s" % self)
-
-def _swig_setattr(self,class_type,name,value):
- return _swig_setattr_nondynamic(self,class_type,name,value,0)
-
-def _swig_getattr(self,class_type,name):
- if (name == "thisown"): return self.this.own()
- method = class_type.__swig_getmethods__.get(name,None)
- if method: return method(self)
- raise AttributeError,name
-
-def _swig_repr(self):
- try: strthis = "proxy of " + self.this.__repr__()
- except: strthis = ""
- return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)
-
-import types
-try:
- _object = types.ObjectType
- _newclass = 1
-except AttributeError:
- class _object : pass
- _newclass = 0
-del types
-
-
-sc_destroy = _SClient.sc_destroy
-sc_initialize = _SClient.sc_initialize
-sc_start = _SClient.sc_start
-sc_stop = _SClient.sc_stop
-sc_setMasterVolume = _SClient.sc_setMasterVolume
-sc_setTrackpadX = _SClient.sc_setTrackpadX
-sc_setTrackpadY = _SClient.sc_setTrackpadY
-sc_inputMessage = _SClient.sc_inputMessage
-sc_scoreEvent4 = _SClient.sc_scoreEvent4
-sc_scoreEvent15 = _SClient.sc_scoreEvent15
-sc_loop_addScoreEvent15 = _SClient.sc_loop_addScoreEvent15
-sc_loop_delScoreEvent = _SClient.sc_loop_delScoreEvent
-sc_loop_clear = _SClient.sc_loop_clear
-sc_loop_getTick = _SClient.sc_loop_getTick
-sc_loop_playing = _SClient.sc_loop_playing
-sc_loop_setNumTicks = _SClient.sc_loop_setNumTicks
-sc_loop_setTick = _SClient.sc_loop_setTick
-sc_loop_setTickDuration = _SClient.sc_loop_setTickDuration
-
-
diff --git a/Util/Clooper/SoundClient.cpp b/Util/Clooper/SoundClient.cpp
index 71dc705..a1bedd1 100644
--- a/Util/Clooper/SoundClient.cpp
+++ b/Util/Clooper/SoundClient.cpp
@@ -51,6 +51,30 @@ struct ev_t
for (size_t i = 0; i < param.size(); ++i) fprintf(f, "%lf ", param[i]);
fprintf(f, "\n");
}
+ void update(int idx, MYFLT val)
+ {
+ if ( (unsigned)idx >= param.size())
+ {
+ fprintf(stderr, "ERROR: updateEvent request for too-high parameter %i\n", idx);
+ return;
+ }
+ if (time_in_ticks)
+ {
+ switch(idx)
+ {
+ case 1: onset = (int) val; break;
+ case 2: duration = val; break;
+ case 8: attack = val; break;
+ case 9: decay = val; break;
+ default: param[idx] = val; break;
+ }
+ prev_secs_per_tick = -1.0; //force recalculation
+ }
+ else
+ {
+ param[idx] = val;
+ }
+ }
void event(CSOUND * csound, MYFLT secs_per_tick)
{
@@ -108,6 +132,7 @@ struct EvLoop
}
ev.erase(ev.begin(), ev.end());
ev_pos = ev.end();
+ idmap.erase(idmap.begin(), idmap.end());
csoundUnlockMutex(mutex);
}
int getTick()
@@ -212,19 +237,43 @@ struct EvLoop
}
else
{
- //this is a new id
csoundLockMutex(mutex);
iter_t e_iter = id_iter->second;//idmap[id];
+ if (e_iter == ev_pos) ++ev_pos;
delete e_iter->second;
ev.erase(e_iter);
idmap.erase(id_iter);
+ csoundUnlockMutex(mutex);
+ }
+ }
+ void updateEvent(int id, int idx, float val)
+ {
+ idmap_t id_iter = idmap.find(id);
+ if (id_iter == idmap.end())
+ {
+ if (_debug) fprintf(_debug, "ERROR: updateEvent request for unknown note %i\n", id);
+ return;
+ }
+
+ //this is a new id
+ csoundLockMutex(mutex);
+ iter_t e_iter = id_iter->second;
+ ev_t * e = e_iter->second;
+ int onset = e->onset;
+ e->update(idx, val);
+ if (onset != e->onset)
+ {
+ ev.erase(e_iter);
+
+ e_iter = ev.insert(pair_t(e->onset, e));
+
//TODO: optimize by thinking about whether to do ev_pos = e_iter
ev_pos = ev.upper_bound( tick_prev );
-
- csoundUnlockMutex(mutex);
+ idmap[id] = e_iter;
}
+ csoundUnlockMutex(mutex);
}
};
struct TamTamSound
@@ -240,7 +289,7 @@ struct TamTamSound
EvLoop * loop;
TamTamSound(char * orc)
- : ThreadID(NULL), csound(NULL), PERF_STATUS(STOP), verbosity(3), _debug(NULL), thread_playloop(0), thread_measurelag(0), loop(NULL)
+ : ThreadID(NULL), csound(NULL), PERF_STATUS(STOP), verbosity(3), _debug(stderr), thread_playloop(0), thread_measurelag(0), loop(NULL)
{
if (1)
{
@@ -639,6 +688,18 @@ DECL(sc_loop_delScoreEvent) // (int id)
sc_tt->loop->delEvent(id);
RetNone;
}
+DECL(sc_loop_updateEvent) // (int id)
+{
+ int id;
+ int idx;
+ float val;
+ if (!PyArg_ParseTuple(args, "iif", &id, &idx, &val ))
+ {
+ return NULL;
+ }
+ sc_tt->loop->updateEvent(id, idx, val);
+ RetNone;
+}
DECL(sc_loop_clear)
{
if (!PyArg_ParseTuple(args, "" ))
@@ -685,6 +746,7 @@ static PyMethodDef SpamMethods[] = {
MDECL(sc_loop_setTickDuration)
MDECL(sc_loop_delScoreEvent)
MDECL(sc_loop_addScoreEvent) // (int id, int duration_in_ticks, char type, farray param)
+ MDECL(sc_loop_updateEvent) // (int id)
MDECL(sc_loop_clear)
MDECL(sc_loop_playing)
MDECL(sc_inputMessage)
diff --git a/Util/Clooper/_SClient.so b/Util/Clooper/_SClient.so
deleted file mode 100755
index da097ed..0000000
--- a/Util/Clooper/_SClient.so
+++ /dev/null
Binary files differ
diff --git a/Util/Clooper/sclient.so b/Util/Clooper/sclient.so
index f2d3b36..5d7583b 100755
--- a/Util/Clooper/sclient.so
+++ b/Util/Clooper/sclient.so
Binary files differ