question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

More control for playing audio

See original GitHub issue

It’d be nice if there was more control over playing audio -

  1. when using ControlAudio, you can only select an AudioSource to play, you cant select an AudioClip to play with said AudioSource
  2. when using PlayMusic/Sound/etc you can only select AudioClip, you cannot select AudioSource. These use the MusicManager which creates(?) or uses(?) an existing AudioSource, but you cannot specify which one you want it to use.

It’d be nice if there was a way to add an AudioClip to ControlAudio, so that one can select both the AudioSource and AudioClip to play. Right now, if one wants to have more control over AudioSources Fungus uses to play audio through, the workaround is using different AudioSources for different AudioClips which is not great.

To temporarily bridge this problem, I have added the following modifications to ControlAudio.cs:

protected SerializedProperty audioClipProp; to line 17, audioClipProp = serializedObject.FindProperty("_audioClip"); to line 29, EditorGUILayout.PropertyField(audioClipProp); to line 38

(these make it so the AudioClip field appears in the interface as per my screenshot attached)

then in ControlAudio.cs I added, [SerializeField] protected AudioClip _audioClip; in the initial declarations, then every time the _audioSource is played, I pasted this line above it; _audioSource.Value.clip = _audioClip;

ideally there should be a better solution to this that is cleaner, but this is my current workaround to it. Hope this is helpful

Unity_sHJmVDI3M8

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:12

github_iconTop GitHub Comments

1reaction
stevehalliwellcommented, May 29, 2020

Re; type of variable; Both, makes it more flexible for Fungus to use say an AudioMixerGroupData to allow an object from a FungusVariable or directly dragged in from scene.

Not a fork, assuming all goes well, I expect this set of items to be in the next version of Fungus (3.14).

0reactions
TheEmbracedOnecommented, Oct 3, 2020

Thank you, I’ll pull it in a short bit!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Control your music, videos & more - Google Chrome Help
Control music, video, or anything that plays sound in a Chrome tab. Play music or sound across ... At the top right, click...
Read more >
Audio and Video controls in Power Apps
An Audio control plays a sound clip from a file, a recording from a Microphone control, or the audio track from a video...
Read more >
Understanding Success Criterion 1.4.2: Audio Control | WAI
2:Audio Control (Level A) If any audio on a Web page plays automatically for more than 3 seconds, either a mechanism is available...
Read more >
Options to Play Audio in PowerPoint 2013
Yes, there are a lot more options to playback audio in PowerPoint than many presenters know. ... You can always control the volume...
Read more >
Audio tricks and traps in PowerPoint
Click on the icon to see the design controls. There's the usual play, pause, forward and back options. The middle bar shows the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found