Browse files

MacOS X Universal binary. Using SSE2 mixing on Mactel

  • Loading branch information...
1 parent 4433b71 commit 31e1c9a57d8c17491b4192425c3237e572b8d8a3 realtech committed Aug 8, 2006
View
10 examples/simpleplayMEM/splayMEM.c
@@ -24,7 +24,7 @@ int main(int argc, char **argv)
{
MODULE *module;
unsigned char *file_data;
- long file_length;
+ long sysFileGetLength;
FILE *fptr;
MREADER *mem_reader;
@@ -58,18 +58,18 @@ int main(int argc, char **argv)
/* calculate the file size */
fseek(fptr, 0, SEEK_END);
- file_length = ftell(fptr);
+ sysFileGetLength = ftell(fptr);
fseek(fptr, 0, SEEK_SET);
/* allocate a buffer and load the file into it */
- file_data = MikMod_malloc(file_length);
+ file_data = MikMod_malloc(sysFileGetLength);
if (file_data == NULL) {
perror("MikMod_malloc");
fclose(fptr);
MikMod_Exit();
return 1;
}
- if (fread(file_data, file_length, 1, fptr) != 1)
+ if (fread(file_data, sysFileGetLength, 1, fptr) != 1)
{
perror("fread");
fclose(fptr);
@@ -80,7 +80,7 @@ int main(int argc, char **argv)
fclose(fptr);
/* Create the memory reader */
- mem_reader = _mm_new_mem_reader(file_data, file_length);
+ mem_reader = _mm_new_mem_reader(file_data, sysFileGetLength);
if (mem_reader == NULL) {
fprintf(stderr, "failed to create mem reader\n");
MikMod_free(file_data);
View
10 examples/soundeffects/soundeffects.c
@@ -21,7 +21,7 @@
SAMPLE *Load(char *fn)
{
char *file_data;
- long file_length;
+ long sysFileGetLength;
FILE *fptr;
// return Sample_Load(fn);
@@ -35,17 +35,17 @@ SAMPLE *Load(char *fn)
/* calculate the file size */
fseek(fptr, 0, SEEK_END);
- file_length = ftell(fptr);
+ sysFileGetLength = ftell(fptr);
fseek(fptr, 0, SEEK_SET);
/* allocate a buffer and load the file into it */
- file_data = MikMod_malloc(file_length);
+ file_data = MikMod_malloc(sysFileGetLength);
if (file_data == NULL) {
perror("MikMod_malloc");
fclose(fptr);
return 0;
}
- if (fread(file_data, file_length, 1, fptr) != 1)
+ if (fread(file_data, sysFileGetLength, 1, fptr) != 1)
{
perror("fread");
fclose(fptr);
@@ -54,7 +54,7 @@ SAMPLE *Load(char *fn)
}
fclose(fptr);
- return Sample_LoadMem(file_data, file_length);
+ return Sample_LoadMem(file_data, sysFileGetLength);
}
main()
View
16 include/mikmod_internals.h
@@ -20,7 +20,7 @@
/*==============================================================================
- $Id: mikmod_internals.h,v 1.4 2005/05/18 13:42:16 raphassenat Exp $
+ $Id: mikmod_internals.h,v 1.5 2006/08/08 00:06:31 realtech Exp $
MikMod sound library internal definitions
@@ -675,27 +675,27 @@ extern BOOL Voice_Stopped_internal(SBYTE);
#endif
/*========== SIMD mixing routines */
+#undef HAVE_ALTIVEC
+#undef HAVE_SSE2
-#if defined(__APPLE__) && defined(__MACH__)
+#if defined(__APPLE__) && !defined (__i386__)
-#ifdef __VEC__
+#if defined __VEC__ && !(defined(__GNUC__) && (__GNUC__ < 3))
#define HAVE_ALTIVEC
#endif // __VEC__
-#if defined(__GNUC__) && (__GNUC__ < 3)
-#undef HAVE_ALTIVEC
-#endif
-
-#elif defined WIN32 || defined __WIN64
+#elif defined WIN32 || defined __WIN64 || (defined __APPLE__ && defined (__i386__) && defined __VEC__)
// FIXME: emmintrin.h requires VC6 processor pack or VC2003+
#define HAVE_SSE2
/* Fixes couples warnings */
+#ifdef _MSC_VER
#pragma warning(disable:4761)
#pragma warning(disable:4391)
#pragma warning(disable:4244)
#endif
+#endif
// TODO: Test for GCC Linux
/*========== SIMD mixing helper functions =============*/
View
4 playercode/mdriver.c
@@ -20,7 +20,7 @@
/*==============================================================================
- $Id: mdriver.c,v 1.2 2005/03/30 19:11:17 realtech Exp $
+ $Id: mdriver.c,v 1.3 2006/08/08 00:06:31 realtech Exp $
These routines are used to access the available soundcard drivers.
@@ -72,7 +72,7 @@ MIKMODAPI UBYTE md_sndfxvolume = 128; /* volume of sound effects */
UBYTE md_hardchn=0,md_softchn=0;
void (*md_player)(void) = Player_HandleTick;
-static BOOL isplaying=0, initialized = 0;
+static volatile BOOL isplaying=0, initialized = 0;
static UBYTE *sfxinfo;
static int sfxpool;
View
4 playercode/mplayer.c
@@ -20,7 +20,7 @@
/*==============================================================================
- $Id: mplayer.c,v 1.3 2005/03/30 19:11:46 realtech Exp $
+ $Id: mplayer.c,v 1.4 2006/08/08 00:06:31 realtech Exp $
The Protracker Player Driver
@@ -3390,7 +3390,7 @@ MIKMODAPI int Player_GetOrder(void)
{
int ret;
MUTEX_LOCK(vars);
- ret = pf ? pf->positions[pf->sngpos ? pf->sngpos-1 : 0]: 0;
+ ret = pf ? pf->sngpos :0; // pf->positions[pf->sngpos ? pf->sngpos-1 : 0]: 0;
MUTEX_UNLOCK(vars);
return ret;
}

0 comments on commit 31e1c9a

Please sign in to comment.