Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » is there MIDI INPUT functions in allegro actually in 2007 ?

This thread is locked; no one can reply to it. rss feed Print
is there MIDI INPUT functions in allegro actually in 2007 ?
karistouf
Member #5,126
October 2004
avatar

hello everybody, i search a little bit in doc and then forum. Seems not to be any Midi INPUTS functions in allegro ( lock device in input, take the note, etc...) any idea or suggestion of a little GNU lib under WINDOWS ?

cheers and a beautifull year to everybody !

Evert
Member #794
November 2000
avatar

Quote:

Seems not to be any Midi INPUTS functions in allegro

No? http://alleg.sourceforge.net/stabledocs/en/alleg029.html
It's a little used feature, so I can't say how well it will work in practice.

karistouf
Member #5,126
October 2004
avatar

Hello and happy new year !
well, its not so clear. I need to have IN directly each note received ...
first I m trying to init the module, but Its not really clear, how to ...
I do not arive to print on screen or to have information about 1 driver number 2 driver for input midi number and of course not that is played by my musical keyboard .
This musical keyboard is connected to my laptop via USB. It is recognized in windows and on other softs as a midi device N° 9.
How to hook it ? that is first my main trouble....

Do not pay attention to quotes missing, I have cleaned from some other functions
... ;-P

1 
2#include "allegro.h"
3#include "stdio.h"
4#include "winalleg.h"
5 
6 
7BITMAP* buffer;
8BITMAP* fond1;
9BITMAP* mouse;
10bool index_quit=0;
11 
12int quit_funct()
13{
14 destroy_bitmap(buffer);
15 destroy_bitmap(fond1);
16 destroy_bitmap(mouse);
17 remove_sound_input();
18 remove_sound();
19 return(0);
20}
21 
22int main()
23{
24 allegro_init();
25 install_keyboard();
26 install_mouse();
27 install_timer();
28 install_sound(DIGI_AUTODETECT,MIDI_AUTODETECT,0);
29 install_sound_input(DIGI_AUTODETECT,MIDI_AUTODETECT);
30 
31 set_color_depth(16);
32 set_gfx_mode(GFX_AUTODETECT_WINDOWED,442,442,0,0);
33 if(set_gfx_mode(GFX_AUTODETECT_WINDOWED,440,400,0,0)!=0){
34 set_gfx_mode(GFX_TEXT,0,0,0,0);
35 allegro_message("%s\nSchwartz_Peter's Video Mode:\n 1024x768 and Higher\n16 or 32 bits better look\n\n", allegro_error);
36 quit_funct();return 1;
37 }
38 fond1=load_bitmap("/schwartzpeter/img/config.tga",NULL);
39 mouse=load_bitmap("/schwartzpeter/img/curseur1.bmp",NULL);
40 buffer=create_bitmap(SCREEN_W,SCREEN_H);
41 blit(buffer,screen,0,0,0,0,442,442);
42
43 while (index_quit==0)
44 {
45 rectfill(buffer,0,0,440,400,makecol(255,255,255));
46 draw_sprite(buffer,fond1,(int)-5,0);
47 textprintf_ex(buffer,font, 10, 180,makecol(100,0,255),-1,"MIDI INPUT:");
48 textprintf_ex(buffer, font, 100, 180, makecol(100,0,0), -1,"Midi Driver: %hx InputDriver: %hx ", midi_driver, midi_input_driver);
49 textprintf_ex(buffer, font, 100, 190, makecol(100,0,0), -1,"Midi Note: %hx ", midi_recorder);
50
51 rect(buffer, 40,230,50,240,makecol(100,0,255));
52 rect(buffer, 40,250,50,260,makecol(100,0,255));
53 rect(buffer, 40,270,50,280,makecol(100,0,255));
54 rect(buffer, 40,290,50,300,makecol(100,0,255));
55 rect(buffer, 40,310,50,320,makecol(100,0,255));
56
57 draw_sprite(buffer,mouse,(int)mouse_x,mouse_y);
58 blit(buffer,screen,0,0,0,0,442,442);
59
60 }
61
62 destroy_bitmap(fond1);
63 destroy_bitmap(mouse);
64remove_timer();
65remove_sound_input();
66remove_sound();
67 
68allegro_exit();
69
70return 0;
71}
72END_OF_MAIN();

Go to: