Moved mpu401 into sound
[reactos.git] / reactos / drivers / sound / mpu401 / test.c
1 #include <stdio.h>
2 #include <windows.h>
3 #include <ntddk.h>
4 #include "mpu401.h"
5
6 int main()
7 {
8 // NTSTATUS s;
9 // PHANDLE Handle;
10 // PIO_STATUS_BLOCK Status;
11 DWORD BytesReturned;
12 BYTE Test[3]; // Will store MIDI data
13 BYTE Notes[] = {50, 52, 54, 55, 57, 59, 61};
14 HANDLE Device;
15 UINT Note;
16 UINT Junk;
17
18 printf("Test program for MPU401 driver\n");
19
20 Device = CreateFile("\\\\.\\MPU401_Out_0", GENERIC_READ | GENERIC_WRITE,
21 FILE_SHARE_READ | FILE_SHARE_WRITE,
22 NULL,
23 OPEN_EXISTING,
24 FILE_FLAG_NO_BUFFERING,
25 NULL);
26
27 if (Device == INVALID_HANDLE_VALUE)
28 {
29 printf("Device is busy or could not be found.\n");
30 return -1;
31 }
32
33 printf("Device is open, let's play some music...\n");
34
35 Test[0] = 0x90;
36 Test[2] = 0x7f;
37
38 for (Note = 0; Note < sizeof(Notes); Note ++)
39 {
40 Test[1] = Notes[Note];
41
42 DeviceIoControl(
43 Device,
44 IOCTL_MIDI_PLAY,
45 &Test,
46 sizeof(Test),
47 NULL,
48 0,
49 &BytesReturned,
50 NULL
51 );
52
53 for (Junk = 0; Junk < 100000; Junk ++); // Pause
54 }
55
56
57 /* s = IoCreateFile(Handle, GENERIC_READ | GENERIC_WRITE,
58 OBJ_KERNEL_HANDLE,
59 Status,
60 0,
61 FILE_SHARE_READ | FILE_SHARE_WRITE,
62 FILE_OPEN,
63 FILE_NON_DIRECTORY_FILE,
64 NULL,
65 0,
66 CreateFileTypeNone,
67 NULL,
68 0);
69 */
70 }