Placeholder-Software / Dissonance

Unity Voice Chat Asset
70 stars 5 forks source link

Issue enabling and disabling Dissonance Voice on HoloLens #99

Closed raymondpols closed 6 years ago

raymondpols commented 6 years ago

I’m using the Dissonance Unity Asset for a couple of months now for our Microsoft HoloLens application. I’m having a very weird effect when using the voice in combination with DictationRecognizer.

  1. Prior to start a dialog to input voice by the dictation recognizer I DISABLE the Dissonance Voice, simply by disabling the Voice Receipt and Voice Broadcast trigger scripts
  2. Than I'm able to input text by voice using the dictation recognizer in a dialog
  3. After OK, I ENABLE the Dissonance Voice again
  4. After this still NO voice gets transmitted….
  5. When I open the Room Channel Type combobox in the Unity Editor to voice transmit starts working!
  6. So .. I thought .. lets change the Channel Type IN CODE after the OK button too, to get it fixed.
  7. Unfortunately, no changes.

So the bottom line: After Speech Dictation, voice transmit is NOT working anymore. Only through a workaround using the Unity Editor. But that’s not possible on HoloLens, so I’m sort of stuck …

martindevans commented 6 years ago

Hi Rayond,

I think I have a guess what's going on here, could you send me a log just to confirm - before capturing the log go to Window > Dissonance > Diagnostic Settings and change all the categories to Debug.

My theory at the moment is as follows:

I DISABLE the Dissonance Voice … by disabling ... the trigger scripts

This doesn't actually prevent Dissonance from capturing audio, it just tells Dissonance not to transmit it (so the audio is pulled from the mic and discarded).

Than I'm able to input text by voice using the dictation recognizer in a dialog

I guess at this stage the dictation engine grabs control of the mic, leaving Dissonance in a broken state (it thinks it has a mic, but control of the mic has been taken away).

When I open the Room Channel Type combobox in the Unity Editor to voice transmit starts working!

When you perform a long UI interaction (e.g. opening a dropdown box) the unity editor freezes execution of certain things for the duration of the interaction. In the past this had caused issues with desyncs when talking from the editor so Dissonance detects these long pauses and completely resets it's mic system to fix the desync.

So I think it's not changing the value which i fixing things - it's actually the act of using the UI which causes a stall and a capture system reset which fixes things! If the log confirms this theory I can easily tell you the right method to call to force a capture system reset yourself :)

raymondpols commented 6 years ago

Hi Martin, Thank you for the quick response! Sounds like a good theory . Find attached the debug LOG. Regards, Raymond UnityEditorLogging.zip

martindevans commented 6 years ago

That log does have a lot of frame skips detected in it, so I think that confirms my theory.

To reset the capture system yourself you need to call RestartTransmissionPipeline on the CapturePipelineManager object - you'll need to make both of these public to access them. There is an instance of the capture pipeline manager in DissonanceComms in the _capture field, you'll also need to give yourself access to this field.

Every time you use your dictation recogniser simply call RestartTransmissionPipeline after you're done to fix the Dissonance microphone.

raymondpols commented 6 years ago

Yes! This fixed the issue. Thank you very much for the excellent diagnosis and quick support!

martindevans commented 6 years ago

Excellent :+1:

awonnink commented 6 years ago

So will this in anyway be included a future release (if only DissonanceComms would have a public method to Restart the transmission pipeline)?

martindevans commented 6 years ago

I've been considering whether or not I should do that and I think I probably will. Calling it at the wrong time will cause a slight audio hitch but it shouldn't otherwise break anything, so it's pretty safe to expose.