svp_vis.h 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. /*
  2. LICENSE
  3. -------
  4. Copyright 2005 Nullsoft, Inc.
  5. All rights reserved.
  6. Redistribution and use in source and binary forms, with or without modification,
  7. are permitted provided that the following conditions are met:
  8. * Redistributions of source code must retain the above copyright notice,
  9. this list of conditions and the following disclaimer.
  10. * Redistributions in binary form must reproduce the above copyright notice,
  11. this list of conditions and the following disclaimer in the documentation
  12. and/or other materials provided with the distribution.
  13. * Neither the name of Nullsoft nor the names of its contributors may be used to
  14. endorse or promote products derived from this software without specific prior written permission.
  15. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
  16. IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  17. FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
  18. CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  19. DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  20. DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
  21. IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  22. OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  23. */
  24. // Note!
  25. // *Video points to memory in 32bit video memory, ie, the following can be used
  26. // for your utility and to help your understanding of the pixel format used.
  27. // In Visual C, you should start a DLL project, under code generation set it to
  28. // use the DLL libraries, and most likely for release you will want to turn
  29. // optimisation for speed on. Include this .h file in your project, then create
  30. // or add your main C/C++ file and #include "vis.h"
  31. // To start off, fill in the VisInfo structure. Render should draw a whole frame
  32. // into the 32 bit ABGR buffer (for blur, smoke and zoom to work it should, rather
  33. // than replacing the video data, add to it using bitwise or, saturated add, or
  34. // alpha blend). Make sure not to exceed the boundaries given. 'Pitch' specifies
  35. // the distance, in pixels, between the start of each line. If you have a pointer
  36. // at the start of a line, Pointer+Pitch is the start of the next line and
  37. // Pointer-Pitch is the start of the previous.
  38. // Make sure that QueryModule is defined exactly as at the end of this file,
  39. // including the extern "C" keyword if you're using C++. It should return a
  40. // pointer to this structure. All routines that are pointed to by the structure
  41. // must be filled in even if they don't do anything. Render is the only function
  42. // that is required to have a body.
  43. #define ALPHA_MASK 0xFF000000
  44. #define RED_MASK 0x00FF0000
  45. #define GREEN_MASK 0x0000FF00
  46. #define BLUE_MASK 0x000000FF
  47. #define ALPHA_SHIFT 24
  48. #define RED_SHIFT 16
  49. #define GREEN_SHIFT 8
  50. #define BLUE_SHIFT 0
  51. #define AlphaByte(x) (((x))>>ALPHA_SHIFT)
  52. #define RedByte(x) (((x) & RED_MASK)>>RED_SHIFT)
  53. #define GreenByte(x) (((x) & GREEN_MASK)>>GREEN_SHIFT)
  54. #define BlueByte(x) (((x) & BLUE_MASK)>>BLUE_SHIFT)
  55. // files should be renamed from .DLL to .SVP
  56. #ifndef DLLEXPORT
  57. #define DLLEXPORT __declspec( dllexport )
  58. #endif
  59. #define VI_WAVEFORM 0x0001 // set if you need the waveform
  60. #define VI_SPECTRUM 0x0002 // set if you need the FFT values
  61. #define SONIQUEVISPROC 0x0004 // set if you want to allow Soniques user pref vis to affect your vis
  62. // for example - blur, smoke and zoom
  63. #pragma pack (push, 8)
  64. typedef struct
  65. {
  66. unsigned long MillSec; // Sonique sets this to the time stamp of end this block of data
  67. unsigned char Waveform[2][512]; // Sonique sets this to the PCM data being outputted at this time
  68. unsigned char Spectrum[2][256]; // Sonique sets this to a lowfidely version of the spectrum data
  69. // being outputted at this time
  70. } VisData;
  71. typedef struct _VisInfo
  72. {
  73. unsigned long Reserved; // Reserved
  74. char *PluginName; // Set to the name of the plugin
  75. long lRequired; // Which vis data this plugin requires (set to a combination of
  76. // the VI_WAVEFORM, VI_SPECTRUM and SONIQEUVISPROC flags)
  77. void (*Initialize)(void); // Called some time before your plugin is asked to render for
  78. // the first time
  79. BOOL (*Render)( unsigned long *Video, int width, int height, int pitch, VisData* pVD);
  80. // Called for each frame. Pitch is in pixels and can be negative.
  81. // Render like this:
  82. // for (y = 0; y < height; y++)
  83. // {
  84. // for (x = 0; x < width; x++)
  85. // Video[x] = <pixel value>;
  86. // Video += pitch;
  87. // }
  88. // OR
  89. // void PutPixel(int x, int y, unsigned long Pixel)
  90. // {
  91. // _ASSERT( x >= 0 && x < width && y >= 0 && y < height );
  92. // Video[y*pitch+x] = Pixel;
  93. // }
  94. BOOL (*SaveSettings)( char* FileName );
  95. // Use WritePrivateProfileString to save settings when this is called
  96. // Example:
  97. // WritePrivateProfileString("my plugin", "brightness", "3", FileName);
  98. BOOL (*OpenSettings)( char* FileName );
  99. // Use GetPrivateProfileString similarly:
  100. // char BrightnessBuffer[256];
  101. // GetPrivateProfileString("my plugin", "brightness", "3", BrightnessBuffer, sizeof(BrightnessBuffer), FileName);
  102. } VisInfo;
  103. #pragma pack (pop, 8)
  104. // DLL exports this function - it should return a pointer to a static structure
  105. // as above.
  106. extern "C"
  107. DLLEXPORT VisInfo* QueryModule(void);