migueldeicaza / SwiftGodot

New Godot bindings for Swift
https://migueldeicaza.github.io/SwiftGodotDocs/tutorials/swiftgodot-tutorials/
MIT License
1.19k stars 77 forks source link

AudioStreamPlayback missing `_mix` method in bindings #501

Closed LemmaEOF closed 5 months ago

LemmaEOF commented 5 months ago

Describe the bug AudioStreamPlayback has a _mix method that is defined in extension_api.json but is not exposed to SwiftGodot. The extension description is as follows:

{
    "name": "_mix",
    "is_const": false,
    "is_static": false,
    "is_vararg": false,
    "is_virtual": true,
    "return_value": {
        "type": "int",
        "meta": "int32"
    },
    "arguments": [
        {
            "name": "buffer",
            "type": "AudioFrame*"
        },
        {
            "name": "rate_scale",
            "type": "float",
            "meta": "float"
        },
        {
            "name": "frames",
            "type": "int",
            "meta": "int32"
        }
    ],
    "description": ""
},

The buffer argument's AudioFrame* type is an array that is modified as a side-effect of the operation, so it will need to be an inout [AudioFrame] in the Swift type signature. This is critical for tasks like processing audio for visualization, and its exclusion makes those currently impossible.

migueldeicaza commented 5 months ago

This is a variation of the pending work for #13

I have for now surfaced the AudioFrame structure, but also the API with a "OpaquePointer", which you will need to cast into AudioFrame* (something like UnsafeMutableBufferPointer) with both the OpaquePointer and the count value.