home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 497a.lha / ComSMUS_v2.2 / src / main.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-04-07  |  2.9 KB  |  167 lines

  1. /* main - karl's smus loader */
  2.  
  3. /* Copyright (C) 1989 by Karl Lehenbauer, All Rights Reserved */
  4.  
  5. #include <exec/types.h>
  6. #include <exec/memory.h>
  7. #include <exec/nodes.h>
  8. #include <exec/lists.h>
  9. #include <functions.h>
  10. #include <devices/audio.h>
  11. #include <workbench/workbench.h>
  12. #include <workbench/startup.h>
  13. #include <fcntl.h>
  14. #include <stdio.h>
  15.  
  16. #include "smus_requests.h"
  17.  
  18.  
  19. extern struct MsgPort *player_request_port;
  20.  
  21. #define YES 1
  22. #define NO 0
  23.  
  24. main(argc,argv)
  25. int argc;
  26. char *argv[];
  27. {
  28.     int songnameindex;
  29.     int i;
  30.     void *songptr;
  31.     void *LoadSong();
  32.  
  33.     printf("Lehenbauer SMUS player V2.2 beta\nCopyright 1989 Karl Lehenbauer, All Rights Reserved\n");
  34.  
  35.     SMUSInitServer();
  36.  
  37.     docommands();
  38.  
  39.     SMUSTerminateServer();
  40.  
  41.     cleanup();
  42.     exit(0);
  43. }
  44.  
  45. docommands()
  46. {
  47.     char cmd[80];
  48.     int Running = YES;
  49.     void *songptr = NULL;
  50.  
  51.     while (Running)
  52.     {
  53.         printf("command (a q l L p i t u f A z P C s S ?): ");
  54.         if (gets(cmd) == NULL)
  55.         {
  56.             printf("EOF -- goodbye\n");
  57.             Running = NO;
  58.         }
  59.  
  60.         switch(cmd[0])
  61.         {
  62.             case 'a':
  63.                 if (songptr)
  64.                     AttachSamples(songptr);
  65.                 else
  66.                     printf("no current song\n");
  67.                 break;
  68.  
  69.             case 'q':
  70.                 Running = NO;
  71.                 break;
  72.  
  73.             case 'l':
  74.                 songptr = LoadSong(&cmd[2]);
  75.                 break;
  76.  
  77.             case 'L':
  78.                 LoadCATArchive(&cmd[2]);
  79.                 break;
  80.  
  81.             case 'p':
  82.                 if (songptr)
  83.                     PlaySong(songptr);
  84.                 else
  85.                     printf("no current song\n");
  86.                 break;
  87.  
  88.             case 'i':
  89.                 if (songptr)
  90.                     StartSong(songptr);
  91.                 else
  92.                     printf("no current song\n");
  93.                 break;
  94.  
  95.             case 'u':
  96.                 if (songptr)
  97.                 {
  98.                     UnloadSong(songptr);
  99.                     songptr = NULL;
  100.                 }
  101.                 else
  102.                     printf("no current song\n");
  103.                 break;
  104.  
  105.             case 't':
  106.                 TerminateServerWhenFinished();
  107.                 Running = NO;
  108.                 break;
  109.  
  110.             case 'f':
  111.                 StartFadeOut();
  112.                 break;
  113.  
  114.             case 'A':
  115.                 AbortSongImmediately();
  116.                 break;
  117.  
  118.             case 'z':
  119.                 WaitTilSongFinishes();
  120.                 break;
  121.  
  122.             case 'P':
  123.                 PurgeUntaggedSamples();
  124.                 break;
  125.  
  126.             case 'C':
  127.                 ClearSampleTags();
  128.                 break;
  129.  
  130.             case 's':
  131.                 SetSampleTag(&cmd[2]);
  132.                 break;
  133.  
  134.             case 'S':
  135.                 if (songptr)
  136.                     SetSampleTagsOfSong(songptr);
  137.                 else
  138.                     printf("no current song\n");
  139.                 break;
  140.  
  141.             case '?':
  142.             default:
  143.                 printf("a       attach samples for current song\n");
  144.                 printf("f       start fade-out\n");
  145.                 printf("i       start song (play with immediate return)\n");
  146.                 printf("l file  load song 'file'\n");
  147.                 printf("s name    set sample tag of named sample\n");
  148.                 printf("t       terminate server when song is finished\n");
  149.                 printf("u       unload current song\n");
  150.                 printf("L file  load samples from IFF CAT 'file'\n");
  151.                 printf("p       play current song\n");
  152.                 printf("q       quit, terminating servers\n");
  153.                 printf("z       wait 'til song finishes\n");
  154.                 printf("\n");
  155.                 printf("A       abort song immediately\n");
  156.                 printf("C       clear all sample tags\n");
  157.                 printf("P       purge all untagged samples\n");
  158.                 printf("S       set tags for samples of current song\n");
  159.                 break;
  160.         }
  161.     }
  162. }
  163.  
  164.  
  165.  
  166.  
  167.