making an array out of objects that are playing sound

hi how do i only put certain GameObject.FindGameObjectsWithTag() that isplaying audio into an array?

this is what i have at the moment, the only way i can think of making this work is to have a separate script on every sound with a boolean on it which gets turned on if there is audio playing and using the information to control them

/*private*/ var allGameSFXSources : AudioSource[];//this is to collect all sfx in game including instantiated ones

function OnEnable()
{	
	var findAllSFX = GameObject.FindGameObjectsWithTag("gameSFX");
	
	allGameSFXSources = new AudioSource[findAllSFX.Length];
	
	for(var ASFXS : int = 0; ASFXS <allGameSFXSources.Length; ASFXS++)
	{		
		allGameSFXSources[ASFXS] = findAllSFX[ASFXS].audio;
		
			allGameSFXSources[ASFXS].Pause();
	}
}

function OnDisable()

{	
	if(allGameSFXSources != [0])
	{	
		for(var ASFXS : int = 0; ASFXS <allGameSFXSources.length; ASFXS++)
		{
			allGameSFXSources[ASFXS].Play();
		}
		allGameSFXSources = new AudioSource[0];
	}
}

Do you want to pause and resume only the sounds that were already playing? If so, you could get the “gameSFX” objects in an array and simply store null in the ones that aren’t playing, then resume only the ones that still have a non-null game object reference:

private var gameSFX: GameObject[];

function OnEnable()
{   
    gameSFX = GameObject.FindGameObjectsWithTag("gameSFX");
    for (var ASFXS : int = 0; ASFXS < gameSFX.length; ASFXS++)
    {   
        var asource: AudioSource = gameSFX[ASFXS].audio;
        if (asource.isPlaying){ // if sound is playing, pause it:
            asource.Pause(); // Pause() allows resuming the sound from where it stopped
        } else { // if not playing, null the game object reference:
            gameSFX[ASFXS] = null;
        }
    }
}

function OnDisable()
{   
    for (ASFXS = 0; ASFXS < gameSFX.length; ASFXS++)
    {
        // resume the sounds that have non-null game object references:
        if (gameSFX[ASFXS]) gameSFX[ASFXS].audio.Play();
    }
}