Index: lib/sound/audio.c
===================================================================
--- lib/sound/audio.c	(revision 5427)
+++ lib/sound/audio.c	(working copy)
@@ -37,6 +37,62 @@
 static BOOL			g_bAudioPaused = false;
 static AUDIO_SAMPLE g_sPreviousSample;
 
+#ifndef WZ_NOSOUND
+static AUDIO_SAMPLE *current_queue_sample = NULL;
+#endif
+
+//*
+// =======================================================================================================================
+// =======================================================================================================================
+//
+BOOL sound_QueueSamplePlaying( void )
+{
+#ifndef WZ_NOSOUND
+	ALenum	state;
+	AUDIO_SAMPLE *psSample = g_psSampleList, *prev = NULL;
+
+	if (!g_bAudioEnabled)
+	{
+		return false;
+	}
+	if (!current_queue_sample)
+	{
+		return false;
+	}
+
+	alGetSourcei(current_queue_sample->iSample, AL_SOURCE_STATE, &state);
+
+	if (state == AL_PLAYING)
+	{
+		return true;
+	}
+
+	sound_DeleteSample(current_queue_sample->iSample);	// because we have our own copies of all samples...
+	while (psSample != NULL)
+	{
+		if (psSample == current_queue_sample)
+		{
+			if (prev)
+			{
+				prev->psNext = psSample->psNext;
+			}
+			else
+			{
+				g_psSampleList = psSample->psNext;
+			}
+			free(psSample);
+			current_queue_sample = NULL;
+			return true;
+		}
+		prev = psSample;
+		psSample = psSample->psNext;
+	}
+	debug(LOG_ERROR, "wtf");
+	current_queue_sample = NULL;
+#endif
+	return false;
+}
+
 /** Counts the number of samples in the SampleQueue
  *  \return the number of samples in the SampleQueue
  */
@@ -123,6 +179,7 @@
 		return true;
 	}
 
+	current_queue_sample = NULL;
 	sound_StopAll();
 	bOK = sound_Shutdown();
 
@@ -493,9 +550,11 @@
 	audio_RemoveSample( &g_psSampleQueue, psSample );
 
 	// add sample to list if able to play
+	current_queue_sample = psSample;
 	if ( !sound_Play2DTrack(psSample, true) )
 	{
 		debug( LOG_NEVER, "audio_UpdateQueue: couldn't play sample\n" );
+		current_queue_sample = NULL;
 		free(psSample);
 		return;
 	}
@@ -548,6 +607,10 @@
 		{
 			audio_RemoveSample( &g_psSampleList, psSample );
 			psSampleTemp = psSample->psNext;
+			if (psSample == current_queue_sample)
+			{
+				current_queue_sample = NULL;
+			}
 			free(psSample);
 			psSample = psSampleTemp;
 		}
@@ -701,6 +764,7 @@
 	if ( !sound_Play3DTrack(psSample) )
 	{
 		debug( LOG_NEVER, "audio_Play3DTrack: couldn't play sample\n" );
+		current_queue_sample = NULL;
 		free(psSample);
 		return false;
 	}
@@ -911,6 +975,10 @@
 	 */
 
 	// add sample to list if able to play
+	if (psSample == current_queue_sample)
+	{
+		current_queue_sample = NULL;	// dunno why, but that's how it was - Per
+	}
 	if ( !sound_Play2DTrack(psSample, false) )
 	{
 		debug( LOG_NEVER, "audio_PlayTrack: couldn't play sample\n" );
@@ -1004,6 +1072,10 @@
 
 		// Destroy the sample
 		free(psSampleTemp);
+		if (psSampleTemp == current_queue_sample)
+		{
+			current_queue_sample = NULL;
+		}
 	}
 
 	g_psSampleQueue = NULL;
@@ -1070,6 +1142,10 @@
 			// Perform the actual task of destroying this sample
 			audio_RemoveSample(&g_psSampleQueue, toRemove);
 			free(toRemove);
+			if (toRemove == current_queue_sample)
+			{
+				current_queue_sample = NULL;
+			}
 
 			// Increment the deletion count
 			++count;
@@ -1107,6 +1183,10 @@
 			// Perform the actual task of destroying this sample
 			audio_RemoveSample(&g_psSampleList, toRemove);
 			free(toRemove);
+			if (current_queue_sample == toRemove)
+			{
+				current_queue_sample = NULL;
+			}
 
 			// Increment the deletion count
 			++count;
Index: lib/sound/openal_track.c
===================================================================
--- lib/sound/openal_track.c	(revision 5427)
+++ lib/sound/openal_track.c	(working copy)
@@ -49,10 +49,6 @@
 
 #define ATTENUATION_FACTOR	0.0003f
 
-#ifndef WZ_NOSOUND
-static AUDIO_SAMPLE *current_queue_sample = NULL;
-#endif
-
 static BOOL openal_initialized = false;
 
 struct __audio_stream
@@ -91,7 +87,32 @@
 static ALCcontext* context = 0;
 #endif
 
+static void sound_DestroyIteratedSample(SAMPLE_LIST** previous, SAMPLE_LIST** sample);
 
+bool sound_DeleteSample(ALuint id)
+{
+	SAMPLE_LIST* node = active_samples;
+	SAMPLE_LIST* previous = NULL;
+
+	// We need to remove it from the queue of actively played samples
+	while (node != NULL)
+	{
+		if (node->curr->iSample == id)
+		{
+			debug(LOG_SOUND, "Removing %u from queue", id);
+			sound_DestroyIteratedSample(&previous, &node);
+			return true;
+		}
+		previous = node;
+		if (node)
+		{
+			node = node->next;
+		}
+	}
+	debug(LOG_ERROR, "Sample %u not found!", id);
+	return false;
+}
+
 /** Removes the given sample from the "active_samples" linked list
  *  \param previous either NULL (if \c to_remove is the first item in the
  *                  list) or the item occurring just before \c to_remove in
@@ -333,61 +354,6 @@
 #endif
 }
 
-//*
-// =======================================================================================================================
-// =======================================================================================================================
-//
-BOOL sound_QueueSamplePlaying( void )
-{
-#ifndef WZ_NOSOUND
-	ALenum	state;
-
-	if ( !openal_initialized )
-	{
-		return false;
-	}
-	if (!current_queue_sample)
-	{
-		return false;
-	}
-
-	alGetSourcei(current_queue_sample->iSample, AL_SOURCE_STATE, &state);
-
-	// Check whether an error occurred while retrieving the state.
-	// If one did, the state returned is useless. So instead of
-	// using it return false.
-	if (sound_GetError() != AL_NO_ERROR)
-		return false;
-
-	if (state == AL_PLAYING)
-	{
-		return true;
-	}
-
-	SAMPLE_LIST* node = active_samples;
-	SAMPLE_LIST* previous = NULL;
-
-	// We need to remove it from the queue of actively played samples
-	while (node != NULL)
-	{
-		if (node->curr == current_queue_sample)
-		{
-			sound_DestroyIteratedSample(&previous, &node);
-			current_queue_sample = NULL;
-			return false;
-		}
-		previous = node;
-		if (node)
-		{
-			node = node->next;
-		}
-	}
-	debug(LOG_ERROR, "Sample %u not deleted because it wasn't in the active queue!", current_queue_sample->iSample);
-	current_queue_sample = NULL;
-#endif
-	return false;
-}
-
 /** Decodes an opened OggVorbis file into an OpenAL buffer
  *  \param psTrack pointer to object which will contain the final buffer
  *  \param PHYSFS_fileHandle file handle given by PhysicsFS to the opened file
@@ -595,14 +561,6 @@
 	sound_GetError();
 	alSourcePlay( psSample->iSample );
 	sound_GetError();
-	if ( bQueued )
-	{
-		current_queue_sample = psSample;
-	}
-	else if ( current_queue_sample == psSample )
-	{
-		current_queue_sample = NULL;
-	}
 #endif
 
 	return true;
Index: lib/sound/track.h
===================================================================
--- lib/sound/track.h	(revision 5427)
+++ lib/sound/track.h	(working copy)
@@ -130,6 +130,8 @@
 extern float sound_GetStreamVolume(const AUDIO_STREAM* stream);
 extern void sound_SetStreamVolume(AUDIO_STREAM* stream, float volume);
 
+bool sound_DeleteSample(ALuint id);
+
 #if defined(__cplusplus)
 }
 #endif
