I’m using Unity3D with Objective-C to run on iOS. When we connect a screen, there is a notification that sends to an object that is no longer valid. There is a hidden call that we have no source code to find. [CoreAudioObjC screenConnect;] Is this a part of the FMOD library? I’d like to disable it’s desire to detect a screen connection.
The error in XCode when I have Zombie Detection enabled is:
[code:lfz15vc0]*** -[OutputCoreAudioObjC screenConnect:]: message sent to deallocated instance 0x3a5fc10[/code:lfz15vc0]
The game doesn’t crash when we disconnect a screen, or when we plug/unplug headphones and we are using JUCE to detect and reroute the audio through the right device.
- Gandalf458 asked 4 years ago
Yeah, when I’ve used FMOD with SquareTangle, it’s nice to have full control of it. I would not consider myself much of an FMOD buff, but I have been using it with Unity for about 1 and a hafl years (behind the scenes) and half a year directly.
Unity doesn’t seem to give me any control of FMOD whether I’m working inside of Unity with C# or in my Xcode project with Objective-C and C++. All of the FMOD is in assembly code, which, although it has some comments, I don’t understand it. It would be great to be able to override or swizzle the dealloc function of FMOD by inheriting or something. The capability to call FMOD.SomeFunction(); would be even better.
I’ve tried to reproduce your error but I have not been successful. If you can reproduce the crash using one of our examples I can investigate further. As Unity customize the FMOD source I cannot be sure the issue is not caused by that. If you have a Unity bug ticket you’d like to bring me in on I’d be happy to work with someone from Unity to resolve this issue.
I will reproduce the crash tomorrow and hopefully be able to give you something to work with. I have not submitted a ticket to Unity, but if that will help, I will do that tomorrow as well. For the nonce, do you recognize the command screenConnect?
I’ve submitted a bug report to Unity. https://fogbugz.unity3d.com/default.asp … je6394sqv0
I’m not sure if I have the rights to submit our code without getting approval from my team lead. There was another picture of the stack track included in the bug report.
I haven’t heard back from Unity or FMOD, so I wanted to show what I’m currently dealing with. As you can see, one instance of FMOD is being destroyed and then recreated. The old Instance however, is still registered (I believe) to receive the screen change notifications. I can’t view FMOD’s destructor, but I need to know if it is taking care of removing the observer like this in the dealloc method? [code:1bql91vo][notificationCenter removeObserver: self][/code:1bql91vo]
Your help is greatly appreciated!
It’s a common request from Unity customers to be able to get full access to the underlying FMOD system objects, we actually have a side-by-side integration in the works for FMOD Studio with Unity.
There is some discussion about it here: http://fmod.org/forum/viewtopic.php?f=2 … 06&p=53515
[quote:359afqqp]I’ve tried to reproduce your error but I have not been successful. If you can reproduce the crash using one of our examples I can investigate further. As Unity customize the FMOD source I cannot be sure the issue is not caused by that. If you have a Unity bug ticket you’d like to bring me in on I’d be happy to work with someone from Unity to resolve this issue.[/quote:359afqqp]
It looks like Unity figured out part of their problem with Unity 4.2. Did that have anything to do with our conversation Matt?
Quote from their new Update logs:
"Audio: Added a more informative error message when the audio device is changed during work in the editor or at runtime (i.e. when plugging in a screen that has built-in audio device such as HDMI screens)."
Yes, that is exactly what’s happened. Unity’s implementation of FMOD does not remove the observer for UIScreenDidConnectNotification. That’s a huge bug don’t you think? Would be cool if I get some kind of pat on the back handshake for this. I swizzled out the addObserver function to never add a notification for UIScreenDidConnectNotification, and the game never crashes.
Is there any way that I could just override the FMOD dealloc function to remove the observer normally? This method of swizzling is a huge hack that doesn’t seem fair. Look at my StackOverflow post. http://stackoverflow.com/questions/1771 … 2_17710567
It does sound like the Unity implementation isn’t doing something correctly.
If you call System::close in FMOD it will call through to [[NSNotificationCenter defaultCenter] removeObserver:self name:UIScreenDidConnectNotification object:nil] so if the System is being properly cleaned up there should be no issue. I cannot speak for what Unity have done though, perhaps it is different?
Please login first to submit.