Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Luoyue · Dec 05, 2015 at 06:17 PM · audioil2cppmicrophone64-bit

My App will carsh when I use Microphone and OnAudioFilterRead under IL2CPP

 void Update ()
 {
     if (Input.GetKeyDown (KeyCode.Mouse0)) {
         mySources = this.gameObject.GetComponent<AudioSource> ();
         selectedDevice = Microphone.devices [0].ToString ();
         mySources.clip = Microphone.Start (null, true, 10, 16000);
         while (!(Microphone.GetPosition(selectedDevice) > 0)) {
         }
         mySources.Play ();
     }
     if (Input.GetKeyUp (KeyCode.Mouse0)) {
         AudioClip clip = mySources.clip;
         mySources.Stop ();
         Microphone.End (selectedDevice);
     }
 }
 
 void OnAudioFilterRead (float[] samples, int channel)
 {
     
 }

Hi All.

My App will crash (iOS) with this code when I select IL2CPP but when i Select Mono2x It is OK,How to solve the problem?Thanks.

Comment
Add comment · Show 10
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image JoshPeterson · Dec 09, 2015 at 12:37 PM 0
Share

Can you provide some more information about the crash? Specifically, do you get a call stack for this crash?

avatar image Luoyue JoshPeterson · Dec 10, 2015 at 08:44 AM 0
Share

I use ipad's microphone to record audio and use OnAudioFilterRead to get audio date then send them to a robot by network. Always ,use void OnAudioFilterRead (float[] samples, int channel) and $$anonymous$$icrophone.Start ,it will crash ,can you try it? you just build an app for ios with the follow code:(if you tap de screen ,it will crash).thank you very mach!

 using UnityEngine;
 using System.Collections;
 using System;
 using System.IO;
 using UnityEngine.Audio;
  
 public class Test001 : $$anonymous$$onoBehaviour
 {
     string selectedDevice;
     public AudioSource mySources;
     AudioClip clip;
     
     bool key = false;
     void Start ()
     {
          
     }
     
     void Update ()
     {
         if (Input.Get$$anonymous$$eyDown ($$anonymous$$eyCode.$$anonymous$$ouse0)) {
             mySources = this.gameObject.GetComponent<AudioSource> ();
             selectedDevice = $$anonymous$$icrophone.devices [0].ToString ();
             mySources.clip = $$anonymous$$icrophone.Start (null, true, 10, 16000);
             while (!($$anonymous$$icrophone.GetPosition(selectedDevice) > 0)) {
             }
             key = true;
             mySources.Play ();
         }
         if (Input.Get$$anonymous$$eyUp ($$anonymous$$eyCode.$$anonymous$$ouse0)) {
             AudioClip clip = mySources.clip;
             
             key = false;
             mySources.Stop ();
             $$anonymous$$icrophone.End (selectedDevice);
         }
     }    
 }
 
avatar image JoshPeterson Luoyue · Dec 10, 2015 at 12:28 PM 0
Share

I'm not seeing a crash with this code. You may want to try the latest version of Unity then (if you have not already). Or, can you provide details about the crash you see. $$anonymous$$aybe I'm doing something wrong when I try to reproduce this.

Show more comments
avatar image JoshPeterson · Dec 11, 2015 at 12:33 PM 0
Share

Thanks for providing the call stack. Actually, we are correcting one bug now that looks similar. We end up with a crash in the GC code on an Audio callback thread, so we may have already corrected this issue. Check this again with 5.3.0p1 (when is it out, next week), as I believe the fix will land in that release. You can find the Unity patch releases here: http://unity3d.com/unity/qa/patch-releases

avatar image Luoyue JoshPeterson · Dec 23, 2015 at 07:38 AM 0
Share

Hello,When Unity 5.3.0p1 releases?I am waiting for it to fix the bug.

avatar image JoshPeterson Luoyue · Dec 23, 2015 at 01:20 PM 0
Share

The 5.3.1p1 version, which might have this fix, was just released. You can find it here:

http://unity3d.com/unity/qa/patch-releases

Show more comments
avatar image JoshPeterson · Dec 29, 2015 at 01:52 PM 0
Share

You're welcome, thanks for verifying!

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Unity 5 AudioMixer nullreference on iOS using IL2CPP 1 Answer

Real time Microphone (line input) FFT analysis 2 Answers

Microphone Input Latency Android 1 Answer

Microphone Failed Result=33 0 Answers

How to use the Microphone class to record multiple AudioClip's 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges