changeset 1590:fd943ec96935 trunk

[svn] Sync with upstream. ADL is now dual licensed, and RIX has had a pitch fixup. Free warning fix included.
author chainsaw
date Thu, 24 Aug 2006 11:11:30 -0700
parents ebc170f08767
children 02841f72b897
files ChangeLog Plugins/Input/adplug/core/adl.cpp Plugins/Input/adplug/core/adl.h Plugins/Input/adplug/core/rix.cpp Plugins/Input/adplug/core/rix.h
diffstat 5 files changed, 52 insertions(+), 100 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed Aug 23 23:09:05 2006 -0700
+++ b/ChangeLog	Thu Aug 24 11:11:30 2006 -0700
@@ -1,3 +1,12 @@
+2006-08-24 06:09:05 +0000  Yoshiki Yazawa <yaz@cc.rim.or.jp>
+  revision [2101]
+  - file_path should not contain file name.
+  
+
+  Changes:        Modified:
+  +1 -1           trunk/Plugins/Container/xspf/xspf.c  
+
+
 2006-08-23 14:46:33 +0000  Yoshiki Yazawa <yaz@cc.rim.or.jp>
   revision [2099]
   - modified time (mtime) has been introduced into tuple
--- a/Plugins/Input/adplug/core/adl.cpp	Wed Aug 23 23:09:05 2006 -0700
+++ b/Plugins/Input/adplug/core/adl.cpp	Thu Aug 24 11:11:30 2006 -0700
@@ -1,21 +1,4 @@
 /*
- * Adplug - Replayer for many OPL2/OPL3 audio file formats.
- * Copyright (C) 1999 - 2006 Simon Peter, <dn.tlp@gmx.net>, et al.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- *
  * adl.cpp - ADL player adaption by Simon Peter <dn.tlp@gmx.net>
  *
  * Original ADL player by Torbjorn Andersson and Johannes Schickel
@@ -23,7 +6,12 @@
  */
 
 /* ScummVM - Scumm Interpreter
+ *
+ * This file is licensed under both GPL and LGPL
  * Copyright (C) 2006 The ScummVM project
+ * Copyright (C) 2006 Torbjorn Andersson and Johannes Schickel
+ *
+ * GPL License
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -38,6 +26,23 @@
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * LPGL License
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ *
  */
 
 #include <inttypes.h>
--- a/Plugins/Input/adplug/core/adl.h	Wed Aug 23 23:09:05 2006 -0700
+++ b/Plugins/Input/adplug/core/adl.h	Thu Aug 24 11:11:30 2006 -0700
@@ -2,20 +2,6 @@
  * Adplug - Replayer for many OPL2/OPL3 audio file formats.
  * Copyright (C) 1999 - 2006 Simon Peter, <dn.tlp@gmx.net>, et al.
  * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- *
  * adl.h - ADL player adaption by Simon Peter <dn.tlp@gmx.net>
  */
 
--- a/Plugins/Input/adplug/core/rix.cpp	Wed Aug 23 23:09:05 2006 -0700
+++ b/Plugins/Input/adplug/core/rix.cpp	Thu Aug 24 11:11:30 2006 -0700
@@ -75,7 +75,7 @@
 	  int offset=f->readInt(4);
 	  f->seek(offset);
   }
-  if(f->readInt(4)!=0x55aa){ fp.close(f);return false; }
+  if(f->readInt(2)!=0x55aa){ fp.close(f);return false; }
   file_buffer = new unsigned char [fp.filesize(f) + 1];
   f->seek(0);
   while(!f->eof())
@@ -91,7 +91,7 @@
 bool CrixPlayer::update()
 {
 	int_08h_entry();
-	return !dro_end;
+	return !play_end;
 }
 
 void CrixPlayer::rewind(int subsong)
@@ -100,7 +100,6 @@
   mus_block = 0;
   ins_block = 0;
   rhythm = 0;
-  mutex = 0;
   music_on = 0;
   pause_flag = 0;
   band = 0;
@@ -108,10 +107,10 @@
   e0_reg_flag = 0;
   bd_modify = 0;
   sustain = 0;
-  dro_end = 0;
+  play_end = 0;
   pos = index = 0; 
 
-  memset(buffer, 0, sizeof(unsigned short) * 300);
+  memset(f_buffer, 0, sizeof(unsigned short) * 300);
   memset(a0b0_data2, 0, sizeof(unsigned short) * 11);
   memset(a0b0_data3, 0, 18);
   memset(a0b0_data4, 0, 18);
@@ -158,7 +157,6 @@
 inline void CrixPlayer::set_new_int()
 {
   if(!ad_initial()) exit(1);
-  prep_int();
 }
 /*----------------------------------------------------------*/
 inline void CrixPlayer::Pause()
@@ -197,7 +195,12 @@
 inline unsigned short CrixPlayer::ad_initial()
 {
   register unsigned short i,j,k = 0;
-  for(i=0;i<25;i++) crc_trans(i,i*4);
+  for(i=0;i<25;i++) 
+  {
+  	f_buffer[i*12]=(unsigned int)((i*24+10000)*0.27461678223+4)>>3;
+  	for(int t=1;t<12;t++)
+  		f_buffer[i*12+t]=(unsigned int)((double)f_buffer[i*12+t-1]*1.06);
+  }
   for(i=0;i<8;i++)
     for(j=0;j<12;j++)
       {
@@ -214,58 +217,25 @@
   return 1;//ad_test();
 }
 /*----------------------------------------------------------*/
-inline void CrixPlayer::crc_trans(unsigned short index,unsigned short v)
-{
-  register unsigned short i;
-  unsigned int res; unsigned short low;
-  res = strm_and_fr(v);
-  low = res;
-  buffer[index*12] = (low+4)>>3;
-  for(i=1;i<=11;i++)
-    {
-      res = (unsigned int)((double)res * 1.06);
-      buffer[index*12+i] = res>>3;
-    }
-}
-
-/*----------------------------------------------------------*/
-inline void CrixPlayer::prep_int()
-{
-  mutex = 0;
-}
-/*----------------------------------------------------------*/
 inline void CrixPlayer::ad_bop(unsigned short reg,unsigned short value)
 {
   if(reg == 2 || reg == 3)
     AdPlug_LogWrite("switch OPL2/3 mode!\n");
   opl->write(reg & 0xff, value & 0xff);
 }
-/*------------------------------------------------------*/
-inline unsigned short CrixPlayer::ad_test()   /* Test the SoundCard */
-{
-  ad_bop(0x04,0x60);
-  ad_bop(0x04,0x80);
-  ad_bop(0x02,0xFF);
-  ad_bop(0x04,0x21);
-  ad_bop(0x04,0x60);
-  ad_bop(0x04,0x80);
-  return 1;
-}
 /*--------------------------------------------------------------*/
 inline void CrixPlayer::int_08h_entry()
   {   
   unsigned short band_sus = 1;
   while(band_sus)
     {
-      if(sustain <= 0 && mutex == 0)
+        if(sustain <= 0)   
 	{
-	  mutex++;
 	  band_sus = rix_proc();
 	  if(band_sus) sustain += band_sus;
-	  mutex--;
-	  if(band_sus == 0)
+            else
 	    {
-	      dro_end=1;
+                play_end=1;   
 	      break;
 	    }
 	}
@@ -311,8 +281,6 @@
 
   for(i = 0; i < 28; i++)
     insbuf[i] = (baddr[i * 2 + 1] << 8) + baddr[i * 2];
-
-//   memcpy(insbuf,(&buf_addr[ins_block])+(band_low<<6),56);
 }
 /*--------------------------------------------------------------*/
 inline void CrixPlayer::rix_90_pro(unsigned short ctrl_l)
@@ -323,9 +291,7 @@
       ins_to_reg(modify[ctrl_l*2+1],insbuf+13,insbuf[27]);
       return;
     }
-  else
-    {
-      if(ctrl_l > 6)
+  else if(ctrl_l > 6)
 	{
 	  ins_to_reg(modify[ctrl_l*2+6],insbuf,insbuf[26]);
 	  return;
@@ -336,7 +302,6 @@
 	  ins_to_reg(15,insbuf+13,insbuf[27]);
 	  return;
 	}
-    }
 }
 /*--------------------------------------------------------------*/
 inline void CrixPlayer::rix_A0_pro(unsigned short ctrl_l,unsigned short index)
@@ -352,11 +317,9 @@
 inline void CrixPlayer::prepare_a0b0(unsigned short index,unsigned short v)  /* important !*/
 {
   short high = 0,low = 0; unsigned int res;
-  low = ((unsigned short)(v-0x2000))*0x19;
-  high = ((short)v)<0x2000?0xFFFF:0;
-  if(low == 0xFF && high == 0) return;
-  res = ((((unsigned int)high)<<16)|low)/0x2000;
-  low = res&0xFFFF;
+  int res1 = (v-0x2000)*0x19;
+  if(res1 == (int)0xff) return;
+  low = res1/0x2000;
   if(low < 0)
     {
       low = 0x18-low; high = (signed short)low<0?0xFFFF:0;
@@ -388,7 +351,7 @@
   a0b0_data3[index] = p2;
   i = ((signed short)i<=0x5F?i:0x5F);
   i = ((signed short)i>=0?i:0);
-  data = buffer[addrs_head[i]+displace[index]/2];
+  data = f_buffer[addrs_head[i]+displace[index]/2];
   ad_bop(0xA0+index,data);
   data = a0b0_data5[i]*4+(p3<1?0:0x20)+((data>>8)&3);
   ad_bop(0xB0+index,data);
@@ -524,12 +487,6 @@
 inline void CrixPlayer::music_ctrl()
 {
   register int i;
-  music_on = 0;
   for(i=0;i<11;i++)
     switch_ad_bd(i);
 }
-/*----------------------------------------------------------------------*/
-inline unsigned int CrixPlayer::strm_and_fr(unsigned short parm)
-{
-  return (int)(((unsigned int)parm*6+10000)*0.27461678223);
-}
--- a/Plugins/Input/adplug/core/rix.h	Wed Aug 23 23:09:05 2006 -0700
+++ b/Plugins/Input/adplug/core/rix.h	Thu Aug 24 11:11:30 2006 -0700
@@ -46,8 +46,8 @@
 
   int flag_mkf;
   unsigned char *file_buffer;
-  unsigned char *buf_addr;  /* rix files' buffer */
-  unsigned short buffer[300];
+  unsigned char *buf_addr;  /* rix files' f_buffer */
+  unsigned short f_buffer[300];//9C0h-C18h
   unsigned short a0b0_data2[11];
   unsigned char a0b0_data3[18];
   unsigned char a0b0_data4[18];
@@ -70,7 +70,6 @@
   unsigned short mus_block;
   unsigned short ins_block;
   unsigned char rhythm;
-  unsigned char mutex;
   unsigned char music_on;
   unsigned char pause_flag;
   unsigned short band;
@@ -78,7 +77,7 @@
   unsigned short e0_reg_flag;
   unsigned char bd_modify;
   int sustain;
-  int dro_end;
+  int play_end;
 
 #define ad_08_reg() ad_bop(8,0)    /**/
   inline void ad_20_reg(unsigned short);              /**/
@@ -101,7 +100,6 @@
   inline void int_08h_entry();    /**/
   inline void music_ctrl();                 /**/
   inline void Pause();                      /**/
-  inline void prep_int();                   /**/
   inline void prepare_a0b0(unsigned short,unsigned short);      /**/
   inline void rix_90_pro(unsigned short);             /**/
   inline void rix_A0_pro(unsigned short,unsigned short);        /**/
@@ -110,8 +108,5 @@
   inline void rix_get_ins();                /**/
   inline unsigned short rix_proc();                   /**/
   inline void set_new_int();
-  inline void set_speed(unsigned short);              /**/
-  inline void set_time(unsigned short);               /**/
   inline void switch_ad_bd(unsigned short);           /**/
-  inline unsigned int strm_and_fr(unsigned short);               /* done */
 };