summaryrefslogtreecommitdiffstats
path: root/libtdemid/tests/ctest.c
blob: 0e7d25884d1c231cd3ff3f8319cc9688a087e758 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#include <libtdemid/libtdemid.h>
#include <unistd.h>
#include <stdio.h>

int main (int argc, char **argv)
{
  int i;
  char c;

  printf("Test1 %s. Using libtdemid from a simple C application\n",kMidVersion());
  printf("%s\n",kMidCopyright());

  if (kMidInit()!=0) 
  {
    printf("Error initializing libtdemid\n");
    return 0;
  }

  if (kMidDevices()!=0)
  {
  printf("Available devices :\n");
  for (i=0;i<kMidDevices();i++)
  {
    printf(" %d) %s - %s\n",i,kMidName(i),kMidType(i));
  }
  printf("\nSelect one:");
  c=getc(stdin);
  }
  else
  {
  printf("There's no available devices. Let's pretend we didn't noticed it\n");
  printf("and start playing.\n");
  c='0';
  }

  kMidSetDevice((int)(c-'0'));

  kMidLoad("Kathzy.mid");
  kMidPlay();

  for (i=0;i<45;i++)
  {
    printf("%d/45 seconds\n",i+1);
    sleep(1);
  }

  kMidStop();
  kMidDestruct();
 
  
  return 0;

};