- Home /
Synchronizing Audio
Hello
I have individual tracks of a song : vocal, bass, drums, vocal2, guitar etc...
I need to start them all in the start function and then trigger them on and off as the player moves around and clicks things...
here's the Audio Manager Script:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[RequireComponent(typeof(AudioSource))]
public class audio_Mgmt: MonoBehaviour {
public audio_Source vocal();
public audio_Source drum();
public audio_Source keys();
public audio_Source bass();
void Awake()
{
AudioSource vocal = GetComponent<AudioSource>();
AudioSource drum = GetComponent<AudioSource>();
AudioSource keys = GetComponent<AudioSource>();
AudioSource bass = GetComponent<AudioSource>();
}
void Start()
{
vocal.Play();
drum.Play();
keys.Play();
bass.Play();
}
}
Here is a script on an individual Trigger Object : using System.Collections; using System.Collections.Generic; using UnityEngine;
[RequireComponent(typeof(AudioSource))]
public class audio_Click : MonoBehaviour
{
private void Start()
{
AudioSource audio = GetComponent<AudioSource>();
}
void OnMouseUp()
{
if (AudioSource.isPlaying) { AudioSource.Mute(); }
else if (AudioSource.!isPlaying) { AudioSource.Play(); }
}
}
Too tired to see straight - Terminology in the last script sux. I want to simply mute the tracks so you can mix them but they all must be playing together already...
Thanks for your help
~be
Comment