Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spout Integration #3

Closed
OfficialIncubo opened this issue Nov 24, 2022 · 16 comments
Closed

Spout Integration #3

OfficialIncubo opened this issue Nov 24, 2022 · 16 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@OfficialIncubo
Copy link
Owner

Because of too many errors or unresolved externals using VS2019, I can't integrate Spout. Can you please help me?

@OfficialIncubo OfficialIncubo added the enhancement New feature or request label Nov 27, 2022
@OfficialIncubo OfficialIncubo moved this from Version 1.3 Milestone to In Progress in BeatDrop Version Milestone Apr 8, 2023
@OfficialIncubo OfficialIncubo added the need help Anyone needs help! label Apr 14, 2023
@OfficialIncubo
Copy link
Owner Author

Maybe I will download the Original BeatDrop for Spout source code, adding the same new features and I will upload it.

@OfficialIncubo OfficialIncubo closed this as not planned Won't fix, can't repro, duplicate, stale Apr 24, 2023
@github-project-automation github-project-automation bot moved this from In Progress to Done in BeatDrop Version Milestone Apr 24, 2023
@OfficialIncubo OfficialIncubo moved this from Done to Version 2.0 Milestone in BeatDrop Version Milestone Apr 24, 2023
@OfficialIncubo
Copy link
Owner Author

I asked the owner of Spout if the Spout version of BeatDrop can be compiled using Visual Studio 2019.

This answer can be found here: milkdrop2077/MilkDrop3#3 (comment)

@OfficialIncubo OfficialIncubo moved this from Version 2.0 Milestone to Version 1.2.6 Milestone in BeatDrop Version Milestone Sep 16, 2023
@OfficialIncubo OfficialIncubo added this to the Version 1.2.6 milestone Sep 24, 2023
@OfficialIncubo
Copy link
Owner Author

OfficialIncubo commented Sep 24, 2023

I have managed to compile the leadedge's BeatDrop SpoutDX, but it does have some cons for it:

  • BeatDrop Starts Stretched, but when resized, it stays normal.
  • Navigation Keys doesn't work. Function Keys works. (now fixed)
  • Ctrl+Z didn't work. (still fixed)
  • Some presets may be broken due to its changes to ns-eel or stuff. (fixed too)
    ...but a con is: it doesn't affect BeatDrop's FPS when the Spout Output is on.

Here is the file what I have modified:
BeatDrop-SpoutDX9-almost-working.zip

Next I can try to compile the Spout OpenGL Version of BeatDrop. I already tested this and it works as my improvement one! Wish me luck! (I give up due to a plugin.cpp problem that we're solved.)

Every Resolume Arena users wants a retrospective music visualization right now!

@OfficialIncubo
Copy link
Owner Author

Ok. Now leadedge (Lynn Jarvis) fixed the navigation keys, also a preset compatibility!

You can check out this commit here.

The Spout Integration is ALMOST done! We have to add some of my BeatDrop features and it's done!

@OfficialIncubo OfficialIncubo moved this from Version 1.2.6 Milestone to In Progress in BeatDrop Version Milestone Sep 25, 2023
@OfficialIncubo
Copy link
Owner Author

Yeah. The one issue is:
The spout won't let me share the screen after reenabling.

BeatDropSpoutReenablingIssue.mp4

...and if I change the SpoutWidth and SpoutHeight below 1920, respectively below 1080, it won't let me share this visualization to Spout.

@OfficialIncubo
Copy link
Owner Author

Hey! I have finished the Spout Integration, but if I change the window, the sender doesn't change the resolution. We recommend to reenable it. Now the Spout output now works after reenabling. Afaik, it remains as a BETA.

BeatDropSpoutIntegrationFinished.mp4

Thank you, leadedge (a.k.a Lynn Jarvis) for help! ;)

@github-project-automation github-project-automation bot moved this from In Progress to Done in BeatDrop Version Milestone Sep 26, 2023
@OfficialIncubo OfficialIncubo removed the need help Anyone needs help! label Sep 26, 2023
@OfficialIncubo
Copy link
Owner Author

OfficialIncubo commented Sep 27, 2023

Fix: BeatDrop Window now syncs to the Spout Sender resolution instead of the fixed size.

BeatDropSpoutWindowSyncTest.mp4

So, it's OFFICIALLY FINISHED!

@OfficialIncubo
Copy link
Owner Author

Hey, @leadedge! Sadly, BeatDrop uses XRGB which isn't supportable for NestDrop of invoking a Spout Sprite. Can you please make this visualizer to share ARGB texture for wide compatibility?

@leadedge
Copy link

I have limited time at the moment due to other commitments.

I would suggest to try forcing the backbuffer format to D3DFMT_A8R8G8B8. This should be done when DirectX is initialized.

  1. Milkdrop2PcmVisualizer.cpp - InitD3d
    Change
    d3dPp.BackBufferFormat = D3DFMT_UNKNOWN;
    to
    d3dPp.BackBufferFormat = D3DFMT_A8R8G8B8;

  2. pluginshell.cpp - PluginPreInitialize
    Change
    m_disp_mode_fs.Format = D3DFMT_UNKNOWN;
    to
    m_disp_mode_fs.Format = D3DFMT_A8R8G8B8;
    and
    m_disp_mode_fs.Format = (dm.dmBitsPerPel==16) ? D3DFMT_R5G6B5 : D3DFMT_X8R8G8B8;
    to
    m_disp_mode_fs.Format = (dm.dmBitsPerPel==16) ? D3DFMT_R5G6B5 : D3DFMT_A8R8G8B8;

  3. plugin.cpp - AllocateMyDX9Stuff
    Look for "// determine format for VS1/VS2"
    Change
    case 8: fmt = D3DFMT_X8R8G8B8 ; break;
    to
    case 8: fmt = D3DFMT_A8R8G8B8 ; break;

The received format is detected as D3DFMT_A8R8G8B8 and might solve the problem so it's worth a try.

@OfficialIncubo
Copy link
Owner Author

Oh! Thank you very much! That solved a problem instead of using D3DFMT_UNKNOWN. I might tag it in a commit! ;)
Now it's using ARGB instead of XRGB. I wonder... Let me test if it works with NestDrop when I enable the BeatDrop's Spout Output.

@OfficialIncubo
Copy link
Owner Author

OfficialIncubo commented Feb 28, 2024

That worked with NestDrop!
Captură de ecran 2024-02-28 111042
Captură de ecran 2024-02-28 105542

I did all the steps above, but sadly, some MilkDrop 1 effects, such as invert and solarize affected the BeatDrop's Spout Sender, except video echo, brighten and darken. Any way to fix, @leadedge?

Proof:
Captură de ecran 2024-02-28 112104
Captură de ecran 2024-02-28 112120

Both Invert and Solarize enabled didn't affect it. I wonder why?

EDIT: One more issue. When doing a soft cut transition, the old preset stays black and the new preset fades in (it depends on Comp Shader presets you are using).

@leadedge
Copy link

Well it was worth a try and it mainly works.
The problem could be that alpha is not set properly and it could be 0 instead of 1.0 or vice versa. This would affect the receiving end if it uses alpha and the effects you mention probably do not set alpha as required because they are designed for XRGB. The whole design is based on XRGB. Perhaps you could make it optional. A shader would be needed to set alpha.

@OfficialIncubo
Copy link
Owner Author

OfficialIncubo commented Feb 29, 2024

Well it was worth a try and it mainly works.
The problem could be that alpha is not set properly and it could be 0 instead of 1.0 or vice versa. This would affect the receiving end if it uses alpha and the effects you mention probably do not set alpha as required because they are designed for XRGB. The whole design is based on XRGB. Perhaps you could make it optional. A shader would be needed to set alpha.

Probably it's because alpha blending.
How do I make it not affecting the Spout Sender by making it non-alpha blendable or something?

EDIT: I know that it's designed for XRGB, but looking forward to make the ARGB renderer very stable for the BeatDrop's Spout Sender by not affecting it by MilkDrop 1 effects and some transitions that has a Comp Shader in the old state.

@leadedge
Copy link

leadedge commented Mar 1, 2024

You would have to examine milkdropfps.cpp, but there are a lot of references to blending and it's complicated.

I suggest another way. Remove the changes in the BeatDrop code to force D3DFMT_A8R8G8B8 and make the change in SpoutDX9.cpp instead -

bool spoutDX9::SendDX9surface(IDirect3DSurface9* pSurface, bool bUpdate)

The texture format is determined from the surface description.

// Get the surface details
D3DSURFACE_DESC desc;
ZeroMemory(&desc, sizeof(desc));
pSurface->GetDesc(&desc);
if (desc.Width == 0 || desc.Height == 0)
	return false;

In this case we know that D3DFMT_A8R8G8B8 works, so here it can be changed to a fixed value.

desc.Format = D3DFMT_A8R8G8B8;

A shared texture of that format is then created, the surface is copied to it and receivers see ARGB. It is received OK as far as I can see.

@OfficialIncubo
Copy link
Owner Author

OfficialIncubo commented Mar 1, 2024

Hey! I have added desc.Format = D3DFMT_A8R8G8B8 below the code of the surface detail getter and it worked as intended. No more problems of the Sender. Thank you for explanation and helping! 🎉

image

EDIT: Here's what it looks like with the tweaked Spout Code of BeatDrop Source Code: https://mega.nz/file/wJZWAarL#xj5-WMG8Gy-EPY7d7DHUv-6cM7wwrl8d_W1rzZa3IQQ (video link)

@leadedge
Copy link

leadedge commented Mar 2, 2024

That's good. It turned out to be a simple solution and it seems to work OK.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Development

No branches or pull requests

2 participants