-
Notifications
You must be signed in to change notification settings - Fork 0
3: Windowed Usage
(TODO: Provide a more detailed explanation. This was moved from the original quick-and-dirty README.)
At a high level, these are the extra steps compared to a regular OpenTK GameWindow scenario:
- Create an
EyeCandyCaptureConfigobject to define audio capture parameters - Create an
EyeCandyWindowConfigobject to define your window characteristics- Set the size:
config.OpenTKNativeWindowSettings.Size = (960, 540); - Set the vert:
config.VertexShaderPathname = "Subdir/filename.vert"; - Set the frag:
config.FragmentShaderPathname = "Subdir/filename.frag";
- Set the size:
- Create a window object derived from
BaseWindow - In the window constructor, create an
AudioTextureEngineobject - Call
engine.Create<AudioTextureXXXX>(...)to define the textures you'll use - Among your other OpenGL calls, in the
OnRenderFrameevent...- Call
engine.UpdateTextures(); - Call
engine.SetTextureUniforms(Shader);
- Call
Refer to the Wave or Frag classes in the demo project for relatively easy-to-follow examples of this. The Wave demo works similarly to VertexShaderArt (the work is performed in a vertex shader based on an array of sequential integers), and the Frag demo works similarly to Shadertoy (the work is performed in a frag shader on a quad that simply covers the entire display surface).
Extensive testing has shown that the background thread generates very little overhead. In my real-world monkey-hi-hat program, it's easiest to just create one of each audio texture and let them run all the time, rather than trying to manage creation/deletion or enabling/disabling. Use it when you need it, ignore it when you don't.