Example #1
0
main(int argc, char** argv)
{
	printf("INIT ... \n");
	OpenSeq();

	pthread_t pThreadMidiOutA, pThreadMidiInA;
	int nIretOut, nIretIn;
	zRun = TRUE;
	nIretOut = pthread_create(&pThreadMidiOutA, NULL, WriteMidi,     (void*) t_seq);
	nIretIn  = pthread_create(&pThreadMidiInA,  NULL, ReadMidi,		 (void*) t_seq);

	signal(SIGINT,  exit_cli);
	signal(SIGTERM, exit_cli);

	while (zRun)
	{   
		printf("WHILE\n");
		sleep(100);
	}

	// Attesa del termine dei thread
	void* pStatusOut;
	pthread_join(pThreadMidiOutA, &pStatusOut);
	void* pStatusIn;
	pthread_join(pThreadMidiInA, &pStatusIn);

	printf("\nFATTO!\n");
}
Example #2
0
int main( int argc, char *argv[])
{
        char            c;
        TSequencer      mySequencer;
        
	OpenSeq(&mySequencer, argv[1]);
	    
	printf ( "\nmsMidiPlayer <midifile> \n\n");
	printf ( "msMidiPlayer plays a MIDIfile\n\n");
	printf ( "Use p or P to start playing\n");
	printf ( "Use s or S to stop playing\n");
	printf ( "Use l or L to start playing and loop\n");
	printf ( "Use q or Q to quit the application\n\n");
        
        while ((c = getchar()) && c != 'q' && c != 'Q')  switch (c) {
	
	        case 'P': case 'p': PlaySeq(&mySequencer); break;
                case 'S': case 's': StopSeq(&mySequencer); break;
		case 'L': case 'l': PlayLoop(&mySequencer); break;
        }
        
        CloseSeq(&mySequencer);
}