summaryrefslogtreecommitdiffstats
path: root/libtdemid/tests
diff options
context:
space:
mode:
Diffstat (limited to 'libtdemid/tests')
-rw-r--r--libtdemid/tests/Kathzy.midbin0 -> 9083 bytes
-rw-r--r--libtdemid/tests/Makefile.am14
-rw-r--r--libtdemid/tests/apitest.cc25
-rw-r--r--libtdemid/tests/ctest.c54
-rw-r--r--libtdemid/tests/notesoff.cc24
5 files changed, 117 insertions, 0 deletions
diff --git a/libtdemid/tests/Kathzy.mid b/libtdemid/tests/Kathzy.mid
new file mode 100644
index 000000000..f3a857fba
--- /dev/null
+++ b/libtdemid/tests/Kathzy.mid
Binary files differ
diff --git a/libtdemid/tests/Makefile.am b/libtdemid/tests/Makefile.am
new file mode 100644
index 000000000..a00018c62
--- /dev/null
+++ b/libtdemid/tests/Makefile.am
@@ -0,0 +1,14 @@
+
+INCLUDES = -I$(srcdir)/.. $(all_includes)
+
+noinst_PROGRAMS = ctest apitest notesoff
+
+ctest_SOURCES = ctest.c
+ctest_LDADD = ../libtdemid.la
+
+apitest_SOURCES = apitest.cc
+apitest_LDADD = ../libtdemid.la
+
+notesoff_SOURCES = notesoff.cc
+notesoff_LDADD = ../libtdemid.la
+
diff --git a/libtdemid/tests/apitest.cc b/libtdemid/tests/apitest.cc
new file mode 100644
index 000000000..7f370331e
--- /dev/null
+++ b/libtdemid/tests/apitest.cc
@@ -0,0 +1,25 @@
+#include <libtdemid/libtdemid.h>
+#include <unistd.h>
+#include <stdio.h>
+
+int main (int , char **)
+{
+ printf("Libtdemid test2 . (C) 2000 Antonio Larrosa Jimenez . Malaga (Spain)\n");
+ printf("Using libtdemid from a simple C++ application\n");
+
+ KMidSimpleAPI::kMidInit();
+ KMidSimpleAPI::kMidLoad("Kathzy.mid");
+ KMidSimpleAPI::kMidPlay();
+
+ for (int i=0;i<30;i++)
+ {
+ printf("%d/30 seconds\n",i+1);
+ sleep(1);
+ };
+
+ KMidSimpleAPI::kMidStop();
+ KMidSimpleAPI::kMidDestruct();
+
+ return 0;
+};
+
diff --git a/libtdemid/tests/ctest.c b/libtdemid/tests/ctest.c
new file mode 100644
index 000000000..0e7d25884
--- /dev/null
+++ b/libtdemid/tests/ctest.c
@@ -0,0 +1,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;
+
+};
+
diff --git a/libtdemid/tests/notesoff.cc b/libtdemid/tests/notesoff.cc
new file mode 100644
index 000000000..15e00bd6c
--- /dev/null
+++ b/libtdemid/tests/notesoff.cc
@@ -0,0 +1,24 @@
+#include <libtdemid/libtdemid.h>
+#include <libtdemid/deviceman.h>
+#include <unistd.h>
+#include <stdio.h>
+
+int main (int , char **)
+{
+ printf("Libtdemid Notes Off . (C) 2000 Antonio Larrosa Jimenez . Malaga (Spain)\n");
+ printf("Using libtdemid from a simple C++ application\n");
+
+ KMidSimpleAPI::kMidInit();
+
+ kMid.midi->checkInit();
+ kMid.midi->openDev();
+ kMid.midi->initDev();
+
+ kMid.midi->allNotesOff();
+ kMid.midi->closeDev();
+
+ KMidSimpleAPI::kMidDestruct();
+
+ return 0;
+};
+