Mercurial > hg > beaglert
diff examples/basic_libpd/render.cpp @ 308:1feb9c23ac57 prerelease
Renamed read/write functions to remove the Frame --> e.g. analogWriteFrameOnce -> analogWriteOnce, digitalReadFrame -> digitalRead
author | andrewm |
---|---|
date | Fri, 27 May 2016 18:21:21 +0100 |
parents | e4392164b458 |
children | 9151fe15c194 |
line wrap: on
line diff
--- a/examples/basic_libpd/render.cpp Fri May 27 18:12:15 2016 +0100 +++ b/examples/basic_libpd/render.cpp Fri May 27 18:21:21 2016 +0100 @@ -115,21 +115,21 @@ // rt_printf("channelsInUse: %d, analogChannels in Use: %d\n", gChannelsInUse, analogChannelsInUse); for(unsigned int n = 0; n < context->audioFrames; ++n){ //pd buffers are interleaved for(unsigned int ch = 0; ch < context->audioChannels; ++ch){ //first two channels are audio - gInBuf[inW++] = audioReadFrame(context, n, ch); + gInBuf[inW++] = audioRead(context, n, ch); } // then analogs // this loop resamples by ZOH, as needed, using m if(context->analogChannels == 8 ){ //hold the value for two frames for(int analogCh = 0; analogCh < analogChannelsInUse; ++analogCh){ - gInBuf[inW++] = analogReadFrame(context, n/2, analogCh); // n/2 wil be the same for n and n+1 when n is even + gInBuf[inW++] = analogRead(context, n/2, analogCh); // n/2 wil be the same for n and n+1 when n is even } } else if(context->analogChannels == 4){ //write every frame for(int analogCh = 0; analogCh < analogChannelsInUse; ++analogCh){ - gInBuf[inW++] = analogReadFrame(context, n, analogCh); + gInBuf[inW++] = analogRead(context, n, analogCh); } } else if(context->analogChannels == 2){ //drop every other frame for(int analogCh = 0; analogCh < analogChannelsInUse; ++analogCh){ - gInBuf[inW++] = analogReadFrame(context, n*2, analogCh); + gInBuf[inW++] = analogRead(context, n*2, analogCh); } } if(inW == gBufLength * gChannelsInUse){ @@ -145,14 +145,14 @@ for(unsigned int n = 0; n < context->audioFrames; n++){ //pd buffers are interleaved for(unsigned int ch = 0; ch < context->audioChannels; ++ch){ - audioWriteFrame(context, n, ch, gOutBuf[outR++]); + audioWrite(context, n, ch, gOutBuf[outR++]); } //and analogs if(context->analogChannels == 8){ for(unsigned int analogCh = 0; analogCh < analogChannelsInUse; ++analogCh){ float analogOut = gOutBuf[outR++]; if((n&1) == 0){//write every two frames - analogWriteFrame(context, n/2, analogCh, analogOut); + analogWrite(context, n/2, analogCh, analogOut); } else { // discard this sample } @@ -160,13 +160,13 @@ } else if(context->analogChannels == 4){ //write every frame for(int analogCh = 0; analogCh < analogChannelsInUse; ++analogCh){ float analogOut = gOutBuf[outR++]; - analogWriteFrame(context, n, analogCh, analogOut); + analogWrite(context, n, analogCh, analogOut); } } else if(context->analogChannels == 2){ //write twice every frame for(unsigned int analogCh = 0; analogCh < analogChannelsInUse; ++analogCh){ float analogOut = gOutBuf[outR++]; - analogWriteFrame(context, 2*n, analogCh, analogOut); - analogWriteFrame(context, 2*n + 1, analogCh, analogOut); + analogWrite(context, 2*n, analogCh, analogOut); + analogWrite(context, 2*n + 1, analogCh, analogOut); } } if(outR == gBufLength * gChannelsInUse){