barelymusician/engine/instrument_test.cpp
// Returns test instrument definition that produces constant output per note.
Returns test instrument definition that produces constant output per note.
Returns test instrument definition that produces constant output per note .
Instrument::Definition GetTestDefinition() {
  static const std::vector<Parameter::Definition> parameter_definitions = {
      Parameter::Definition{15.0, 10.0, 20.0},
  };
  return Instrument::Definition(
      [](void** state, int ) {
        *state = static_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 GetTestDefinition ( ) { static const std :: vector < Parameter :: Definition > parameter_definitions = { Parameter :: Definition { 15.0 , 10.0 , 20.0 } , } ; return Instrument :: Definition ( [ ] ( void * * state , int ) { * state = static_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 per note.
Returns test instrument definition that produces constant output per note .
/*frame_rate*/ /*state*/ /*data*/ /*size*/ /*pitch*/ /*slope*/