Piping Data

  • WayVes supports supplying in dynamic values for its Shaders . This is achieved by using Named Pipes .
  • For a variable to be eligible for dynamic overrides in this way, it should be declared as a uniform .
  • uniforms are always declared globally, so they should be declared outside any functions.

For Example, if you want to supply visualiserDirections as a dynamic input, then in the Shader Configuration File,

change :


#define visualiserDirections 0 

to


uniform int visualiserDirections = 0; 

You can then pass in data using external scripts to manipulate visualiserDirections

Pipe the data you want to send in the /tmp/WayVes/<ShaderClass> file. Data should be in the form:


variableName1 = variableValue1
variableName2 = variableValue2
.
.
.

You can also pass in colors in the same way. Just define an attribute with a suitable name as a uniform:


uniform vec4 dynamicColor = vec4(1, 0, 0, 1);             // vec4(1, 0, 0, 1) serves as the initial value here

Consume the value where you want in the Shader:


bar.color = dynamicColor; 

Then, you can write to the pipe /tmp/WayVes/linear (assuming the className is linear):


echo "dynamicColor = vec4(0, 0, 1, 1)" >> /tmp/WayVes/linear 

Bars' color will change from Red to Blue in this case.


Supported Data Types
PropertyDescription
boolBoolean
intInteger
floatFloat
doubleDouble
vec2Vector of 2 values
vec3Vector of 3 values
rgb8-bit RGB Representation
vec4Vector of 4 values
rgba8-bit RGBA Representation

Reloading Configurations

  • WayVes uses named instances to identify the group of Shaders that can be targeted for a reload.
  • Supply an instance name while launching WayVes by supplying the -i flag along with the name to identify the Instance with.
  • All Audio Object names within an instance must be unique. You can run different invocations of the same instance as long as their Audio Object names are all different.
  • To target a reload for an instance, you need to pipe in the name of the new YAML file from which to read the new Spec that will replace the Shaders for that instance.
  • This is useful if you dynamically want to change the number and types of Shaders based on any runtime attribute.
  • For an instance with name instanceName, the pipe is present at /tmp/WayVes/instance_instanceName
  • For example, if you want to target the instance desktop and reload its contents with the Shaders specification defined in a file newShaderSpec.yaml , then:

echo "reload = newShaderSpec" >> /tmp/WayVes/instance_desktop