OUT.H 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. #ifndef NULLSOFT_OUTH
  2. #define NULLSOFT_OUTH
  3. // Output plugin interface
  4. #include <windows.h>
  5. #include <stddef.h>
  6. #define OUT_VER 0x10
  7. // added 5.64+
  8. #define OUT_VER_U 0x11
  9. // specify OUT_VER_U if you want to provide a unicode (wchar_t*) description and only work on 5.64+
  10. // specify OUT_VER to use the original (char*) description as before
  11. // note: we are using the fact that sizeof(char*) == sizeof(wchar_t*) to be able to allow this
  12. // so when using OUT_VER_U you will need to cast description to (wchar_t*) to set
  13. typedef struct
  14. {
  15. int version; // module version (OUT_VER)
  16. char *description; // description of module, with version string
  17. intptr_t id; // module id. each input module gets its own. non-nullsoft modules should be >= 65536
  18. // known module ids are (though these may now be deprecated...):
  19. // waveout: 32
  20. // gapless: 64
  21. // xfade: 63
  22. // disk: 33
  23. // dsound: 38
  24. // NULL: 65
  25. // mm2: 69
  26. // wasapi: 70
  27. HWND hMainWindow; // winamp's main window (filled in by winamp)
  28. HINSTANCE hDllInstance; // DLL instance handle (filled in by winamp)
  29. void (__cdecl *Config)(HWND hwndParent); // configuration dialog
  30. void (__cdecl *About)(HWND hwndParent); // about dialog
  31. void (__cdecl *Init)(); // called when loaded
  32. void (__cdecl *Quit)(); // called when unloaded
  33. int (__cdecl *Open)(int samplerate, int numchannels, int bitspersamp, int bufferlenms, int prebufferms);
  34. // this returns >=0 on success, <0 on failure
  35. // NOTE: bufferlenms and prebufferms are ignored in most if not all output plug-ins.
  36. // ... so don't expect the max latency returned to be what you asked for.
  37. // returns max latency in ms (0 for diskwriters, etc)
  38. // bufferlenms and prebufferms must be in ms. 0 to use defaults.
  39. // prebufferms must be <= bufferlenms
  40. // pass bufferlenms==-666 to tell the output plugin that it's clock is going to be used to sync video
  41. // out_ds turns off silence-eating when -666 is passed
  42. void (__cdecl *Close)(); // close the ol' output device.
  43. int (__cdecl *Write)(char *buf, int len);
  44. // 0 on success. Len == bytes to write (<= 8192 always). buf is straight audio data.
  45. // 1 returns not able to write (yet). Non-blocking, always.
  46. int (__cdecl *CanWrite)(); // returns number of bytes possible to write at a given time.
  47. // Never will decrease unless you call Write (or Close, heh)
  48. int (__cdecl *IsPlaying)(); // non0 if output is still going or if data in buffers waiting to be
  49. // written (i.e. closing while IsPlaying() returns 1 would truncate the song
  50. int (__cdecl *Pause)(int pause); // returns previous pause state
  51. void (__cdecl *SetVolume)(int volume); // volume is 0-255
  52. void (__cdecl *SetPan)(int pan); // pan is -128 to 128
  53. void (__cdecl *Flush)(int t); // flushes buffers and restarts output at time t (in ms) (used for seeking)
  54. int (__cdecl *GetOutputTime)(); // returns played time in MS
  55. int (__cdecl *GetWrittenTime)(); // returns time written in MS (used for synching up vis stuff)
  56. } Out_Module;
  57. // These are the return values to be used with the uninstall plugin export function:
  58. // __declspec(dllexport) int __cdecl winampUninstallPlugin(HINSTANCE hDllInst, HWND hwndDlg, int param)
  59. // which determines if Winamp can uninstall the plugin immediately or on winamp restart.
  60. // If this is not exported then Winamp will assume an uninstall with reboot is the only way.
  61. //
  62. // Note: output plugins cannot be uninstalled without a reboot (unlike other plugin types).
  63. // From Winamp 5.6 and higher, if you do return a non-zero value then it will still be
  64. // able to uninstall the plug-in (prior to this, returning non-zero prevented uninstall).
  65. //
  66. #define OUT_PLUGIN_UNINSTALL_REBOOT 0x0
  67. //
  68. // Uninstall support was added from 5.0+ and uninstall now support from 5.5+ though note
  69. // that it is down to you to ensure that if uninstall now is returned that it will not
  70. // cause a crash i.e. don't use if you've been subclassing the main window.
  71. //
  72. // The HWND passed in the calling of winampUninstallPlugin(..) is the preference page HWND.
  73. //
  74. // For a output plugin to be correctly detected by Winamp you need to ensure that
  75. // the exported winampGetOutModule(..) is exported as an undecorated function
  76. // e.g.
  77. // #ifdef __cplusplus
  78. // extern "C" {
  79. // #endif
  80. // __declspec(dllexport) Out_Module * __cdecl winampGetOutModule(){ return &plugin; }
  81. // #ifdef __cplusplus
  82. // }
  83. // #endif
  84. //
  85. // added 5.64+
  86. // this is used to notify a compatible output plug-in when it is being used or not
  87. // as the currently active output plug-in allowing it to clean up things as needed
  88. // #ifdef __cplusplus
  89. // extern "C" {
  90. // #endif
  91. // __declspec(dllexport) void __cdecl winampGetOutModeChange(int mode){ }
  92. // #ifdef __cplusplus
  93. // }
  94. // #endif
  95. // the following are passed to the exported function indicating the state and also
  96. // where the change has been triggered by:
  97. #define OUT_UNSET 0x0 // no longer the active output
  98. #define OUT_SET 0x1 // is becoming the active output
  99. #define OUT_PLAYBACK 0x100 // used when playback begins and an output plug-in
  100. // is set for an input plug-in or not based on the
  101. // input plug-in settings when the playback begins
  102. // note: it is possible to get seemingly 'repeat' mode changes as changing of the
  103. // output plug-in via the preferences often is not fully applied until the
  104. // (re-)starting of playback and the related updating of the input plug-in.
  105. #endif