Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

AudioClip.GetData bug

Discussion in 'Unity 5 Pre-order Beta' started by gregzo, Feb 24, 2015.

  1. gregzo

    gregzo

    Joined:
    Dec 17, 2011
    Posts:
    795
    Hi,

    This one has been around since earlier betas, but I've only spotted it now in RC3 : calling AudioClip.GetData( float[] data, int offset ) on a mono clip incorrectly wraps around if data.Length is greater than clip.samples - offset.

    It used to work fine, but now the wrapped portion of the grabbed data is incorrectly offset.
    Use case is reusing buffers to grab data from AudioClips, to avoid feeding the GC.

    I just lost a good 3 hours on this, looking at the unsafe portions of my code over and over again trying to spot a mistake in pointer arithmetics :(

    Case 675086

    Cheers,

    Gregzo
     
    Last edited: Feb 24, 2015