Exemplo n.º 1
0
static void gottlieb1_sh_w(device_t *riot, UINT8 data)
{
	device_t *samples = riot->machine().device("samples");
	int pa7 = (data & 0x0f) != 0xf;
	int pa0_5 = ~data & 0x3f;

	/* snoop the data looking for commands that need samples */
	if (pa7 && samples != NULL)
		trigger_sample(samples, pa0_5);

	/* write the command data to the low 6 bits, and the trigger to the upper bit */
	riot6532_porta_in_set(riot, pa0_5 | (pa7 << 7), 0xbf);
}
Exemplo n.º 2
0
static void run(LV2_Handle instance, uint32_t n_samples) {
  int i,kitInt,baseNote,ignno;
  DrMr* drmr = (DrMr*)instance;

  kitInt = (int)floorf(*(drmr->kitReq));
  baseNote = (int)floorf(*(drmr->baseNote));
  ignno = (int)floorf(*(drmr->ignore_note_off));

  if (kitInt != drmr->curKit) // requested a new kit
    pthread_cond_signal(&drmr->load_cond);

  LV2_Event_Iterator eit;
  if (drmr->midi_port && lv2_event_begin(&eit,drmr->midi_port)) { // if we have any events
    LV2_Event *cur_ev;
    uint8_t nn;
    uint8_t* data;
    while (lv2_event_is_valid(&eit)) {
      cur_ev = lv2_event_get(&eit,&data);
      if (cur_ev->type == drmr->uris.midi_event) {
	//int channel = *data & 15;
	switch ((*data) >> 4) {
	case 8:
	  if (!ignno) {
	    nn = data[1];
	    nn-=baseNote;
	    untrigger_sample(drmr,nn);
	  }
	  break;
	case 9: {
	  nn = data[1];
	  nn-=baseNote;
	  trigger_sample(drmr,nn,data);
	  break;
	}
	default:
	  printf("Unhandeled status: %i\n",(*data)>>4);
	}
      } else printf("unrecognized event\n");
      lv2_event_increment(&eit);
    }