{' UNIT WMPEffects.pas
'--------------------------- BassVis API Module -----------------------------
' BassVis ADD-ON for Bass Audio Library
' Copyright © 2006-2012 BrewIdeas@Emil Weiss, All Rights Reserved
'
' Author(s) of this Unit: Emil Weiss
'
'----------------------------------------------------------------------------}
unit WMPEffects;
interface
uses
Windows, WMPLib_TLB;
const
SA_BUFFER_SIZE = 1024;
IID_IWMPEffects : TGUID = '
{D3984C13-C3CB-48e2-8BE5-5168340B4F35}';
IID_IWMPEffects2 : TGUID = '
{695386EC-AA3C-4618-A5E1-DD9A8B987632}';
IID_IWMPMedia: TGUID = '
{94D55E95-3FAC-11D3-B155-00C04F79FAA6}';
Type EffectsCapability =
(EFFECT_CANGOFULLSCREEN = $00000001,
// can the effect go full screen?
EFFECT_HASPROPERTYPAGE = $00000002,
// does the effect have a property page?
EFFECT_VARIABLEFREQSTEP = $00000004,
// should effect return frequency data with variable size steps?
EFFECT_WINDOWEDONLY = $00000008,
EFFECT2_FULLSCREENEXCLUSIVE = $00000010);
Type
TimedLevel =
record
frequency :
array [0..1, 0..SA_BUFFER_SIZE-1]
of byte;
waveform :
array [0..1, 0..SA_BUFFER_SIZE-1]
of byte;
state : integer;
timeStamp : int64;
Rendering : Bool;
end;
IWMPEffects =
interface(IUnknown)
['
{D3984C13-C3CB-48e2-8BE5-5168340B4F35}']
// Render using the rectangle on the normalized device context
//void Render(ref TimedLevel levels, IntPtr hdc, ref RECT r);
procedure Render(
var pLevels : TimedLevel; hdc : HDC;
var prc : TRect);
safecall;
// provides the no. channels, sample rate and title of the audio currently playing
procedure MediaInfo(lChannelCount : longint; lSampleRate : longint; bstrTitle : WideString);
safecall;
// called to retrieive the capabilities of the effect (fullscreen? property page?, etc.)
procedure GetCapabilities(
var pdwCapabilities : DWORD);
safecall;
// retrieve the display title of the effect
procedure GetTitle(
var bstrTitle : WideString);
safecall;
// retrieve the title for a preset
procedure GetPresetTitle(nPreset : LongInt;
var bstrPresetTitle : WideString);
safecall;
// retrieve the number of presets this effect supports
procedure GetPresetCount(
var pnPresetCount : LongInt);
safecall;
// set / get the current preset
procedure SetCurrentPreset(nPreset : LongInt);
safecall;
procedure GetCurrentPreset(
var pnPreset : LongInt);
safecall;
// display the property page of the effect (if there is one)
procedure DisplayPropertyPage(hwndOwner : HWND);
safecall;
// This method will be called when the effect is to start and stop full screen
// rendering (if supported)
procedure GoFullscreen(fFullScreen : BOOL);
safecall;
// This method will get called after a successful call to GoFullScreen to render
// the effect. Return failure from this method to signal loss of full screen.
procedure RenderFullScreen(
var pLevels : TimedLevel);
safecall;
end;
IWMPEffects2 =
interface(IWMPEffects)
['
{695386EC-AA3C-4618-A5E1-DD9A8B987632}']
// Called by Windows Media Player to provide visualization access to the
// core Windows Media Player APIs.
procedure SetCore(
var pPlayer : IWMPCore);
safecall;
// Called by Windows Media Player to instantiate a visualization window
procedure Create(hwndParent : HWND);
safecall;
// Called by Windows Media Player to destroy a visualization window
// instantiated in the Create method.
procedure Destroy;
safecall;
//Called by Windows Media Player to inform the visualization that a new
//media item has been loaded.
procedure NotifyNewMedia(
var pMedia : IWMPMedia);
safecall;
// Called by Windows Media Player to pass window messages to a visualization.
procedure OnWindowMessage(msg : UINT; WParam : WPARAM; LParam : LPARAM;
var plResultParam : LRESULT);
safecall;
// Called by Windows Media Player to render a windowed visualization.
procedure RenderWindowed(
var pData : TimedLevel; fRequiredRender : BOOL);
safecall;
end;
var
TimedLvl : TimedLevel;
implementation
end.