Skip to content

Fix AudioBuffer::getChannelData implementation #80

Open
@b-ma

Description

@b-ma

This function relies on unsafe to be able to mutate the returned channel, which may be a problem in some situations

I think this inhibits some undefined behaviour - theoretically.

You are asking the compiler for a mutable reference of the AudioBuffer, but then this information is 'erased' via the unsafe slice cast. This means if you call the method twice and mutate one of the copies, the compiler could assume the other copy will not be affected.

I don't have a clear solution though (perhaps return the same TypedArray via set_property??) - should we add an issue to address this later?

Originally posted by @orottier in #79 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions