Documentation/Visualization
class

Visualization

js/vis.js:294

Visualization object returned by vis.Create and vis.CreateAsync. This is a documentation-only instance description, not a constructor exposed by the vis namespace. A visualization retains its native audio subscription while alive.
Source runtime properties are exposed directly on this object; built-in renderers add their renderer properties to the same object. Shader visualizations expose FeedbackIntervalMs and InjectFeedback. See Visualization API for the complete property tables.

propertyreadonly

DebugInfo

js/vis.js:391
DebugInfo: string

Diagnostic information about this visualization and its native audio engine, including source and feedback statistics when applicable.

property

FeedbackIntervalMs

js/vis.js:354
FeedbackIntervalMs: number = 0

Shader feedback interval in milliseconds. Use 0 to advance history on every Draw, or a finite number from 1 to 1000 for a fixed cadence; fractional values are supported. Positive values require a feedback pass. Without feedback, the property reads 0 and accepts only 0.

Changing the value preserves history and other visualization state. The next eligible Draw uses the new cadence; assigning the same value leaves the current schedule intact. This property does not create a timer or request a repaint, and missed history steps are skipped. See Visualization API for shader timing details.

// visual already has a feedback pass; keep requesting panel repaints.
visual.FeedbackIntervalMs = 1000 / 120; // Fixed 120-Hz history step.
const interval = visual.FeedbackIntervalMs;
visual.FeedbackIntervalMs = 0;          // History advances on each Draw.

Throws

Error —

If the value is not a finite number equal to 0 or within 1..1000, or a positive value is assigned without a feedback pass.

propertyreadonly

RendererType

js/vis.js:384
RendererType: number

Renderer family: built-in, JavaScript callback, or shader. See VisRendererType

propertyreadonly

SourceType

js/vis.js:377
SourceType: number

Numeric native source type used to create this visualization. See VisSourceType

method

Draw

js/vis.js:306
Draw(gr, x, y, width, height)

Draws this visualization within the specified rectangle. Call from on_paint using the current graphics context. The method does not change vis.UpdateIntervalMs or schedule another repaint. With shader feedback enabled, it also advances history when a step is due.
Built-in and JavaScript callback renderers support GDI and Direct2D; shader renderers created with CreateAsync require Direct2D.

Parameters

NameTypeDescription
grD2DGraphics|GdiGraphics

Current drawing context.

xnumber

Left edge in panel pixels.

ynumber

Top edge in panel pixels.

widthnumber

Destination width in pixels.

heightnumber

Destination height in pixels.

method

InjectFeedback

js/vis.js:321
InjectFeedback(bitmap)

Queues a D2DBitmap for the next actual feedback-history update of a shader visualization. The image is alpha-composited after the feedback and source passes and before history is saved; post passes run afterwards. The injection is one-shot and does not force a repaint or an early history update.

The bitmap is copied on the GPU when this method is called and may then be modified or released. If several injections are queued before the next history update, only the latest is retained. The bitmap must use the same Direct2D device as the visualization and is scaled to the history area. Maximum size: 4096 px per side and 4194304 pixels total. A graphics-device reset can discard a pending injection. Available only when the shader visualization has a feedback pass.

Example:

// 'visual' is a shader visualization created with a feedback pass.
const image = d2d.CreateImage(512, 128);
const g = image.GetGraphics();
try {
    g.DrawString('Next track', d2d.Font('Segoe UI', 28),
        0xffffffff, 10, 20, 492, 70);
} finally {
    image.ReleaseGraphics(g);
}
visual.InjectFeedback(image); // One next history step, not every Draw().

Parameters

NameTypeDescription
bitmapD2DBitmap

Direct2D bitmap with the image to add to history, normally on a transparent background.

Returns

void

Throws

Error —

If feedback is absent, the bitmap is invalid, exceeds the feedback limits or uses an incompatible Direct2D device.

Example source