Skip to content

Commit

Permalink
Fixed silly bugs (thanks Max)
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Oct 20, 2002
1 parent f04befc commit 7e115c3
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions native_midi/native_midi_mac.c
Expand Up @@ -124,7 +124,7 @@ NativeMidiSong *native_midi_loadsong(char *midifile)

/* Increment the instance count */
gInstaceCount++;
if (NULL == gTunePlayer)
if (gTunePlayer == NULL)
gTunePlayer = OpenDefaultComponent(kTunePlayerComponentType, 0);

/* Finally, free the event list */
Expand Down Expand Up @@ -166,7 +166,7 @@ void native_midi_freesong(NativeMidiSong *song)

/* Increment the instance count */
gInstaceCount--;
if (gTunePlayer && (gInstaceCount == 0))
if ((gTunePlayer != NULL) && (gInstaceCount == 0))
{
CloseComponent(gTunePlayer);
gTunePlayer = NULL;
Expand All @@ -178,6 +178,8 @@ void native_midi_start(NativeMidiSong *song)
UInt32 queueFlags = 0;
ComponentResult tpError;

assert (gTunePlayer != NULL);

/* First, stop the currently playing music */
native_midi_stop();

Expand Down Expand Up @@ -228,7 +230,7 @@ void native_midi_start(NativeMidiSong *song)

void native_midi_stop()
{
if (gTunePlayer)
if (gTunePlayer == NULL)
return;

/* Stop music */
Expand All @@ -240,7 +242,7 @@ void native_midi_stop()

int native_midi_active()
{
if (gTunePlayer)
if (gTunePlayer != NULL)
{
TuneStatus ts;

Expand All @@ -253,7 +255,7 @@ int native_midi_active()

void native_midi_setvolume(int volume)
{
if (gTunePlayer)
if (gTunePlayer == NULL)
return;

/* QTMA olume may range from 0.0 to 1.0 (in 16.16 fixed point encoding) */
Expand Down

0 comments on commit 7e115c3

Please sign in to comment.