aboutsummaryrefslogtreecommitdiffstats
path: root/demos
diff options
context:
space:
mode:
authorinmarket <andrewh@inmarket.com.au>2014-03-24 10:08:51 +1000
committerinmarket <andrewh@inmarket.com.au>2014-03-24 10:08:51 +1000
commit9919aeac899e0044549c75be849aaf6b1e2456ab (patch)
treeecbd92627b35d34075ce77d59359ea54a0c7b61a /demos
parentc354639f7b8ab1c33866b3d57a243de95a75decc (diff)
downloaduGFX-9919aeac899e0044549c75be849aaf6b1e2456ab.tar.gz
uGFX-9919aeac899e0044549c75be849aaf6b1e2456ab.tar.bz2
uGFX-9919aeac899e0044549c75be849aaf6b1e2456ab.zip
Bug fixes and comments in audio recording demo
Diffstat (limited to 'demos')
-rw-r--r--demos/modules/gaudio/oscilloscope/gwinosc.c4
-rw-r--r--demos/modules/gaudio/oscilloscope/main.c13
2 files changed, 11 insertions, 6 deletions
diff --git a/demos/modules/gaudio/oscilloscope/gwinosc.c b/demos/modules/gaudio/oscilloscope/gwinosc.c
index 9d095c86..6b51232b 100644
--- a/demos/modules/gaudio/oscilloscope/gwinosc.c
+++ b/demos/modules/gaudio/oscilloscope/gwinosc.c
@@ -144,10 +144,10 @@ void gwinScopeWaitForTrace(GHandle gh) {
scopemin = 0;
#endif
- for(i = paud->len/(gfxSampleFormatBits(gs->format)/8); i; i--) {
+ for(i = paud->len/((gfxSampleFormatBits(gs->format)+7)/8); i; i--) {
/* Calculate the new scope value - re-scale using simple shifts for efficiency, re-center and y-invert */
- if (gs->format <= 8)
+ if (gfxSampleFormatBits(gs->format) <= 8)
y = yoffset - (((coord_t)(*pa8++ ) << shr) >> (16-SCOPE_Y_BITS));
else
y = yoffset - (((coord_t)(*pa16++) << shr) >> (16-SCOPE_Y_BITS));
diff --git a/demos/modules/gaudio/oscilloscope/main.c b/demos/modules/gaudio/oscilloscope/main.c
index a0b9320e..9b53de8e 100644
--- a/demos/modules/gaudio/oscilloscope/main.c
+++ b/demos/modules/gaudio/oscilloscope/main.c
@@ -55,10 +55,15 @@ int main(void) {
gfxInit();
- // Allocate audio buffers - 4 x 128 byte buffers.
- // You may need to increase this for slower cpu's.
- // You may be able to decrease this for low latency operating systems.
- gfxBufferAlloc(4, 128);
+ /**
+ * Allocate audio buffers - eg. 4 x 128 byte buffers.
+ * You may need to increase this for slower cpu's.
+ * You may be able to decrease this for low latency operating systems.
+ * 16 x 256 seems to work on the really slow Olimex SAM7EX256 board (display speed limitation) @8kHz
+ * If your oscilloscope display stops then it is likely that your driver has stalled due to running
+ * out of free buffers. Increase the number of buffers..
+ */
+ gfxBufferAlloc(16, 256);
/* Get the screen dimensions */
swidth = gdispGetWidth();