WWise Audio Question ;)

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
User avatar
HawkX
Posts: 147
Joined: Mon Feb 27, 2017 1:50 pm
Location: Quebec
Contact:

WWise Audio Question ;)

Post by HawkX »

Hi again! :)

Hope you are doing well!

My audio team has been asking me for suggestion on how to implement audio and voice over in the dialogues...

I have searched your forums... found 2 threads (1 from 2018 and 1 from earlier this year)
https://www.pixelcrushers.com/phpbb/vie ... ise#p29947

However I have zero knowledge on how to use the Sequencer... nor do I think we really "need" to for our project...
Maybe I should learn it... i don't know really since we use very classic "visual novel style" of dialogues

My audio team wanted to simply add some "type sound" WWise Event every time a letter appeared using the UnityUITypewriterEffect.cs --- I found that at line 241 there is a reference to the audiosource/audioclip, then on line 326 there is PlayCharacterAudio.. which is where I would fire up the Wwise Event... a single line would do it...

YOU DID however tell me a few months ago when I started at this job to let you know if i ever wanted to modify your source code ;)
https://www.pixelcrushers.com/phpbb/vie ... 268#p32268

So I am writing! hehehe...

As always, thank you very much for your time and have a nice day!!
User avatar
Tony Li
Posts: 21977
Joined: Thu Jul 18, 2013 1:27 pm

Re: WWise Audio Question ;)

Post by Tony Li »

Hi,

Two suggestions:

1. Consider using TextMesh Pro and TextMeshProTypewriterEffect instead of UI Text and UnityUITypewriterEffect. In most cases, TextMesh Pro looks much nicer than UI Text. (More info: TextMesh Pro support, or Dialogue UI Tutorial 1 for video example)

2. If you want to use Wwise instead of Unity's audio, make a subclass of the typewriter effect script (UnityUITypewriterEffect or TextMeshProTypewriterEffect) and override the PlayCharacterAudio() method. No need to directly modify source code.
User avatar
HawkX
Posts: 147
Joined: Mon Feb 27, 2017 1:50 pm
Location: Quebec
Contact:

Re: WWise Audio Question ;)

Post by HawkX »

We already use textmeshpro everywhere... I was under the impression we were already using textmeshpro... we use it everywhere else in the game... and i DID install the dialogue system version of it as well...

perhaps its because the prefab model we duplicated to use/modify (VN Template Standard Dialogue UI) was not using it?

We actually hired a new programmer (that is much more knowledgeable than I am) so i'll ask him how to do the override :)

thanks again!!
User avatar
Tony Li
Posts: 21977
Joined: Thu Jul 18, 2013 1:27 pm

Re: WWise Audio Question ;)

Post by Tony Li »

None of the templates use TextMesh Pro since we can't guarantee that everyone's project has TextMesh Pro installed. The Dialogue UI Tutorial 1 video (linked in my previous reply) starts with converting a dialogue UI to TextMesh Pro.

I suspect the override will look roughly like this:

Code: Select all

using UnityEngine;
using PixelCrushers.DialogueSystem;

public class MyTypewriterEffect : TextMeshProTypewriterEffect
{
    public AK.Wwise.Event wwiseEvent;
    
    protected override void PlayCharacterAudio() //[EDIT: Fixed "public" to "protected"]
    {
        wwiseEvent.Post();
    }
}
Note: There's also a PlayCharacterAudio(char) that accepts a character as a parameter. If you want to play different sounds for different characters, you can override that method.
User avatar
HawkX
Posts: 147
Joined: Mon Feb 27, 2017 1:50 pm
Location: Quebec
Contact:

Re: WWise Audio Question ;)

Post by HawkX »

Ohhh I always assumed when we "installed" the TMPro "plugin/version" of DialogueSystem that it was replacing the existing prefab with the TMPRO ones... :)

Alright I'll do that then!

As always Thank you so much for all of your help!
User avatar
Tony Li
Posts: 21977
Joined: Thu Jul 18, 2013 1:27 pm

Re: WWise Audio Question ;)

Post by Tony Li »

Happy to help!
User avatar
HawkX
Posts: 147
Joined: Mon Feb 27, 2017 1:50 pm
Location: Quebec
Contact:

Re: WWise Audio Question ;)

Post by HawkX »

Hi again :)

I followed your video to changed my text to TMP... tested it ingame to make sure the new typerwriter for TMP was working fine...

then I copied your "override" class...

Then I was getting this error :
cannot change access modifiers when overriding 'protected' inherited member

a quick search told me to change it from public to protected override void PlayCharacterAudio()
which worked...
(right now im just trying to print some debug.logs)
but i dont know how to make it "get used"...
its not a monobehavior so i cannot put it on any gameobject...
yet it seems to be getting ignored (perhaps because the original PlayCharacteraudio starts with the following) :
if (audioClip == null || audioSource == null) return; ?
shouldnt the "override" skips all of it and simply run my own code instead?
or am I missing something :)

Sorry for being "noob" again... this is all pretty new for me!

EDIT : hopefully before you have answered :P
I found it!! i went back to my prefab, and replaced the typewriter tmp fx with this new script and it worked!! :)
User avatar
Tony Li
Posts: 21977
Joined: Thu Jul 18, 2013 1:27 pm

Re: WWise Audio Question ;)

Post by Tony Li »

Great! I'm glad you got it working. Thanks for letting me know about the protected/public thing. I just fixed my code example above.
Post Reply