home *** CD-ROM | disk | FTP | other *** search
/ FreeWare Collection 2 / FreeSoftwareCollection2pd199x-jp.img / look / src / shell.c < prev    next >
Text File  |  1990-06-14  |  1KB  |  82 lines

  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. #include <snd.h>
  5.  
  6. #define BUFF_SIZE (66000)
  7. #define BIOS_WORK_SIZE (16384)
  8.  
  9. extern int ML_Start();
  10. extern int ML_End();
  11. extern int ML_Set();
  12. extern int ML_Play();
  13. extern int ML_Stop();
  14. extern int ML_Check();
  15. extern int SL_Start();
  16. extern int SL_Status();
  17. extern int SL_Load();
  18. extern int SL_Play();
  19. extern int SL_Stop();
  20. extern int SND_eup_stat_flag();
  21. extern int SND_eup_stat_meas();
  22.  
  23. extern char *swork;
  24.  
  25. void    runeup(char *filename)
  26. {
  27.     int    b,x,y;
  28.     char *buff;
  29.  
  30.     wrtmos(3);
  31.     if((buff = malloc(BUFF_SIZE)) == NULL)
  32.         return;
  33.  
  34.     if(ML_Start(buff,BUFF_SIZE,swork))
  35.         goto ERROR;
  36.     if ( ML_Set(filename) ) {
  37.         ML_Stop();
  38.         ML_End();
  39.         goto ERROR;
  40.     }
  41.     ML_Play(0);
  42.     while(SND_eup_stat_flag()){
  43.         if(ML_Check()){
  44.             ML_Stop();
  45.             ML_End();
  46.             goto ERROR;
  47.         }
  48.         SND_eup_stat_meas();
  49.         MOS_rdpos(&b,&x,&y);
  50.         if ( b != 0 )
  51.             break;
  52.     }
  53.     ML_End();
  54. ERROR:
  55.     free(buff);
  56.     wrtmos(0);
  57. }
  58. void    runsnd(char *filename)
  59. {
  60.     int    b,x,y;
  61.     char *buff;
  62.  
  63.     wrtmos(4);
  64.     if((buff = malloc(BUFF_SIZE)) == NULL)
  65.         return;
  66.  
  67.     if(SL_Start())
  68.         goto ERROR;
  69.     if ( SL_Load(filename,buff,BUFF_SIZE) )
  70.         goto ERROR;
  71.     SL_Play(0,0,127,64,buff);
  72.     while ( SL_Status() ) {
  73.         MOS_rdpos(&b,&x,&y);
  74.         if ( b != 0 )
  75.             break;
  76.    }
  77.     SL_Stop();
  78. ERROR:
  79.     free(buff);
  80.     wrtmos(0);
  81. }
  82.