public SingleAudioItem(string name, int id, AudioSource audioSource, AudioInfo audioInfo, GameObject gameObject, CoroutineHolder coroutineHolder, GainManager gainManager, AudioItemManager itemManager, Magicolo.AudioTools.Player player) : base(name, id, itemManager, player) { this.audioSource = audioSource; this.audioInfo = audioInfo; this.gameObject = gameObject; this.coroutineHolder = coroutineHolder; this.gainManager = gainManager; Pitch = audioSource.pitch; }
public AudioItem GetAudioItem(string soundName, GameObject source, params AudioOption[] audioOptions) { AudioInfo audioInfo = infoManager.GetAudioInfo(soundName); AudioSource audioSource = GetAudioSource(audioInfo, source, audioOptions); GameObject gameObject = audioSource.gameObject; CoroutineHolder coroutineHolder = gameObject.GetOrAddComponent <CoroutineHolder>(); GainManager gainManager = gameObject.GetOrAddComponent <GainManager>(); idCounter += 1; SingleAudioItem audioItem = new SingleAudioItem(soundName, idCounter, audioSource, audioInfo, gameObject, coroutineHolder, gainManager, this, audioPlayer); gainManager.Initialize(audioItem, audioPlayer); audioItem.Update(); player.metronome.Subscribe(audioItem); inactiveAudioItems.Add(audioItem); return(audioItem); }