aboutsummaryrefslogtreecommitdiff
path: root/bpe.py
diff options
context:
space:
mode:
authorIOhannes m zmölnig <zmoelnig@iem.at>2015-10-14 15:14:06 +0200
committerIOhannes m zmölnig <zmoelnig@iem.at>2015-10-14 15:14:06 +0200
commit90c6018a9401e38859f733b3521c919e042322b7 (patch)
treeb4a6bd88d73feafa8fa55e6fe7c5fcd7df2cab72 /bpe.py
parent2daa10b2676f8befd3aaa54e70155459f9b6d79b (diff)
moved abstractions into abstractions/
Diffstat (limited to 'bpe.py')
-rw-r--r--bpe.py91
1 files changed, 0 insertions, 91 deletions
diff --git a/bpe.py b/bpe.py
deleted file mode 100644
index 7a54b2c..0000000
--- a/bpe.py
+++ /dev/null
@@ -1,91 +0,0 @@
-# $Id: bpe.py,v 1.2 2005-12-17 17:52:01 timblech Exp $
-#
-# Copyright (C) 2005 Tim Blechmann
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; see the file COPYING. If not, write to
-# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-# Boston, MA 02111-1307, USA.
-
-
-import pyext
-
-def parse_arguments(*args):
- duration = args[0]
- if duration == 0:
- return args[1:]
-
- length = len(args)
- durations = []
- breakpoints = []
- for i in range(1,length):
- if i % 2 == 0:
- durations.append(args[i])
- else:
- breakpoints.append(args[i])
- duration_factor = duration / reduce(lambda x,y: x + y, durations)
-
- durations = map(lambda x: x*duration_factor, durations)
-
- ret = []
-
- for i in range(len(durations)):
- ret.append(breakpoints[i])
- ret.append(durations[i])
- ret[-2] = ret[0]
- return ret
-
-class Bpe(pyext._class):
- _inlets = 1
- _outlets = 1
-
- def list_1(self, *args):
- if args[0] != 0:
- self._outlet(1,parse_arguments(*args))
-
-class VolBpe(pyext._class):
- _inlets = 3
- _outlets = 1
-
- def __init__(self, dollar1):
- try:
- self.duration = 1000 / dollar1
- except:
- self.duration = 1000
- self._detach = 1
- self._priority(-20)
-
- self.bpe = []
- self.running = False
-
- def list_1(self, *args):
- arglist = list(args)
- arguments = [self.duration] + arglist
- self.bpe = arglist
- self._outlet(1,parse_arguments(*arguments))
- if not self.running:
- self._outlet(1, None)
- self.running = True
-
- def float_2(self, freq):
- self.duration = 1000 / freq;
- arguments = self.duration + self.bpe
- self._outlet(1,parse_arguments(*arguments))
-
-
- def float_3(self, switch):
- if switch == 0:
- self._outlet(1, self.bpe[0], 0, self.bpe[0], self.duration)
- else:
- self._outlet(1, self.bpe)
-