void RegionChooser::on_note_off_event(int key, int velocity) {
    if (is_black_key(key)) {
        draw_region(key, key+1, black);
    } else {
        draw_region(key, key+1, key >= 21 && key <= 108 ? white : grey1);
    }
    m_VirtKeybOffVelocityLabel.set_text(ToString(velocity));
}
Example #2
0
void TreeNode::draw() const
{
  std::ofstream ofs(NODE_FILENAME);
  cairo_t *cr;
  cairo_surface_t *surface;
  CGAL::Bbox_2 bbox = region.bbox();

  assert(bbox.xmin() >= 0.0);
  assert(bbox.ymin() >= 0.0);

#ifdef PDF_OUTPUT
  surface = cairo_pdf_surface_create(IMG_FILENAME, bbox.xmax(), bbox.ymax());
#endif
#ifdef PNG_OUTPUT
  surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, bbox.xmax(), bbox.ymax());
#endif
  cr = cairo_create(surface);

  cairo_select_font_face(cr, "serif", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
  cairo_set_font_size(cr, 10.0);

  draw_region(cr);
  draw_text(cr);
  write_centroid(ofs);

  cairo_show_page(cr);
  cairo_destroy(cr);
#ifdef PNG_OUTPUT
  cairo_surface_write_to_png(surface, IMG_FILENAME);
#endif
  cairo_surface_destroy(surface);
}
Example #3
0
void handle_vbl(void){
	if (!app_data.debug) {
		handle_key();
		update_audio();
		update_voice();
	}
	draw_region();
	ext_IRQ();
	mstate = 1;
}
Example #4
0
void ext_write(Byte dat, ADDRESS adr){
	int i;

	if (!(p1 & 0x08)) {
		/* Handle VDC Write */		
		if (adr == 0xA0){
			if ((VDCwrite[0xA0] & 0x02) && !(dat & 0x02)) {
				y_latch = master_clk/22;
				x_latch = h_clk * 12;
				if (y_latch > 241) y_latch=0xFF;
			}
			if ((master_clk <= VBLCLK) && (VDCwrite[0xA0] != dat)) {
				draw_region();
			}
		} else if (adr == 0xA3){
			int l;
			l = snapline((int)((float)master_clk/22.0+0.5), dat, 1);
			for (i=l; i<MAXLINES; i++) ColorVector[i] = (dat & 0x7f) | (p1 & 0x80);
		} else if (adr == 0xAA) {
			for (i=master_clk/22; i<MAXLINES; i++) AudioVector[i]=dat;
		} else if ((adr >= 0x40) && (adr <= 0x7f) && ((adr & 2) == 0)) {
			/* simulate quad: all 4 sub quad position registers
			 * are mapped to the same internal register */
			adr = adr & 0x71;
			/* Another minor thing: the y register always returns
			 * bit 0 as 0 */
			if ((adr & 1) == 0) dat = dat & 0xfe;
			VDCwrite[adr] = VDCwrite[adr+4] = VDCwrite[adr+8] = VDCwrite[adr+12] = dat;
        }
        VDCwrite[adr]=dat;
	} else if (!(p1 & 0x10) && !(p1 & 0x40)) {
		adr = adr & 0xFF;
        		
        if (adr < 0x80) {
			/* Handle ext RAM Write */
			extRAM[adr] = dat;
		
        
        } else {
			if (app_data.bank == 4) {
				romlatch = (~dat) & 7;
				rom=rom_table[(p1 & 1)?0:romlatch];
			}
				
			/* Handle The Voice */
			if (!(dat & 0x20))
				reset_voice();
			else {
				if (adr == 0xE4)
					set_voice_bank(0);
				else if ((adr >= 0xE8) && (adr <= 0xEF))
					set_voice_bank(adr-0xE7);
				else if (((adr >= 0x80) && (adr <= 0xDF)) || ((adr >= 0xF0) && (adr <= 0xFF)))
					trigger_voice(adr);
			}
		}
	} else if (!(p1 & 0x20)) {
		/* Write to a Videopac+ register */
		vpp_write(dat,adr);
	}
}
void RegionChooser::on_note_on_event(int key, int velocity) {
    draw_region(key, key+1, activeKeyColor);
    m_VirtKeybVelocityLabel.set_text(ToString(velocity));
}
Example #6
0
/**
 * \brief Draws a subrectangle of this object, applying dynamic effects.
 * \param region The rectangle to draw in this object.
 * \param dst_surface The destination surface.
 */
void Drawable::draw_region(
    const Rectangle& region,
    Surface& dst_surface) {

  draw_region(region, dst_surface, Rectangle(0, 0));
}