Comments (4)
Ooops should have checked my code. I think this is OK
static void
Counter_generates(Counter *self) {
int i;
MYFLT *in = Stream_getData((Stream *)self->input_stream);
for (i=0; i<self->bufsize; i++) {
if (in[i] == 1) {
if (self->dir == 0) {
self->tmp++;
if (self->tmp >= self->max)
self->tmp = self->min;
self->value = (MYFLT)self->tmp; // PJL
}
else if (self->dir == 1) {
self->tmp--;
if (self->tmp < self->min)
self->tmp = self->max - 1;
self->value = (MYFLT)self->tmp; // PJL
}
else if (self->dir == 2) {
self->tmp = self->tmp + self->direction;
if (self->tmp >= self->max) {
self->direction = -1;
self->tmp = self->max-2; //PJL
}
else if (self->tmp < self->min) {
self->direction = 1;
self->tmp=self->min+1; //PJL
}
self->value = (MYFLT)self->tmp; // PJL
}
}
self->data[i] = self->value;
}
}
Original comment by PaulJohnLeonard
on 14 Jun 2012 at 12:19
from pyo.
Fixed in sources. That was a special case when dir = 2 AND count range = 2...
With your fix, you're always missing the first count. The missing count print
in your example is caused by the minimum set to 0 (same as buffer
initialization value) and the Print method set to 1 (print only on new value).
Original comment by [email protected]
on 14 Jun 2012 at 1:03
- Changed state: Fixed
from pyo.
I am a bit confused.
My expectation was that the first trigger should change the state from 0 to 1.
With your version I have to send 2 triggers is this what you want?
Original comment by PaulJohnLeonard
on 14 Jun 2012 at 1:30
from pyo.
I just looked at the reset(value) to see if I can get what I want this way but
it appears that it would take 2 triggers to change the counters value after a
reset()? To make it do what I want I would need to inject an additional trigger
just after creation. I think intuitively I would expect the counter to start at
it's minimum value (or maximum if it was a down counter). I would then expect
it to change on every trigger. If I understand correctly at present the
counter starts with 0 even if that is not in the counters range ?
Original comment by PaulJohnLeonard
on 14 Jun 2012 at 2:11
from pyo.
Related Issues (20)
- In the last built _.ctrl() does not work properly on macOS HOT 3
- Minor bug: In Pyo Server window (wxPython v4.2) if Interpreter input has focus and then clicking on buttons HOT 2
- Wxpython 4.2.0 issue found by usage of Spectrum() HOT 3
- Dependencies and HomeBrew HOT 1
- How to hide `wxPython` warnings ? HOT 7
- `pyo` doesn't produce sound in Qt App HOT 1
- Found bug with stdout during pyo.Server initialization HOT 3
- Issue with Linseg output HOT 4
- portaudio error on pip install HOT 2
- error installing on mac M1 system HOT 5
- Running pyo in a headless server mode HOT 1
- pyo legacy-install-failure HOT 1
- Pyo enhancements HOT 2
- install failure on OSX Ventura HOT 9
- Inconsistency in NoteinRead and NoteinRec file format HOT 3
- winhost='asio' unusual behaviour when using buffersize. HOT 2
- Fails to build with GCC 14 due to -Wincompatible-pointer-types HOT 4
- win10 getting requirements to build wheel did not run successfully
- metadata-generation-failed (py 3.8, windows 10)
- `pyo-discuss` not accessible. Move to Github Discussions?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pyo.