Skip to content

Relation of Audio Device Client and AudioContext #5

Open
@chrisguttandin

Description

@chrisguttandin

Am I correct, when I assume that there is a 1:1 relation between an Audio Device Client and an AudioContext? Each Audio Device Client can only have one AudioContext and each AudioContext can only belong to one Audio Device Client. But an AudioContext is optional and an Audio Device Client can exist without an AudioContext associated to it.

If my assumption is correct, I think it would make sense to flip around the process of creating an AudioContext associated to an Audio Device Client. If there is a getContext() method on the Audio Device Client, it implies that the context is already there and just has to be returned. If the AudioContext would just be created as usual but with an additional constructor argument it might better reflect what is actually going on behind the scenes.

const ac = new AudioContext({ deviceClient: myPreviouslyCreatedAudioDeviceClient });

// This will then throw an error, because there is already
// a context associated to the same Audio Device Client
const ac2 = new AudioContext({ deviceClient: myPreviouslyCreatedAudioDeviceClient });

Metadata

Metadata

Assignees

No one assigned

    Labels

    AudioDeviceClientProject label for AudioDeviceClient

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions