Mercurial > hg > beaglert
comparison core/PulseIn.cpp @ 311:493a07f6ec09 prerelease
Renamed BelaContext->audioSampleCount to BelaContext->audioFramesElapsed for consistency of terminology
author | andrewm |
---|---|
date | Fri, 27 May 2016 18:37:51 +0100 |
parents | 02c4ca0e3718 |
children |
comparison
equal
deleted
inserted
replaced
310:02c4ca0e3718 | 311:493a07f6ec09 |
---|---|
24 _array[n] = 0; //maybe a few of these will be overwritten below | 24 _array[n] = 0; //maybe a few of these will be overwritten below |
25 } | 25 } |
26 for(unsigned int n = 0; n < context->digitalFrames; n++){ | 26 for(unsigned int n = 0; n < context->digitalFrames; n++){ |
27 if(_pulseIsOn == false){ // look for start edge | 27 if(_pulseIsOn == false){ // look for start edge |
28 if(digitalRead(context, n, _digitalInput) == _pulseOnState){ | 28 if(digitalRead(context, n, _digitalInput) == _pulseOnState){ |
29 _pulseStart = context->audioSampleCount + n; // store location of start edge | 29 _pulseStart = context->audioFramesElapsed + n; // store location of start edge |
30 _pulseIsOn = true; | 30 _pulseIsOn = true; |
31 } | 31 } |
32 } else { // _pulseIsOn == true; | 32 } else { // _pulseIsOn == true; |
33 if(digitalRead(context, n, _digitalInput) == !_pulseOnState){ // look for stop edge | 33 if(digitalRead(context, n, _digitalInput) == !_pulseOnState){ // look for stop edge |
34 _array[n] = context->audioSampleCount + n - _pulseStart; // compute and store pulse duration | 34 _array[n] = context->audioFramesElapsed + n - _pulseStart; // compute and store pulse duration |
35 _pulseIsOn = false; | 35 _pulseIsOn = false; |
36 } | 36 } |
37 } | 37 } |
38 } | 38 } |
39 _lastContext = context->audioSampleCount; | 39 _lastContext = context->audioFramesElapsed; |
40 }; | 40 }; |
41 | 41 |
42 PulseIn::~PulseIn() { | 42 PulseIn::~PulseIn() { |
43 // TODO Auto-generated destructor stub | 43 // TODO Auto-generated destructor stub |
44 } | 44 } |