AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Projekte TAudioVolume Komponente incl. System Mixer
Thema durchsuchen
Ansicht
Themen-Optionen

TAudioVolume Komponente incl. System Mixer

Ein Thema von EWeiss · begonnen am 6. Mai 2018 · letzter Beitrag vom 24. Jul 2019
 
EWeiss
(Gast)

n/a Beiträge
 
#11

AW: TAudioVolume Komponente incl. System Mixer

  Alt 8. Mai 2018, 22:23
Neue Version nur Master Icon addiert.
Mache jetzt erst mal pause mit dem Kram wegen den Event Problemen.
Hier ein Beispiel!
Delphi-Quellcode:
unit AudioSessionNotification;

interface

uses
  Windows, Messages, Classes, AudioSessionControl, Constants;

type
   IAudioSessionNotification = interface(IUnknown)
  ['{641DD20B-4D41-49CC-ABA3-174B9477BB08}']
    function OnSessionCreated(const NewSession: IAudioSessionControl): HResult; stdcall;
  end;

  TAudioSessionNotification = class(TInterfacedObject, IAudioSessionNotification)
  private
    MsgHandle: HWND;
  public
    function OnSessionCreated(const NewSession: IAudioSessionControl): HResult; stdcall;
    procedure SetMsgHandle(WinHandle: HWND);
  end;

implementation

{ TSessionNotification }

function TAudioSessionNotification.OnSessionCreated(const NewSession: IAudioSessionControl): HResult;
begin
  PostMessage(MsgHandle, WM_SessionCreate, integer(@NewSession), 0);

  Result := S_OK;
end;

procedure TAudioSessionNotification.SetMsgHandle(WinHandle: HWND);
begin

  MsgHandle := WinHandle;
end;

end.
Ich erstelle das Event.
Delphi-Quellcode:
TAudioVolume.Create..
var
  ISessionNotification: TAudioSessionNotification;
//...
// SessionNotification
ISessionNotification := TAudioSessionNotification.Create;
ISessionNotification.SetMsgHandle(FEventHandle);
SessionNotification := ISessionNotification;
Dann registriere ich das Notification
Delphi-Quellcode:
// Register TAudioSessionNotification to receive a notification when a session is created.
HR := SessionManager2.RegisterSessionNotification(SessionNotification);
if HR <> S_OK then
  raise Exception.Create('Error : Unable to Register Session Notification');
Jetzt sollte hier wenn eine neue Session erstellt wird außerhalb der Anwendung
Delphi-Quellcode:
function TAudioSessionNotification.OnSessionCreated(const NewSession: IAudioSessionControl): HResult;
begin
  PostMessage(MsgHandle, WM_SessionCreate, integer(@NewSession), 0);

  Result := S_OK;
end;
Das Event feuern tut es aber nicht auch das nicht OnSessionDisconnected.
Das war nur zur Info.

Ihr habt den Source also tobt euch aus.

gruss

Geändert von EWeiss ( 8. Mai 2018 um 23:00 Uhr)
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 03:26 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz