-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from kameffee/develop
v0.0.3
- Loading branch information
Showing
18 changed files
with
167 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,57 @@ | ||
# AudioPlayer | ||
![Unity 2019.4+](https://img.shields.io/badge/unity-unity%202019.4%2B-blue) | ||
![License: MIT](https://img.shields.io/badge/License-MIT-brightgreen.svg) | ||
|
||
## Introduction | ||
|
||
### Initialize | ||
|
||
```c# | ||
// One time Initialize | ||
AudioPlayer.Instance.Initialize(); | ||
``` | ||
|
||
### Play Bgm | ||
|
||
#### Simple play | ||
```c# | ||
AudioPlayer.Instance.Bgm.Play(audioClip); | ||
``` | ||
|
||
#### Cross Fade | ||
```c# | ||
AudioPlayer.Instance.Bgm.CrossFade(audioClip, crossFadeTime: 3f); | ||
``` | ||
|
||
### Play Sound effects | ||
```c# | ||
AudioPlayer.Instance.Se.Play(audioClip); | ||
``` | ||
|
||
### Volume settings | ||
|
||
#### Change the volumes | ||
```c# | ||
// Master volume | ||
AudioPlayer.Instance.SetMasterVolume(0.5f); | ||
|
||
// Bgm volume | ||
AudioPlayer.Instance.Bgm.SetVolume(1f); // ActualVolume 0.5f | ||
// Se volume | ||
AudioPlayer.Instance.Se.SetVolume(0.5f); // ActualVolume 0.25f | ||
``` | ||
|
||
The actual volume of the BGM will be `0.5 x 1 = 0.5f`. | ||
The actual volume of the SE will be `0.5 x 0.5 = 0.25f`. | ||
|
||
## Installation | ||
|
||
### Installing from a Git URL | ||
1. Copy for `https://github.com/kameffee/AudioPlayer.git` | ||
2. Open a PackageManager. `Window/PackageManager` | ||
3. Click the add **[+]** button in the status bar. | ||
4. Select Add package from git URL from the add menu. | ||
5. Enter a valid Git URL in the text box and click Add. | ||
|
||
see for [Installing from a Git URL](https://docs.unity3d.com/2019.4/Documentation/Manual/upm-ui-giturl.html) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
using System; | ||
|
||
namespace Kameffee.AudioPlayer | ||
{ | ||
public interface IAudioPlayer | ||
{ | ||
float MasterVolume { get; } | ||
|
||
bool Initialized { get; } | ||
|
||
event Action<float> OnChangeMasterVolume; | ||
|
||
IBgmPlayer Bgm { get; } | ||
|
||
ISePlayer Se { get; } | ||
|
||
void Initialize(); | ||
|
||
void SetMasterVolume(float volume); | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
using System; | ||
using UnityEngine; | ||
|
||
namespace Kameffee.AudioPlayer | ||
{ | ||
public interface IBgmPlayer | ||
{ | ||
bool IsPlaying { get; } | ||
|
||
float Volume { get; } | ||
|
||
event Action<float> OnChangeVolume; | ||
|
||
void Play(int id, float pitch = 1, float fadeTime = 0f, bool ignoreTimeScale = false); | ||
|
||
void Play(AudioClip audioClip, float pitch = 1, float fadeTime = 0f, bool ignoreTimeScale = false); | ||
|
||
void CrossFade(int id, float crossFadeTime, float pitch = 1, bool ignoreTimeScale = false); | ||
|
||
void CrossFade(AudioClip audioClip, float crossFadeTime, float pitch = 1, bool ignoreTimeScale = false); | ||
|
||
void Stop(float fadeTime = 0f, bool ignoreTimeScale = false); | ||
|
||
void Pause(); | ||
|
||
void UnPause(); | ||
|
||
void SetVolume(float volume); | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using System; | ||
using UnityEngine; | ||
|
||
namespace Kameffee.AudioPlayer | ||
{ | ||
public interface ISePlayer | ||
{ | ||
float Volume { get; } | ||
|
||
event Action<float> OnChangeVolume; | ||
|
||
void Play(AudioClip audioClip, float pitch = 1f); | ||
|
||
void Stop(); | ||
|
||
void SetVolume(float volume); | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters