aboutsummaryrefslogtreecommitdiffstats
path: root/demos/modules/gaudio/oscilloscope
diff options
context:
space:
mode:
Diffstat (limited to 'demos/modules/gaudio/oscilloscope')
-rw-r--r--demos/modules/gaudio/oscilloscope/gfxconf.h1
-rw-r--r--demos/modules/gaudio/oscilloscope/gwinosc.c8
-rw-r--r--demos/modules/gaudio/oscilloscope/main.c13
3 files changed, 13 insertions, 9 deletions
diff --git a/demos/modules/gaudio/oscilloscope/gfxconf.h b/demos/modules/gaudio/oscilloscope/gfxconf.h
index 2caa1da9..8e20ce0b 100644
--- a/demos/modules/gaudio/oscilloscope/gfxconf.h
+++ b/demos/modules/gaudio/oscilloscope/gfxconf.h
@@ -45,7 +45,6 @@
#define GFX_USE_GDISP TRUE
#define GFX_USE_GWIN TRUE
#define GFX_USE_GTIMER TRUE
-//#define GFX_USE_GADC TRUE
#define GFX_USE_GAUDIO TRUE
/* Features for the GDISP sub-system. */
diff --git a/demos/modules/gaudio/oscilloscope/gwinosc.c b/demos/modules/gaudio/oscilloscope/gwinosc.c
index 21a83760..6b51232b 100644
--- a/demos/modules/gaudio/oscilloscope/gwinosc.c
+++ b/demos/modules/gaudio/oscilloscope/gwinosc.c
@@ -96,7 +96,7 @@ GHandle gwinGScopeCreate(GDisplay *g, GScopeObject *gs, GWindowInit *pInit, uint
void gwinScopeWaitForTrace(GHandle gh) {
#define gs ((GScopeObject *)(gh))
- GAudioData *paud;
+ GDataBuffer *paud;
int i;
coord_t x, y;
coord_t yoffset;
@@ -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));
@@ -216,6 +216,6 @@ void gwinScopeWaitForTrace(GHandle gh) {
gs->scopemin = scopemin;
#endif
- gaudioReleaseBuffer(paud);
+ gfxBufferRelease(paud);
#undef gs
}
diff --git a/demos/modules/gaudio/oscilloscope/main.c b/demos/modules/gaudio/oscilloscope/main.c
index b44b5a02..3636e8f9 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.
- gaudioAllocBuffers(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.
+ * 8 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(8, 256);
/* Get the screen dimensions */
swidth = gdispGetWidth();