No subject



//
// File:           mdRegister-test.c++ 
//
// Summary:        
//
// Author:         Tobias Kunze
// E-Mail:         tkunze@ccrma.stanford.edu
// Org:            CCRMA, Stanford University
//
// Orig-Date:       9-Dec-97 at 11:47:33
// Last-Mod:       12-Dec-97 at 15:48:29 by Tobias Kunze
//
// Description:    CC -fullwarn -o foo foo.c++ -lmd
//
#ident "$Revision: 0.0 $"
//
// Changes:
//    00-Jan-00    tk    created


#include <dmedia/midi.h>
#include <iostream.h>

char gInterface[] = "myInterface";

char gHelp[] = 
  " Usage:\n" 
  " h        display this help\n"
  " r        register test interface name\n"
  " u        unregister test interface name\n"
  " U        unregister whatever the last call to mdRegister returned\n"
  " i        info on all interfaces\n"
  " q        quit\n";

void main(void) {
  int n, i, res;
  char* interface = gInterface;
  char* name;
  char c;
  int quit = 0;
  
  n = mdInit();

  while (!quit) {
    cout << "> ";
    cin >> c;
    switch (c) {
    case 'r' :
      name = mdRegister(interface);
      cout << "register: " << (name ? name : "NULL") << endl;
      break;
    case 'u' : 
      res = mdUnRegister(interface);
      cout << "unregister \"" << interface << "\" returned " << res << endl;
      break;
    case 'U' : 
      res = mdUnRegister(name);
      cout << "unregister \"" << name << "\" returned " << res << endl;
      break;
    case 'i' : 
      n = mdInit();
      cout << n << " Interfaces:" << endl;
      for (i = 0; i < n; i++)
	cout << "   " << mdGetName(i) << endl;
      break;
    case 'q' : 
      quit = 1;
      break;
    case 'h' : 
    default : 
      cout << gHelp; 
      break;
    }
  }
}


//
// -*- EOF -*-

--PART-BOUNDARY=.19712121618.ZM8638.kgw.tu-berlin.de--