public void setVoiceChannel(int v) { channel = v; if (voiceChannels != null) { voice = voiceChannels[channel]; } }
public DrumVoice GetVoice() { if (DrumVoiceSource == null) { DrumVoiceSource = GameObject.Find("DrumVoices"); } if (voiceChannels == null || voice == null) { voiceChannels = DrumVoiceSource.GetComponentsInChildren <DrumVoice>(); voice = voiceChannels[channel]; } return(voice); }
// Use this for initialization void Awake() { audioSource = GetComponent <AudioSource>(); timer = GameObject.Find("Timer").GetComponent <BPMTimer>(); osc = GameObject.Find("OSC").GetComponent <OSC>(); if (DrumVoiceSource == null) { DrumVoiceSource = GameObject.Find("DrumVoices"); } rend = GetComponent <Renderer>(); noise = DrumVoiceSource.GetComponentInChildren <NoiseGenerator>(); voiceChannels = DrumVoiceSource.GetComponentsInChildren <DrumVoice>(); if (voiceChannels != null) { voice = voiceChannels[channel]; } message.address = "/block/" + OscID; message.values.Add("bang"); UpdateSample(currentSample = (int)Random.Range(0, Samples.Count)); if (PlaybackMode == Mode.Sample) { audioSource.loop = false; audioSource.playOnAwake = false; } if (spawnManager == null) { spawnManager = GameObject.Find("BlockSpawnManager").GetComponent <BlockSpawnManager>(); } }