History

implemented basic DSP for Spectacle

Joel Matthys committed 12 years ago

Commit 4325a601 parent 0ecc72732 files · +3252 −1434Browse files

Showing the changes to Spectacle/genlib/Obucket.cpp (1 of 32 files). Show all

Unified · Split

Spectacle/genlib/Obucket.cpp+33−0
@@ -0,0 +1,33 @@
1// RTcmix - Copyright (C) 2005 The RTcmix Development Team
2// See ``AUTHORS'' for a list of contributors. See ``LICENSE'' for
3// the license to this software and for a DISCLAIMER OF ALL WARRANTIES.
4
5#include "Obucket.h"
6
7Obucket::Obucket(int len, ProcessFunction callback, void *context)
8 : _len(len), _index(0), _callback(callback), _context(context)
9{
10 _buf = new float [len];
11}
12
13Obucket::~Obucket()
14{
15 delete [] _buf;
16}
17
18void Obucket::flush(float defaultval)
19{
20 if (_index > 0) {
21 for (int i = _index; i < _len; i++)
22 _buf[i] = defaultval;
23 (*_callback)(_buf, _len, _context);
24 _index = 0;
25 }
26}
27
28void Obucket::clear(float defaultval)
29{
30 for (int i = 0; i < _len; i++)
31 _buf[i] = defaultval;
32}
33

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t