mirror of
https://github.com/RHeavenStudio/HeavenStudio.git
synced 2025-06-12 08:27:40 +02:00
Audio mixers
This commit is contained in:
@ -83,12 +83,16 @@ namespace RhythmHeavenMania.Games.DJSchool
|
||||
{
|
||||
FlashFX(true);
|
||||
}
|
||||
|
||||
// Settings.GetMusicMixer().audioMixer.FindSnapshot("DJSchool_Hold").TransitionTo(0.15f);
|
||||
}
|
||||
|
||||
public void UnHold()
|
||||
{
|
||||
anim.speed = -1;
|
||||
anim.Play("Hold", 0, 0);
|
||||
|
||||
// Settings.GetMusicMixer().audioMixer.FindSnapshot("Main").TransitionTo(0.15f);
|
||||
}
|
||||
|
||||
public void Swipe()
|
||||
@ -104,6 +108,8 @@ namespace RhythmHeavenMania.Games.DJSchool
|
||||
TurnTable.GetComponent<Animator>().Play("Student_Turntable_Swipe", 0, 0);
|
||||
|
||||
Instantiate(slamFX).SetActive(true);
|
||||
|
||||
// Settings.GetMusicMixer().audioMixer.FindSnapshot("Main").TransitionTo(0.15f);
|
||||
}
|
||||
|
||||
private void FlashFX(bool inverse)
|
||||
|
@ -1,6 +1,7 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Audio;
|
||||
|
||||
namespace RhythmHeavenMania
|
||||
{
|
||||
@ -50,6 +51,7 @@ namespace RhythmHeavenMania
|
||||
source.clip = music;
|
||||
Conductor.AddComponent<Conductor>();
|
||||
Conductor.GetComponent<Conductor>().musicSource = source;
|
||||
source.outputAudioMixerGroup = Settings.GetMusicMixer();
|
||||
// Conductor.AddComponent<AudioDspTimeKeeper>();
|
||||
|
||||
if (editor)
|
||||
|
32
Assets/Scripts/Settings.cs
Normal file
32
Assets/Scripts/Settings.cs
Normal file
@ -0,0 +1,32 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.Audio;
|
||||
|
||||
namespace RhythmHeavenMania
|
||||
{
|
||||
public class Settings : MonoBehaviour
|
||||
{
|
||||
public static AudioMixerGroup GetMusicMixer()
|
||||
{
|
||||
AudioMixerGroup audioMixerGroup = Resources.Load<AudioMixer>("MainMixer").FindMatchingGroups("Music")[0];
|
||||
AudioMixer audioMixer = GetMainMixer();
|
||||
// float vol = Mathf.Log10(GetMusicVolume()) * 20;
|
||||
// audioMixer.SetFloat("MusicVolume", vol);
|
||||
return audioMixerGroup;
|
||||
}
|
||||
|
||||
public static AudioMixerGroup GetSFXMixer()
|
||||
{
|
||||
AudioMixerGroup audioMixerGroup = Resources.Load<AudioMixer>("MainMixer").FindMatchingGroups("SFX")[0];
|
||||
AudioMixer audioMixer = GetMainMixer();
|
||||
// float vol = Mathf.Log10(GetSFXVolume()) * 20;
|
||||
// audioMixer.SetFloat("SFXVolume", vol);
|
||||
return audioMixerGroup;
|
||||
}
|
||||
|
||||
public static AudioMixer GetMainMixer()
|
||||
{
|
||||
return Resources.Load<AudioMixer>("MainMixer");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
11
Assets/Scripts/Settings.cs.meta
Normal file
11
Assets/Scripts/Settings.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: eb8f26370948d1542840935f91aae1d6
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -45,6 +45,7 @@ namespace RhythmHeavenMania.Util
|
||||
GameObject oneShot = new GameObject("oneShot");
|
||||
|
||||
AudioSource audioSource = oneShot.AddComponent<AudioSource>();
|
||||
//audioSource.outputAudioMixerGroup = Settings.GetSFXMixer();
|
||||
audioSource.playOnAwake = false;
|
||||
|
||||
Sound snd = oneShot.AddComponent<Sound>();
|
||||
|
Reference in New Issue
Block a user