OfficialIncubo / BeatDrop-Music-Visualizer

The Milkdrop2 Music Visualization Standalone, only for Windows
https://twitter.com/BeatDropVis
Other
45 stars 3 forks source link

Spout Input as Sprites! #26

Open OfficialIncubo opened 9 months ago

OfficialIncubo commented 9 months ago

Hey! It would be cool if this feature will be integrated in! This will be the true Mini-NestDrop!

The usage: If you want to invoke a sprite as a Spout Input, then beatdrop_img.ini will be necessary to access images/Spout Inputs.

Add Spout/SpoutInputName before img= on any digit headers you want, so it should be able to access it. SpoutInputName is the Spout Sender name that you want to invoke it, else it gets an error.

For example: The Spout OBS Plug-in Sender Name that I route from a YouTube Video is YouTubeSpoutActivator, so it should be img=Spout/YouTubeSpoutActivator in the [img11] header on beatdrop_img.ini. If I try to change to Sprite Mode and type 11 (e.g. K11), it will invoke a Spout Input Sprite routed from OBS.

Killing/Clearing a Spout Sprite (e.g. In sprite mode, pressed DEL or CTRL+SHIFT+K), it should stop and releasing the received Spout texture, freeing up some resources.

Hey, @leadedge, a.k.a. Lynn Jarvis, you are the one who made the Spout Output Integration of BeatDrop and I am the one who improves this project. Will it be possible to add a Spout Sprite Input functionality like the example that I have mentioned?

Closes Issue #4.

leadedge commented 9 months ago

You would have to set up a receiver or multiple receivers somehow, but it should be possible. I can't remember whether you are using OpenGL or DirectX but The example receiver source code for OpenGL or SpoutDX for DirectX and Windows applications would be a reference.

OfficialIncubo commented 9 months ago

I can't remember whether you are using OpenGL or DirectX but The example receiver source code for OpenGL or SpoutDX for DirectX and Windows applications would be a reference.

Yes! BeatDrop only uses SpoutDX for performance improvement, also for Spout Output (I think). Where can I paste the entire code of "Tutorial07.cpp"? In plugin.cpp, I think there's a Sprite Activation, so what should I enable support for Spout Input Sprites when it detects img=Spout/InputName?

leadedge commented 9 months ago

Tutorial07 is a complete example from Microsoft, modified for Spout functions, so it's not possible to copy/paste the entire thing.

Unfortunately, I forgot that BeatDrop uses DirectX 9, so this is a relevant example using SpoutDX9. ReceiveDX9Texture will give a texture to work with. I am sorry that I can't assist with BeatDrop code.

OfficialIncubo commented 9 months ago

I am sorry that I can't assist with BeatDrop code.

Well ok! :) If you have more time assisting the BeatDrop code, then tell me. This should be postponed in version v1.3.3 because it's been long months that the new version isn't released. After finishing the Drag and Drop MilkDrop Preset Feature, I should release the version 1.3.2 with lots of fixes and optimizations (and a new feature).

OfficialIncubo commented 8 months ago

But hey, @leadedge! You can take a look in plugin.cpp -> bool CPlugin::LaunchSprite -> part of the comment starting from // 1. read in image filename. This is a functionality that gets an image filename, which it would have ability to read the Spout\ prefix then the sender name, so it should have to receive the Spout Texture as a sprite and it will be effected by the init and per-frame code from the image ini file, like NestDrop.

You can also look in texmgr.cpp -> int texmgr::LoadTex. As you can see that it's an algorithm that it loads a sprite or a texture.

A question: should it work if I try to receive a selected Spout Sender Texture (ex. YouTubeSpoutActivator) read from the image ini file, for example ReceiveDX9Texture(YouTubeSpoutActivator)?

leadedge commented 8 months ago

There is no support in SpoutDX9 for image files or pixel buffers. You might be able to import the images to a surface with D3DXLoadSurfaceFromFile.