-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathGameUnityAudioSettings.cs
More file actions
212 lines (196 loc) · 7.68 KB
/
GameUnityAudioSettings.cs
File metadata and controls
212 lines (196 loc) · 7.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
using System.Collections.Generic;
using System.Linq;
using AudioLib.UnityAudio;
namespace GameSample.Audio
{
/// <summary>
/// ゲーム内サウンド設定
/// </summary>
public class GameUnityAudioSettings : IGameAudioSettings
{
/// <summary>
/// SoundEvent名
/// </summary>
public string SoundEventName_BgmSpaceWould => UnityAudio.AudioName.BgmSpaceWould;
public string SoundEventName_BgmShotThunder => UnityAudio.AudioName.BgmShotThunder;
public string SoundEventName_BgmAtomChain => UnityAudio.AudioName.BgmAtomChain;
public string SoundEventName_SeAttack => UnityAudio.AudioName.SeAttack;
public string SoundEventName_SeMove => UnityAudio.AudioName.SeMove;
/// <summary>
/// SoundSheet名
/// </summary>
public string SoundSheetName_Bgm => UnityAudio.SoundSheetName.Bgm;
public string SoundSheetName_Se => UnityAudio.SoundSheetName.Se;
/// <summary>
/// GameParameter名
/// </summary>
public string GameParameterName_Battle => null;
/// <summary>
/// ビート同期ラベル名
/// </summary>
public string BeatSyncLabelName_AtomChain => null;
/// <summary>
/// カスタムイベント名
/// </summary>
public string CustomEventName_StartAtomChainMainLoop => null;
/// <summary>
/// UnityAudio固有
/// </summary>
public static class UnityAudio
{
/// <summary>
/// サウンドシート名
/// </summary>
public static class SoundSheetName
{
public const string Bgm = "BGM";
public const string Se = "SE";
}
/// <summary>
/// サウンドシート情報
/// </summary>
public static IUnityAudioApiService.SoundSheetInfo[] SoundSheetInfoArray = new IUnityAudioApiService.SoundSheetInfo[]
{
new IUnityAudioApiService.SoundSheetInfo()
{
Name = SoundSheetName.Bgm,
IsPlayLoop = true,
},
new IUnityAudioApiService.SoundSheetInfo()
{
Name = SoundSheetName.Se,
IsPlayLoop = false,
}
};
/// <summary>
/// オーディオファイル名
/// </summary>
public static class AudioName
{
public static readonly string BgmSpaceWould = "BGM-SpaceWould";
public static readonly string BgmShotThunder = "BGM-ShotThunder";
public static readonly string BgmAtomChain = "BGM-AtomChain";
public static readonly string SeAttack = "SE-Attack";
public static readonly string SeMove = "SE-Move";
}
/// <summary>
/// サウンドシートに紐づくオーディオ情報
/// </summary>
public static readonly Dictionary<string, string[]> SoundSheetAudioDictionary = new ()
{
{
SoundSheetName.Bgm,
new[]
{
AudioName.BgmSpaceWould,
AudioName.BgmShotThunder,
AudioName.BgmAtomChain,
}
},
{
SoundSheetName.Se,
new[]
{
AudioName.SeAttack,
AudioName.SeMove
}
},
};
/// <summary>
/// Audio名から対象のSoundSheet名を取得する
/// </summary>
/// <param name="audioName"></param>
/// <returns></returns>
public static string GetSoundSheetName(string audioName)
{
foreach (var soundSheetName in SoundSheetAudioDictionary.Keys)
{
var eventNameArray = SoundSheetAudioDictionary[soundSheetName];
if (eventNameArray.Contains(audioName))
{
return soundSheetName;
}
}
UnityEngine.Debug.LogError($"not found cueSheetName by audioName=> {audioName}");
return null;
}
/// <summary>
/// Snapshot名
/// </summary>
public static class SnapshotName
{
public static readonly string Normal = "Normal";
public static readonly string Reverb = "Reverb";
public static readonly string Distortion = "Distortion";
}
/// <summary>
/// AudioMixer名
/// </summary>
public static class AudioMixerName
{
public static string Main = "MainAudioMixer";
public static string EffectBgm = "EffectBgmAudioMixer";
public static string EffectSe = "EffectSeAudioMixer";
}
/// <summary>
/// AudioMixerGroup名
/// </summary>
public static class AudioMixerGroupName
{
public static string Master = "Master";
public static string BGM = "BGM";
public static string SE = "SE";
}
/// <summary>
/// AudioMixerでExposeしたパラメータ名
/// </summary>
public static class AudioMixerParamName
{
public static readonly string MasterVolume = "MasterVolume";
public static readonly string BgmVolume = "BGMVolume";
public static readonly string SeVolume = "SeVolume";
}
/// <summary>
/// AudioMixer情報
/// </summary>
public static IUnityAudioApiService.AudioMixerInfo[] AudioMixerInfoArray = new[]
{
new IUnityAudioApiService.AudioMixerInfo()
{
MixerName = AudioMixerName.Main,
MixerGroupName = AudioMixerGroupName.Master,
VolumeParamName = AudioMixerParamName.MasterVolume,
SoundSheetName = null, // Mainはnull
},
new IUnityAudioApiService.AudioMixerInfo()
{
MixerName = AudioMixerName.EffectBgm,
MixerGroupName = AudioMixerGroupName.Master,
VolumeParamName = AudioMixerParamName.BgmVolume,
SoundSheetName = SoundSheetName.Bgm,
},
new IUnityAudioApiService.AudioMixerInfo()
{
MixerName = AudioMixerName.EffectSe,
MixerGroupName = AudioMixerGroupName.Master,
VolumeParamName = AudioMixerParamName.SeVolume,
SoundSheetName = SoundSheetName.Se,
}
};
/// <summary>
/// 初期生成情報
/// </summary>
public static readonly IUnityAudioApiService.InitializeSetting InitializeSetting = new()
{
// サービス生成時に設定する
ListenerObject = null,
MonoBehaviourHandler = null,
// ゲームオーディオ設定
AudioAssetPath = "UnityAudio",
AudioMixerAssetPath = "UnityAudio/Mixer",
SoundSheetInfoArray = SoundSheetInfoArray,
AudioMixerInfoArray = AudioMixerInfoArray,
};
}
}
}