barelymusician/engine/engine_test.cpp
// Returns test instrument definition that produces constant output that is set.
Returns test instrument definition that produces constant output that is set.
Returns test instrument definition that produces constant output that is set .
Instrument::Definition GetTestInstrumentDefinition() {
  static const std::vector<Parameter::Definition> parameter_definitions = {
      Parameter::Definition{0.0, -10.0, 10.0},
  };
  return Instrument::Definition(
      [](void** state, int ) {
        *state = reinterpret_cast<void*>(new double{0.0});
      },
      [](void** state) { delete static_cast<double*>(*state); },
      [](void** state, double* output, int num_output_channels,
         int num_output_frames) {
        std::fill_n(output, num_output_channels * num_output_frames,
                    *reinterpret_cast<double*>(*state));
      },
      [](void** , const void* , int ) {},
      [](void** state, double ) {
        *reinterpret_cast<double*>(*state) = 0.0;
      },
      [](void** state, double pitch, double intensity) {
        *reinterpret_cast<double*>(*state) = pitch * intensity;
      },
      [](void** state, int index, double value, double ) {
        *reinterpret_cast<double*>(*state) =
            static_cast<double>(index + 1) * value;
      },
      parameter_definitions);
}
Instrument :: Definition GetTestInstrumentDefinition ( ) { static const std :: vector < Parameter :: Definition > parameter_definitions = { Parameter :: Definition { 0.0 , -10.0 , 10.0 } , } ; return Instrument :: Definition ( [ ] ( void * * state , int ) { * state = reinterpret_cast < void * > ( new double { 0.0 } ) ; } , [ ] ( void * * state ) { delete static_cast < double * > ( * state ) ; } , [ ] ( void * * state , double * output , int num_output_channels , int num_output_frames ) { std :: fill_n ( output , num_output_channels * num_output_frames , * reinterpret_cast < double * > ( * state ) ) ; } , [ ] ( void * * , const void * , int ) { } , [ ] ( void * * state , double ) { * reinterpret_cast < double * > ( * state ) = 0.0 ; } , [ ] ( void * * state , double pitch , double intensity ) { * reinterpret_cast < double * > ( * state ) = pitch * intensity ; } , [ ] ( void * * state , int index , double value , double ) { * reinterpret_cast < double * > ( * state ) = static_cast < double > ( index + 1 ) * value ; } , parameter_definitions ) ; }
Returns test instrument definition that produces constant output that is set.
Returns test instrument definition that produces constant output that is set .
/*frame_rate*/ /*state*/ /*data*/ /*size*/ /*pitch*/ /*slope*/