Skip to content

System volume #610

@myangelkamikaze

Description

@myangelkamikaze

Looks like win11 changed how audio sessions work. Before all apps just always had active audio sessions so we could initialize system volume on startup and save it on shutdown. Now, the audio sessions supposedly only show up when the application starts producing audio (though I had EO show up even without audio, so no idea).

We'll probably need to handle everything with COM

[Guid("641DD20B-4D41-49CC-ABA3-174B9477BB08")]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
interface IAudioSessionNotification
{
    void OnSessionCreated(IAudioSessionControl newSession);
}

[Guid("bfa971f1-4d5e-40bb-935e-967039bfbee4")]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
interface IAudioSessionEvents
{
    void OnDisplayNameChanged([MarshalAs(UnmanagedType.LPWStr)] string newDisplayName, Guid eventContext);
    void OnIconPathChanged([MarshalAs(UnmanagedType.LPWStr)] string newIconPath, Guid eventContext);
    void OnSimpleVolumeChanged(float newVolume, bool newMute, Guid eventContext);
    void OnChannelVolumeChanged(uint channelCount, IntPtr newVolumes, uint channelIndex, Guid eventContext);
    void OnGroupingParamChanged(Guid newGroupingParam, Guid eventContext);
    void OnStateChanged(AudioSessionState newState);
    void OnSessionDisconnected(AudioSessionDisconnectReason disconnectReason);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions