Logo Search packages:      
Sourcecode: aubio version File versions  Download package

sint_t aubio_midi_send_event ( aubio_midi_player_t player,
aubio_midi_event_t *  event 
)

aubio_midi_send_event

This is a utility function that doesn't really belong to any class or structure. It is called by aubio_midi_track and aubio_midi_device.

Note:
This could be moved to a callback function defined in the main programs

Definition at line 418 of file midi_player.c.

References _aubio_midi_player_t::usec_passed.

{
  /* current time in seconds */
  //smpl_t print_time = player->msec_passed * 1e-3;
  smpl_t print_time = player->usec_passed * 1e-6;
  switch (event->type) {
    case NOTE_ON:
      AUBIO_MSG("Time=%f, chan=%d, pitch=%d vol=%d \n", 
          print_time, event->channel, event->param1, event->param2);
      /*if (aubio_synth_noteon(synth, event->channel, event->param1, event->param2) != AUBIO_OK) {
        return AUBIO_FAIL;
      }*/
      break;
    case NOTE_OFF:
      AUBIO_MSG("Time=%f, chan=%d, pitch=%d, vol=0\n",
          print_time, event->channel, event->param1);
      /*if (aubio_synth_noteoff(synth, event->channel, event->param1) != AUBIO_OK) {
        return AUBIO_FAIL;
      }*/
      break;
    case CONTROL_CHANGE:
      AUBIO_MSG("Time=%f Parameter, chan=%d c1=%d c2=%d\n",
          print_time, event->channel, event->param1, event->param2);
      /*if (aubio_synth_cc(synth, event->channel, event->param1, event->param2) != AUBIO_OK) {
        return AUBIO_FAIL;
      }*/
      break;
    case MIDI_SET_TEMPO:
      if (player != NULL) {
        if (aubio_midi_player_set_midi_tempo(player, event->param1) != AUBIO_OK) {
          return AUBIO_FAIL;
        }
      }
      break;
    case PROGRAM_CHANGE:
      AUBIO_MSG("Time=%f Program, chan=%d program=%d\n",
          print_time, event->channel, event->param1);
      /*if (aubio_synth_program_change(synth, event->channel, event->param1) != AUBIO_OK) {
        return AUBIO_FAIL;
      }*/
      break;
    case PITCH_BEND:
      AUBIO_MSG("Time=%f Pitchbend, chan=%d msb=%d lsb=%d \n", 
          print_time, event->channel, event->param1, event->param2);
      /*if (aubio_synth_pitch_bend(synth, event->channel, event->param1) != AUBIO_OK) {
        return AUBIO_FAIL;
      }
      break;*/
    default:
      break;
  }
  return AUBIO_OK;
}


Generated by  Doxygen 1.6.0   Back to index