Git Product home page Git Product logo

eazy-sound-manager's People

Contributors

dogukanerkut avatar jackm36 avatar ykw815 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

eazy-sound-manager's Issues

UnityException FindObjectsOfType

UnityException: FindObjectsOfType is not allowed to be called from a MonoBehaviour constructor (or instance field initializer), call it in Awake or Start instead. Called from MonoBehaviour 'EazySoundManager' on game object 'GameManager'.

Line 68 in EazySoundManager script
instance = (EazySoundManager)FindObjectOfType(typeof(EazySoundManager));

3D audio doesn't work

All audiosources are added as components to the EasySoundManager gameObject. So how are audiosources at various locations supposed to work when there is only one EasySoundManager position?

And secondly: the position of EasySoundManager doesn't seem to be set to the sourceTransform.position. The 3D support seems untested.

Garbage collector

Hi! After reading the message about the memory leak, I downloaded the version from the github. And that's what the profiler showed...
Only one source of music plays, nothing more, but the garbage collector does not calm down ... :) (Assetstore version -the same picture)
PS Sorry for googletranslate :)
2018-08-23_14-17-07

Audio'Id that created in Start() does not work on Update() etc.

When audio's id that is created in Start() is used with EazySoundManager.GetMusicAudio(id).Play() in Start(), the sound plays.
But the id is used in Update(), the sound does'nt play.
Stop() is work in Update().
Why?

I wrote the following code.

`

public class MusicManager : MonoBehaviour {
	public AudioClip wbgm;
	private Dictionary<string,int> ids = new Dictionary<string,int>();

	void Start(){
		ids["wbgm"] = EazySoundManager.PrepareMusic(wbgm, 1.0f, true,false);
		//this.Play("wbgm");
	}

	void Update(){
		if(Input.GetKeyDown(KeyCode.Space)){
			//ids["wbgm"] = EazySoundManager.PrepareMusic(wbgm, 1.0f, true,false);
			this.Play("wbgm");
		}
	}

	public void Play(string name){
		EazySoundManager.GetMusicAudio(ids[name]).Play();
	}
}

Queue feature request

I'd like to request a playlist queue feature for Eazy Sound Manager.

The idea would be that I can queue up several sounds in a row to play in sequence. My particular use case for this would be to queue up 3-4 songs as background music, and have ESM cycle through them automatically. This would save me from writing my own code to monitor the playing status of ESM and starting the next song manually.

Suggested things:
SoundManager.AddToQueue(clip)
SoundManager.RemoveFromQueue(clip)
AudioClip[] SoundManager.CurrentQueue()
SoundManager.queueLength
SoundManager.PlayQueue()
SoundManager.QueueParams(fadeInTime, fadeOutTime, loop, persist)

Alternatively, if you'll give me some guidance on how you'd like it done I'll take a look and implementing it in a pull request.

Thanks!

AudioMixer Support

Hello Jack,

Thanks for an awesome asset. Would it be possible to add support for our audiomixers so global volume can be drawn from there?

Regards

audiosource don't destroy issue

I had solve this problem, you forget to delete the unnecessary "add component()" in playsound function, there are two audiosource was generated when playsound.

Exceptions when setting ignoreDuplicateMusic = true

Hi!
Thanks for this great tool! It is exactly what I was looking for! But I ran into a bunch of problems when setting the ignoreDuplicateMusic property to true.

1) NullReferenceException when setting it to true before first usage

When setting SoundManager.ignoreDuplicateMusic = true; in a custom script I use for audio management (I tried placing it in Start,Awake,OnEnable), and playing music by SoundManager.PlayMusic(...), I get following exception:

NullReferenceException: Object reference not set to an instance of an object EazyTools.SoundManager.SoundManager.PlayMusic (UnityEngine.AudioClip clip, System.Single volume, System.Boolean loop, System.Boolean persist, System.Single fadeInSeconds, System.Single fadeOutSeconds, System.Single currentMusicfadeOutSeconds, UnityEngine.Transform sourceTransform) (at Assets/Eazy Tools/Sound Manager/Scripts/SoundManager.cs:478) EazyTools.SoundManager.SoundManager.PlayMusic (UnityEngine.AudioClip clip, System.Single volume, System.Boolean loop, System.Boolean persist) (at Assets/Eazy Tools/Sound Manager/Scripts/SoundManager.cs:439)

I looked at the code - this happens because the static field musicAudio is accessed before calling Init().

I did not add the script to the scene (as being written in your installation instructions), therefore the Awake function (which calls Init()) is not called. For now, i fixed(?) this by accessing the SoundManager instance (and therefore triggering Init()) with this:

var unusedGO = SoundManager.gameobject;
SoundManager.ignoreDuplicateMusic = true; //Has to be set after, as it get's overriden by Init()

2) MissingReferenceException when trying to play music that has been played before

When using the fix described above and trying to play an AudioClip with SoundManager.PlayMusic(clip) that I already played before, I get this exception:
MissingReferenceException: The object of type 'AudioSource' has been destroyed but you are still trying to access it. Your script should either check if it is null or you should not destroy the object. EazyTools.SoundManager.SoundManager.PlayMusic (UnityEngine.AudioClip clip, System.Single volume, System.Boolean loop, System.Boolean persist, System.Single fadeInSeconds, System.Single fadeOutSeconds, System.Single currentMusicfadeOutSeconds, UnityEngine.Transform sourceTransform) (at Assets/Eazy Tools/Sound Manager/Scripts/SoundManager.cs:481) EazyTools.SoundManager.SoundManager.PlayMusic (UnityEngine.AudioClip clip, System.Single volume, System.Boolean loop, System.Boolean persist) (at Assets/Eazy Tools/Sound Manager/Scripts/SoundManager.cs:439)

I keep the AudioClip in a Dictionary on my script and do not call any functions on it. I only get it from the Dict and pass it to the SoundManager. This works perfectly fine when not setting ignoreDuplicateMusic!

Is ignoreDuplicateMusic even supposed to be used?

In this case i just keep track of the current track myself. :)

memory leak issue

I found that when finish play sound , the audio clip didn't release, when I check unity profiler , it referenced by ManagedStaticReferentces( ).

Issue with playing short sounds

When playing sound you set starting volume to 0 and on Update() change it. But when a sound is short(20 ms), it can be played on 0 volume before the first Update() tick occurs.

Avoid use of null audio source when Pause, UnPause or Resume

I use these methods when pause the game, but I don't have control of variable audioSource. To solve this, I add a verification on Pause, UnPause and Resume. An example on line 979:

if (audioSource)
{
      audioSource.Pause();
      paused = true;
}

Error happen when load scene.

When EazySoundManager.PrepareMusic is used, Error happen with SceneManager.LoadScene().

Log:

KeyNotFoundException: The given key was not present in the dictionary.
System.Collections.Generic.Dictionary2[System.Int32,Hellmade.Sound.Audio].get_Item (Int32 key) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Collections.Generic/Dictionary.cs:561) Hellmade.Sound.EazySoundManager.RemoveNonPersistAudio (System.Collections.Generic.Dictionary2 audioDict) (at Assets/Support/Eazy-Sound-Manager-master/Assets/Hellmade/Eazy Sound Manager/Scripts/EazySoundManager.cs:232)
Hellmade.Sound.EazySoundManager.OnSceneLoaded (Scene scene, LoadSceneMode mode) (at Assets/Support/Eazy-Sound-Manager-master/Assets/Hellmade/Eazy Sound Manager/Scripts/EazySoundManager.cs:128)
UnityEngine.SceneManagement.SceneManager.Internal_SceneLoaded (Scene scene, LoadSceneMode mode) (at C:/buildslave/unity/build/Runtime/Export/SceneManager/SceneManager.cs:122)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.