fill

awgrover/buffer1/fill

Fill the entire buffer with a value. Default fill is 0.
fill
@/fill
Fill the entire buffer with a value. Default fill is 0.
buffer1@/buffer1
valuebyte
Fills the buffer with this byte.
triggerpulse
fill
buffer1
value
trigger
buffer
done
donepulse
buffer@/buffer1
To use the node in your project you should have the awgrover/buffer1 library installed. Use the “File → Add Library” menu item in XOD IDE if you don’t have it yet. See Using libraries for more info.

C++ implementation

//-- void buffer1::fill(value)
struct State {
  // not used
  };

{{ GENERATED_CODE }}

void evaluate(Context ctx) {

  if ( !isInputDirty<input_value>(ctx) ) return;

  auto value = static_cast<char> (getValue<input_value>(ctx)); // char
  auto _object = getValue<input_buffer1>(ctx); // buffer1

  if ( ! _object->buffer ) {
    DEBUG_SERIAL.print(F("buffer1/"));DEBUG_SERIAL.print(F("fill")); DEBUG_SERIAL.print(F(" saw unallocated buffer1\n")); // exception
  }
  else {
    memset( _object->buffer, value, _object->len );
    emitValue<output_done>(ctx, 1); // pulse
  }

  emitValue<output_buffer>(ctx, _object); // convenience
}