summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorPeter D'Hoye <peter.dhoye@gmail.com>2007-04-09 23:04:43 +0000
committerPeter D'Hoye <peter.dhoye@gmail.com>2007-04-09 23:04:43 +0000
commit81e0c9ce801273284fda3b5f9d4606bca15386de (patch)
treebfea007f55b024a2c21df0ef8ed3fe2b90c0d009 /apps
parent3e6ec547160ec80ccadd3e2bf6afe8a36572ea42 (diff)
downloadrockbox-81e0c9ce801273284fda3b5f9d4606bca15386de.tar.gz
rockbox-81e0c9ce801273284fda3b5f9d4606bca15386de.zip
Better endianness handling, removed some leftovers
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13089 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r--apps/plugins/wavview.c43
1 files changed, 4 insertions, 39 deletions
diff --git a/apps/plugins/wavview.c b/apps/plugins/wavview.c
index 37c10aca67..d8bbaf103e 100644
--- a/apps/plugins/wavview.c
+++ b/apps/plugins/wavview.c
@@ -18,27 +18,13 @@
****************************************************************************/
#include "plugin.h"
-#include <codecs/libwavpack/wavpack.h> /* for little_endian_to_native() */
-
PLUGIN_HEADER
static struct plugin_api* rb;
-// temp byte buffer
+/* temp byte buffer */
uint8_t samples[10 * 1024]; /* read 10KB at the time */
-/* +++ required by wavpack */
-void *memset(void *s, int c, size_t n)
-{
- return(rb->memset(s,c,n));
-}
-
-void *memcpy(void *dest, const void *src, size_t n)
-{
- return(rb->memcpy(dest,src,n));
-}
-/* --- required by wavpack */
-
static struct wav_header
{
int8_t chunkid[4];
@@ -86,7 +72,7 @@ static uint32_t ppp = 1;
/* helper function copied from libwavpack bits.c */
void little_endian_to_native (void *data, char *format)
{
- uchar *cp = (uchar *) data;
+ unsigned char *cp = (unsigned char *) data;
while (*format) {
switch (*format) {
@@ -106,7 +92,6 @@ void little_endian_to_native (void *data, char *format)
break;
}
-
format++;
}
}
@@ -186,12 +171,8 @@ static int readwavpeaks(char *filename)
minutes,
seconds);
rb->lcd_puts(0, 5, tstr);
-
rb->lcd_puts(0, 6, "Searching for peaks... ");
-
-#ifdef HAVE_LCD_BITMAP
rb->lcd_update();
-#endif
/* calculate room for peaks */
filepeakcount = header.datachunksize /
@@ -226,27 +207,13 @@ static int readwavpeaks(char *filename)
while(bytes_read)
{
-#ifdef ROCKBOX_BIG_ENDIAN
- sampleval = (*sampleshort) >> 8;
- sampleval |= (*sampleshort) << 8;
- sampleshort++;
-#else
- sampleval = *(sampleshort++);
-#endif
-
+ sampleval = letoh16(*sampleshort++);
if(sampleval < peak->lmin)
peak->lmin = sampleval;
else if (sampleval > peak->lmax)
peak->lmax = sampleval;
-#ifdef ROCKBOX_BIG_ENDIAN
- sampleval = (*sampleshort) >> 8;
- sampleval |= (*sampleshort) << 8;
- sampleshort++;
-#else
- sampleval = *(sampleshort++);
-#endif
-
+ sampleval = letoh16(*sampleshort++);
if(sampleval < peak->rmin)
peak->rmin = sampleval;
else if (sampleval > peak->rmax)
@@ -360,9 +327,7 @@ int displaypeaks(void)
rymin = INT_MAX;
rymax = INT_MIN;
x++;
-#ifdef HAVE_LCD_BITMAP
rb->lcd_update();
-#endif
}
peakcount++;
}