Skip to content

Commit

Permalink
Ported to MacOS
Browse files Browse the repository at this point in the history
  • Loading branch information
Sam Lantinga committed Feb 11, 2000
1 parent c0fcd53 commit 1df71a7
Show file tree
Hide file tree
Showing 14 changed files with 533 additions and 33 deletions.
32 changes: 17 additions & 15 deletions CHANGES
@@ -1,24 +1,26 @@

1.0.4:
* Markus Oberhumer Wed Feb 2 13:16:17 PST 2000
- Fixed problem with short looping sounds
* Sam Lantinga Tue Feb 1 13:25:44 PST 2000
- Added Visual C++ project file
* Markus Oberhumer Tue Feb 1 13:23:11 PST 2000
- Cleaned up code for compiling with Visual C++
- Don't hang in Mix_HaltMusic() if the music is paused
* Sam Lantinga Fri Jan 28 08:54:56 PST 2000
- Fixed looping WAVE chunks that are not aligned on sample boundaries
Sam Lantinga - Thu Feb 10 19:42:03 PST 2000
* Ported the base mixer and mikmod libraries to MacOS
Markus Oberhumer - Wed Feb 2 13:16:17 PST 2000
* Fixed problem with short looping sounds
Sam Lantinga - Tue Feb 1 13:25:44 PST 2000
* Added Visual C++ project file
Markus Oberhumer - Tue Feb 1 13:23:11 PST 2000
* Cleaned up code for compiling with Visual C++
* Don't hang in Mix_HaltMusic() if the music is paused
Sam Lantinga - Fri Jan 28 08:54:56 PST 2000
* Fixed looping WAVE chunks that are not aligned on sample boundaries

1.0.3:
* Sam Lantinga Mon Jan 17 19:48:09 PST 2000
- Changed the name of the library from "mixer" to "SDL_mixer"
- Instead of including "mixer.h", include "SDL_mixer.h",
- Instead of linking with libmixer.a, link with libSDL_mixer.a
Sam Lantinga - Mon Jan 17 19:48:09 PST 2000
* Changed the name of the library from "mixer" to "SDL_mixer"
* Instead of including "mixer.h", include "SDL_mixer.h",
* Instead of linking with libmixer.a, link with libSDL_mixer.a

1.0.2:
* Sam Lantinga Fri Jan 14 11:06:56 PST 2000
- Made the CHANGELOG entries Y2K compliant. :)
Sam Lantinga - Fri Jan 14 11:06:56 PST 2000
* Made the CHANGELOG entries Y2K compliant. :)
MFX - Updated the mikmod support to MikMod 3.1.8
MFX - Added Mix_HookMusicFinished() API function

Expand Down
450 changes: 450 additions & 0 deletions MPWmake.sea.hqx

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions Makefile.am
Expand Up @@ -32,6 +32,7 @@ endif
EXTRA_DIST = \
CHANGES \
VisualC.zip \
MPWmake.sea.hqx \
autogen.sh

libSDL_mixer_la_LDFLAGS = \
Expand Down
5 changes: 3 additions & 2 deletions mikmod/mdriver.c
Expand Up @@ -39,13 +39,14 @@
#include <sys/stat.h>
#endif

#include "mikmod_internals.h"

#include <string.h>
#ifdef HAVE_STRINGS_H
#include <strings.h>
#endif

#include "mikmod_internals.h"


static MDRIVER *firstdriver=NULL;
MDRIVER *md_driver=NULL;
extern MODULE *pf; /* modfile being played */
Expand Down
22 changes: 18 additions & 4 deletions mikmod/mikmod_internals.h
Expand Up @@ -29,10 +29,6 @@
#ifndef _MIKMOD_INTERNALS_H
#define _MIKMOD_INTERNALS_H

#ifdef __cplusplus
extern "C" {
#endif

#ifdef HAVE_MALLOC_H
#include <malloc.h>
#endif
Expand All @@ -43,11 +39,29 @@ extern "C" {

#include <mikmod_build.h>

#ifdef macintosh
#define __STDC__=1
static char *strdup(const char *str)
{
char *newstr;

newstr = (char *)malloc(strlen(str)+1);
if ( newstr != NULL ) {
strcpy(newstr, str);
}
return(newstr);
}
#endif

#ifdef WIN32
#define __STDC__
#pragma warning(disable:4761)
#endif

#ifdef __cplusplus
extern "C" {
#endif

/*========== More type definitions */

/* SLONGLONG: 64bit, signed */
Expand Down
2 changes: 1 addition & 1 deletion mikmod/mloader.c
Expand Up @@ -33,10 +33,10 @@
#ifdef HAVE_MEMORY_H
#include <memory.h>
#endif
#include <string.h>

#include "mikmod_internals.h"

#include <string.h>

MREADER *modreader;
MODULE of;
Expand Down
3 changes: 2 additions & 1 deletion mikmod/munitrk.c
Expand Up @@ -30,9 +30,10 @@
#include "config.h"
#endif

#include <string.h>

#include "mikmod_internals.h"

#include <string.h>

/* Unibuffer chunk size */
#define BUFPAGE 128
Expand Down
14 changes: 11 additions & 3 deletions mikmod/virtch.c
Expand Up @@ -38,11 +38,12 @@
#include "config.h"
#endif

#include "mikmod_internals.h"

#include <stddef.h>
#include <string.h>

#include "mikmod_internals.h"


/*
Constant definitions
====================
Expand Down Expand Up @@ -524,7 +525,6 @@ static void AddChannel(SLONG* ptr,NATIVE todo)
reached the end of the sample */
while(todo>0) {
SLONGLONG endpos;

if(vnf->flags & SF_REVERSE) {
/* The sample is playing in reverse */
if((vnf->flags&SF_LOOP)&&(vnf->current<idxlpos)) {
Expand Down Expand Up @@ -640,12 +640,20 @@ static void AddChannel(SLONG* ptr,NATIVE todo)
vnf->current=MixMonoNormal
(s,ptr,vnf->current,vnf->increment,done);
}

} else
/* update sample position */
vnf->current=endpos;

todo-=done;
#if 1
if ( vc_mode & DMODE_STEREO )
ptr += done*2;
else
ptr += done;
#else
ptr +=(vc_mode & DMODE_STEREO)?(done<<1):done;
#endif
}
}

Expand Down
23 changes: 21 additions & 2 deletions mikmod/virtch2.c
Expand Up @@ -39,11 +39,14 @@
#include "config.h"
#endif

#include "mikmod_internals.h"

#include <stddef.h>
#include <string.h>

#include "mikmod_internals.h"

#ifdef macintosh
#define NO_64BIT_MIXER
#endif
/*
Constant Definitions
====================
Expand Down Expand Up @@ -266,6 +269,8 @@ static SLONG Mix32StereoSurround(SWORD* srce,SLONG* dest,SLONG index,SLONG incre

/*========== 64 bit mixers */

#ifndef NO_64BIT_MIXER

static SLONGLONG MixMonoNormal(SWORD* srce,SLONG* dest,SLONGLONG index,SLONGLONG increment,SLONG todo)
{
SWORD sample=0;
Expand Down Expand Up @@ -381,6 +386,8 @@ static SLONGLONG MixStereoSurround(SWORD* srce,SLONG* dest,SLONGLONG index,SLONG
return index;
}

#endif /* NO_64BIT_MIXER */

static void(*Mix32to16)(SWORD* dste,SLONG* srce,NATIVE count);
static void(*Mix32to8)(SBYTE* dste,SLONG* srce,NATIVE count);
static void(*MixReverb)(SLONG* srce,NATIVE count);
Expand Down Expand Up @@ -645,6 +652,9 @@ static void AddChannel(SLONG* ptr,NATIVE todo)
(s,ptr,vnf->current,vnf->increment,done);
} else
#endif
#ifdef NO_64BIT_MIXER
/* Uh oh, the 64-bit mixers don't compile... */;
#else
{
if(vc_mode & DMODE_STEREO) {
if((vnf->pan==PAN_SURROUND)&&(vc_mode&DMODE_SURROUND))
Expand All @@ -657,14 +667,23 @@ static void AddChannel(SLONG* ptr,NATIVE todo)
vnf->current=MixMonoNormal
(s,ptr,vnf->current,vnf->increment,done);
}
#endif
} else {
vnf->lastvalL = vnf->lastvalR = 0;
/* update sample position */
vnf->current=endpos;
}

todo -= done;
#if 1
if ( vc_mode & DMODE_STEREO ) {
ptr += done*2;
} else {
ptr += done;
}
#else
ptr +=(vc_mode & DMODE_STEREO)?(done<<1):done;
#endif
}
}

Expand Down
2 changes: 2 additions & 0 deletions mixer.c
Expand Up @@ -185,11 +185,13 @@ int Mix_OpenAudio(int frequency, Uint16 format, int channels, int chunksize)

/* Create the channel lock mutex */
mixer_lock = SDL_CreateMutex();
#ifndef macintosh /* Hmm.. what implications does this have? */
if ( mixer_lock == NULL ) {
SDL_CloseAudio();
SDL_SetError("Unable to create mixer lock");
return(-1);
}
#endif

/* Initialize the music players */
if ( open_music(&mixer) < 0 ) {
Expand Down
2 changes: 1 addition & 1 deletion music.c
Expand Up @@ -328,7 +328,7 @@ int open_music(SDL_AudioSpec *mixer)
Mix_Music *Mix_LoadMUS(const char *file)
{
FILE *fp;
unsigned char magic[5];
char magic[5];
Mix_Music *music;

/* Figure out what kind of file this is */
Expand Down
4 changes: 2 additions & 2 deletions playmus.c
Expand Up @@ -26,7 +26,7 @@
#include <stdio.h>
#include <string.h>
#include <signal.h>
#ifndef WIN32
#ifdef unix
#include <unistd.h>
#endif

Expand Down Expand Up @@ -83,7 +83,7 @@ void Menu(void)

main(int argc, char *argv[])
{
Uint32 audio_rate;
int audio_rate;
Uint16 audio_format;
int audio_channels;
int audio_buffers;
Expand Down
4 changes: 2 additions & 2 deletions playwave.c
Expand Up @@ -26,7 +26,7 @@
#include <stdio.h>
#include <string.h>
#include <signal.h>
#ifndef WIN32
#ifdef unix
#include <unistd.h>
#endif

Expand Down Expand Up @@ -57,7 +57,7 @@ void Usage(char *argv0)

main(int argc, char *argv[])
{
Uint32 audio_rate;
int audio_rate;
Uint16 audio_format;
int audio_channels;
int loops = 0;
Expand Down
2 changes: 2 additions & 0 deletions wavestream.c
Expand Up @@ -57,9 +57,11 @@ int WAVStream_Init(SDL_AudioSpec *mixerfmt)
{
/* FIXME: clean up the mutex, or move it into music.c */
music_lock = SDL_CreateMutex();
#ifndef macintosh /* Hmm.. */
if ( music_lock == NULL ) {
return(-1);
}
#endif
mixer = *mixerfmt;
return(0);
}
Expand Down

0 comments on commit 1df71a7

Please sign in to comment.