www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/06/18/23:46:38

From: langtons AT NOTTHISBIT DOT manawatu DOT gen DOT nz (Michael Langton)
Newsgroups: comp.os.msdos.djgpp
Subject: Help with Allegro's midi_out
Date: Fri, 19 Jun 1998 03:35:23 GMT
Organization: PlaNet (NZ) Manawatu, +64 6 357-9245, +64 6 367-9944
Lines: 35
Message-ID: <3589db9a.12704933@news.manawatu.gen.nz>
NNTP-Posting-Host: newshost.manawatu.gen.nz
Mime-Version: 1.0
NNTP-Posting-Date: 19 Jun 1998 03:34:41 GMT
Cache-Post-Path: news.manawatu.gen.nz!unknown AT 5-128 DOT static DOT dialup DOT manawatu DOT net DOT nz
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Hello,
I was thinking of trying some stuff with real-time midi output, and I
made the following program to see how it works.  This program
compiles, runs, installs sound, and does everything right except
actually play the note.  (I got the info on the midi data from PCGPE).
Can somebody please help me out here?  I'm using gcc 2.8.1, allegro
3.0, under win95.

#include <allegro.h>

main() {
	unsigned char data1[] = {0xC0, 0x00}; //set piano
	unsigned char data2[] = {0x90, 0x24, 0x40};  //note c3 on
	unsigned char data3[] = {0x80, 0x24, 0x40}; //note c3 off

	allegro_init();
	install_keyboard();

	if (install_sound(DIGI_AUTODETECT, MIDI_AUTODETECT, "") != 0) 
	{
   	printf("Error initialising sound system\n%s\n",
allegro_error);
		return 1;
	}

	midi_out((unsigned char *) &data1, sizeof(data1));
	midi_out((unsigned char *) &data2, sizeof(data2));
	readkey();
	midi_out((unsigned char *) &data3, sizeof(data3));
}

TIA

--
  Michael Langton <langtons DOT NOTTHISBIT AT manawatu DOT gen DOT nz>

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019