Example #1
0
void App::config_open(){
    system("config.txt");
    load_config();
    midi_close(midi_device);
    midi_device = midi_init();
    echo("Wczytano nowe ustawienia.");
}
Example #2
0
/*
 * The main function - the program starts executing here
 */
int main(void)
{
	/* Declare integer variables for specifying a note */
	int pitch, channel, velocity;

    /* initialize the midi functions */
    midi_start();

	/* Set the pitch variable to 60, which is middle C */
	pitch = 60;

	/* We will play the note on MIDI channel 1 */
	channel = 1;

	/* The note will have a medium velocity (volume) */
	velocity = 64;

	/* Start playing a middle C at moderate volume */
	midi_note(pitch, channel, velocity);

	/* Wait, for 1 second, so that we can hear the note playing */
	pause(1000);

	/* Turn the note off by setting its volume to 0 */
	midi_note(pitch, channel, 0);

    /* close down all midi functions */
    midi_close();

	return 0;
}
Example #3
0
int main(void)
{
	/* Declare integer variables for specifying a note */
	int pitch, channel, velocity, offset;

	/* Set the pitch variable to 60, which is middle C */
	pitch = 60;

	/* We will play the note on MIDI channel 1 */
	channel = 1;

	/* The note will have a medium velocity (volume) */
	velocity = 64;

    /* initialize the midi functions */
    midi_start();

	/* Play an octave's worth of chromatic scale */
	for (offset = 0; offset <= 12; offset++)
	{
		/* Start playing a note */
		midi_note(pitch + offset, channel, velocity);

		/* Wait, so that we can hear the note playing */
		pause(400);

		/* Turn the note off */
		midi_note(pitch + offset, channel, 0);
	}

    /* close down all midi functions */
    midi_close();

	return 0;
}
Example #4
0
File: main.c Project: hoglet67/b-em
void main_close()
{
        debug_kill();

#ifdef WIN32
        timeEndPeriod(1);
#endif

        config_save();
        cmos_save(models[curmodel]);

        midi_close();
        mem_close();
        uef_close();
        csw_close();
        tube_6502_close();
        arm_close();
        x86_close();
        z80_close();
        w65816_close();
        n32016_close();
        disc_close(0);
        disc_close(1);
        scsi_close();
        ide_close();
        vdfs_close();
        ddnoise_close();
        tapenoise_close();

        al_close();
        video_close();
        log_close();
}
Example #5
0
void xapi_close_midi(void *d) {
#ifdef HAVE_MIDI
	midi_close();
	remote_printf(100,"midi close.");
#else
	remote_printf(499,"midi not available.");
#endif
}
Example #6
0
int main(int argc, char *argv[])
{
    struct midi m;
    struct pollfd pt[8];

    if (argc != 2) {
        fprintf(stderr, "usage: %s <device>\n", argv[0]);
        return -1;
    }

    if (midi_open(&m, argv[1]) == -1)
        return -1;

    for (;;) {
        ssize_t z;
        char buf[32];

        z = midi_pollfds(&m, pt, ARRAY_SIZE(pt));
        if (z == -1)
            return -1;

        fputs("poll...\n", stderr);

        if (poll(pt, z, -1) == -1) {
            perror("poll");
            return -1;
        }

        fputs("... return\n", stderr);

        for (;;) {
            size_t n;
            ssize_t z;

            z = midi_read(&m, buf, sizeof buf);
            if (z == -1)
                return -1;
            if (z == 0)
                break;

            for (n = 0; n < z; n++)
                printf(" %02hhx", buf[n]);

            z = midi_write(&m, buf, z);
            printf(" =%d", z);
            if (z == -1)
                return -1;
        }
        printf("\n");

        fflush(stdout);
    }

    midi_close(&m);
}
Example #7
0
void xapi_open_jack(void *d) {
#ifdef HAVE_MIDI
	midi_close();
#endif
#if defined (HAVE_LTCSMPTE) || defined (HAVE_LTC)
	close_ltcjack();
#endif
	open_jack();
	if (jack_client) 
		remote_printf(100,"connected to jack server.");
	else 
		remote_printf(405,"failed to connect to jack server");
}
Example #8
0
void closepc()
{
    atapi->exit();
//        ioctl_close();
    dumppic();
//        output=7;
//        setpitclock(clocks[0][0][0]);
//        while (1) runpc();
    savedisc(0);
    savedisc(1);
    dumpregs();
    closevideo();
    device_close_all();
    midi_close();
}
Example #9
0
void xapi_open_ltc(void *d) {
#if defined (HAVE_LTCSMPTE) || defined (HAVE_LTC)
#ifdef HAVE_MIDI
	midi_close();
#endif
	close_jack();
	open_ltcjack((char *) d); // TODO: autoconnect 
	if (ltcjack_connected())
		remote_printf(100,"opened LTC jack port.");
	else 
		remote_printf(405,"failed to connect to jack server");
#else
	remote_printf(499,"LTC-jack is not available.");
#endif
}
Example #10
0
void resetpchard()
{
    if (!modelchanged)
        device_close_all();
    else
        modelchanged = 0;
    device_init();

    midi_close();
    midi_init();

    timer_reset();
    sound_reset();
    mem_resize();

    if (pcfirsttime)
    {
        fdc_init();
        pcfirsttime = 0;
    }
    else
        fdc_hard_reset();

    model_init();
    video_init();
    speaker_init();

// #ifdef USE_NETWORKING
    vlan_reset();	//NETWORK
    network_card_init(network_card_current);
// #endif

    sound_card_init(sound_card_current);
    if (GUS)
        device_add(&gus_device);
    if (GAMEBLASTER)
        device_add(&cms_device);
    if (SSI2001)
        device_add(&ssi2001_device);
    if (voodoo_enabled)
        device_add(&voodoo_device);
    pc_reset();

    resetide();

    loadnvr();

//        cpuspeed2 = (AT)?2:1;
//        atfullspeed = 0;
//        setpitclock(models[model].cpu[cpu_manufacturer].cpus[cpu].rspeed);

    shadowbios = 0;
    ali1429_reset();

    keyboard_at_reset();

//        output=3;

#if __unix
    if (cdrom_drive == -1)
        cdrom_null_reset();
    else
#endif
        ioctl_reset();
}
Example #11
0
static int oscb_mididisconnect (const char *path, const char *types, lo_arg **argv, int argc, lo_message msg, void *user_data){
#ifdef HAVE_MIDI
  midi_close();
#endif
  return(0);
}
Example #12
0
void xapi_reopen_midi(void *d) {
#ifdef HAVE_MIDI
	midi_close();
	xapi_open_midi(midiid);
#endif
}
Example #13
0
void retro_deinit()
{
  closepc();

  midi_close();
}
Example #14
0
int main(int argc, char *argv[])
{
        int frames = 0;
        int c, d;
        allegro_init();
        allegro_video_init();
        install_timer();
        install_int_ex(timer_rout, BPS_TO_TIMER(100));
	install_int_ex(onesec, BPS_TO_TIMER(1));
	midi_init();
        
        initpc(argc, argv);

        d = romset;
        for (c = 0; c < ROM_MAX; c++)
        {
                romset = c;
                romspresent[c] = loadbios();
                pclog("romset %i - %i\n", c, romspresent[c]);
        }
        
        for (c = 0; c < ROM_MAX; c++)
        {
                if (romspresent[c])
                   break;
        }
        if (c == ROM_MAX)
        {
                printf("No ROMs present!\nYou must have at least one romset to use PCem.");
                return 0;
        }

        romset=d;
        c=loadbios();

        if (!c)
        {
                if (romset != -1)
			printf("Configured romset not available.\nDefaulting to available romset.");
                for (c = 0; c < ROM_MAX; c++)
                {
                        if (romspresent[c])
                        {
                                romset = c;
                                model = model_getmodel(romset);
                                saveconfig();
                                resetpchard();
                                break;
                        }
                }
        }

        for (c = 0; c < GFX_MAX; c++)
                gfx_present[c] = video_card_available(video_old_to_new(c));

        if (!video_card_available(video_old_to_new(gfxcard)))
        {
                if (gfxcard) printf("Configured video BIOS not available.\nDefaulting to available romset.");
                for (c = GFX_MAX-1; c >= 0; c--)
                {
                        if (gfx_present[c])
                        {
                                gfxcard = c;
                                saveconfig();
                                resetpchard();
                                break;
                        }
                }
        }

	resetpchard();

        ticks = 0;
        while (!quited)
        {
                if (ticks)
                {
                        ticks--;
                        runpc();
                        frames++;
                        if (frames >= 200 && nvr_dosave)
                        {
                                frames = 0;
                                nvr_dosave = 0;
                                savenvr();
                        }
                }
                else
                        rest(1);

		if (ticks > 10)
			ticks = 0;
                
		if ((mouse_b & 1) && !mousecapture)
			mousecapture = 1;

		if (((key[KEY_LCONTROL] || key[KEY_RCONTROL]) && key[KEY_END]) || (mouse_b & 4))
			mousecapture = 0;

                if ((key[KEY_LCONTROL] || key[KEY_RCONTROL]) && key[KEY_ALT] && key[KEY_PGDN])
                {
			int old_winsizex = winsizex, old_winsizey = winsizey;
			if (winsizex < 512 || winsizey < 350)
				updatewindowsize(512, 350);
                        gui_enter();
			if (old_winsizex < 512 || old_winsizey < 350)
				updatewindowsize(old_winsizex, old_winsizey);
                        ticks = 0;
                }
        }
        
        closepc();

	midi_close();

        return 0;
}