Difference for arch/linux/hmiplay.c from version 1.6 to 1.7


version 1.6 version 1.7
Line 74
 
Line 74
   
 Voice_info *voices;  Voice_info *voices;
 unsigned char *data=NULL;  unsigned char *data=NULL;
   char digi_last_midi_song[16] = "";
   
 struct synth_info card_info;  struct synth_info card_info;
   
Line 567
 
Line 568
 int do_ipc(int qid, struct msgbuf *buf, int flags)  int do_ipc(int qid, struct msgbuf *buf, int flags)
 {  {
  int ipc_read;   int ipc_read;
  CFILE *fptr;   CFILE *fptr=NULL;
    float last_volume = volume;
  int l=0;   int l=0;
    
  ipc_read = msgrcv(qid,buf,16,0,flags | MSG_NOERROR);   ipc_read = msgrcv(qid,buf,16,0,flags | MSG_NOERROR);
Line 586
 
Line 588
  switch (buf->mtext[0])   switch (buf->mtext[0])
  {   {
  case 'v':   case 'v':
  volume=(double) ((double) buf->mtext[0]/127.0);   volume=(double) (atof(buf->mtext+1)/128.0);
    printf("vol %f->%f\n",last_volume,volume);
    if (last_volume<=0 && volume>0) {
    buf->mtext[0]='p';//start playing again if volume raised above 0
    strcpy(buf->mtext+1, digi_last_midi_song);
    //fall through to case 'p'
    }else if (last_volume>0 && volume<=0) {
    strcpy(buf->mtext, "s"); //stop playing if volume reduced to 0
    stop = 2;
    break;
    }else
  break;   break;
  case 'p':   case 'p':
    if (buf->mtext[1]) {
    strcpy(digi_last_midi_song, buf->mtext+1);
    if (volume>0)
  fptr=cfopen((buf->mtext+1),"rb");    fptr=cfopen((buf->mtext+1),"rb");
    }
  if(fptr != NULL)   if(fptr != NULL)
  {   {
  l = cfilelength(fptr);   l = cfilelength(fptr);
Line 597
 
Line 613
  cfread(data, l, 1, fptr);   cfread(data, l, 1, fptr);
  cfclose(fptr);   cfclose(fptr);
  printf ("good. fpr=%p l=%i data=%p\n", fptr, l, data);//##########3   printf ("good. fpr=%p l=%i data=%p\n", fptr, l, data);//##########3
  }  
  stop = 0;   stop = 0;
    } else {
    strcpy(buf->mtext, "s"); //not playing, thus "stop".
    stop = 2;
    }
  break;   break;
  case 's':   case 's':
  stop = 2;   stop = 2;
Line 607
 
Line 626
 // SDL_KillThread(player_thread);  // SDL_KillThread(player_thread);
  break;     break; 
  }   }
   // printf ("do_ipc %s ret %i\n", buf->mtext, ipc_read);//##########3
  }   }
    
  return ipc_read;   return ipc_read;
Line 782
 
Line 802
 }  }
   
 void digi_play_midi_song( char * filename, char * melodic_bank, char * drum_bank, int loop ) {  void digi_play_midi_song( char * filename, char * melodic_bank, char * drum_bank, int loop ) {
    if (!filename)
    send_ipc("p");
    else {
         char buf[128];          char buf[128];
       
         sprintf(buf,"p%s",filename);          sprintf(buf,"p%s",filename);
         send_ipc(buf);          send_ipc(buf);
    }
 }  }
 void digi_set_midi_volume( int mvolume ) {   void digi_set_midi_volume( int mvolume ) {
         char buf[128];          char buf[128];

Legend:
line(s) removed in v.1.6 
line(s) changed
 line(s) added in v.1.7