pdbox: Solved issue with WAV file import on big-endian targets (signed 16-bit files only); small I/O-related workaround in g_array.c

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26439 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Wincent Balin 2010-06-01 00:23:59 +00:00
parent dc496d6fbe
commit a266ff185a
2 changed files with 9 additions and 2 deletions

View file

@ -423,7 +423,14 @@ static void soundfile_xferin(int sfchannels, int nvecs, t_sample **vecs,
{ {
for (j = 0, sp2 = sp, fp=vecs[i] + itemsread; for (j = 0, sp2 = sp, fp=vecs[i] + itemsread;
j < nitems; j++, sp2 += bytesperframe, fp++) j < nitems; j++, sp2 += bytesperframe, fp++)
#ifdef ROCKBOX_BIG_ENDIAN
{
short xx = (sp2[1] << 8) | sp2[0];
*fp = xx << (fix1-16);
}
#else
*fp = ((short*)sp2)[0]<<(fix1-16); *fp = ((short*)sp2)[0]<<(fix1-16);
#endif
} }
} }
else if (bytespersamp == 3) else if (bytespersamp == 3)

View file

@ -1154,7 +1154,7 @@ static void garray_read(t_garray *x, t_symbol *filename)
canvas_getdir(glist_getcanvas(x->x_glist))->s_name, canvas_getdir(glist_getcanvas(x->x_glist))->s_name,
filename->s_name, "", buf, &bufptr, MAXPDSTRING, 0)) < 0 filename->s_name, "", buf, &bufptr, MAXPDSTRING, 0)) < 0
#ifdef ROCKBOX #ifdef ROCKBOX
) || !(fd = filedesc))
#else #else
|| !(fd = fdopen(filedesc, "r"))) || !(fd = fdopen(filedesc, "r")))
#endif #endif
@ -1234,7 +1234,7 @@ static void garray_read16(t_garray *x, t_symbol *filename,
canvas_getdir(glist_getcanvas(x->x_glist))->s_name, canvas_getdir(glist_getcanvas(x->x_glist))->s_name,
filename->s_name, "", buf, &bufptr, MAXPDSTRING, 1)) < 0 filename->s_name, "", buf, &bufptr, MAXPDSTRING, 1)) < 0
#ifdef ROCKBOX #ifdef ROCKBOX
) || !(fd = filedesc))
#else #else
|| !(fd = fdopen(filedesc, BINREADMODE))) || !(fd = fdopen(filedesc, BINREADMODE)))
#endif #endif