2026-03-26 16:14:05 +08:00
|
|
|
using System.Collections.Generic;
|
2025-09-05 19:46:30 +08:00
|
|
|
using UnityEngine;
|
|
|
|
|
using UnityEngine.Audio;
|
|
|
|
|
|
|
|
|
|
namespace AlicizaX.Audio.Runtime
|
|
|
|
|
{
|
2026-04-20 13:46:44 +08:00
|
|
|
public interface IAudioService : IService
|
2025-09-05 19:46:30 +08:00
|
|
|
{
|
2026-04-23 17:21:36 +08:00
|
|
|
float Volume { get; set; }
|
|
|
|
|
bool Enable { get; set; }
|
|
|
|
|
AudioMixer AudioMixer { get; }
|
|
|
|
|
Transform InstanceRoot { get; }
|
|
|
|
|
Transform ListenerTransform { get; }
|
|
|
|
|
|
|
|
|
|
void Initialize(AudioGroupConfig[] audioGroupConfigs, Transform instanceRoot = null, AudioMixer audioMixer = null);
|
|
|
|
|
void Restart();
|
|
|
|
|
float GetCategoryVolume(AudioType type);
|
|
|
|
|
void SetCategoryVolume(AudioType type, float value);
|
|
|
|
|
bool GetCategoryEnable(AudioType type);
|
|
|
|
|
void SetCategoryEnable(AudioType type, bool value);
|
|
|
|
|
void RegisterListener(AudioListener listener);
|
|
|
|
|
void UnregisterListener(AudioListener listener);
|
|
|
|
|
ulong Play(AudioType type, string path, bool loop = false, float volume = 1f, bool async = false, bool cacheClip = true);
|
|
|
|
|
ulong Play(AudioType type, AudioClip clip, bool loop = false, float volume = 1f);
|
|
|
|
|
ulong Play3D(AudioType type, string path, in Vector3 position, bool loop = false, float volume = 1f, bool async = false, bool cacheClip = true);
|
|
|
|
|
ulong Play3D(AudioType type, string path, in Vector3 position, float minDistance, float maxDistance, AudioRolloffMode rolloffMode, float spatialBlend = 1f, bool loop = false, float volume = 1f, bool async = false, bool cacheClip = true);
|
|
|
|
|
ulong Play3D(AudioType type, AudioClip clip, in Vector3 position, bool loop = false, float volume = 1f);
|
|
|
|
|
ulong Play3D(AudioType type, AudioClip clip, in Vector3 position, float minDistance, float maxDistance, AudioRolloffMode rolloffMode, float spatialBlend = 1f, bool loop = false, float volume = 1f);
|
|
|
|
|
ulong PlayFollow(AudioType type, string path, Transform target, in Vector3 localOffset, bool loop = false, float volume = 1f, bool async = false, bool cacheClip = true);
|
|
|
|
|
ulong PlayFollow(AudioType type, string path, Transform target, in Vector3 localOffset, float minDistance, float maxDistance, AudioRolloffMode rolloffMode, float spatialBlend = 1f, bool loop = false, float volume = 1f, bool async = false, bool cacheClip = true);
|
|
|
|
|
ulong PlayFollow(AudioType type, AudioClip clip, Transform target, in Vector3 localOffset, bool loop = false, float volume = 1f);
|
|
|
|
|
ulong PlayFollow(AudioType type, AudioClip clip, Transform target, in Vector3 localOffset, float minDistance, float maxDistance, AudioRolloffMode rolloffMode, float spatialBlend = 1f, bool loop = false, float volume = 1f);
|
|
|
|
|
bool Stop(ulong handle, bool fadeout = false);
|
|
|
|
|
bool IsPlaying(ulong handle);
|
|
|
|
|
void Stop(AudioType type, bool fadeout);
|
|
|
|
|
void StopAll(bool fadeout);
|
|
|
|
|
void Pause(ulong handle);
|
|
|
|
|
void Resume(ulong handle);
|
|
|
|
|
void Preload(IList<string> paths, bool pin = true);
|
|
|
|
|
void Unload(IList<string> paths);
|
|
|
|
|
void ClearCache();
|
2025-09-05 19:46:30 +08:00
|
|
|
}
|
|
|
|
|
}
|