How to stop audio

I have vuforia ImageTarget app. When image is detect i need to play sound. I used AudioSource.PlayClipAtPoint(sound, transform.position); But if is not detecting i won’t need to play audio. After i change the target image, still previous audio is playing. I’m using play() function inside this function OnTrackingFound(). It plays the sound. How can i remove the sound or stop inside this function private void OnTrackingLost()

using UnityEngine;
using System.Collections;
 
public class SoundPlay : MonoBehaviour,ITrackableEventHandler {
 
 
#region PRIVATE_MEMBER_VARIABLES
 
private TrackableBehaviour mTrackableBehaviour;
public AudioClip sound;
#endregion // PRIVATE_MEMBER_VARIABLES
 
 
 
#region UNTIY_MONOBEHAVIOUR_METHODS
 
// Use this for initialization
void Start () {
 
mTrackableBehaviour = GetComponent<TrackableBehaviour>();
    if (mTrackableBehaviour)
    {
        mTrackableBehaviour.RegisterTrackableEventHandler(this);
    }
 
}
 
 
#endregion // UNTIY_MONOBEHAVIOUR_METHODS
 
 
 
#region PUBLIC_METHODS
 
/// <summary>
/// Implementation of the ITrackableEventHandler function called when the
/// tracking state changes.
/// </summary>
public void OnTrackableStateChanged(
                                TrackableBehaviour.Status previousStatus,
                                TrackableBehaviour.Status newStatus)
{
    if (newStatus == TrackableBehaviour.Status.DETECTED ||
        newStatus == TrackableBehaviour.Status.TRACKED)
    {
        OnTrackingFound();
    }
    else
    {
        OnTrackingLost();
    }
}
 
#endregion // PUBLIC_METHODS
 
 
 
#region PRIVATE_METHODS
 
 
private void OnTrackingFound()
{
    Renderer[] rendererComponents = GetComponentsInChildren<Renderer>(true);
    Collider[] colliderComponents = GetComponentsInChildren<Collider>(true);
 
    // Enable rendering:
    foreach (Renderer component in rendererComponents)
    {

play( );
        component.enabled = true;
    }
 
    // Enable colliders:
    foreach (Collider component in colliderComponents)
    {
        component.enabled = true;
    }
 
    Debug.Log("Trackable " + mTrackableBehaviour.TrackableName + " found");
 
}
 
 
private void OnTrackingLost()
{
    Renderer[] rendererComponents = GetComponentsInChildren<Renderer>(true);
    Collider[] colliderComponents = GetComponentsInChildren<Collider>(true);
 
    // Disable rendering:
    foreach (Renderer component in rendererComponents)
    {
        component.enabled = false;
    }
 
    // Disable colliders:
    foreach (Collider component in colliderComponents)
    {
        component.enabled = false;
    }
 
    Debug.Log("Trackable " + mTrackableBehaviour.TrackableName + " lost");
}
 
 
 public void Play(){
    AudioSource.PlayClipAtPoint(sound, transform.position);
}
#endregion // PRIVATE_METHODS
}

AudioSource.PlayClipAtPoint creates an object, attaches an audiosource, and plays it, all automatically for you. Unfortunately, it does not return a reference to the object it creates.

The best approach for you, is to create a GameObject with an audiosource in the hierarchy, add a reference to it in the script, and simply turn it on or off as you please:

public AudioSource audioSource; // set reference to object with audio source here in the inspector

public void Play() {
    audioSource.transform.position = transform.position;
    audioSource.PlayOneShot(sound);
}

private void OnTrackingLost() {
    aduioSource.Stop();

    // rest of your code here
}