Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added audioproperties, removed unused para, added new "keep" var #22

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Chillu1
Copy link

@Chillu1 Chillu1 commented Mar 21, 2021

Added a new keep variable, which will keep the audio info in dictionary on scene change, so we can use it later again. Without duplicate preparation.

Imo the current PrepareSound, PrepareAudio, etc way is not ideal. Adds extra code duplication, so I added a AudioProperties instead. Example of use:

_winningSoundId = EazySoundManager.PrepareAudio(new AudioProperties()
    { audioType = Audio.AudioType.Sound, clip = Resources.Load<AudioClip>("Audio/SoundEffects/WinningSound"), keep = true});

or:

_defaultDanceMusicId = EazySoundManager.PrepareAudio(new AudioProperties()
{
    audioType = Audio.AudioType.Music, clip = Resources.Load<AudioClip>("Audio/Music/dance"),
    volume = 0.2f, loop = true, persist = false, keep = true,
});

Also removed "currentMusicfadeOutSeconds" since it was redundant

@@ -434,7 +434,7 @@ public void Play(float volume)
}

// Recreate audiosource if it does not exist
if (AudioSource == null)
if (AudioSource == null || !AudioSource.enabled)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Forgot to mention. This only happens when I spam the sound a fair amount. Let's say the player jumps 10-20 times a second in a small area, hitting his head a lot.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix. This should be merged in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants