コード例 #1
0
ファイル: pnmtorle.c プロジェクト: jhbsz/DIR-850L_A1
/*-----------------------------------------------------------------------------
 *                                        Read the pnm image file header.
 */
static void
read_pnm_header()
{
    pnm_readpnminit(fp, &width, &height, &maxval, &format);
    switch (format) {
    case PBM_FORMAT:
        VPRINTF(stderr, "Image type: plain pbm format\n");
        break;
    case RPBM_FORMAT:
        VPRINTF(stderr, "Image type: raw pbm format\n");
        break;
    case PGM_FORMAT:
        VPRINTF(stderr, "Image type: plain pgm format\n");
        break;
    case RPGM_FORMAT:
        VPRINTF(stderr, "Image type: raw pgm format\n");
        break;
    case PPM_FORMAT:
        VPRINTF(stderr, "Image type: plain ppm format\n");
        break;
    case RPPM_FORMAT:
        VPRINTF(stderr, "Image type: raw ppm format\n");
        break;
    }
    VPRINTF(stderr, "Full image: %dx%d\n", width, height);
    VPRINTF(stderr, "Maxval:     %d\n", maxval);
    if (do_alpha)
        VPRINTF(stderr, "Computing alpha channel...\n");
}
コード例 #2
0
ファイル: sound.c プロジェクト: broftkd/historic-mame
void sound_init(running_machine *machine)
{
	attotime update_frequency = SOUND_UPDATE_FREQUENCY;
	const char *filename;

	/* handle -nosound */
	nosound_mode = !options_get_bool(mame_options(), OPTION_SOUND);
	if (nosound_mode)
		Machine->sample_rate = 11025;

	/* count the speakers */
	for (totalspeakers = 0; Machine->drv->speaker[totalspeakers].tag; totalspeakers++) ;
	VPRINTF(("total speakers = %d\n", totalspeakers));

	/* allocate memory for mix buffers */
	leftmix = auto_malloc(Machine->sample_rate * sizeof(*leftmix));
	rightmix = auto_malloc(Machine->sample_rate * sizeof(*rightmix));
	finalmix = auto_malloc(Machine->sample_rate * sizeof(*finalmix));

	/* allocate a global timer for sound timing */
	sound_update_timer = timer_alloc(sound_update, NULL);
	timer_adjust(sound_update_timer, update_frequency, 0, update_frequency);

	/* initialize the streams engine */
	VPRINTF(("streams_init\n"));
	streams_init(machine, update_frequency.attoseconds);

	/* now start up the sound chips and tag their streams */
	VPRINTF(("start_sound_chips\n"));
	start_sound_chips();

	/* then create all the speakers */
	VPRINTF(("start_speakers\n"));
	start_speakers();

	/* finally, do all the routing */
	VPRINTF(("route_sound\n"));
	route_sound();

	/* open the output WAV file if specified */
	filename = options_get_string(mame_options(), OPTION_WAVWRITE);
	if (filename[0] != 0)
		wavfile = wav_open(filename, machine->sample_rate, 2);

	/* enable sound by default */
	global_sound_enabled = TRUE;
	sound_muted = FALSE;
	sound_set_attenuation(options_get_int(mame_options(), OPTION_VOLUME));

	/* register callbacks */
	config_register("mixer", sound_load, sound_save);
	add_pause_callback(machine, sound_pause);
	add_reset_callback(machine, sound_reset);
	add_exit_callback(machine, sound_exit);
}
コード例 #3
0
ファイル: compute.c プロジェクト: claf/MJPEG
int idct_process (Channel * c[2]) {
#ifdef DEADLOCK
  printf("Thread compute 0x%.8x has been created\n", (unsigned int)pthread_self());
#endif

	uint8_t * Idct_YCbCr;
	int32_t * block_YCbCr;
	uint32_t flit_size = 0;

	channelRead (c[0], (uint8_t *) & flit_size, sizeof (uint32_t));
	VPRINTF("Flit size = %lu\r\n", flit_size);

	Idct_YCbCr = (uint8_t *) malloc (flit_size * 64 * sizeof (uint8_t));
	if (Idct_YCbCr == NULL) printf ("%s,%d: malloc failed\n", __FILE__, __LINE__);

	block_YCbCr = (int32_t *) malloc (flit_size * 64 * sizeof (int32_t));
	if (block_YCbCr == NULL) printf ("%s,%d: malloc failed\n", __FILE__, __LINE__);

	while (1) {
		channelRead (c[0], (unsigned char *) block_YCbCr, flit_size * 64 * sizeof (int32_t));

		for (uint32_t i = 0; i < flit_size; i++) IDCT(& block_YCbCr[i * 64], & Idct_YCbCr[i * 64]);

		channelWrite (c[1], (unsigned char *) Idct_YCbCr, flit_size * 64 * sizeof (uint8_t));
	}

	return 0;
}
コード例 #4
0
ファイル: xly_dump.c プロジェクト: rfhh/lily-contribs
static void
key_set(symbol_p s, int code, voice_p voice)
{
    if (code == KEY_RESET) {
        if (voice->key_current != KEY_RESET) {
            voice->key_previous_current = voice->key_current;
            voice->key_current = KEY_RESET;
        }
        return;
    }

    if (code < 0) {
        assert(voice->key_current > -code);
        assert(voice->key_current < 8 || -code >= 8);
        assert(voice->key_current >= 8 || -code < 8);
        voice->key_current += code;
    } else {
        voice->key_current = code;
    }

    if (voice->key_current != voice->key_previous_current) {
        if (voice->key_previous_current == KEY_RESET) {
            voice->key_previous_current = voice->key_current;
        }
        last_dumped_symbol = s;
        fprintf(lily_out, " \\key %s \\major",
                key_sign_name(voice->key_current));
        newline();
    }

    VPRINTF("Dump this key; key_current := %d\n", voice->key_current);
}
コード例 #5
0
ファイル: LogicalPlacement.c プロジェクト: rfhh/lily-contribs
static RIFFIOSuccess
cbLogicalPlacement(NIFFIOTagContext *pctxTag, niffLogicalPlacement *p)
{
	extern void debugMeAt(mpq_t t);
	debugMeAt(t_current);

    if (cbTagStart(pctxTag, p, cbLogicalPlacement)) {
        assert(pctxTag != 0);
        assert(pctxTag->pnf != 0);
        assert(pctxTag->pchunkParent != 0);

        if (symbol_current != NULL && symbol_current->type == SYM_STEM &&
            p->vertical != 0) {
            symbol_current->symbol.stem.flags |= FLAG_STEM_EXPLICIT;
            if (p->vertical == 1) {
                symbol_current->symbol.stem.flags |= FLAG_STEM_UP;
            }
        } else {
            VPRINTF(" = (%d,%d) (proximity %d)", p->horizontal, p->vertical, p->proximity);
        }
    }
    cbTagEnd(pctxTag);

    return RIFFIO_OK;
}
コード例 #6
0
ファイル: z80ctc.c プロジェクト: CJBass/mame2013-libretro
void z80ctc_device::ctc_channel::trigger(UINT8 data)
{
	// normalize data
	data = data ? 1 : 0;

	// see if the trigger value has changed
	if (data != m_extclk)
	{
		m_extclk = data;

		// see if this is the active edge of the trigger
		if (((m_mode & EDGE) == EDGE_RISING && data) || ((m_mode & EDGE) == EDGE_FALLING && !data))
		{
			// if we're waiting for a trigger, start the timer
			if ((m_mode & WAITING_FOR_TRIG) && (m_mode & MODE) == MODE_TIMER)
			{
				attotime curperiod = period();
				VPRINTF(("CTC period %s\n", curperiod.as_string()));
				m_timer->adjust(curperiod, m_index, curperiod);
			}

			// we're no longer waiting
			m_mode &= ~WAITING_FOR_TRIG;

			// if we're clocking externally, decrement the count
			if ((m_mode & MODE) == MODE_COUNTER)
			{
				// if we hit zero, do the same thing as for a timer interrupt
				if (--m_down == 0)
					timer_callback();
			}
		}
	}
}
コード例 #7
0
ファイル: server.c プロジェクト: irays/test_repository
void
str_echo(int sockfd)
{
  int n;
  int  len;
  char *buf;
  
  while (1) {
    //COMPLETED THE MISSING AND IMPORTANT LINE HERE
      n = net_readn(sockfd, &len, sizeof(int));
    if (n != sizeof(int)) {
      fprintf(stderr, "%s: ERROR failed to read len: %d!=%d"
	      " ... closing connection\n", __func__, n, (int)sizeof(int));
      break;
    } 
    //WHAT DOES THE NEXT LINE DO?
    len = ntohl(len);
    if (len) {
      buf = (char *)malloc(len);
      n = net_readn(sockfd, buf, len);
      if ( n != len ) {
	fprintf(stderr, "%s: ERROR failed to read msg: %d!=%d"
		" .. closing connection\n" , __func__, n, len);
	break;
      }
      VPRINTF("got: %d '%s'\n", len, buf);
      net_writen(sockfd, buf, len);
      free(buf);
    }
  }
  close(sockfd);
  return;
}
コード例 #8
0
ファイル: threshtree.c プロジェクト: YggdrasiI/KinectGrid
void threshtree_find_blobs( Blobtree *blob,
		const unsigned char *data,
		const unsigned int w, const unsigned int h,
		const BlobtreeRect roi,
		const unsigned char thresh,
		ThreshtreeWorkspace *workspace )
{
	// Avoid hard crash for null data.
	if( data == NULL ){
		VPRINTF("Runtime error: Input data is NULL! threshtree_filter_blobs aborts.\n");
	}
	//clear old tree
	if( blob->tree != NULL){
		tree_destroy(&blob->tree);
		blob->tree = NULL;
	}
	if( blob->tree_data != NULL){
		free(blob->tree_data);
		blob->tree_data = NULL;
	}
	//get new blob tree structure.
#ifdef BLOB_SUBGRID_CHECK
	blob->tree = find_connection_components_subcheck(
			data, w, h, roi, thresh,
			blob->grid.width,
			&blob->tree_data,
			workspace );
#else
	blob->tree = find_connection_components_coarse(
			data, w, h, roi, thresh,
			blob->grid.width, blob->grid.height,
			&blob->tree_data,
			workspace );
#endif
}
コード例 #9
0
ファイル: threshtree.c プロジェクト: YggdrasiI/KinectGrid
bool threshtree_realloc_workspace(
		const unsigned int max_comp,
		ThreshtreeWorkspace **pworkspace
		){

	ThreshtreeWorkspace *r = *pworkspace;
	r->max_comp = max_comp;
	if(
			( r->comp_same = (unsigned int*) realloc(r->comp_same, max_comp*sizeof(unsigned int) ) ) == NULL ||
			( r->prob_parent = (unsigned int*) realloc(r->prob_parent, max_comp*sizeof(unsigned int) ) ) == NULL ||
#ifdef BLOB_COUNT_PIXEL
			( r->comp_size = (unsigned int*) realloc(r->comp_size, max_comp*sizeof(unsigned int) ) ) == NULL ||
#endif
#ifdef BLOB_DIMENSION
			( r->top_index = (unsigned int*) realloc(r->top_index, max_comp*sizeof(unsigned int) ) ) == NULL ||
			( r->left_index = (unsigned int*) realloc(r->left_index, max_comp*sizeof(unsigned int) ) ) == NULL ||
			( r->right_index = (unsigned int*) realloc(r->right_index, max_comp*sizeof(unsigned int) ) ) == NULL ||
			( r->bottom_index = (unsigned int*) realloc(r->bottom_index, max_comp*sizeof(unsigned int) ) ) == NULL ||
#endif
#ifdef BLOB_BARYCENTER_TYPE
			( r->pixel_sum_X = (BLOB_BARYCENTER_TYPE*) realloc(r->pixel_sum_X, max_comp*sizeof(BLOB_BARYCENTER_TYPE) ) ) == NULL ||
			( r->pixel_sum_Y = (BLOB_BARYCENTER_TYPE*) realloc(r->pixel_sum_Y, max_comp*sizeof(BLOB_BARYCENTER_TYPE) ) ) == NULL ||
#endif
			0 ){
		// realloc failed
		VPRINTF("Critical error: Reallocation of workspace failed!\n");
		threshtree_destroy_workspace( pworkspace );
		return false;
	}

	free(r->blob_id_filtered);//omit unnessecary reallocation and omit wrong/low size
	r->blob_id_filtered = NULL;//should be allocated later if needed.

	return true;
}
コード例 #10
0
ファイル: server.c プロジェクト: irays/test_repository
int
main(int argc, char **argv)
{
  int listenfd, port=0;
  long connfd;
  pthread_t tid;

  bzero(&globals, sizeof(globals));

  if (net_setup_listen_socket(&listenfd,&port)!=1) {
    fprintf(stderr, "net_setup_listen_socket FAILED!\n");
    exit(-1);
  }

  printf("listening on port=%d\n", port);

  if (net_listen(listenfd) < 0) {
    fprintf(stderr, "Error: server listen failed (%d)\n", errno);
    exit(-1);
  }

  for (;;) {
    connfd = net_accept(listenfd);
    if (connfd < 0) {
      fprintf(stderr, "Error: server accept failed (%d)\n", errno);
    } else {
      //EXPLAIN WHAT IS HAPPENING HERE IN YOUR LOG
      pthread_create(&tid, NULL, &doit, (void *)connfd);
    }
  }

  VPRINTF("Exiting\n");
}
コード例 #11
0
ファイル: xly_dump.c プロジェクト: rfhh/lily-contribs
static void
dump_notes(int do_beams)
{
    int         f;
    int         p;
    int         v;

    fprintf(stderr, "Now write parts...\n");
    for (p = 0; p < n_part; p++) {
        if (ONLY != -1 && p != ONLY) {
            fprintf(stderr, "Skip staff %d, do only staff %d\n", p, ONLY);
            continue;
        }
        fprintf(stderr, "      ........ part %d, ", p);
        for (f = 0; f < part[p].n_staff; f++) {
            fprintf(stderr, "staff %d, ", f);
            for (v = 0; v < part[p].staff[f].n_voice; v++) {
                fprintf(stderr, "voice %d ", v);
                VPRINTF("Now dump part %d staff %d voice %d", p, f, v);
                voice_reset();
                fprintf(lily_out, "%s = {", part_name(p, f, v));
                indup();
                dumpVoice(&part[p].staff[f].voice[v], do_beams);
                indown();
                fprintf(lily_out, "}");
                newline();
                newline();
            }
        }
        fprintf(stderr, "\n");
    }
}
コード例 #12
0
ファイル: depthtree.c プロジェクト: YggdrasiI/KinectGrid
void depthtree_find_blobs(Blobtree *blob, const unsigned char *data, const unsigned int w, const unsigned int h, const BlobtreeRect roi, const unsigned char *depth_map, DepthtreeWorkspace *workspace ){
	// Avoid hard crash for null data.
	if( data == NULL ){
		VPRINTF("Runtime error: Input data is NULL! threshtree_filter_blobs aborts.\n");
	}
	//clear old tree
	if( blob->tree != NULL){
		tree_destroy(&blob->tree);
		blob->tree = NULL;
	}
	if( blob->tree_data != NULL){
		free(blob->tree_data);
		blob->tree_data = NULL;
	}
	//get new blob tree structure.
	/*
		 if( blob->grid.height == 11 ){
		 blob->tree = find_depthtree11(data, w, h, roi, depth_map, 
		 workspace, &blob->tree_data);
		 }else{
		 blob->tree = find_depthtree(data, w, h, roi, depth_map, 
		 blob->grid.width,
		 workspace, &blob->tree_data);
		 }*/

	if( blob->grid.width == 1 ){
		blob->tree = find_depthtree(data, w, h, roi, depth_map, 1, workspace, &blob->tree_data);
	}else if( blob->grid.width == 2 ){
		blob->tree = find_depthtree(data, w, h, roi, depth_map, 2, workspace, &blob->tree_data);
	}else if( blob->grid.width == 3 ){
		blob->tree = find_depthtree(data, w, h, roi, depth_map, 3, workspace, &blob->tree_data);
	}else if( blob->grid.width == 4 ){
		blob->tree = find_depthtree(data, w, h, roi, depth_map, 4, workspace, &blob->tree_data);
		/*
			 }else if( blob->grid.width == 5 ){
			 blob->tree = find_depthtree(data, w, h, roi, depth_map, 5, workspace, &blob->tree_data);
			 }else if( blob->grid.width == 6 ){
			 blob->tree = find_depthtree(data, w, h, roi, depth_map, 6, workspace, &blob->tree_data);
			 }else if( blob->grid.width == 7 ){
			 blob->tree = find_depthtree(data, w, h, roi, depth_map, 7, workspace, &blob->tree_data);
			 }else if( blob->grid.width == 8 ){
			 blob->tree = find_depthtree(data, w, h, roi, depth_map, 8, workspace, &blob->tree_data);
			 }else if( blob->grid.width == 9 ){
			 blob->tree = find_depthtree(data, w, h, roi, depth_map, 9, workspace, &blob->tree_data);
			 }else if( blob->grid.width == 10 ){
			 blob->tree = find_depthtree(data, w, h, roi, depth_map, 10, workspace, &blob->tree_data);
			 }else if( blob->grid.width == 11 ){
			 blob->tree = find_depthtree(data, w, h, roi, depth_map, 11, workspace, &blob->tree_data);
			 */
	}else{
		blob->tree = find_depthtree(data, w, h, roi, depth_map, blob->grid.width, workspace, &blob->tree_data);
	}







}
コード例 #13
0
ファイル: streams.c プロジェクト: DarrenBranford/MAME4iOS
sound_stream *stream_create(device_t *device, int inputs, int outputs, int sample_rate, void *param, stream_update_func callback)
{
	running_machine *machine = device->machine;
	streams_private *strdata = machine->streams_data;
	int inputnum, outputnum;
	sound_stream *stream;
	char statetag[30];

	/* allocate memory */
	stream = auto_alloc_clear(device->machine, sound_stream);

	VPRINTF(("stream_create(%d, %d, %d) => %p\n", inputs, outputs, sample_rate, stream));

	/* fill in the data */
	stream->device = device;
	stream->index = strdata->stream_index++;
	stream->sample_rate = sample_rate;
	stream->inputs = inputs;
	stream->outputs = outputs;
	stream->callback = callback;
	stream->param = param;

	/* create a unique tag for saving */
	sprintf(statetag, "%d", stream->index);
	state_save_register_item(machine, "stream", statetag, 0, stream->sample_rate);

	/* allocate space for the inputs */
	if (inputs > 0)
	{
		stream->input = auto_alloc_array_clear(device->machine, stream_input, inputs);
		stream->input_array = auto_alloc_array_clear(device->machine, stream_sample_t *, inputs);
	}
コード例 #14
0
ファイル: Http.c プロジェクト: diogomonica/ralemTTPD
/* This function identifies the type of url requested, http://filename
   or /filename
*/
int parseUrl(httprequest *request, char *line) {
    int returnValue;
    if (!strncmp(line, "http", 4)) {

        VPRINTF("Full URL %s\n", line);
        if ((returnValue = parseFullUrl(request,line)) <0)
            return (-1);
    }
    if (!strncmp(line, "/", 1)) {

        VPRINTF("Simple URL %s\n", line);
        if ((returnValue = parseSimpleUrl(request,line)) <0)
            return (-1);
    }
    return 0;
}
コード例 #15
0
void
mq200_init_backlight(struct mq200_softc *sc, int inattach)
{
	int val = -1;

	if (sc->sc_lcd_inited&BACKLIGHT_INITED)
		return;

	if (config_hook_call(CONFIG_HOOK_GET,
	    CONFIG_HOOK_POWER_LCDLIGHT, &val) != -1) {
		/* we can get real light state */
		VPRINTF("init_backlight: real backlight=%d\n", val);
		if (val == 0)
			sc->sc_powerstate &= ~PWRSTAT_BACKLIGHT;
		else
			sc->sc_powerstate |= PWRSTAT_BACKLIGHT;
		sc->sc_lcd_inited |= BACKLIGHT_INITED;
	} else if (inattach) {
		/*
		   we cannot get real light state in attach time
		   because light device not yet attached.
		   we will retry in !inattach.
		   temporary assume light is on.
		*/
		sc->sc_powerstate |= PWRSTAT_BACKLIGHT;
	} else {
		/* we cannot get real light state, so work by myself state */
		sc->sc_lcd_inited |= BACKLIGHT_INITED;
	}
}
コード例 #16
0
ファイル: sndintrf.c プロジェクト: cdenix/ps3-mame-0125
int sndintrf_init_sound(int sndnum, sound_type sndtype, int clock, const void *config)
{
	sndintrf_data *info = &sound[sndnum];
	int index;

	/* fill in the type and interface */
	info->intf = sndintrf[sndtype];
	info->sndtype = sndtype;
	info->aliastype = sndtype_get_info_int(sndtype, SNDINFO_INT_ALIAS);
	if (info->aliastype == 0)
		info->aliastype = sndtype;
	info->clock = clock;

	/* find an empty slot in the matrix and add it */
	totalsnd++;
	for (index = 0; index < MAX_SOUND; index++)
		if (sound_matrix[info->aliastype][index] == 0)
		{
			sound_matrix[info->aliastype][index] = totalsnd;
			break;
		}
	info->index = index;

	/* start the chip, tagging all its streams */
	current_sound_start = &sound[sndnum];
	info->token = (*info->intf.start)(index, clock, config);
	current_sound_start = NULL;
	VPRINTF(("  token = %p\n", info->token));

	/* if that failed, die */
	if (!info->token)
		return 1;

	return 0;
}
コード例 #17
0
ファイル: xly_dump.c プロジェクト: rfhh/lily-contribs
static void
dumpSkip(mpq_t *t, const symbol_t *scan)
{
    static int          initialized = 0;
    static mpq_t        dt;
    static int          de;
    static int          nu;
    static mpz_t        zde;
    static mpz_t        znu;
    int rnd;

    if (! initialized) {
        mpq_init(dt);
        mpz_init(zde);
        mpz_init(znu);
        initialized = 1;
    }

    if (mpq_equal(*t, scan->start)) {
        return;
    }

    while (dump_tuplet_current != NO_ID) {
        /* stop */
        fprintf(lily_out, " }");
        tuplet_pop(&dump_tuplet_current);
    }

    if (mpq_cmp(*t, scan->start) > 0) {
        fprintf(stderr, "Uh oh -- start time ");
        mpq_out_str(stderr, 10, scan->start);
        fprintf(stderr, " is too low, should be ");
        mpq_out_str(stderr, 10, *t);
        fprintf(stderr, " -- is my voice analysis correct?\n");
        return;
    }
    mpq_sub(dt, scan->start, *t);
    mpq_get_num(znu, dt);
    mpq_get_den(zde, dt);
    nu = mpz_get_ui(znu);
    de = mpz_get_ui(zde);
    rnd = nu / de;
    if (rnd != 0) {
        fprintf(lily_out, " s1*%d", rnd);
        nu -= rnd * de;
    }
    if (! is_two_pow(de)) {
        fprintf(stderr, "Uh oh -- skip now already a tuplet %d/%d??\n", nu, de);
        fprintf(lily_out, " s1*%d/%d", nu, de);
    } else {
        if (nu != 0) {
            fprintf(lily_out, " s%d*%d", de, nu);
        }
    }
    last_dumped_symbol = &sym_any_skip;
    mpq_set(*t, scan->start);
    VPRINTF(" skip to t = ");
    VPRINT_MPQ(*t);
}
コード例 #18
0
ファイル: xly_dump.c プロジェクト: rfhh/lily-contribs
static void
dumpClef(symbol_p s)
{
    clef_p      c = &s->symbol.clef;

    if (clef_equals(clef_current, c)) {
        return;
    }

    clef_current = c;

    VPRINTF("At t = ");
    VPRINT_MPQ(s->start);
    VPRINTF(" this clef\n");
    fprintf(lily_out, " %s", clef_name(clef_current));
    newline();
}
コード例 #19
0
ファイル: xly_dump.c プロジェクト: rfhh/lily-contribs
static void
dumpArticulation(symbol_p s)
{
    articulation_p      a = &s->symbol.articulation;

    VPRINTF("OK, an articulation\n");

    switch (a->shape) {
    case artStrongAccent:
        fprintf(lily_out, "-\\marcato");
        break;
    case artMediumAccent:
        fprintf(lily_out, "-\\accent");
        break;
    case artLightAccent:
        fprintf(lily_out, "-\\tenuto");
        break;
    case artStaccato:
        fprintf(lily_out, "-.");
        break;
    case artDownBow:
        fprintf(lily_out, "-\\downbow");
        break;
    case artUpBow:
        fprintf(lily_out, "-\\upbow");
        break;
    case artHarmonic:
        fprintf(lily_out, "-\\flageolet");
        break;
    case artFermata:
        fprintf(lily_out, "-\\fermata");
        break;
    case artArsisSign:
        fprintf(lily_out, "-\\lheel");
        break;
    case artThesisSign:
        fprintf(lily_out, "-\\rheel");
        break;
    case artPlusSign:
        fprintf(lily_out, "-\\stopped");
        break;
    case artVerticalFilledWedge:
        fprintf(lily_out, "-\\staccatissimo");
        break;
    case artDoubleTonguing:
        fprintf(stderr, "Double tounguing articulation not implemented\n");
        break;
    case artTripleTonguing:
        fprintf(stderr, "Triple tounguing articulation not implemented\n");
        break;
    case artSnapPizzicato:
        fprintf(lily_out, "-\\thumb");
        break;

    default:
        fprintf(stderr, "Undefined articulation %d\n", a->shape);
    }
}
コード例 #20
0
ファイル: xly_dump.c プロジェクト: rfhh/lily-contribs
static void
dumpTimeSig(mpq_t *now, symbol_p s)
{
    symbol_p t;
    symbol_p scan;
    symbol_p prev = NULL;

    if (mpq_equal(time_sig_current->duration, s->symbol.time_signature.duration)) {
        return;
    }

    dumpSkip(now, s);

    t = symbol_clone(s);

    scan = time_line;
    while (scan != NULL) {
        prev = scan;
        scan = scan->next;
    }
    if (prev == NULL) {
        time_line = t;
    } else {
        prev->next = t;
    }
    t->next = NULL;

    time_sig_current->top = t->symbol.time_signature.top;
    time_sig_current->bottom = t->symbol.time_signature.bottom;
    mpq_set(time_sig_current->duration, t->symbol.time_signature.duration);

    VPRINTF("At t = ");
    VPRINT_MPQ(s->start);
    VPRINTF(" this time sig: %d/%d\n",
             time_sig_current->top, time_sig_current->bottom);

    if (time_sig_current->top == -1) {
        fprintf(lily_out, " \\override Staff.TimeSignature.style = #'C \\time 4/4 ");
    } else if (time_sig_current->top == -2) {
        fprintf(lily_out, " \\override Staff.TimeSignature.style = #'C \\time 2/2 ");
    } else {
        fprintf(lily_out, " \\time %d/%d ", time_sig_current->top, time_sig_current->bottom);
    }
    newline();
}
コード例 #21
0
ファイル: sound.c プロジェクト: DarrenBranford/MAME4iOS
void sound_init(running_machine *machine)
{
	sound_private *global;
	const char *filename;

	machine->sound_data = global = auto_alloc_clear(machine, sound_private);

	/* handle -nosound */
	global->nosound_mode = !options_get_bool(machine->options(), OPTION_SOUND);
	if (global->nosound_mode)
		machine->sample_rate = 11025;

	/* count the speakers */
	VPRINTF(("total speakers = %d\n", speaker_output_count(machine->config)));

	/* allocate memory for mix buffers */
	global->leftmix = auto_alloc_array(machine, INT32, machine->sample_rate);
	global->rightmix = auto_alloc_array(machine, INT32, machine->sample_rate);
	global->finalmix = auto_alloc_array(machine, INT16, machine->sample_rate);

	/* allocate a global timer for sound timing */
	global->update_timer = timer_alloc(machine, sound_update, NULL);
	timer_adjust_periodic(global->update_timer, STREAMS_UPDATE_ATTOTIME, 0, STREAMS_UPDATE_ATTOTIME);

	/* finally, do all the routing */
	VPRINTF(("route_sound\n"));
	route_sound(machine);

	/* open the output WAV file if specified */
	filename = options_get_string(machine->options(), OPTION_WAVWRITE);
	if (filename[0] != 0)
		global->wavfile = wav_open(filename, machine->sample_rate, 2);

	/* enable sound by default */
	global->enabled = TRUE;
	global->muted = FALSE;
	sound_set_attenuation(machine, options_get_int(machine->options(), OPTION_VOLUME));

	/* register callbacks */
	config_register(machine, "mixer", sound_load, sound_save);
	machine->add_notifier(MACHINE_NOTIFY_PAUSE, sound_pause);
	machine->add_notifier(MACHINE_NOTIFY_RESUME, sound_resume);
	machine->add_notifier(MACHINE_NOTIFY_RESET, sound_reset);
	machine->add_notifier(MACHINE_NOTIFY_EXIT, sound_exit);
}
コード例 #22
0
ファイル: Rest.c プロジェクト: rfhh/lily-contribs
static RIFFIOSuccess
cbRestEnd(NIFFIOChunkContext *pctxChunk, niffRest *p)
{
    VPRINTF(" (tuplet ID = %d|%d)",
            symbol_current->symbol.note.stem->tuplet,
            symbol_current->symbol.note.tuplet);

    return cbChunkEnd(pctxChunk);
}
コード例 #23
0
ファイル: ioapi_buf.c プロジェクト: Manromen/QMinizip
void print_buf_internal(voidpf opaque, voidpf stream, char *format, ...)
{
    ourstream_t *streamio = (ourstream_t *)stream;
    va_list arglist;
    PRINTF("Buf stream %p - ", streamio);
    va_start(arglist, format);
    VPRINTF(format, arglist);
    va_end(arglist);
}
コード例 #24
0
ファイル: pciconf.c プロジェクト: xmyth/pmon-osolution
void
_pci_bdfprintf (int bus, int device, int function, const char *fmt, ...)
{
    va_list arg;

    print_bdf (bus, device, function);
    va_start(arg, fmt);
    VPRINTF (fmt, arg);
    va_end(arg);
}
コード例 #25
0
ファイル: xly_dump.c プロジェクト: rfhh/lily-contribs
static void
dump_noteval(note_p note, voice_p voice)
{
    /* Find out the pitch */
    int val = note->value + clef_current->offset;
    int octave;
    int key;
    int accidental;

    if (val < 0) {
        octave = - ((- val + OCTAVE_DIATON - 1) / OCTAVE_DIATON);
        val = (val - octave * OCTAVE_DIATON) % OCTAVE_DIATON;
    } else {
        octave = val / OCTAVE_DIATON;
        val = val % OCTAVE_DIATON;
    }

    accidental = measure_accidental[note->value];
    if (note->tie_end != NO_ID) {
        tie_p tie = &ties[note->tie_end];
        accidental = tie->notes[0]->accidental;
    }

    key = defaultKey(val, voice);
    VPRINTF(" dump note, keyed value = %d, accidental %d, measure accidental %d, key ofdset %d\n",
            val, note->accidental, measure_accidental[note->value],
            defaultKey(val, voice));
    fprintf(lily_out, " %s", keyName(val));
    if (note->accidental != 0) {
        dumpAccidental(note->accidental);
        measure_accidental[note->value] = note->accidental;
    } else if (accidental != 0) {
        /* Require the actual accidental for cross-bar ties */
        note->accidental = accidental;
        dumpAccidental(accidental);
    } else {
        switch (key) {
        case 0: break;
        case 1: fprintf(lily_out, "is"); break;
        case 2: fprintf(lily_out, "isis"); break;
        case -1: fprintf(lily_out, "es"); break;
        case -2: fprintf(lily_out, "eses"); break;
        }
    }

    while (octave > 0) {
        fprintf(lily_out, "'");
        octave--;
    }
    while (octave < 0) {
        fprintf(lily_out, ",");
        octave++;
    }
}
コード例 #26
0
ファイル: gtm_stdio.c プロジェクト: CeperaCPP/fis-gtm
/* Wrapper for printf() */
int gtm_printf(const char *format, ...)
{
	va_list		printargs;
	int		retval;

	va_start(printargs, format);
	VPRINTF(format, printargs, retval);
	retval = (-1 == retval) ? errno : 0;
	va_end(printargs);
	return retval;
}
コード例 #27
0
void
mq200_init_brightness(struct mq200_softc *sc, int inattach)
{
	int val = -1;

	if (sc->sc_lcd_inited&BRIGHTNESS_INITED)
		return;

	VPRINTF("init_brightness\n");
	if (config_hook_call(CONFIG_HOOK_GET,
	    CONFIG_HOOK_BRIGHTNESS_MAX, &val) != -1) {
		/* we can get real brightness max */
		VPRINTF("init_brightness: real brightness max=%d\n", val);
		sc->sc_max_brightness = val;
		val = -1;
		if (config_hook_call(CONFIG_HOOK_GET,
		    CONFIG_HOOK_BRIGHTNESS, &val) != -1) {
			/* we can get real brightness */
			VPRINTF("init_brightness: real brightness=%d\n", val);
			sc->sc_brightness_save = sc->sc_brightness = val;
		} else {
			sc->sc_brightness_save =
			    sc->sc_brightness = sc->sc_max_brightness;
		}
		sc->sc_lcd_inited |= BRIGHTNESS_INITED;
	} else if (inattach) {
		/*
		   we cannot get real brightness in attach time
		   because brightness device not yet attached.
		   we will retry in !inattach.
		*/
		sc->sc_max_brightness = -1;
		sc->sc_brightness = -1;
		sc->sc_brightness_save = -1;
	} else {
		/* we cannot get real brightness */
		sc->sc_lcd_inited |= BRIGHTNESS_INITED;
	}

	return;
}
コード例 #28
0
ファイル: z80ctc.cpp プロジェクト: Robbbert/store1
void z80ctc_device::device_reset()
{
	// reset each channel
	m_channel[0].reset();
	m_channel[1].reset();
	m_channel[2].reset();
	m_channel[3].reset();

	// check for interrupts
	interrupt_check();
	VPRINTF(("CTC Reset\n"));
}
コード例 #29
0
ファイル: z80sio.c プロジェクト: broftkd/mess-svn
UINT8 z80sio_device::sio_channel::data_read()
{
	// update the status register
	m_status[0] &= ~SIO_RR0_RX_CHAR_AVAILABLE;

	// reset the receive interrupt
	clear_interrupt(INT_RECEIVE);

	VPRINTF(("%s:sio_data_r(%c) = %02X\n", m_device->machine().describe_context(), 'A' + m_index, m_inbuf));

	return m_inbuf;
}
コード例 #30
0
static v7fs_daddr_t
make_freeblocklist(struct v7fs_self *fs, v7fs_daddr_t listblk, uint8_t *buf)
{
	uint32_t (*val32)(uint32_t) = fs->val.conv32;
	uint16_t (*val16)(uint16_t) = fs->val.conv16;
	struct v7fs_freeblock *fb = (struct v7fs_freeblock *)buf;
	int i, j, k;

	memset(buf, 0, V7FS_BSIZE);

	for (i = V7FS_MAX_FREEBLOCK - 1, j = listblk + 1, k = 0; i >= 0;
	    i--, j++, k++) {
		progress(0);
		if (j == (int32_t)fs->superblock.volume_size)
		{
			VPRINTF(4, "\nlast freeblock #%d\n",
			    (*val32)(fb->freeblock[i + 1]));

			memmove(fb->freeblock + 1, fb->freeblock + i + 1, k *
			    sizeof(v7fs_daddr_t));
			fb->freeblock[0] = 0; /* Terminate link; */
			fb->nfreeblock = (*val16)(k + 1);
			VPRINTF(4, "last freeblock contains #%d\n",
			    (*val16)(fb->nfreeblock));
			fs->io.write(fs->io.cookie, buf, listblk);
			return 0;
		}
		fb->freeblock[i] = (*val32)(j);
	}
	fb->nfreeblock = (*val16)(k);

	if (!fs->io.write(fs->io.cookie, buf, listblk)) {
		errno = EIO;
		warn("blk=%ld", (long)listblk);
		return 0;
	}

	/* Return next link block */
	return (*val32)(fb->freeblock[0]);
}