mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-09 05:05:20 -05:00
Improve simulator use of multiple codecs
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11083 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
076ab8d206
commit
8c9d5f35f0
1 changed files with 18 additions and 15 deletions
|
|
@ -331,28 +331,31 @@ void *sim_codec_load_ram(char* codecptr, int size,
|
||||||
char path[MAX_PATH];
|
char path[MAX_PATH];
|
||||||
int fd;
|
int fd;
|
||||||
int copy_n;
|
int copy_n;
|
||||||
static int codec_count = 0;
|
int codec_count;
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
char buf[256];
|
char buf[256];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
*pd = NULL;
|
*pd = NULL;
|
||||||
|
|
||||||
/* We have to create the dynamic link library file from ram
|
/* We have to create the dynamic link library file from ram so we
|
||||||
so we could simulate the codec loading. */
|
can simulate the codec loading. With voice and crossfade,
|
||||||
|
multiple codecs may be loaded at the same time, so we need
|
||||||
|
to find an unused filename */
|
||||||
|
for (codec_count = 0; codec_count < 10; codec_count++)
|
||||||
|
{
|
||||||
|
sprintf(path, TEMP_CODEC_FILE, codec_count);
|
||||||
|
|
||||||
sprintf(path, TEMP_CODEC_FILE, codec_count);
|
#ifdef WIN32
|
||||||
|
fd = open(path, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, S_IRWXU);
|
||||||
/* if voice is enabled, two codecs may be loaded at same time */
|
#else
|
||||||
if (!codec_count)
|
fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, S_IRWXU);
|
||||||
codec_count++;
|
#endif
|
||||||
|
if (fd >= 0)
|
||||||
#ifdef WIN32
|
break; /* Created a file ok */
|
||||||
fd = open(path, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, S_IRWXU);
|
}
|
||||||
#else
|
if (fd < 0)
|
||||||
fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, S_IRWXU);
|
{
|
||||||
#endif
|
|
||||||
if (fd < 0) {
|
|
||||||
DEBUGF("failed to open for write: %s\n", path);
|
DEBUGF("failed to open for write: %s\n", path);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue