8/23/2023 0 Comments Third party sound control windows![]() To respond to external audio events, we need to implement our interface extending IAudioSessionsEvents as follows: TAudioEvent = class(TInterfacedPersistent, IAudioSessionEvents)įunction OnDisplayNameChanged(NewDisplayName: LPCWSTR EventContext: PGUID): HRESULT stdcall įunction OnIconPathChanged(NewIconPath: LPCWSTR EventContext: PGUID): HRESULT stdcall You will need IAudioSessionEvents, IAudioSessionControl, ISimpleAudioVolume, IAudioSessionManager, IMMDevice, IMMDeviceCollection, IMMNotificationClient, and IMMDeviceEnumerator interfaces. You can get a variety of MMDeviceAPI implementations at GitHub and many other forums, but here I will strip the necessary interfaces to achieve what we need. Still for your own application, IAudioSessionManager will work well, specially using IAudioSimpleVolume. However, I still wanted to integrate with Windows' mixer, so modifying volume from external applications (like EarTrumpet or Windows Mixer itself) would reflect in my application's volume slider too automatically.Īs comments mentioned, there are some disadvantages with Windows XP, since IAudioSession was introduced from Vista onwards, and Windows 7 and newer included improvementes like IAudioSessionManager2, IAudioVolumeDuckNotification, etc). What a coincidence, I'm also writing my personal radio stream client using bass.dll, which is a great library BTW. Part two is, what's the proper way to to control volume and toggle mute (system-wide or per application) on XP, where these interfaces are not available? So one part of the question is, does it exist as a 3rd party library? ![]() I understand that for Vista and above I need ISimpleAudioVolume and/or IAudioEndpointVolume, but cannot find a Delphi implementation of these. (The application volume control in Windows mixer is unaffected.) The application needs to run under Windows XP, Vista and 7.īass makes it easy to control global volume, but has no facility for muting sound, and in general it's a better idea to control volume on per-application basis.īass also makes it easy to control the volume of a "channel" (stream), but again there is no muting, and this isn't the proper per-application control, either. I have an internet radio player written in Delphi XE, using the BASS library for audio streaming and playback. I'm not even sure if this fits into one question, but it is a single problem.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |