![]() |
Vista Core Audio. Problem mit dem Callback
Hallo zusammen!!
Ich beschäftige mich z.Zt mit den neuen Vista Core Audio Funktionen. Funktioniert auch soweit. Nur leider bekomme ich die Callback-Funktion (also RegisterControlChangeNotify) ned ans laufen. Ich fange gerade erst an, diese COM und Interface-Geschichten zu verstehen. Normalerweise würde ich einen Callback mit Hilfe von Pointern anlegen. Aber hier scheint das ned zu funktionieren?! Ausschnitt aus der MMDeviceApi:
Delphi-Quellcode:
Und hier ein Auszug aus meinem Prog (Beispiel: Master-Volume auslesen):
type
PAUDIO_VOLUME_NOTIFICATION_DATA = ^AUDIO_VOLUME_NOTIFICATION_DATA; AUDIO_VOLUME_NOTIFICATION_DATA = packed record guidEventContext: TGUID; bMuted: BOOL; fMasterVolume: Single; nChannels: UINT; afChannelVolumes: array [1..1] of Single; end; type IAudioEndpointVolumeCallback = interface(IUnknown) ['{657804FA-D6AD-4496-8A60-352752AF4F89}'] function OnNotify(pNotify:PAUDIO_VOLUME_NOTIFICATION_DATA):HRESULT; end; type IMMNotificationClient = interface(IUnknown) end; IPropertyStore = interface(IUnknown) end; type IAudioEndpointVolume = interface(IUnknown) ['{5CDF2C82-841E-4546-9722-0CF74078229A}'] function RegisterControlChangeNotify(pNotify:IAudioEndpointVolumeCallback):HRESULT stdcall; function UnregisterControlChangeNotify(pNotify:IAudioEndpointVolumeCallback):HRESULT stdcall; function GetMasterVolumeLevelScalar(var pfLevel: Single):HRESULT stdcall; . . . end;
Delphi-Quellcode:
Ich habe
function GetAudioEndpointVolume:IAudioEndpointVolume;
var Enumerator: IMMDeviceEnumerator; Endpoint: IMMDevice; clsid: TGUID; begin Result := nil; CoInitialize(nil); Enumerator := CreateComObject(CLASS_IMMDeviceEnumerator) as IMMDeviceEnumerator; if Failed( Enumerator.GetDefaultAudioEndpoint(eRender, eConsole, Endpoint)) then Exit; clsid := IID_IAudioEndpointVolume; if Failed( Endpoint.Activate(clsid, CLSCTX_ALL, nil, IUnknown(Result))) then Exit; CoUnInitialize; end; function GetMasterVolume: single; var AudioEndVol: IAudioEndpointVolume; Mute: LongBool; begin AudioEndVol := GetAudioEndpointVolume; if not Assigned(AudioEndVol) then Exit; if Failed( AudioEndVol.GetMasterVolumeLevelScalar(result)) then Exit; end; procedure VolCallback; begin showmessage('Callback'); end; ![]()
Delphi-Quellcode:
defaultDevice.AudioEndpointVolume.OnVolumeNotification += new
AudioEndpointVolumeNotificationDelegate( AudioEndpointVolume_OnVolumeNotification); . . void AudioEndpointVolume_OnVolumeNotification(AudioVolumeNotificationData data) { Console.WriteLine("New Volume {0}", data.MasterVolume); Console.WriteLine("Muted {0}", data.Muted); } Wie krieg ich nun das Interface 'RegisterControlChangeNotify' dazu, meine 'VolCallback' zu benutzen?? Ich hoffe irgendjemand hier kann mir helfen. Habe mir schon die Finger blutig gegoogelt.... MfG DarkDonald |
Re: Vista Core Audio. Problem mit dem Callback
*push*
Keiner ne Idee? |
Alle Zeitangaben in WEZ +1. Es ist jetzt 12:38 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 by Thomas Breitkreuz