home *** CD-ROM | disk | FTP | other *** search
/ Chip 2002 October / Chip_2002-10_cd1.bin / zkuste / vbasic / Data / Utils / WMP71SDK.exe / WMEffect.awx / TEMPLATE / EFFECTS.IDL < prev    next >
Encoding:
Text File  |  2001-10-01  |  5.0 KB  |  120 lines

  1. ///////////////////////////////////////////////////////////////////////////////
  2. // Microsoft Windows Media Player
  3. // Copyright (C) Microsoft Corporation, 1999-2000
  4. //
  5. // Filename:    effects.idl
  6. //
  7. // Abstract:    Interface implemented by all Windows Media Player effects.
  8. //
  9. ///////////////////////////////////////////////////////////////////////////////
  10.  
  11. #include <olectl.h>
  12.  
  13. import "oaidl.idl";
  14. import "ocidl.idl";
  15.  
  16.  
  17. // These flags are to be returned in the GetCapabilities method.  They
  18. // indicate to the effects host what the effect supports
  19.  
  20. const DWORD EFFECT_CANGOFULLSCREEN  = 0x00000001;   // can the effect go full screen?
  21. const DWORD EFFECT_HASPROPERTYPAGE  = 0x00000002;   // does the effect have a property page?
  22. const DWORD EFFECT_VARIABLEFREQSTEP = 0x00000004;   // should effect return frequency data with variable size steps?
  23.  
  24. // This structure is passed to the Render() method of the effect. It holds the frequency,
  25. // waveform and state data need to render the effect.
  26. //
  27. // The first dimension of each array corresponds to the channel: 0-left/mono 1-right(stereo only)
  28. // The second dimension contains the sampled levels.  The frequency data ranges
  29. // from 0..255.  The wave form data represents -128..127 but is stored as 
  30. // 0..255. The state contains the current audio playback state. The time stamp provides
  31. // the relative time of these samples in the audio stream.
  32.  
  33. const int SA_BUFFER_SIZE    = 1024;  // number of frequency/waveform samples
  34.  
  35. enum PlayerState                    // audio playback states
  36. {
  37.     stop_state              = 0,    // audio is currently stopped
  38.     pause_state             = 1,    // audio is currently paused
  39.     play_state              = 2     // audio is currently playing
  40. };
  41.  
  42. cpp_quote("")
  43. cpp_quote("//**********************************************************************")
  44. cpp_quote("// Define the minimum and maximum frequency ranges returned in our")
  45. cpp_quote("// TimedLevel frequency array (i.e. first index in TimedLevel.frequency")
  46. cpp_quote("// is at 20Hz and last is at 22050Hz).")
  47. cpp_quote("//**********************************************************************")
  48. cpp_quote("const float kfltTimedLevelMaximumFrequency = 22050.0F;")
  49. cpp_quote("const float kfltTimedLevelMinimumFrequency = 20.0F;")
  50. cpp_quote("")
  51. cpp_quote("/*")
  52. cpp_quote(" * FREQUENCY_INDEX() returns the index into TimedLevel.frequency[] where ")
  53. cpp_quote(" * the specified frequency is located in the power spectrum")
  54. cpp_quote(" */")
  55. cpp_quote("#define FREQUENCY_INDEX(FREQ)\\")
  56. cpp_quote("  (int)(((FREQ) - kfltTimedLevelMinimumFrequency) /\\")
  57. cpp_quote("    (((kfltTimedLevelMaximumFrequency - kfltTimedLevelMinimumFrequency) / SA_BUFFER_SIZE)))")
  58. cpp_quote("")
  59.  
  60. typedef struct tagTimedLevel
  61. {
  62.     unsigned char   frequency[2][SA_BUFFER_SIZE];
  63.     unsigned char   waveform [2][SA_BUFFER_SIZE]; 
  64.     int             state;
  65.     hyper           timeStamp;
  66. } TimedLevel;
  67.  
  68. [
  69.     object,
  70.     uuid(D3984C13-C3CB-48e2-8BE5-5168340B4F35),
  71.     helpstring("IEffects Interface"),
  72.     pointer_default(unique)
  73. ]
  74. interface IWMPEffects : IUnknown
  75. {
  76.     // render effect to the rectangle on the provided dc - the dc is normalized
  77.     [helpstring("method Render")] 
  78.     HRESULT Render([in] TimedLevel *pLevels, [in] HDC hdc, [in] RECT *prc);
  79.  
  80.     // provides the no. channels, sample rate and title of the audio currently playing
  81.     [helpstring("method MediaInfo")] 
  82.     HRESULT MediaInfo([in] LONG lChannelCount, [in] LONG lSampleRate, [in] BSTR bstrTitle );
  83.  
  84.     // called to retrieive the capabilities of the effect (fullscreen? property page?, etc.)
  85.     [helpstring("method GetCapabilities")]
  86.     HRESULT GetCapabilities([out] DWORD * pdwCapabilities);
  87.  
  88.     // retrieve the display title of the effect
  89.     [helpstring("method GetTitle")]
  90.     HRESULT GetTitle([out] BSTR *bstrTitle);
  91.  
  92.     // retrieve the title for a preset
  93.     [helpstring("method GetPresetTitle")]
  94.     HRESULT GetPresetTitle([in] LONG nPreset, [out] BSTR *bstrPresetTitle);
  95.  
  96.     // retrieve the number of presets this effect supports
  97.     [helpstring("method GetPresetCount")]
  98.     HRESULT GetPresetCount([out] LONG * pnPresetCount);
  99.  
  100.     // set / get the current preset
  101.     [helpstring("method SetPreset")]
  102.     HRESULT SetCurrentPreset([in] LONG nPreset);
  103.     [helpstring("method GetPreset")]
  104.     HRESULT GetCurrentPreset([out] LONG * pnPreset);
  105.  
  106.     // display the property page of the effect (if there is one)
  107.     [helpstring("method DisplayPropertyPage")] 
  108.     HRESULT DisplayPropertyPage([in] HWND hwndOwner);
  109.  
  110.     // This method will be called when the effect is to start and stop full screen
  111.     // rendering (if supported)
  112.     [helpstring("method GoFullscreen")] 
  113.     HRESULT GoFullscreen([in] BOOL fFullScreen);
  114.  
  115.     // This method will get called after a successful call to GoFullScreen to render
  116.     // the effect.  Return failure from this method to signal loss of full screen.
  117.     [helpstring("method RenderFullScreen")] 
  118.     HRESULT RenderFullScreen([in] TimedLevel *pLevels);
  119. };
  120.