aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorspiff_ <spiff_@svn>2010-10-04 17:38:44 +0000
committerspiff_ <spiff_@svn>2010-10-04 17:38:44 +0000
commitbcb676939e0d5d20733b3d3c35f08d4ba418e7e4 (patch)
tree6089e38492683c0f1582aa0ab5f95d41046ef323
parent987412e06055902361ae305996834ef6675297b4 (diff)
change: remove the GYM codec. it's broken, the code is an utter mess and i cba to maintain it. can be revisited when codecs are add-ons.
git-svn-id: https://xbmc.svn.sourceforge.net/svnroot/xbmc/trunk@34439 568bbfeb-2a22-0410-94d2-cc84cf5bfa90
-rw-r--r--Makefile.in2
-rw-r--r--configure.in1
-rw-r--r--system/players/paplayer/gensapu.dllbin65536 -> 0 bytes
-rw-r--r--xbmc/Makefile.in1
-rw-r--r--xbmc/MusicInfoTagLoaderFactory.cpp6
-rw-r--r--xbmc/MusicInfoTagLoaderGYM.cpp75
-rw-r--r--xbmc/MusicInfoTagLoaderGYM.h39
-rw-r--r--xbmc/cores/paplayer/CodecFactory.cpp3
-rw-r--r--xbmc/cores/paplayer/DllGensApu.h61
-rw-r--r--xbmc/cores/paplayer/GYMCodec.cpp108
-rw-r--r--xbmc/cores/paplayer/GYMCodec.h51
-rw-r--r--xbmc/cores/paplayer/GYMCodec/Makefile.in23
-rw-r--r--xbmc/cores/paplayer/GYMCodec/XBMCGYM.cpp251
-rw-r--r--xbmc/cores/paplayer/GYMCodec/gensapu.sln21
-rw-r--r--xbmc/cores/paplayer/GYMCodec/gensapu.vcproj234
-rw-r--r--xbmc/cores/paplayer/GYMCodec/gym_play.cpp256
-rw-r--r--xbmc/cores/paplayer/GYMCodec/gym_play.h47
-rw-r--r--xbmc/cores/paplayer/GYMCodec/psg.c491
-rw-r--r--xbmc/cores/paplayer/GYMCodec/psg.h73
-rw-r--r--xbmc/cores/paplayer/GYMCodec/readme.txt59
-rw-r--r--xbmc/cores/paplayer/GYMCodec/ym2612.c2503
-rw-r--r--xbmc/cores/paplayer/GYMCodec/ym2612.h199
-rw-r--r--xbmc/cores/paplayer/Makefile.in2
23 files changed, 1 insertions, 4505 deletions
diff --git a/Makefile.in b/Makefile.in
index 3f49613457..00837d6c68 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -71,7 +71,6 @@ PAPCODECS_DIRS= \
xbmc/cores/paplayer/NSFCodec \
xbmc/cores/paplayer/timidity \
xbmc/cores/paplayer/SIDCodec \
- xbmc/cores/paplayer/GYMCodec \
xbmc/cores/paplayer/YMCodec/StSoundLibrary \
xbmc/cores/paplayer/SPCCodec/SNES/SNESAPU \
xbmc/cores/paplayer/vgmstream \
@@ -356,7 +355,6 @@ endif
ifeq ($(findstring osx,$(ARCH)), osx)
$(MAKE) -C xbmc/cores/paplayer/FLACCodec
endif
- $(MAKE) -C xbmc/cores/paplayer/GYMCodec
$(MAKE) -C xbmc/cores/paplayer/vgmstream
$(MAKE) -C xbmc/cores/paplayer/timidity
$(MAKE) -C xbmc/cores/paplayer/NSFCodec
diff --git a/configure.in b/configure.in
index 4c0b1b7d99..721ea8ec02 100644
--- a/configure.in
+++ b/configure.in
@@ -1394,7 +1394,6 @@ OUTPUT_FILES="Makefile \
xbmc/cores/paplayer/timidity/Makefile \
xbmc/cores/paplayer/AC3Codec/Makefile \
xbmc/cores/paplayer/ADPCMCodec/Makefile \
- xbmc/cores/paplayer/GYMCodec/Makefile \
xbmc/cores/paplayer/NSFCodec/Makefile \
xbmc/cores/paplayer/SIDCodec/Makefile \
xbmc/cores/paplayer/vgmstream/Makefile \
diff --git a/system/players/paplayer/gensapu.dll b/system/players/paplayer/gensapu.dll
deleted file mode 100644
index 149db6453f..0000000000
--- a/system/players/paplayer/gensapu.dll
+++ /dev/null
Binary files differ
diff --git a/xbmc/Makefile.in b/xbmc/Makefile.in
index be86c19fdb..2be01d483b 100644
--- a/xbmc/Makefile.in
+++ b/xbmc/Makefile.in
@@ -71,7 +71,6 @@ SRCS=Application.cpp \
MusicInfoTagLoaderDatabase.cpp \
MusicInfoTagLoaderFactory.cpp \
MusicInfoTagLoaderFlac.cpp \
- MusicInfoTagLoaderGYM.cpp \
MusicInfoTagLoaderMidi.cpp \
MusicInfoTagLoaderMod.cpp \
MusicInfoTagLoaderMP3.cpp \
diff --git a/xbmc/MusicInfoTagLoaderFactory.cpp b/xbmc/MusicInfoTagLoaderFactory.cpp
index d35e5cbe45..5c4a9da524 100644
--- a/xbmc/MusicInfoTagLoaderFactory.cpp
+++ b/xbmc/MusicInfoTagLoaderFactory.cpp
@@ -40,7 +40,6 @@
#endif
#include "MusicInfoTagLoaderNSF.h"
#include "MusicInfoTagLoaderSPC.h"
-#include "MusicInfoTagLoaderGYM.h"
#include "MusicInfoTagLoaderYM.h"
#include "MusicInfoTagLoaderDatabase.h"
#include "MusicInfoTagLoaderASAP.h"
@@ -159,11 +158,6 @@ IMusicInfoTagLoader* CMusicInfoTagLoaderFactory::CreateLoader(const CStdString&
CMusicInfoTagLoaderSPC *pTagLoader = new CMusicInfoTagLoaderSPC();
return (IMusicInfoTagLoader*)pTagLoader;
}
- else if (strExtension == "gym")
- {
- CMusicInfoTagLoaderGYM *pTagLoader = new CMusicInfoTagLoaderGYM();
- return (IMusicInfoTagLoader*)pTagLoader;
- }
else if (strExtension == "ym")
{
CMusicInfoTagLoaderYM *pTagLoader = new CMusicInfoTagLoaderYM();
diff --git a/xbmc/MusicInfoTagLoaderGYM.cpp b/xbmc/MusicInfoTagLoaderGYM.cpp
deleted file mode 100644
index 8810856d27..0000000000
--- a/xbmc/MusicInfoTagLoaderGYM.cpp
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright (C) 2005-2008 Team XBMC
- * http://www.xbmc.org
- *
- * This Program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This Program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with XBMC; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- * http://www.gnu.org/copyleft/gpl.html
- *
- */
-
-#include "MusicInfoTagLoaderGYM.h"
-#include "MusicInfoTag.h"
-#include "utils/log.h"
-
-#include <fstream>
-
-using namespace MUSIC_INFO;
-
-CMusicInfoTagLoaderGYM::CMusicInfoTagLoaderGYM(void)
-{
- m_gym = 0;
-}
-
-CMusicInfoTagLoaderGYM::~CMusicInfoTagLoaderGYM()
-{
-}
-
-bool CMusicInfoTagLoaderGYM::Load(const CStdString& strFileName, CMusicInfoTag& tag)
-{
- tag.SetLoaded(false);
-
- if (!m_dll.Load())
- return false;
-
- m_dll.Init();
-
- m_gym = m_dll.LoadGYM(strFileName.c_str());
- if (!m_gym)
- {
- CLog::Log(LOGERROR,"MusicInfoTagLoaderGYM: failed to open GYM %s",strFileName.c_str());
- return false;
- }
-
- tag.SetURL(strFileName);
-
- tag.SetLoaded(false);
- char* szTitle = (char*)m_dll.GetTitle(m_gym); // no alloc
- if (szTitle)
- if( strcmp(szTitle,"") )
- {
- tag.SetTitle(szTitle);
- tag.SetLoaded(true);
- }
-
- char* szArtist = (char*)m_dll.GetArtist(m_gym); // no alloc
- if (szArtist)
- if( strcmp(szArtist,"") && tag.Loaded() )
- tag.SetArtist(szArtist);
-
- m_dll.FreeGYM(m_gym);
- m_gym = 0;
-
- return tag.Loaded();
-}
diff --git a/xbmc/MusicInfoTagLoaderGYM.h b/xbmc/MusicInfoTagLoaderGYM.h
deleted file mode 100644
index d49f4d9e4d..0000000000
--- a/xbmc/MusicInfoTagLoaderGYM.h
+++ /dev/null
@@ -1,39 +0,0 @@
-#pragma once
-/*
- * Copyright (C) 2005-2008 Team XBMC
- * http://www.xbmc.org
- *
- * This Program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This Program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with XBMC; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- * http://www.gnu.org/copyleft/gpl.html
- *
- */
-
-#include "ImusicInfoTagLoader.h"
-#include "cores/paplayer/DllGensApu.h"
-
-namespace MUSIC_INFO
-{
- class CMusicInfoTagLoaderGYM: public IMusicInfoTagLoader
- {
- public:
- CMusicInfoTagLoaderGYM(void);
- virtual ~CMusicInfoTagLoaderGYM();
-
- virtual bool Load(const CStdString& strFileName, CMusicInfoTag& tag);
- private:
- int m_gym;
- DllGensApu m_dll;
- };
-}
diff --git a/xbmc/cores/paplayer/CodecFactory.cpp b/xbmc/cores/paplayer/CodecFactory.cpp
index abb86c9656..5ae8f71723 100644
--- a/xbmc/cores/paplayer/CodecFactory.cpp
+++ b/xbmc/cores/paplayer/CodecFactory.cpp
@@ -34,7 +34,6 @@
#ifdef HAS_SPC_CODEC
#include "SPCCodec.h"
#endif
-#include "GYMCodec.h"
#include "SIDCodec.h"
#include "VGMCodec.h"
#include "YMCodec.h"
@@ -105,8 +104,6 @@ ICodec* CodecFactory::CreateCodec(const CStdString& strFileType)
else if (strFileType.Equals("spc"))
return new SPCCodec();
#endif
- else if (strFileType.Equals("gym"))
- return new GYMCodec();
else if (strFileType.Equals("sid") || strFileType.Equals("sidstream"))
return new SIDCodec();
else if (VGMCodec::IsSupportedFormat(strFileType))
diff --git a/xbmc/cores/paplayer/DllGensApu.h b/xbmc/cores/paplayer/DllGensApu.h
deleted file mode 100644
index ad943f1963..0000000000
--- a/xbmc/cores/paplayer/DllGensApu.h
+++ /dev/null
@@ -1,61 +0,0 @@
-#pragma once
-
-/*
- * Copyright (C) 2005-2008 Team XBMC
- * http://www.xbmc.org
- *
- * This Program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This Program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with XBMC; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- * http://www.gnu.org/copyleft/gpl.html
- *
- */
-
-#include "DynamicDll.h"
-
-class DllGensApuInterface
-{
-public:
- virtual ~DllGensApuInterface() {}
- virtual int Init()=0;
- virtual int LoadGYM(const char* szFileName)=0;
- virtual void FreeGYM(int gym)=0;
- virtual int FillBuffer(int gym, void* buffer)=0;
- virtual void Seek(int gym, unsigned int iPos)=0;
- virtual int GetTitle(int spc)=0;
- virtual int GetArtist(int spc)=0;
- virtual __int64 GetLength(int gym)=0;
-};
-
-class DllGensApu : public DllDynamic, DllGensApuInterface
-{
- DECLARE_DLL_WRAPPER(DllGensApu, DLL_PATH_GYM_CODEC)
- DEFINE_METHOD0(int, Init)
- DEFINE_METHOD1(int, LoadGYM, (const char* p1))
- DEFINE_METHOD1(void, FreeGYM, (int p1))
- DEFINE_METHOD2(int, FillBuffer, (int p1, void* p2))
- DEFINE_METHOD2(void, Seek, (int p1, unsigned int p2))
- DEFINE_METHOD1(int, GetTitle, (int p1))
- DEFINE_METHOD1(int, GetArtist, (int p1))
- DEFINE_METHOD1(__int64, GetLength, (int p1))
- BEGIN_METHOD_RESOLVE()
- RESOLVE_METHOD_RENAME(DLL_Init, Init)
- RESOLVE_METHOD_RENAME(DLL_LoadGYM, LoadGYM)
- RESOLVE_METHOD_RENAME(DLL_FreeGYM, FreeGYM)
- RESOLVE_METHOD_RENAME(DLL_FillBuffer, FillBuffer)
- RESOLVE_METHOD_RENAME(DLL_Seek, Seek)
- RESOLVE_METHOD_RENAME(DLL_GetTitle, GetTitle)
- RESOLVE_METHOD_RENAME(DLL_GetArtist, GetArtist)
- RESOLVE_METHOD_RENAME(DLL_GetLength, GetLength)
- END_METHOD_RESOLVE()
-};
diff --git a/xbmc/cores/paplayer/GYMCodec.cpp b/xbmc/cores/paplayer/GYMCodec.cpp
deleted file mode 100644
index ca1a784e5c..0000000000
--- a/xbmc/cores/paplayer/GYMCodec.cpp
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Copyright (C) 2005-2008 Team XBMC
- * http://www.xbmc.org
- *
- * This Program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This Program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with XBMC; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- * http://www.gnu.org/copyleft/gpl.html
- *
- */
-
-#include "GYMCodec.h"
-#include "cores/DllLoader/DllLoader.h"
-#include "utils/log.h"
-
-GYMCodec::GYMCodec()
-{
- m_CodecName = L"GYM";
- m_iDataInBuffer = 0;
- m_szBuffer = NULL;
- m_gym = 0;
- m_iDataPos = 0;
-}
-
-GYMCodec::~GYMCodec()
-{
- DeInit();
-}
-
-bool GYMCodec::Init(const CStdString &strFile, unsigned int filecache)
-{
- if (!m_dll.Load())
- return false; // error logged previously
-
- m_iBufferSize = m_dll.Init();
-
- m_gym = m_dll.LoadGYM(strFile.c_str());
- if (!m_gym)
- {
- CLog::Log(LOGERROR,"GYMCodec: error opening file %s!",strFile.c_str());
- return false;
- }
-
- m_Channels = 2;
- m_SampleRate = 48000;
- m_BitsPerSample = 16;
- m_TotalTime = m_dll.GetLength(m_gym);
- m_szBuffer = new char[m_iBufferSize];
- m_iDataPos = 0;
-
- return true;
-}
-
-void GYMCodec::DeInit()
-{
- if (m_gym)
- m_dll.FreeGYM(m_gym);
- m_gym = 0;
-
- if (m_szBuffer)
- delete[] m_szBuffer;
- m_szBuffer = NULL;
-}
-
-__int64 GYMCodec::Seek(__int64 iSeekTime)
-{
- m_dll.Seek(m_gym,(unsigned int) (iSeekTime/1000*60));
-
- m_iDataPos = iSeekTime/1000*48000*4;
- return iSeekTime;
-}
-
-int GYMCodec::ReadPCM(BYTE *pBuffer, int size, int *actualsize)
-{
- if (m_iDataPos >= m_TotalTime/1000*48000*4)
- return READ_EOF;
-
- if (m_iDataInBuffer <= 0)
- {
- if (!m_dll.FillBuffer(m_gym,m_szBuffer))
- return READ_ERROR;
- m_iDataInBuffer = m_iBufferSize;
- m_szStartOfBuffer = m_szBuffer;
- }
-
- *actualsize= size<m_iDataInBuffer?size:m_iDataInBuffer;
- memcpy(pBuffer,m_szStartOfBuffer,*actualsize);
- m_szStartOfBuffer += *actualsize;
- m_iDataInBuffer -= *actualsize;
- m_iDataPos += *actualsize;
-
- return READ_SUCCESS;
-}
-
-bool GYMCodec::CanInit()
-{
- return m_dll.CanLoad();
-}
diff --git a/xbmc/cores/paplayer/GYMCodec.h b/xbmc/cores/paplayer/GYMCodec.h
deleted file mode 100644
index b82b560b35..0000000000
--- a/xbmc/cores/paplayer/GYMCodec.h
+++ /dev/null
@@ -1,51 +0,0 @@
-#ifndef GYM_CODEC_H_
-#define GYM_CODEC_H_
-
-/*
- * Copyright (C) 2005-2008 Team XBMC
- * http://www.xbmc.org
- *
- * This Program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This Program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with XBMC; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- * http://www.gnu.org/copyleft/gpl.html
- *
- */
-
-#include "ICodec.h"
-#include "DllGensApu.h"
-
-class GYMCodec : public ICodec
-{
-public:
- GYMCodec();
- virtual ~GYMCodec();
-
- virtual bool Init(const CStdString &strFile, unsigned int filecache);
- virtual void DeInit();
- virtual __int64 Seek(__int64 iSeekTime);
- virtual int ReadPCM(BYTE *pBuffer, int size, int *actualsize);
- virtual bool CanInit();
-
-private:
- DllGensApu m_dll;
- char* m_szBuffer;
- char* m_szStartOfBuffer; // never allocated
- int m_iDataInBuffer;
- int m_iBufferSize;
- int m_gym;
- __int64 m_iDataPos;
-};
-
-#endif
-
diff --git a/xbmc/cores/paplayer/GYMCodec/Makefile.in b/xbmc/cores/paplayer/GYMCodec/Makefile.in
deleted file mode 100644
index 50cc5fac4d..0000000000
--- a/xbmc/cores/paplayer/GYMCodec/Makefile.in
+++ /dev/null
@@ -1,23 +0,0 @@
-ARCH=@ARCH@
-
-CFLAGS+=-D_LINUX -fPIC -I../../../linux -I../../../ -I../../../../guilib/
-CXXFLAGS+=-D_LINUX -fPIC -I../../../linux -I../../../ -I../../../../guilib/
-OBJS=gym_play.o psg.o XBMCGYM.o ym2612.o
-ifeq ($(ARCH), powerpc-osx)
- BUNDLE1_O=-lbundle1.o -L/usr/lib/gcc/powerpc-apple-darwin8/4.0.1/ -lgcc
-endif
-
-SLIB=../../../../system/players/paplayer/gensapu-@ARCH@.so
-
-$(SLIB): $(OBJS)
-ifeq ($(findstring osx,$(ARCH)), osx)
- ld -bundle -flat_namespace -undefined suppress -o $@ *.o $(BUNDLE1_O)
- ../../../../tools/Mach5/wrapper.rb $@;mv output.so $@
- chmod +x $@
-else
- $(CXX) $(CXXFLAGS) $(LDFLAGS) -shared -o $@ *.o `cat ../../DllLoader/exports/wrapper.def` ../../DllLoader/exports/wrapper.o
-
-endif
-
-include ../../../../Makefile.include
-
diff --git a/xbmc/cores/paplayer/GYMCodec/XBMCGYM.cpp b/xbmc/cores/paplayer/GYMCodec/XBMCGYM.cpp
deleted file mode 100644
index d965f31401..0000000000
--- a/xbmc/cores/paplayer/GYMCodec/XBMCGYM.cpp
+++ /dev/null
@@ -1,251 +0,0 @@
-/*
- * Copyright (C) 2008-2010 Team XBMC
- * http://www.xbmc.org
- *
- * This Program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This Program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with XBMC; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- * http://www.gnu.org/copyleft/gpl.html
- *
- */
-
-#include <cstdio>
-#include <cstdlib>
-#include <cstring>
-#include <cmath>
-
-#ifndef _LINUX
-#include <windows.h>
-#else
-#include "PlatformInclude.h"
-#undef __declspec
-#define __declspec(x)
-#endif
-
-#include "gym_play.h"
-#include "ym2612.h"
-#include "psg.h"
-
-HANDLE hMutex = NULL;
-
-extern "C"
-{
- extern struct ym2612__ YM2612;
- extern struct _psg PSG;
-
- struct GYMSong
- {
- unsigned char* gym; // this is the one alloced
- unsigned char* gymStart;
- unsigned char* gymPos;
- unsigned int gymSize;
- struct GYMTAG
- {
- char gym_id[4];
- char song_title[32];
- char game_title[32];
- char game_publisher[32];
- char dumper_emu[32];
- char dumper_person[32];
- char comments[256];
- unsigned int looped;
- unsigned int compressed;
- };
- GYMTAG* gymTag;
- __int64 iLength;
- int Seg_L[1600], Seg_R[1600];
- struct ym2612__ YM2612;
- struct _psg PSG;
- };
-
- __int64 calc_gym_time_length(GYMSong* gym)
- {
- if (gym->gymStart == 0 || gym->gymSize == 0)
- return 0;
-
- unsigned int loop, num_zeros = 0;
-
- for(loop = 0; loop < gym->gymSize; loop++)
- {
- switch(gym->gymStart[loop])
- {
- case(0x00):
- num_zeros++;
- continue;
- case(0x01):
- loop += 2;
- continue;
- case(0x02):
- loop += 2;
- continue;
- case(0x03):
- loop += 1;
- continue;
- }
- }
-
- return (__int64)(num_zeros)*1000/60;
- }
-
- int __declspec(dllexport) DLL_Init()
- {
- if (!hMutex)
- {
- hMutex = CreateMutex(NULL,true,NULL);
- YM2612_Enable = true;
- YM2612_Improv = true;
-
- Chan_Enable[0] = true;
- Chan_Enable[1] = true;
- Chan_Enable[2] = true;
- Chan_Enable[3] = true;
- Chan_Enable[4] = true;
- Chan_Enable[5] = true;
- DAC_Enable = true;
-
- PSG_Enable = true;
- PSG_Improv = true;
-
- PSG_Chan_Enable[0] = true;
- PSG_Chan_Enable[1] = true;
- PSG_Chan_Enable[2] = true;
- PSG_Chan_Enable[3] = true;
-
- ReleaseMutex(hMutex);
- }
- return (int) ceil(48000/60.0) << 2;
- }
-
- void __declspec(dllexport) DLL_DeInit()
- {
- }
-
- long __declspec(dllexport) DLL_LoadGYM(const char *szFileName)
- {
- GYMSong* result = new GYMSong;
- FILE* f = fopen(szFileName,"rb");
- int iResult = 0;
- if (f)
- {
- WaitForSingleObject(hMutex,INFINITE);
- fseek(f,0,SEEK_END);
- result->gymSize = ftell(f);
- fseek(f,0,SEEK_SET);
- result->gym = (unsigned char*)malloc(result->gymSize*sizeof(unsigned char));
- unsigned int iRead = 0;
- result->gymPos = result->gym;
- while (iRead < result->gymSize)
- {
- if (fread(result->gym,1,result->gymSize,f) != 1)
- break;
-
- int iCurrRead = fread(result->gymPos,1,16384,f);
- if (iCurrRead > 0)
- {
- iRead += iCurrRead;
- ReleaseMutex(hMutex);
- Sleep(10); // prevent starving pap during xfade
- WaitForSingleObject(hMutex,INFINITE);
- }
- else
- break;
- }
-
- fclose(f);
- result->gymTag = (GYMSong::GYMTAG*)result->gym;
- if (strncmp(((GYMSong::GYMTAG*)result->gym)->gym_id, "GYMX", 4) == 0)
- {
- result->gymStart = result->gymPos = result->gym+sizeof(GYMSong::GYMTAG);
- result->gymSize -= sizeof(GYMSong::GYMTAG);
- result->iLength = calc_gym_time_length(result);
- }
- else
- {
- result->gymStart = result->gymPos = result->gym;
- result->gymTag = NULL;
- }
-
-
- result->YM2612 = YM2612;
- result->PSG = PSG;
- Start_Play_GYM(48000);
- iResult = (long)result;
- ReleaseMutex(hMutex);
- }
-
- return (int)iResult;
- }
-
- void __declspec(dllexport) DLL_FreeGYM(int gym)
- {
- GYMSong* song = (GYMSong*)gym;
- free(song->gym);
- free(song);
- }
-
- int __declspec(dllexport) DLL_FillBuffer(int gym, char* szBuffer)
- {
- WaitForSingleObject(hMutex,INFINITE);
- GYMSong* song = (GYMSong*)gym;
- Seg_L = song->Seg_L;
- Seg_R = song->Seg_R;
- YM2612 = song->YM2612;
- PSG = song->PSG;
- song->gymPos = Play_GYM(szBuffer,song->gymStart,song->gymPos,song->gymSize,0);
- song->YM2612 = YM2612;
- song->PSG = PSG;
- ReleaseMutex(hMutex);
- if (!song->gymPos)
- return 0;
-
- return 1;
- }
-
- void __declspec(dllexport) DLL_Seek(int gym, unsigned int iPos)
- {
- WaitForSingleObject(hMutex,INFINITE);
- GYMSong* song = (GYMSong*)gym;
- Seg_L = song->Seg_L;
- Seg_R = song->Seg_R;
- YM2612 = song->YM2612;
- PSG = song->PSG;
- jump_gym_time_pos(song->gymStart,song->gymSize,iPos);
- song->YM2612 = YM2612;
- song->PSG = PSG;
- ReleaseMutex(hMutex);
- }
-
- long __declspec(dllexport) DLL_GetArtist(int gym)
- {
- GYMSong* song = (GYMSong*)gym;
- if (song->gymTag)
- return (long)song->gymTag->game_publisher;
-
- return 0;
- }
-
- long __declspec(dllexport) DLL_GetTitle(int gym)
- {
- GYMSong* song = (GYMSong*)gym;
- if (song->gymTag)
- return (long)song->gymTag->song_title;
-
- return 0;
- }
-
- __int64 __declspec(dllexport) DLL_GetLength(int gym)
- {
- GYMSong* song = (GYMSong*)gym;
- return song->iLength;
- }
-}
diff --git a/xbmc/cores/paplayer/GYMCodec/gensapu.sln b/xbmc/cores/paplayer/GYMCodec/gensapu.sln
deleted file mode 100644
index 3c0de0e4c4..0000000000
--- a/xbmc/cores/paplayer/GYMCodec/gensapu.sln
+++ /dev/null
@@ -1,21 +0,0 @@
-Microsoft Visual Studio Solution File, Format Version 8.00
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gensapu", "gensapu.vcproj", "{60D5F6A6-8D2E-4040-8728-B1156AFD1A42}"
- ProjectSection(ProjectDependencies) = postProject
- EndProjectSection
-EndProject
-Global
- GlobalSection(SolutionConfiguration) = preSolution
- Debug = Debug
- Release = Release
- EndGlobalSection
- GlobalSection(ProjectConfiguration) = postSolution
- {60D5F6A6-8D2E-4040-8728-B1156AFD1A42}.Debug.ActiveCfg = Debug|Win32
- {60D5F6A6-8D2E-4040-8728-B1156AFD1A42}.Debug.Build.0 = Debug|Win32
- {60D5F6A6-8D2E-4040-8728-B1156AFD1A42}.Release.ActiveCfg = Release|Win32
- {60D5F6A6-8D2E-4040-8728-B1156AFD1A42}.Release.Build.0 = Release|Win32
- EndGlobalSection
- GlobalSection(ExtensibilityGlobals) = postSolution
- EndGlobalSection
- GlobalSection(ExtensibilityAddIns) = postSolution
- EndGlobalSection
-EndGlobal
diff --git a/xbmc/cores/paplayer/GYMCodec/gensapu.vcproj b/xbmc/cores/paplayer/GYMCodec/gensapu.vcproj
deleted file mode 100644
index 4c764abd02..0000000000
--- a/xbmc/cores/paplayer/GYMCodec/gensapu.vcproj
+++ /dev/null
@@ -1,234 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="7.10"
- Name="gensapu"
- ProjectGUID="{60D5F6A6-8D2E-4040-8728-B1156AFD1A42}"
- SccProjectName=""
- SccLocalPath="">
- <Platforms>
- <Platform
- Name="Win32"/>
- </Platforms>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory=".\Debug"
- IntermediateDirectory=".\Debug"
- ConfigurationType="2"
- UseOfMFC="0"
- ATLMinimizesCRunTimeLibraryUsage="FALSE"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories=""
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SUPPORT_YMAMP20B_EZPK"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- PrecompiledHeaderFile=""
- AssemblerListingLocation=".\Debug/"
- ObjectFile=".\Debug/"
- ProgramDataBaseFileName=".\Debug/"
- BrowseInformation="1"
- WarningLevel="3"
- SuppressStartupBanner="TRUE"
- DebugInformationFormat="4"
- CompileAs="0"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- IgnoreImportLibrary="TRUE"
- OutputFile="Debug/gensapu.dll"
- LinkIncremental="0"
- SuppressStartupBanner="TRUE"
- GenerateDebugInformation="TRUE"
- ProgramDatabaseFile="Debug/gensapu.pdb"
- ImportLibrary="Debug/gensapu.lib"
- TargetMachine="1"/>
- <Tool
- Name="VCMIDLTool"
- PreprocessorDefinitions="_DEBUG"
- MkTypLibCompatible="TRUE"
- SuppressStartupBanner="TRUE"
- TargetEnvironment="1"
- TypeLibraryName="Debug/gensapu.tlb"
- HeaderFileName=""/>
- <Tool
- Name="VCPostBuildEventTool"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"
- PreprocessorDefinitions="_DEBUG"
- Culture="1033"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory=".\Release"
- IntermediateDirectory=".\Release"
- ConfigurationType="2"
- UseOfMFC="0"
- ATLMinimizesCRunTimeLibraryUsage="FALSE"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="1"
- InlineFunctionExpansion="1"
- AdditionalIncludeDirectories=""
- PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;SUPPORT_YMAMP20B_EZPK"
- StringPooling="TRUE"
- RuntimeLibrary="2"
- EnableFunctionLevelLinking="TRUE"
- UsePrecompiledHeader="0"
- PrecompiledHeaderFile=""
- AssemblerListingLocation=".\Release/"
- ObjectFile=".\Release/"
- ProgramDataBaseFileName=".\Release/"
- BrowseInformation="1"
- WarningLevel="3"
- SuppressStartupBanner="TRUE"
- CompileAs="0"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- IgnoreImportLibrary="TRUE"
- OutputFile="Release/gensapu.dll"
- LinkIncremental="1"
- SuppressStartupBanner="TRUE"
- ProgramDatabaseFile=".\Release/gensapu.pdb"
- ImportLibrary=".\Release/gensapu.lib"
- TargetMachine="1"/>
- <Tool
- Name="VCMIDLTool"
- PreprocessorDefinitions="NDEBUG"
- MkTypLibCompatible="TRUE"
- SuppressStartupBanner="TRUE"
- TargetEnvironment="1"
- TypeLibraryName=".\Release/gensapu.tlb"
- HeaderFileName=""/>
- <Tool
- Name="VCPostBuildEventTool"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"
- PreprocessorDefinitions="NDEBUG"
- Culture="1033"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <File
- RelativePath="gym_play.cpp">
- <FileConfiguration
- Name="Debug|Win32">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories=""
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;FOO_GYM_EXPORTS;SUPPORT_YMAMP20B_EZPK;$(NoInherit)"
- BasicRuntimeChecks="3"
- BrowseInformation="1"/>
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="1"
- AdditionalIncludeDirectories=""
- PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;FOO_GYM_EXPORTS;SUPPORT_YMAMP20B_EZPK;$(NoInherit)"
- BrowseInformation="1"/>
- </FileConfiguration>
- </File>
- <File
- RelativePath="gym_play.h">
- </File>
- <File
- RelativePath="psg.c">
- <FileConfiguration
- Name="Debug|Win32">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories=""
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;FOO_GYM_EXPORTS;SUPPORT_YMAMP20B_EZPK;$(NoInherit)"
- BasicRuntimeChecks="3"
- BrowseInformation="1"/>
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="1"
- AdditionalIncludeDirectories=""
- PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;FOO_GYM_EXPORTS;SUPPORT_YMAMP20B_EZPK;$(NoInherit)"
- BrowseInformation="1"/>
- </FileConfiguration>
- </File>
- <File
- RelativePath="psg.h">
- </File>
- <File
- RelativePath="resource.h">
- </File>
- <File
- RelativePath=".\XBMCGYM.cpp">
- </File>
- <File
- RelativePath="ym2612.c">
- <FileConfiguration
- Name="Debug|Win32">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories=""
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;FOO_GYM_EXPORTS;SUPPORT_YMAMP20B_EZPK;$(NoInherit)"
- BasicRuntimeChecks="3"
- BrowseInformation="1"/>
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="1"
- AdditionalIncludeDirectories=""
- PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;FOO_GYM_EXPORTS;SUPPORT_YMAMP20B_EZPK;$(NoInherit)"
- BrowseInformation="1"/>
- </FileConfiguration>
- </File>
- <File
- RelativePath="ym2612.h">
- </File>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/xbmc/cores/paplayer/GYMCodec/gym_play.cpp b/xbmc/cores/paplayer/GYMCodec/gym_play.cpp
deleted file mode 100644
index 093e59f6b9..0000000000
--- a/xbmc/cores/paplayer/GYMCodec/gym_play.cpp
+++ /dev/null
@@ -1,256 +0,0 @@
-/*
- * Copyright (C) 2008-2010 Team XBMC
- * http://www.xbmc.org
- *
- * This Program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This Program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with XBMC; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- * http://www.gnu.org/copyleft/gpl.html
- *
- */
-
-#include <stdio.h>
-#include <memory.h>
-#include <math.h>
-#include "gym_play.h"
-#include "psg.h"
-#include "ym2612.h"
-
-//int Seg_L[1600], Seg_R[1600];
-int* Seg_L; int* Seg_R;
-int Seg_Lenght;
-
-#define CLOCK_NTSC 53700000 //53693175
-
-unsigned int Sound_Extrapol[312][2];
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* #ifdef __cplusplus */
-
-int VDP_Current_Line = 0;
-int GYM_Dumping = 0;
-
-int Update_GYM_Dump(char v0, char v1, char v2)
-{
- return 0;
-}
-
-#ifdef __cplusplus
-}
-#endif /* #ifdef __cplusplus */
-
-unsigned char *jump_gym_time_pos(unsigned char *gym_start, unsigned int gym_size, unsigned int new_pos)
-{
- unsigned int loop, num_zeros = 0;
-
- for (loop = 0; num_zeros < new_pos; loop++)
- {
- if (loop > gym_size)
- {
- return 0;
- }
-
- switch(gym_start[loop])
- {
- case(0x00):
- num_zeros++;
- continue;
- case(0x01):
- loop += 2;
- continue;
- case(0x02):
- loop += 2;
- continue;
- case(0x03):
- loop += 1;
- continue;
- }
- }
-
- return (gym_start + loop);
-}
-
-void Write_Sound_Stereo(short *Dest, int lenght)
-{
- int i, out_L, out_R;
- short *dest = Dest;
-
- for(i = 0; i < Seg_Lenght; i++)
- {
- out_L = Seg_L[i];
- Seg_L[i] = 0;
-
- if (out_L < -0x7FFF) *dest++ = -0x7FFF;
- else if (out_L > 0x7FFF) *dest++ = 0x7FFF;
- else *dest++ = (short) out_L;
-
- out_R = Seg_R[i];
- Seg_R[i] = 0;
-
- if (out_R < -0x7FFF) *dest++ = -0x7FFF;
- else if (out_R > 0x7FFF) *dest++ = 0x7FFF;
- else *dest++ = (short) out_R;
- }
-}
-
-void Start_Play_GYM(int sampleRate)
-{
- Seg_Lenght = (int) ceil(sampleRate / 60.0);
-
-/* memset(Seg_L, 0, Seg_Lenght << 2);
- memset(Seg_R, 0, Seg_Lenght << 2);*/
-
- YM2612_Init(CLOCK_NTSC / 7, sampleRate, YM2612_Improv);
- PSG_Init(CLOCK_NTSC / 15, sampleRate);
-}
-
-unsigned char *GYM_Next(unsigned char *gym_start, unsigned char *gym_pos, unsigned int gym_size, unsigned int gym_loop)
-{
- unsigned char c, c2;
-
- unsigned char dac_data[1600];
-
- int *buf[2];
- int dacMax = 0, i = 0;
-
- int oldPos = 0;
- double curPos = 0;
- double dacSize;
- int step;
- int *dacBuf[2];
- int retCode = 1;
-
- YM_Buf[0] = PSG_Buf[0] = buf[0] = Seg_L;
- YM_Buf[1] = PSG_Buf[1] = buf[1] = Seg_R;
-
- YM_Len = PSG_Len = 0;
-
- memset(dac_data, 0, sizeof(dac_data));
-
- if (!gym_pos)
- {
- return 0;
- }
-
- if ((unsigned int)(gym_pos - gym_start) >= gym_size)
- {
- if (gym_loop)
- {
- gym_pos = jump_gym_time_pos(gym_start, gym_size, gym_loop - 1);
- }
- else
- {
- return 0;
- }
- }
-
- do
- {
- c = *gym_pos++;
-
- switch(c)
- {
- case 0:
- if (YM2612_Enable)
- {
- // if dacMax is zero, dacSize will be NaN - so what, we won't
- // be using it in that case anyway :p
- dacSize = (double)Seg_Lenght / dacMax;
-
- for (i = 0; i < dacMax; i++)
- {
- oldPos = (int)curPos;
-
- YM2612_Write(0, 0x2A);
- YM2612_Write(1, dac_data[i]);
-
- if (i == dacMax - 1)
- {
- step = Seg_Lenght - oldPos;
- }
- else
- {
- curPos += dacSize;
- step = (int)curPos - oldPos;
- }
-
- dacBuf[0] = buf[0] + (int)oldPos;
- dacBuf[1] = buf[1] + (int)oldPos;
-
- YM2612_DacAndTimers_Update(dacBuf, step);
- }
-
- YM2612_Update(buf, Seg_Lenght);
- }
- if (PSG_Enable)
- {
- if (PSG_Improv)
- {
- PSG_Update_SIN(buf, Seg_Lenght);
- }
- else
- {
- PSG_Update(buf, Seg_Lenght);
- }
- }
- break;
-
- case 1:
- c2 = *gym_pos++;
-
- if (c2 == 0x2A)
- {
- c2 = *gym_pos++;
- dac_data[dacMax++] = c2;
- }
- else
- {
- YM2612_Write(0, c2);
- c2 = *gym_pos++;
- YM2612_Write(1, c2);
- }
- break;
-
- case 2:
- c2 = *gym_pos++;
- YM2612_Write(2, c2);
-
- c2 = *gym_pos++;
- YM2612_Write(3, c2);
- break;
-
- case 3:
- c2 = *gym_pos++;
- PSG_Write(c2);
- break;
- }
-
- } while (c);
-
- return gym_pos;
-}
-
-unsigned char *Play_GYM(void *Dump_Buf, unsigned char *gym_start, unsigned char *gym_pos, unsigned int gym_size, unsigned int gym_loop)
-{
- unsigned char *new_gym_pos = GYM_Next(gym_start, gym_pos, gym_size, gym_loop);
-
- if (new_gym_pos == 0)
- {
- return 0;
- }
-
- Write_Sound_Stereo((short *)Dump_Buf, Seg_Lenght);
-
- return new_gym_pos;
-}
diff --git a/xbmc/cores/paplayer/GYMCodec/gym_play.h b/xbmc/cores/paplayer/GYMCodec/gym_play.h
deleted file mode 100644
index 47e199c28e..0000000000
--- a/xbmc/cores/paplayer/GYMCodec/gym_play.h
+++ /dev/null
@@ -1,47 +0,0 @@
-#ifndef SOUND_H
-#define SOUND_H
-/*
- * Copyright (C) 2008-2010 Team XBMC
- * http://www.xbmc.org
- *
- * This Program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This Program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with XBMC; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- * http://www.gnu.org/copyleft/gpl.html
- *
- */
-
-/////////////////////////////////////////////////////////////////////////////////////////////
-// SOUND.H
-/////////////////////////////////////////////////////////////////////////////////////////////
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* #ifdef __cplusplus */
-
-extern int* Seg_L, *Seg_R;
-extern int Seg_Lenght;
-
-extern unsigned int Sound_Extrapol[312][2];
-
-void Start_Play_GYM(int sampleRate);
-unsigned char *Play_GYM(void *Dump_Buf, unsigned char *gym_start, unsigned char *gym_pos, unsigned int gym_size, unsigned int gym_loop);
-
-unsigned char *jump_gym_time_pos(unsigned char *gym_start, unsigned int gym_size, unsigned int new_pos);
-
-#ifdef __cplusplus
-}
-#endif /* #ifdef __cplusplus */
-
-#endif
-
diff --git a/xbmc/cores/paplayer/GYMCodec/psg.c b/xbmc/cores/paplayer/GYMCodec/psg.c
deleted file mode 100644
index c3a71761c8..0000000000
--- a/xbmc/cores/paplayer/GYMCodec/psg.c
+++ /dev/null
@@ -1,491 +0,0 @@
-/***************************************************************************
- * Gens: TI SN76489 (PSG) emulator. *
- * *
- * Copyright (c) 1999-2002 by Stéphane Dallongeville *
- * Copyright (c) 2003-2004 by Stéphane Akhoun *
- * Copyright (c) 2008-2009 by David Korth *
- * *
- * This program is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU General Public License as published by the *
- * Free Software Foundation; either version 2 of the License, or (at your *
- * option) any later version. *
- * *
- * This program 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 General Public License for more details. *
- * *
- * 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. *
- ***************************************************************************/
-
-/***********************************************************/
-/* */
-/* PSG.C : SN76489 emulator */
-/* */
-/* Noise define constantes taken from MAME */
-/* */
-/* This source is a part of Gens project */
-/* Written by Stéphane Dallongeville (gens@consolemul.com) */
-/* Copyright (c) 2002 by Stéphane Dallongeville */
-/* */
-/***********************************************************/
-
-#include <stdio.h>
-#include <math.h>
-#include "psg.h"
-
-
-/* Defines */
-
-#ifndef PI
-#define PI 3.14159265358979323846
-#endif
-
-// Change MAX_OUTPUT to change PSG volume (default = 0x7FFF)
-
-#define MAX_OUTPUT 0x4FFF
-
-#define W_NOISE 0x12000
-#define P_NOISE 0x08000
-
-//#define NOISE_DEF 0x0f35
-//#define NOISE_DEF 0x0001
-#define NOISE_DEF 0x4000
-
-#define PSG_DEBUG_LEVEL 0
-
-#if PSG_DEBUG_LEVEL > 0
-
-#define PSG_DEBUG_0(x) \
-fprintf(psg_debug_file, (x));
-#define PSG_DEBUG_1(x, a) \
-fprintf(psg_debug_file, (x), (a));
-#define PSG_DEBUG_2(x, a, b) \
-fprintf(psg_debug_file, (x), (a), (b));
-#define PSG_DEBUG_3(x, a, b, c) \
-fprintf(psg_debug_file, (x), (a), (b), (c));
-#define PSG_DEBUG_4(x, a, b, c, d) \
-fprintf(psg_debug_file, (x), (a), (b), (c), (d));
-
-#else
-
-#define PSG_DEBUG_0(x)
-#define PSG_DEBUG_1(x, a)
-#define PSG_DEBUG_2(x, a, b)
-#define PSG_DEBUG_3(x, a, b, c)
-#define PSG_DEBUG_4(x, a, b, c, d)
-
-#endif
-
-
-/* Variables */
-
-unsigned int PSG_SIN_Table[16][512];
-unsigned int PSG_Step_Table[1024];
-unsigned int PSG_Volume_Table[16];
-unsigned int PSG_Noise_Step_Table[4];
-unsigned int PSG_Save[8];
-
-struct _psg PSG;
-
-#if PSG_DEBUG_LEVEL > 0
-FILE *psg_debug_file = NULL;
-#endif
-
-
-/* Gens specific extern and variables */
-
-extern unsigned int Sound_Extrapol[312][2];
-extern int Seg_L[882], Seg_R[882];
-extern int VDP_Current_Line;
-extern int GYM_Dumping;
-
-int Update_GYM_Dump(char v0, char v1, char v2);
-
-int PSG_Enable;
-int PSG_Improv;
-int *PSG_Buf[2];
-int PSG_Len = 0;
-
-int PSG_Chan_Enable[4];
-
-/* Functions */
-
-void PSG_Write(int data)
-{
- if (GYM_Dumping) Update_GYM_Dump((unsigned char) 3, (unsigned char) data, (unsigned char) 0);
-
- if (data & 0x80)
- {
- PSG.Current_Register = (data & 0x70) >> 4;
- PSG.Current_Channel = PSG.Current_Register >> 1;
-
- data &= 0x0F;
-
- PSG.Register[PSG.Current_Register] = (PSG.Register[PSG.Current_Register] & 0x3F0) | data;
-
- if (PSG.Current_Register & 1)
- {
- // Volume
-
- PSG_Special_Update();
-
- PSG.Volume[PSG.Current_Channel] = PSG_Volume_Table[data];
-
- PSG_DEBUG_2("channel %d volume = %.8X\n", PSG.Current_Channel, PSG.Volume[PSG.Current_Channel]);
- }
- else
- {
- // Frequency
-
- PSG_Special_Update();
-
- if (PSG.Current_Channel != 3)
- {
- // Normal channel
-
- PSG.CntStep[PSG.Current_Channel] = PSG_Step_Table[PSG.Register[PSG.Current_Register]];
-
- if ((PSG.Current_Channel == 2) && ((PSG.Register[6] & 3) == 3))
- {
- PSG.CntStep[3] = PSG.CntStep[2] >> 1;
- }
-
- PSG_DEBUG_2("channel %d step = %.8X\n", PSG.Current_Channel, PSG.CntStep[PSG.Current_Channel]);
- }
- else
- {
- // Noise channel
-
- PSG.Noise = NOISE_DEF;
- PSG_Noise_Step_Table[3] = PSG.CntStep[2] >> 1;
- PSG.CntStep[3] = PSG_Noise_Step_Table[data & 3];
-
- if (data & 4) PSG.Noise_Type = W_NOISE;
- else PSG.Noise_Type = P_NOISE;
-
- PSG_DEBUG_1("channel N type = %.2X\n", data);
- }
- }
- }
- else
- {
- if (!(PSG.Current_Register & 1))
- {
- // Frequency
-
- if (PSG.Current_Channel != 3)
- {
- PSG_Special_Update();
-
- PSG.Register[PSG.Current_Register] = (PSG.Register[PSG.Current_Register] & 0x0F) | ((data & 0x3F) << 4);
-
- PSG.CntStep[PSG.Current_Channel] = PSG_Step_Table[PSG.Register[PSG.Current_Register]];
-
- if ((PSG.Current_Channel == 2) && ((PSG.Register[6] & 3) == 3))
- {
- PSG.CntStep[3] = PSG.CntStep[2] >> 1;
- }
-
- PSG_DEBUG_2("channel %d step = %.8X\n", PSG.Current_Channel, PSG.CntStep[PSG.Current_Channel]);
- }
- }
- }
-}
-
-
-void PSG_Update_SIN(int **buffer, int length)
-{
- int i, j, out;
- int cur_cnt, cur_step, cur_vol;
- unsigned int *sin_t;
-
- for(j = 2; j >= 0; j--)
- {
- if (PSG.Volume[j])
- {
- cur_cnt = PSG.Counter[j];
- cur_step = PSG.CntStep[j];
- sin_t = PSG_SIN_Table[PSG.Register[(j << 1) + 1]];
-
- for(i = 0; i < length; i++)
- {
- out = sin_t[(cur_cnt = (cur_cnt + cur_step) & 0x1FFFF) >> 8];
-
- if (PSG_Chan_Enable[j])
- {
- buffer[0][i] += out;
- buffer[1][i] += out;
- }
- }
-
- PSG.Counter[j] = cur_cnt;
- }
- else PSG.Counter[j] += PSG.CntStep[j] * length;
- }
-
-
- // Channel 3 - Noise
-
- if ((cur_vol = PSG.Volume[3]))
- {
- cur_cnt = PSG.Counter[3];
- cur_step = PSG.CntStep[3];
-
- for(i = 0; i < length; i++)
- {
- cur_cnt += cur_step;
-
- if (PSG.Noise & 1)
- {
- if (PSG_Chan_Enable[3])
- {
- buffer[0][i] += cur_vol;
- buffer[1][i] += cur_vol;
- }
-
- if (cur_cnt & 0x10000)
- {
- cur_cnt &= 0xFFFF;
- PSG.Noise = (PSG.Noise ^ PSG.Noise_Type) >> 1;
- }
- }
- else if (cur_cnt & 0x10000)
- {
- cur_cnt &= 0xFFFF;
- PSG.Noise >>= 1;
- }
- }
-
- PSG.Counter[3] = cur_cnt;
- }
- else PSG.Counter[3] += PSG.CntStep[3] * length;
-}
-
-
-void PSG_Update(int **buffer, int length)
-{
- int i, j;
- int cur_cnt, cur_step, cur_vol;
-
- for(j = 2; j >= 0; j--)
- {
- if ((cur_vol = PSG.Volume[j]))
- {
- if ((cur_step = PSG.CntStep[j]) < 0x10000)
- {
- cur_cnt = PSG.Counter[j];
-
- for(i = 0; i < length; i++)
- {
- if ((cur_cnt += cur_step) & 0x10000)
- {
- if (PSG_Chan_Enable[j])
- {
- buffer[0][i] += cur_vol;
- buffer[1][i] += cur_vol;
- }
- }
- }
-
- PSG.Counter[j] = cur_cnt;
- }
- else
- {
- for(i = 0; i < length; i++)
- {
- if (PSG_Chan_Enable[j])
- {
- buffer[0][i] += cur_vol;
- buffer[1][i] += cur_vol;
- }
- }
- }
- }
- else
- {
- PSG.Counter[j] += PSG.CntStep[j] * length;
- }
- }
-
- // Channel 3 - Noise
-
- if ((cur_vol = PSG.Volume[3]))
- {
- cur_cnt = PSG.Counter[3];
- cur_step = PSG.CntStep[3];
-
- for(i = 0; i < length; i++)
- {
- cur_cnt += cur_step;
-
- if (PSG.Noise & 1)
- {
- if (PSG_Chan_Enable[3])
- {
- buffer[0][i] += cur_vol;
- buffer[1][i] += cur_vol;
- }
-
- if (cur_cnt & 0x10000)
- {
- cur_cnt &= 0xFFFF;
- PSG.Noise = (PSG.Noise ^ PSG.Noise_Type) >> 1;
- }
- }
- else if (cur_cnt & 0x10000)
- {
- cur_cnt &= 0xFFFF;
- PSG.Noise >>= 1;
- }
- }
-
- PSG.Counter[3] = cur_cnt;
- }
- else PSG.Counter[3] += PSG.CntStep[3] * length;
-}
-
-
-void PSG_Init(int clock, int rate)
-{
- int i, j;
- double out;
-
-#if PSG_DEBUG_LEVEL > 0
- if (psg_debug_file == NULL)
- {
- psg_debug_file = fopen("psg.log", "w");
- fprintf(psg_debug_file, "PSG logging :\n\n");
- }
-#endif
-
- for(i = 1; i < 1024; i++)
- {
- // Step calculation
-
- out = (double) (clock) / (double) (i << 4); // out = frequency
- out /= (double) (rate);
- out *= 65536.0;
-
- PSG_Step_Table[i] = (unsigned int) out;
- }
-
- PSG_Step_Table[0] = PSG_Step_Table[1];
-
- for(i = 0; i < 3; i++)
- {
- out = (double) (clock) / (double) (1 << (9 + i));
- out /= (double) (rate);
- out *= 65536.0;
-
- PSG_Noise_Step_Table[i] = (unsigned int) out;
- }
-
- PSG_Noise_Step_Table[3] = 0;
-
- out = (double) MAX_OUTPUT / 3.0;
-
- for (i = 0; i < 15; i++)
- {
- PSG_Volume_Table[i] = (unsigned int) out;
- out /= 1.258925412; // = 10 ^ (2/20) = 2dB
- }
-
- PSG_Volume_Table[15] = 0;
-
-/*
- for(i = 0; i < 256; i++)
- {
- out = (i + 1.0) / 256.0;
-
- for(j = 0; j < 16; j++)
- {
- PSG_SIN_Table[j][i] = (unsigned int) (out * (double) PSG_Volume_Table[j]);
- }
- }
-
- for(i = 0; i < 256; i++)
- {
- out = 1.0 - ((i + 1.0) / 256.0);
-
- for(j = 0; j < 16; j++)
- {
- PSG_SIN_Table[j][i + 256] = (unsigned int) (out * (double) PSG_Volume_Table[j]);
- }
- }
-*/
- for(i = 0; i < 512; i++)
- {
- out = sin((2.0 * PI) * ((double) (i) / 512));
- out = sin((2.0 * PI) * ((double) (i) / 512));
-
- for(j = 0; j < 16; j++)
- {
- PSG_SIN_Table[j][i] = (unsigned int) (out * (double) PSG_Volume_Table[j]);
- }
- }
-
- PSG.Current_Register = 0;
- PSG.Current_Channel = 0;
- PSG.Noise = 0;
- PSG.Noise_Type = 0;
-
- for (i = 0; i < 4; i++)
- {
- PSG.Volume[i] = 0;
- PSG.Counter[i] = 0;
- PSG.CntStep[i] = 0;
- }
-
- for (i = 0; i < 8; i += 2)
- {
- PSG_Save[i] = 0;
- PSG_Save[i + 1] = 0x0F; // volume = OFF
- }
-
- PSG_Restore_State(); // Reset
-}
-
-
-void PSG_Save_State(void)
-{
- int i;
-
- for(i = 0; i < 8; i++) PSG_Save[i] = PSG.Register[i];
-}
-
-
-void PSG_Restore_State(void)
-{
- int i;
-
- for(i = 0; i < 8; i++)
- {
- PSG_Write(0x80 | (i << 4) | (PSG_Save[i] & 0xF));
- PSG_Write((PSG_Save[i] >> 4) & 0x3F);
- }
-}
-
-
-/* Gens */
-
-void PSG_Special_Update(void)
-{
- if (PSG_Len && PSG_Enable)
- {
- if (PSG_Improv) PSG_Update_SIN(PSG_Buf, PSG_Len);
- else PSG_Update(PSG_Buf, PSG_Len);
-
- PSG_Buf[0] = Seg_L + Sound_Extrapol[VDP_Current_Line + 1][0];
- PSG_Buf[1] = Seg_R + Sound_Extrapol[VDP_Current_Line + 1][0];
- PSG_Len = 0;
- }
-}
-
-#ifdef __PORT__
-void _PSG_Write(int data) __attribute__ ((alias ("PSG_Write")));
-#endif
-
-/* end */
diff --git a/xbmc/cores/paplayer/GYMCodec/psg.h b/xbmc/cores/paplayer/GYMCodec/psg.h
deleted file mode 100644
index 8ae995596a..0000000000
--- a/xbmc/cores/paplayer/GYMCodec/psg.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/***************************************************************************
- * Gens: TI SN76489 (PSG) emulator. *
- * *
- * Copyright (c) 1999-2002 by Stéphane Dallongeville *
- * Copyright (c) 2003-2004 by Stéphane Akhoun *
- * Copyright (c) 2008-2009 by David Korth *
- * *
- * This program is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU General Public License as published by the *
- * Free Software Foundation; either version 2 of the License, or (at your *
- * option) any later version. *
- * *
- * This program 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 General Public License for more details. *
- * *
- * 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. *
- ***************************************************************************/
-
-#ifndef _PSG_H
-#define _PSG_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-extern unsigned int PSG_Save[8];
-
-struct _psg
-{
- int Current_Channel;
- int Current_Register;
- int Register[8];
- unsigned int Counter[4];
- unsigned int CntStep[4];
- int Volume[4];
- unsigned int Noise_Type;
- unsigned int Noise;
-};
-
-extern struct _psg PSG;
-
-/* Gens */
-
-extern int PSG_Enable;
-extern int PSG_Improv;
-extern int *PSG_Buf[2];
-extern int PSG_Len;
-
-extern int PSG_Chan_Enable[4];
-
-/* end */
-
-void PSG_Write(int data);
-void PSG_Update_SIN(int **buffer, int length);
-void PSG_Update(int **buffer, int length);
-void PSG_Init(int clock, int rate);
-void PSG_Save_State(void);
-void PSG_Restore_State(void);
-
-/* Gens */
-
-void PSG_Special_Update(void);
-
-#ifdef __cplusplus
-};
-#endif
-
-#endif
diff --git a/xbmc/cores/paplayer/GYMCodec/readme.txt b/xbmc/cores/paplayer/GYMCodec/readme.txt
deleted file mode 100644
index ae4680feff..0000000000
--- a/xbmc/cores/paplayer/GYMCodec/readme.txt
+++ /dev/null
@@ -1,59 +0,0 @@
-Compiled using foobar2000 0.7 final SDK.
-
-Changes 1.4 -> 1.5
-------------------
-* Added options for looping tracks (number of loops and fade length)
-
-Changes 1.3 -> 1.4
-------------------
-* Finally fixed long-standing issues with memory leaks
-
-Changes 1.2b -> 1.3
--------------------
-* Compiled with 0.7 final SDK
-* Added options to allow for turning individual YM2612 and PSG channels on and off
-
-Changes 1.2a -> 1.2b
---------------------
-
-* Necessary changes for 0.7b29 SDK made
-
-Changes 1.2 -> 1.2a
--------------------
-
-* Only populates info fields if they aren't empty
-
-Changes 1.1 -> 1.2
-------------------
-
-* Fixed (I think) potential crash bug in loading EZPK-compressed GYM files
-* Necessary changes made for foobar 0.7(b13)
-* Some minor code cleanup, mostly dealing with configuration
-* Compressed with UPX
-
-Changes 1.0b -> 1.1
--------------------
-
-* Now supports EZPK-compressed (basically customized libbzip2) GYM files
-* No longer relies on zlib.dll (necessary parts statically linked in now instead)
-* Some minor optimization
-
----
-
-Credits:
-
-
-Uses source code from libbzip2, zlib, Gens, and kpigym. Uses information from YMAMP 2.0.
-
- libbzip2 1.0.2 copyright (C) 1996-2002 Julian R Seward. All rights reserved.
- zlib 1.1.4 (C) 1995-1998 Jean-loup Gailly and Mark Adler
- Gens 2.12a Copyright (c) 2002 by Stéphane Dallongeville
- kpigym 1.0r6+ (C) 2002 by Mamiya
- YMAMP 2.0 (C) 1999-2000 by Marp
-
-<----- END OF ORIGINAL DOCUMENTATION ------>
-
-I used the sources for foo_gym as basis for adding the plugin to xbmc. thanks a lot!
-currently stripped for zlib and libbzip2
-
-spiff \ No newline at end of file
diff --git a/xbmc/cores/paplayer/GYMCodec/ym2612.c b/xbmc/cores/paplayer/GYMCodec/ym2612.c
deleted file mode 100644
index f9b18e7b9d..0000000000
--- a/xbmc/cores/paplayer/GYMCodec/ym2612.c
+++ /dev/null
@@ -1,2503 +0,0 @@
-/***************************************************************************
- * Gens: Yamaha YM2612 FM synthesis chip emulator. *
- * *
- * Copyright (c) 1999-2002 by Stéphane Dallongeville *
- * Copyright (c) 2003-2004 by Stéphane Akhoun *
- * Copyright (c) 2008-2009 by David Korth *
- * *
- * This program is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU General Public License as published by the *
- * Free Software Foundation; either version 2 of the License, or (at your *
- * option) any later version. *
- * *
- * This program 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 General Public License for more details. *
- * *
- * 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. *
- ***************************************************************************/
-
-/***********************************************************
- * *
- * YM2612.C : YM2612 emulator *
- * *
- * Almost constantes are taken from the MAME core *
- * *
- * This source is a part of Gens project *
- * Written by Stéphane Dallongeville (gens@consolemul.com) *
- * Copyright (c) 2002 by Stéphane Dallongeville *
- * *
- ***********************************************************/
-
-#include <stdio.h>
-#include <math.h>
-#include <string.h>
-#include "ym2612.h"
-
-
-/********************************************
- * Partie définition *
- ********************************************/
-
-#define YM_DEBUG_LEVEL 0
-
-#ifndef PI
-#define PI 3.14159265358979323846
-#endif
-
-#define ATTACK 0
-#define DECAY 1
-#define SUBSTAIN 2
-#define RELEASE 3
-
-// SIN_LBITS <= 16
-// LFO_HBITS <= 16
-// (SIN_LBITS + SIN_HBITS) <= 26
-// (ENV_LBITS + ENV_HBITS) <= 28
-// (LFO_LBITS + LFO_HBITS) <= 28
-
-#define SIN_HBITS 12 // Sinus phase counter int part
-#define SIN_LBITS (26 - SIN_HBITS) // Sinus phase counter float part (best setting)
-
-#if (SIN_LBITS > 16)
-#define SIN_LBITS 16 // Can't be greater than 16 bits
-#endif
-
-#define ENV_HBITS 12 // Env phase counter int part
-#define ENV_LBITS (28 - ENV_HBITS) // Env phase counter float part (best setting)
-
-#define LFO_HBITS 10 // LFO phase counter int part
-#define LFO_LBITS (28 - LFO_HBITS) // LFO phase counter float part (best setting)
-
-#define SIN_LENGHT (1 << SIN_HBITS)
-#define ENV_LENGHT (1 << ENV_HBITS)
-#define LFO_LENGHT (1 << LFO_HBITS)
-
-#define TL_LENGHT (ENV_LENGHT * 3) // Env + TL scaling + LFO
-
-#define SIN_MASK (SIN_LENGHT - 1)
-#define ENV_MASK (ENV_LENGHT - 1)
-#define LFO_MASK (LFO_LENGHT - 1)
-
-#define ENV_STEP (96.0 / ENV_LENGHT) // ENV_MAX = 96 dB
-
-#define ENV_ATTACK ((ENV_LENGHT * 0) << ENV_LBITS)
-#define ENV_DECAY ((ENV_LENGHT * 1) << ENV_LBITS)
-#define ENV_END ((ENV_LENGHT * 2) << ENV_LBITS)
-
-#define MAX_OUT_BITS (SIN_HBITS + SIN_LBITS + 2) // Modulation = -4 <--> +4
-#define MAX_OUT ((1 << MAX_OUT_BITS) - 1)
-
-//Just for tests stuff...
-//
-//#define COEF_MOD 0.5
-//#define MAX_OUT ((int) (((1 << MAX_OUT_BITS) - 1) * COEF_MOD))
-
-#define OUT_BITS (OUTPUT_BITS - 2)
-#define OUT_SHIFT (MAX_OUT_BITS - OUT_BITS)
-#define LIMIT_CH_OUT ((int) (((1 << OUT_BITS) * 1.5) - 1))
-
-#define PG_CUT_OFF ((int) (78.0 / ENV_STEP))
-#define ENV_CUT_OFF ((int) (68.0 / ENV_STEP))
-
-#define AR_RATE 399128
-#define DR_RATE 5514396
-
-//#define AR_RATE 426136
-//#define DR_RATE (AR_RATE * 12)
-
-#define LFO_FMS_LBITS 9 // FIXED (LFO_FMS_BASE gives somethink as 1)
-#define LFO_FMS_BASE ((int) (0.05946309436 * 0.0338 * (double) (1 << LFO_FMS_LBITS)))
-
-#define S0 0 // Stupid typo of the YM2612
-#define S1 2
-#define S2 1
-#define S3 3
-
-
-/********************************************
- * Partie variables *
- ********************************************/
-
-
-struct ym2612__ YM2612;
-
-int *SIN_TAB[SIN_LENGHT]; // SINUS TABLE (pointer on TL TABLE)
-int TL_TAB[TL_LENGHT * 2]; // TOTAL LEVEL TABLE (positif and minus)
-unsigned int ENV_TAB[2 * ENV_LENGHT + 8]; // ENV CURVE TABLE (attack & decay)
-
-//unsigned int ATTACK_TO_DECAY[ENV_LENGHT]; // Conversion from attack to decay phase
-unsigned int DECAY_TO_ATTACK[ENV_LENGHT]; // Conversion from decay to attack phase
-
-unsigned int FINC_TAB[2048]; // Frequency step table
-
-unsigned int AR_TAB[128]; // Attack rate table
-unsigned int DR_TAB[96]; // Decay rate table
-unsigned int DT_TAB[8][32]; // Detune table
-unsigned int SL_TAB[16]; // Substain level table
-unsigned int NULL_RATE[32]; // Table for NULL rate
-
-int LFO_ENV_TAB[LFO_LENGHT]; // LFO AMS TABLE (adjusted for 11.8 dB)
-int LFO_FREQ_TAB[LFO_LENGHT]; // LFO FMS TABLE
-int LFO_ENV_UP[MAX_UPDATE_LENGHT]; // Temporary calculated LFO AMS (adjusted for 11.8 dB)
-int LFO_FREQ_UP[MAX_UPDATE_LENGHT]; // Temporary calculated LFO FMS
-
-int INTER_TAB[MAX_UPDATE_LENGHT]; // Interpolation table
-
-int LFO_INC_TAB[8]; // LFO step table
-
-int in0, in1, in2, in3; // current phase calculation
-int en0, en1, en2, en3; // current enveloppe calculation
-
-const void (*UPDATE_CHAN[8 * 8])(channel_ *CH, int **buf, int lenght) = // Update Channel functions pointer table
-{
- Update_Chan_Algo0,
- Update_Chan_Algo1,
- Update_Chan_Algo2,
- Update_Chan_Algo3,
- Update_Chan_Algo4,
- Update_Chan_Algo5,
- Update_Chan_Algo6,
- Update_Chan_Algo7,
-
- Update_Chan_Algo0_LFO,
- Update_Chan_Algo1_LFO,
- Update_Chan_Algo2_LFO,
- Update_Chan_Algo3_LFO,
- Update_Chan_Algo4_LFO,
- Update_Chan_Algo5_LFO,
- Update_Chan_Algo6_LFO,
- Update_Chan_Algo7_LFO,
-
- Update_Chan_Algo0_Int,
- Update_Chan_Algo1_Int,
- Update_Chan_Algo2_Int,
- Update_Chan_Algo3_Int,
- Update_Chan_Algo4_Int,
- Update_Chan_Algo5_Int,
- Update_Chan_Algo6_Int,
- Update_Chan_Algo7_Int,
-
- Update_Chan_Algo0_LFO_Int,
- Update_Chan_Algo1_LFO_Int,
- Update_Chan_Algo2_LFO_Int,
- Update_Chan_Algo3_LFO_Int,
- Update_Chan_Algo4_LFO_Int,
- Update_Chan_Algo5_LFO_Int,
- Update_Chan_Algo6_LFO_Int,
- Update_Chan_Algo7_LFO_Int
-};
-
-const void (*ENV_NEXT_EVENT[8])(slot_ *SL) = // Next Enveloppe phase functions pointer table
-{
- Env_Attack_Next,
- Env_Decay_Next,
- Env_Substain_Next,
- Env_Release_Next,
- Env_NULL_Next,
- Env_NULL_Next,
- Env_NULL_Next,
- Env_NULL_Next
-};
-
-const unsigned int DT_DEF_TAB[4 * 32] =
-{
-// FD = 0
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
-// FD = 1
- 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2,
- 2, 3, 3, 3, 4, 4, 4, 5, 5, 6, 6, 7, 8, 8, 8, 8,
-
-// FD = 2
- 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5,
- 5, 6, 6, 7, 8, 8, 9, 10, 11, 12, 13, 14, 16, 16, 16, 16,
-
-// FD = 3
- 2, 2, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 6, 6, 7,
- 8 , 8, 9, 10, 11, 12, 13, 14, 16, 17, 19, 20, 22, 22, 22, 22
-};
-
-const unsigned int FKEY_TAB[16] =
-{
- 0, 0, 0, 0,
- 0, 0, 0, 1,
- 2, 3, 3, 3,
- 3, 3, 3, 3
-};
-
-const unsigned int LFO_AMS_TAB[4] =
-{
- 31, 4, 1, 0
-};
-
-const unsigned int LFO_FMS_TAB[8] =
-{
- LFO_FMS_BASE * 0, LFO_FMS_BASE * 1,
- LFO_FMS_BASE * 2, LFO_FMS_BASE * 3,
- LFO_FMS_BASE * 4, LFO_FMS_BASE * 6,
- LFO_FMS_BASE * 12, LFO_FMS_BASE * 24
-};
-
-int int_cnt; // Interpolation calculation
-
-
-#if YM_DEBUG_LEVEL > 0 // Debug
-FILE *debug_file = NULL;
-#endif
-
-
-/* Gens */
-
-extern unsigned int Sound_Extrapol[312][2];
-//extern int Seg_L[882], Seg_R[882];
-extern int *Seg_L, *Seg_R;
-extern int VDP_Current_Line;
-extern int GYM_Dumping;
-extern int YM2612_Enable;
-extern int DAC_Enable;
-
-int Update_GYM_Dump(char v0, char v1, char v2);
-
-int YM2612_Enable;
-int YM2612_Improv;
-int DAC_Enable;
-int *YM_Buf[2];
-int YM_Len = 0;
-
-int Chan_Enable[6];
-
-/* end */
-
-
-/***********************************************
- * fonctions calcul param *
- ***********************************************/
-
-
-INLINE void CALC_FINC_SL(slot_ *SL, int finc, int kc)
-{
- int ksr;
-
- SL->Finc = (finc + SL->DT[kc]) * SL->MUL;
-
- ksr = kc >> SL->KSR_S; // keycode atténuation
-
-#if YM_DEBUG_LEVEL > 1
- fprintf(debug_file, "FINC = %d SL->Finc = %d\n", finc, SL->Finc);
-#endif
-
- if (SL->KSR != ksr) // si le KSR a changé alors
- { // les différents taux pour l'enveloppe sont mis à jour
- SL->KSR = ksr;
-
- SL->EincA = SL->AR[ksr];
- SL->EincD = SL->DR[ksr];
- SL->EincS = SL->SR[ksr];
- SL->EincR = SL->RR[ksr];
-
- if (SL->Ecurp == ATTACK) SL->Einc = SL->EincA;
- else if (SL->Ecurp == DECAY) SL->Einc = SL->EincD;
- else if (SL->Ecnt < ENV_END)
- {
- if (SL->Ecurp == SUBSTAIN) SL->Einc = SL->EincS;
- else if (SL->Ecurp == RELEASE) SL->Einc = SL->EincR;
- }
-
-#if YM_DEBUG_LEVEL > 1
- fprintf(debug_file, "KSR = %.4X EincA = %.8X EincD = %.8X EincS = %.8X EincR = %.8X\n", ksr, SL->EincA, SL->EincD, SL->EincS, SL->EincR);
-#endif
- }
-}
-
-
-INLINE void CALC_FINC_CH(channel_ *CH)
-{
- int finc, kc;
-
- finc = FINC_TAB[CH->FNUM[0]] >> (7 - CH->FOCT[0]);
- kc = CH->KC[0];
-
- CALC_FINC_SL(&CH->SLOT[0], finc, kc);
- CALC_FINC_SL(&CH->SLOT[1], finc, kc);
- CALC_FINC_SL(&CH->SLOT[2], finc, kc);
- CALC_FINC_SL(&CH->SLOT[3], finc, kc);
-}
-
-
-
-/***********************************************
- * fonctions setting *
- ***********************************************/
-
-
-INLINE void KEY_ON(channel_ *CH, int nsl)
-{
- slot_ *SL = &(CH->SLOT[nsl]); // on recupère le bon pointeur de slot
-
- if (SL->Ecurp == RELEASE) // la touche est-elle relâchée ?
- {
- SL->Fcnt = 0;
-
- // Fix Ecco 2 splash sound
-
- SL->Ecnt = (DECAY_TO_ATTACK[ENV_TAB[SL->Ecnt >> ENV_LBITS]] + ENV_ATTACK) & SL->ChgEnM;
- SL->ChgEnM = 0xFFFFFFFF;
-
-// SL->Ecnt = DECAY_TO_ATTACK[ENV_TAB[SL->Ecnt >> ENV_LBITS]] + ENV_ATTACK;
-// SL->Ecnt = 0;
-
- SL->Einc = SL->EincA;
- SL->Ecmp = ENV_DECAY;
- SL->Ecurp = ATTACK;
- }
-}
-
-
-INLINE void KEY_OFF(channel_ *CH, int nsl)
-{
- slot_ *SL = &(CH->SLOT[nsl]); // on recupère le bon pointeur de slot
-
- if (SL->Ecurp != RELEASE) // la touche est-elle appuyée ?
- {
- if (SL->Ecnt < ENV_DECAY) // attack phase ?
- {
- SL->Ecnt = (ENV_TAB[SL->Ecnt >> ENV_LBITS] << ENV_LBITS) + ENV_DECAY;
- }
-
- SL->Einc = SL->EincR;
- SL->Ecmp = ENV_END;
- SL->Ecurp = RELEASE;
- }
-}
-
-
-INLINE void CSM_Key_Control()
-{
- KEY_ON(&YM2612.CHANNEL[2], 0);
- KEY_ON(&YM2612.CHANNEL[2], 1);
- KEY_ON(&YM2612.CHANNEL[2], 2);
- KEY_ON(&YM2612.CHANNEL[2], 3);
-}
-
-
-int SLOT_SET(int Adr, unsigned char data)
-{
- channel_ *CH;
- slot_ *SL;
- int nch, nsl;
-
- if ((nch = Adr & 3) == 3) return 1;
- nsl = (Adr >> 2) & 3;
-
- if (Adr & 0x100) nch += 3;
-
- CH = &(YM2612.CHANNEL[nch]);
- SL = &(CH->SLOT[nsl]);
-
- switch(Adr & 0xF0)
- {
- case 0x30:
- if ((SL->MUL = (data & 0x0F))) SL->MUL <<= 1;
- else SL->MUL = 1;
-
- SL->DT = DT_TAB[(data >> 4) & 7];
-
- CH->SLOT[0].Finc = -1;
-
-#if YM_DEBUG_LEVEL > 1
- fprintf(debug_file, "CHANNEL[%d], SLOT[%d] DTMUL = %.2X\n", nch, nsl, data & 0x7F);
-#endif
- break;
-
- case 0x40:
- SL->TL = data & 0x7F;
-
- // SOR2 do a lot of TL adjustement and this fix R.Shinobi jump sound...
- YM2612_Special_Update();
-
-#if ((ENV_HBITS - 7) < 0)
- SL->TLL = SL->TL >> (7 - ENV_HBITS);
-#else
- SL->TLL = SL->TL << (ENV_HBITS - 7);
-#endif
-
-#if YM_DEBUG_LEVEL > 1
- fprintf(debug_file, "CHANNEL[%d], SLOT[%d] TL = %.2X\n", nch, nsl, SL->TL);
-#endif
- break;
-
- case 0x50:
- SL->KSR_S = 3 - (data >> 6);
-
- CH->SLOT[0].Finc = -1;
-
- if (data &= 0x1F) SL->AR = &AR_TAB[data << 1];
- else SL->AR = &NULL_RATE[0];
-
- SL->EincA = SL->AR[SL->KSR];
- if (SL->Ecurp == ATTACK) SL->Einc = SL->EincA;
-
-#if YM_DEBUG_LEVEL > 1
- fprintf(debug_file, "CHANNEL[%d], SLOT[%d] AR = %.2X EincA = %.6X\n", nch, nsl, data, SL->EincA);
-#endif
- break;
-
- case 0x60:
- if ((SL->AMSon = (data & 0x80))) SL->AMS = CH->AMS;
- else SL->AMS = 31;
-
- if (data &= 0x1F) SL->DR = &DR_TAB[data << 1];
- else SL->DR = &NULL_RATE[0];
-
- SL->EincD = SL->DR[SL->KSR];
- if (SL->Ecurp == DECAY) SL->Einc = SL->EincD;
-
-#if YM_DEBUG_LEVEL > 1
- fprintf(debug_file, "CHANNEL[%d], SLOT[%d] AMS = %d DR = %.2X EincD = %.6X\n", nch, nsl, SL->AMSon, data, SL->EincD);
-#endif
- break;
-
- case 0x70:
- if (data &= 0x1F) SL->SR = &DR_TAB[data << 1];
- else SL->SR = &NULL_RATE[0];
-
- SL->EincS = SL->SR[SL->KSR];
- if ((SL->Ecurp == SUBSTAIN) && (SL->Ecnt < ENV_END)) SL->Einc = SL->EincS;
-
-#if YM_DEBUG_LEVEL > 1
- fprintf(debug_file, "CHANNEL[%d], SLOT[%d] SR = %.2X EincS = %.6X\n", nch, nsl, data, SL->EincS);
-#endif
- break;
-
- case 0x80:
- SL->SLL = SL_TAB[data >> 4];
-
- SL->RR = &DR_TAB[((data & 0xF) << 2) + 2];
-
- SL->EincR = SL->RR[SL->KSR];
- if ((SL->Ecurp == RELEASE) && (SL->Ecnt < ENV_END)) SL->Einc = SL->EincR;
-
-#if YM_DEBUG_LEVEL > 1
- fprintf(debug_file, "CHANNEL[%d], SLOT[%d] SL = %.8X\n", nch, nsl, SL->SLL);
- fprintf(debug_file, "CHANNEL[%d], SLOT[%d] RR = %.2X EincR = %.2X\n", nch, nsl, ((data & 0xF) << 1) | 2, SL->EincR);
-#endif
- break;
-
- case 0x90:
- // SSG-EG envelope shapes :
- /*
- E At Al H
-
- 1 0 0 0 \\\\
-
- 1 0 0 1 \___
-
- 1 0 1 0 \/\/
- ___
- 1 0 1 1 \
-
- 1 1 0 0 ////
- ___
- 1 1 0 1 /
-
- 1 1 1 0 /\/\
-
- 1 1 1 1 /___
-
- E = SSG-EG enable
- At = Start negate
- Al = Altern
- H = Hold */
-
- if (data & 0x08) SL->SEG = data & 0x0F;
- else SL->SEG = 0;
-
-#if YM_DEBUG_LEVEL > 1
- fprintf(debug_file, "CHANNEL[%d], SLOT[%d] SSG-EG = %.2X\n", nch, nsl, data);
-#endif
- break;
- }
-
- return 0;
-}
-
-
-int CHANNEL_SET(int Adr, unsigned char data)
-{
- channel_ *CH;
- int num;
-
- if ((num = Adr & 3) == 3) return 1;
-
- switch(Adr & 0xFC)
- {
- case 0xA0:
- if (Adr & 0x100) num += 3;
- CH = &(YM2612.CHANNEL[num]);
-
- YM2612_Special_Update();
-
- CH->FNUM[0] = (CH->FNUM[0] & 0x700) + data;
- CH->KC[0] = (CH->FOCT[0] << 2) | FKEY_TAB[CH->FNUM[0] >> 7];
-
- CH->SLOT[0].Finc = -1;
-
-#if YM_DEBUG_LEVEL > 1
- fprintf(debug_file, "CHANNEL[%d] part1 FNUM = %d KC = %d\n", num, CH->FNUM[0], CH->KC[0]);
-#endif
- break;
-
- case 0xA4:
- if (Adr & 0x100) num += 3;
- CH = &(YM2612.CHANNEL[num]);
-
- YM2612_Special_Update();
-
- CH->FNUM[0] = (CH->FNUM[0] & 0x0FF) + ((int) (data & 0x07) << 8);
- CH->FOCT[0] = (data & 0x38) >> 3;
- CH->KC[0] = (CH->FOCT[0] << 2) | FKEY_TAB[CH->FNUM[0] >> 7];
-
- CH->SLOT[0].Finc = -1;
-
-#if YM_DEBUG_LEVEL > 1
- fprintf(debug_file, "CHANNEL[%d] part2 FNUM = %d FOCT = %d KC = %d\n", num, CH->FNUM[0], CH->FOCT[0], CH->KC[0]);
-#endif
- break;
-
- case 0xA8:
- if (Adr < 0x100)
- {
- num++;
-
- YM2612_Special_Update();
-
- YM2612.CHANNEL[2].FNUM[num] = (YM2612.CHANNEL[2].FNUM[num] & 0x700) + data;
- YM2612.CHANNEL[2].KC[num] = (YM2612.CHANNEL[2].FOCT[num] << 2) | FKEY_TAB[YM2612.CHANNEL[2].FNUM[num] >> 7];
-
- YM2612.CHANNEL[2].SLOT[0].Finc = -1;
-
-#if YM_DEBUG_LEVEL > 1
- fprintf(debug_file, "CHANNEL[2] part1 FNUM[%d] = %d KC[%d] = %d\n", num, YM2612.CHANNEL[2].FNUM[num], num, YM2612.CHANNEL[2].KC[num]);
-#endif
- }
- break;
-
- case 0xAC:
- if (Adr < 0x100)
- {
- num++;
-
- YM2612_Special_Update();
-
- YM2612.CHANNEL[2].FNUM[num] = (YM2612.CHANNEL[2].FNUM[num] & 0x0FF) + ((int) (data & 0x07) << 8);
- YM2612.CHANNEL[2].FOCT[num] = (data & 0x38) >> 3;
- YM2612.CHANNEL[2].KC[num] = (YM2612.CHANNEL[2].FOCT[num] << 2) | FKEY_TAB[YM2612.CHANNEL[2].FNUM[num] >> 7];
-
- YM2612.CHANNEL[2].SLOT[0].Finc = -1;
-
-#if YM_DEBUG_LEVEL > 1
- fprintf(debug_file, "CHANNEL[2] part2 FNUM[%d] = %d FOCT[%d] = %d KC[%d] = %d\n", num, YM2612.CHANNEL[2].FNUM[num], num, YM2612.CHANNEL[2].FOCT[num], num, YM2612.CHANNEL[2].KC[num]);
-#endif
- }
- break;
-
- case 0xB0:
- if (Adr & 0x100) num += 3;
- CH = &(YM2612.CHANNEL[num]);
-
- if (CH->ALGO != (data & 7))
- {
- // Fix VectorMan 2 heli sound (level 1)
- YM2612_Special_Update();
-
- CH->ALGO = data & 7;
-
- CH->SLOT[0].ChgEnM = 0;
- CH->SLOT[1].ChgEnM = 0;
- CH->SLOT[2].ChgEnM = 0;
- CH->SLOT[3].ChgEnM = 0;
- }
-
- CH->FB = 9 - ((data >> 3) & 7); // Real thing ?
-
-// if (CH->FB = ((data >> 3) & 7)) CH->FB = 9 - CH->FB; // Thunder force 4 (music stage 8), Gynoug, Aladdin bug sound...
-// else CH->FB = 31;
-
-#if YM_DEBUG_LEVEL > 1
- fprintf(debug_file, "CHANNEL[%d] ALGO = %d FB = %d\n", num, CH->ALGO, CH->FB);
-#endif
- break;
-
- case 0xB4:
- if (Adr & 0x100) num += 3;
- CH = &(YM2612.CHANNEL[num]);
-
- YM2612_Special_Update();
-
- if (data & 0x80) CH->LEFT = 0xFFFFFFFF;
- else CH->LEFT = 0;
-
- if (data & 0x40) CH->RIGHT = 0xFFFFFFFF;
- else CH->RIGHT = 0;
-
- CH->AMS = LFO_AMS_TAB[(data >> 4) & 3];
- CH->FMS = LFO_FMS_TAB[data & 7];
-
- if (CH->SLOT[0].AMSon) CH->SLOT[0].AMS = CH->AMS;
- else CH->SLOT[0].AMS = 31;
- if (CH->SLOT[1].AMSon) CH->SLOT[1].AMS = CH->AMS;
- else CH->SLOT[1].AMS = 31;
- if (CH->SLOT[2].AMSon) CH->SLOT[2].AMS = CH->AMS;
- else CH->SLOT[2].AMS = 31;
- if (CH->SLOT[3].AMSon) CH->SLOT[3].AMS = CH->AMS;
- else CH->SLOT[3].AMS = 31;
-
-#if YM_DEBUG_LEVEL > 0
- fprintf(debug_file, "CHANNEL[%d] AMS = %d FMS = %d\n", num, CH->AMS, CH->FMS);
-#endif
- break;
- }
-
- return 0;
-}
-
-
-int YM_SET(int Adr, unsigned char data)
-{
- channel_ *CH;
- int nch;
-
- switch(Adr)
- {
- case 0x22:
- if (data & 8)
- {
- // Cool Spot music 1, LFO modified severals time which
- // distord the sound, have to check that on a real genesis...
-
- YM2612.LFOinc = LFO_INC_TAB[data & 7];
-
-#if YM_DEBUG_LEVEL > 0
- fprintf(debug_file, "\nLFO Enable, LFOinc = %.8X %d\n", YM2612.LFOinc, data & 7);
-#endif
- }
- else
- {
- YM2612.LFOinc = YM2612.LFOcnt = 0;
-
-#if YM_DEBUG_LEVEL > 0
- fprintf(debug_file, "\nLFO Disable\n");
-#endif
- }
- break;
-
- case 0x24:
- YM2612.TimerA = (YM2612.TimerA & 0x003) | (((int) data) << 2);
-
- if (YM2612.TimerAL != (1024 - YM2612.TimerA) << 12)
- {
- YM2612.TimerAcnt = YM2612.TimerAL = (1024 - YM2612.TimerA) << 12;
-
-#if YM_DEBUG_LEVEL > 1
- fprintf(debug_file, "Timer A Set = %.8X\n", YM2612.TimerAcnt);
-#endif
- }
- break;
-
- case 0x25:
- YM2612.TimerA = (YM2612.TimerA & 0x3fc) | (data & 3);
-
- if (YM2612.TimerAL != (1024 - YM2612.TimerA) << 12)
- {
- YM2612.TimerAcnt = YM2612.TimerAL = (1024 - YM2612.TimerA) << 12;
-
-#if YM_DEBUG_LEVEL > 1
- fprintf(debug_file, "Timer A Set = %.8X\n", YM2612.TimerAcnt);
-#endif
- }
- break;
-
- case 0x26:
- YM2612.TimerB = data;
-
- if (YM2612.TimerBL != (256 - YM2612.TimerB) << (4 + 12))
- {
- YM2612.TimerBcnt = YM2612.TimerBL = (256 - YM2612.TimerB) << (4 + 12);
-
-#if YM_DEBUG_LEVEL > 1
- fprintf(debug_file, "Timer B Set = %.8X\n", YM2612.TimerBcnt);
-#endif
- }
- break;
-
- case 0x27:
- // Paramètre divers
- // b7 = CSM MODE
- // b6 = 3 slot mode
- // b5 = reset b
- // b4 = reset a
- // b3 = timer enable b
- // b2 = timer enable a
- // b1 = load b
- // b0 = load a
-
- if ((data ^ YM2612.Mode) & 0x40)
- {
- // We changed the channel 2 mode, so recalculate phase step
- // This fix the punch sound in Street of Rage 2
-
- YM2612_Special_Update();
-
- YM2612.CHANNEL[2].SLOT[0].Finc = -1; // recalculate phase step
- }
-
-// if ((data & 2) && (YM2612.Status & 2)) YM2612.TimerBcnt = YM2612.TimerBL;
-// if ((data & 1) && (YM2612.Status & 1)) YM2612.TimerAcnt = YM2612.TimerAL;
-
-// YM2612.Status &= (~data >> 4); // Reset du Status au cas ou c'est demandé
- YM2612.Status &= (~data >> 4) & (data >> 2); // Reset Status
-
- YM2612.Mode = data;
-
-#if YM_DEBUG_LEVEL > 0
- fprintf(debug_file, "Mode reg = %.2X\n", data);
-#endif
- break;
-
- case 0x28:
- if ((nch = data & 3) == 3) return 1;
-
- if (data & 4) nch += 3;
- CH = &(YM2612.CHANNEL[nch]);
-
- YM2612_Special_Update();
-
- if (data & 0x10) KEY_ON(CH, S0); // On appuie sur la touche pour le slot 1
- else KEY_OFF(CH, S0); // On relâche la touche pour le slot 1
- if (data & 0x20) KEY_ON(CH, S1); // On appuie sur la touche pour le slot 3
- else KEY_OFF(CH, S1); // On relâche la touche pour le slot 3
- if (data & 0x40) KEY_ON(CH, S2); // On appuie sur la touche pour le slot 2
- else KEY_OFF(CH, S2); // On relâche la touche pour le slot 2
- if (data & 0x80) KEY_ON(CH, S3); // On appuie sur la touche pour le slot 4
- else KEY_OFF(CH, S3); // On relâche la touche pour le slot 4
-
-#if YM_DEBUG_LEVEL > 0
- fprintf(debug_file, "CHANNEL[%d] KEY %.1X\n", nch, ((data & 0xf0) >> 4));
-#endif
- break;
-
- case 0x2A:
- YM2612.DACdata = ((int) data - 0x80) << 7; // donnée du DAC
- break;
-
- case 0x2B:
- if (YM2612.DAC ^ (data & 0x80)) YM2612_Special_Update();
-
- YM2612.DAC = data & 0x80; // activation/désactivation du DAC
- break;
- }
-
- return 0;
-}
-
-
-
-/***********************************************
- * fonctions de génération *
- ***********************************************/
-
-
-void Env_NULL_Next(slot_ *SL)
-{
-}
-
-
-void Env_Attack_Next(slot_ *SL)
-{
- // Verified with Gynoug even in HQ (explode SFX)
- SL->Ecnt = ENV_DECAY;
-
- SL->Einc = SL->EincD;
- SL->Ecmp = SL->SLL;
- SL->Ecurp = DECAY;
-}
-
-
-void Env_Decay_Next(slot_ *SL)
-{
- // Verified with Gynoug even in HQ (explode SFX)
- SL->Ecnt = SL->SLL;
-
- SL->Einc = SL->EincS;
- SL->Ecmp = ENV_END;
- SL->Ecurp = SUBSTAIN;
-}
-
-
-void Env_Substain_Next(slot_ *SL)
-{
- if (SL->SEG & 8) // SSG envelope type
- {
- if (SL->SEG & 1)
- {
- SL->Ecnt = ENV_END;
- SL->Einc = 0;
- SL->Ecmp = ENV_END + 1;
- }
- else
- {
- // re KEY ON
-
- // SL->Fcnt = 0;
- // SL->ChgEnM = 0xFFFFFFFF;
-
- SL->Ecnt = 0;
- SL->Einc = SL->EincA;
- SL->Ecmp = ENV_DECAY;
- SL->Ecurp = ATTACK;
- }
-
- SL->SEG ^= (SL->SEG & 2) << 1;
- }
- else
- {
- SL->Ecnt = ENV_END;
- SL->Einc = 0;
- SL->Ecmp = ENV_END + 1;
- }
-}
-
-
-void Env_Release_Next(slot_ *SL)
-{
- SL->Ecnt = ENV_END;
- SL->Einc = 0;
- SL->Ecmp = ENV_END + 1;
-}
-
-
-#define GET_CURRENT_PHASE \
-in0 = CH->SLOT[S0].Fcnt; \
-in1 = CH->SLOT[S1].Fcnt; \
-in2 = CH->SLOT[S2].Fcnt; \
-in3 = CH->SLOT[S3].Fcnt;
-
-
-#define UPDATE_PHASE \
-CH->SLOT[S0].Fcnt += CH->SLOT[S0].Finc; \
-CH->SLOT[S1].Fcnt += CH->SLOT[S1].Finc; \
-CH->SLOT[S2].Fcnt += CH->SLOT[S2].Finc; \
-CH->SLOT[S3].Fcnt += CH->SLOT[S3].Finc;
-
-
-#define UPDATE_PHASE_LFO \
-if ((freq_LFO = (CH->FMS * LFO_FREQ_UP[i]) >> (LFO_HBITS - 1))) \
-{ \
- CH->SLOT[S0].Fcnt += CH->SLOT[S0].Finc + ((CH->SLOT[S0].Finc * freq_LFO) >> LFO_FMS_LBITS); \
- CH->SLOT[S1].Fcnt += CH->SLOT[S1].Finc + ((CH->SLOT[S1].Finc * freq_LFO) >> LFO_FMS_LBITS); \
- CH->SLOT[S2].Fcnt += CH->SLOT[S2].Finc + ((CH->SLOT[S2].Finc * freq_LFO) >> LFO_FMS_LBITS); \
- CH->SLOT[S3].Fcnt += CH->SLOT[S3].Finc + ((CH->SLOT[S3].Finc * freq_LFO) >> LFO_FMS_LBITS); \
-} \
-else \
-{ \
- CH->SLOT[S0].Fcnt += CH->SLOT[S0].Finc; \
- CH->SLOT[S1].Fcnt += CH->SLOT[S1].Finc; \
- CH->SLOT[S2].Fcnt += CH->SLOT[S2].Finc; \
- CH->SLOT[S3].Fcnt += CH->SLOT[S3].Finc; \
-}
-
-
-#define GET_CURRENT_ENV \
-if (CH->SLOT[S0].SEG & 4) \
-{ \
- if ((en0 = ENV_TAB[(CH->SLOT[S0].Ecnt >> ENV_LBITS)] + CH->SLOT[S0].TLL) > ENV_MASK) en0 = 0; \
- else en0 ^= ENV_MASK; \
-} \
-else en0 = ENV_TAB[(CH->SLOT[S0].Ecnt >> ENV_LBITS)] + CH->SLOT[S0].TLL; \
-if (CH->SLOT[S1].SEG & 4) \
-{ \
- if ((en1 = ENV_TAB[(CH->SLOT[S1].Ecnt >> ENV_LBITS)] + CH->SLOT[S1].TLL) > ENV_MASK) en1 = 0; \
- else en1 ^= ENV_MASK; \
-} \
-else en1 = ENV_TAB[(CH->SLOT[S1].Ecnt >> ENV_LBITS)] + CH->SLOT[S1].TLL; \
-if (CH->SLOT[S2].SEG & 4) \
-{ \
- if ((en2 = ENV_TAB[(CH->SLOT[S2].Ecnt >> ENV_LBITS)] + CH->SLOT[S2].TLL) > ENV_MASK) en2 = 0; \
- else en2 ^= ENV_MASK; \
-} \
-else en2 = ENV_TAB[(CH->SLOT[S2].Ecnt >> ENV_LBITS)] + CH->SLOT[S2].TLL; \
-if (CH->SLOT[S3].SEG & 4) \
-{ \
- if ((en3 = ENV_TAB[(CH->SLOT[S3].Ecnt >> ENV_LBITS)] + CH->SLOT[S3].TLL) > ENV_MASK) en3 = 0; \
- else en3 ^= ENV_MASK; \
-} \
-else en3 = ENV_TAB[(CH->SLOT[S3].Ecnt >> ENV_LBITS)] + CH->SLOT[S3].TLL;
-
-
-#define GET_CURRENT_ENV_LFO \
-env_LFO = LFO_ENV_UP[i]; \
- \
-if (CH->SLOT[S0].SEG & 4) \
-{ \
- if ((en0 = ENV_TAB[(CH->SLOT[S0].Ecnt >> ENV_LBITS)] + CH->SLOT[S0].TLL) > ENV_MASK) en0 = 0; \
- else en0 = (en0 ^ ENV_MASK) + (env_LFO >> CH->SLOT[S0].AMS); \
-} \
-else en0 = ENV_TAB[(CH->SLOT[S0].Ecnt >> ENV_LBITS)] + CH->SLOT[S0].TLL + (env_LFO >> CH->SLOT[S0].AMS); \
-if (CH->SLOT[S1].SEG & 4) \
-{ \
- if ((en1 = ENV_TAB[(CH->SLOT[S1].Ecnt >> ENV_LBITS)] + CH->SLOT[S1].TLL) > ENV_MASK) en1 = 0; \
- else en1 = (en1 ^ ENV_MASK) + (env_LFO >> CH->SLOT[S1].AMS); \
-} \
-else en1 = ENV_TAB[(CH->SLOT[S1].Ecnt >> ENV_LBITS)] + CH->SLOT[S1].TLL + (env_LFO >> CH->SLOT[S1].AMS); \
-if (CH->SLOT[S2].SEG & 4) \
-{ \
- if ((en2 = ENV_TAB[(CH->SLOT[S2].Ecnt >> ENV_LBITS)] + CH->SLOT[S2].TLL) > ENV_MASK) en2 = 0; \
- else en2 = (en2 ^ ENV_MASK) + (env_LFO >> CH->SLOT[S2].AMS); \
-} \
-else en2 = ENV_TAB[(CH->SLOT[S2].Ecnt >> ENV_LBITS)] + CH->SLOT[S2].TLL + (env_LFO >> CH->SLOT[S2].AMS); \
-if (CH->SLOT[S3].SEG & 4) \
-{ \
- if ((en3 = ENV_TAB[(CH->SLOT[S3].Ecnt >> ENV_LBITS)] + CH->SLOT[S3].TLL) > ENV_MASK) en3 = 0; \
- else en3 = (en3 ^ ENV_MASK) + (env_LFO >> CH->SLOT[S3].AMS); \
-} \
-else en3 = ENV_TAB[(CH->SLOT[S3].Ecnt >> ENV_LBITS)] + CH->SLOT[S3].TLL + (env_LFO >> CH->SLOT[S3].AMS);
-
-
-#define UPDATE_ENV \
-if ((CH->SLOT[S0].Ecnt += CH->SLOT[S0].Einc) >= CH->SLOT[S0].Ecmp) \
- ENV_NEXT_EVENT[CH->SLOT[S0].Ecurp](&(CH->SLOT[S0])); \
-if ((CH->SLOT[S1].Ecnt += CH->SLOT[S1].Einc) >= CH->SLOT[S1].Ecmp) \
- ENV_NEXT_EVENT[CH->SLOT[S1].Ecurp](&(CH->SLOT[S1])); \
-if ((CH->SLOT[S2].Ecnt += CH->SLOT[S2].Einc) >= CH->SLOT[S2].Ecmp) \
- ENV_NEXT_EVENT[CH->SLOT[S2].Ecurp](&(CH->SLOT[S2])); \
-if ((CH->SLOT[S3].Ecnt += CH->SLOT[S3].Einc) >= CH->SLOT[S3].Ecmp) \
- ENV_NEXT_EVENT[CH->SLOT[S3].Ecurp](&(CH->SLOT[S3]));
-
-
-#define DO_LIMIT \
-if (CH->OUTd > LIMIT_CH_OUT) CH->OUTd = LIMIT_CH_OUT; \
-else if (CH->OUTd < -LIMIT_CH_OUT) CH->OUTd = -LIMIT_CH_OUT;
-
-
-#define DO_FEEDBACK0 \
-in0 += CH->S0_OUT[0] >> CH->FB; \
-CH->S0_OUT[0] = SIN_TAB[(in0 >> SIN_LBITS) & SIN_MASK][en0];
-
-
-#define DO_FEEDBACK \
-in0 += (CH->S0_OUT[0] + CH->S0_OUT[1]) >> CH->FB; \
-CH->S0_OUT[1] = CH->S0_OUT[0]; \
-CH->S0_OUT[0] = SIN_TAB[(in0 >> SIN_LBITS) & SIN_MASK][en0];
-
-
-#define DO_FEEDBACK2 \
-in0 += (CH->S0_OUT[0] + (CH->S0_OUT[0] >> 2) + CH->S0_OUT[1]) >> CH->FB; \
-CH->S0_OUT[1] = CH->S0_OUT[0] >> 2; \
-CH->S0_OUT[0] = SIN_TAB[(in0 >> SIN_LBITS) & SIN_MASK][en0];
-
-
-#define DO_FEEDBACK3 \
-in0 += (CH->S0_OUT[0] + CH->S0_OUT[1] + CH->S0_OUT[2] + CH->S0_OUT[3]) >> CH->FB; \
-CH->S0_OUT[3] = CH->S0_OUT[2] >> 1; \
-CH->S0_OUT[2] = CH->S0_OUT[1] >> 1; \
-CH->S0_OUT[1] = CH->S0_OUT[0] >> 1; \
-CH->S0_OUT[0] = SIN_TAB[(in0 >> SIN_LBITS) & SIN_MASK][en0];
-
-
-#define DO_ALGO_0 \
-DO_FEEDBACK \
-in1 += CH->S0_OUT[1]; \
-in2 += SIN_TAB[(in1 >> SIN_LBITS) & SIN_MASK][en1]; \
-in3 += SIN_TAB[(in2 >> SIN_LBITS) & SIN_MASK][en2]; \
-CH->OUTd = (SIN_TAB[(in3 >> SIN_LBITS) & SIN_MASK][en3]) >> OUT_SHIFT;
-
-#define DO_ALGO_1 \
-DO_FEEDBACK \
-in2 += CH->S0_OUT[1] + SIN_TAB[(in1 >> SIN_LBITS) & SIN_MASK][en1]; \
-in3 += SIN_TAB[(in2 >> SIN_LBITS) & SIN_MASK][en2]; \
-CH->OUTd = (SIN_TAB[(in3 >> SIN_LBITS) & SIN_MASK][en3]) >> OUT_SHIFT;
-
-#define DO_ALGO_2 \
-DO_FEEDBACK \
-in2 += SIN_TAB[(in1 >> SIN_LBITS) & SIN_MASK][en1]; \
-in3 += CH->S0_OUT[1] + SIN_TAB[(in2 >> SIN_LBITS) & SIN_MASK][en2]; \
-CH->OUTd = (SIN_TAB[(in3 >> SIN_LBITS) & SIN_MASK][en3]) >> OUT_SHIFT;
-
-#define DO_ALGO_3 \
-DO_FEEDBACK \
-in1 += CH->S0_OUT[1]; \
-in3 += SIN_TAB[(in1 >> SIN_LBITS) & SIN_MASK][en1] + SIN_TAB[(in2 >> SIN_LBITS) & SIN_MASK][en2]; \
-CH->OUTd = (SIN_TAB[(in3 >> SIN_LBITS) & SIN_MASK][en3]) >> OUT_SHIFT;
-
-#define DO_ALGO_4 \
-DO_FEEDBACK \
-in1 += CH->S0_OUT[1]; \
-in3 += SIN_TAB[(in2 >> SIN_LBITS) & SIN_MASK][en2]; \
-CH->OUTd = ((int) SIN_TAB[(in3 >> SIN_LBITS) & SIN_MASK][en3] + (int) SIN_TAB[(in1 >> SIN_LBITS) & SIN_MASK][en1]) >> OUT_SHIFT; \
-DO_LIMIT
-
-#define DO_ALGO_5 \
-DO_FEEDBACK \
-in1 += CH->S0_OUT[1]; \
-in2 += CH->S0_OUT[1]; \
-in3 += CH->S0_OUT[1]; \
-CH->OUTd = ((int) SIN_TAB[(in3 >> SIN_LBITS) & SIN_MASK][en3] + (int) SIN_TAB[(in1 >> SIN_LBITS) & SIN_MASK][en1] + (int) SIN_TAB[(in2 >> SIN_LBITS) & SIN_MASK][en2]) >> OUT_SHIFT; \
-DO_LIMIT
-
-#define DO_ALGO_6 \
-DO_FEEDBACK \
-in1 += CH->S0_OUT[1]; \
-CH->OUTd = ((int) SIN_TAB[(in3 >> SIN_LBITS) & SIN_MASK][en3] + (int) SIN_TAB[(in1 >> SIN_LBITS) & SIN_MASK][en1] + (int) SIN_TAB[(in2 >> SIN_LBITS) & SIN_MASK][en2]) >> OUT_SHIFT; \
-DO_LIMIT
-
-#define DO_ALGO_7 \
-DO_FEEDBACK \
-CH->OUTd = ((int) SIN_TAB[(in3 >> SIN_LBITS) & SIN_MASK][en3] + (int) SIN_TAB[(in1 >> SIN_LBITS) & SIN_MASK][en1] + (int) SIN_TAB[(in2 >> SIN_LBITS) & SIN_MASK][en2] + CH->S0_OUT[1]) >> OUT_SHIFT; \
-DO_LIMIT
-
-
-#define DO_OUTPUT \
-buf[0][i] += CH->OUTd & CH->LEFT; \
-buf[1][i] += CH->OUTd & CH->RIGHT;
-
-
-#define DO_OUTPUT_INT0 \
-if ((int_cnt += YM2612.Inter_Step) & 0x04000) \
-{ \
- int_cnt &= 0x3FFF; \
- buf[0][i] += CH->OUTd & CH->LEFT; \
- buf[1][i] += CH->OUTd & CH->RIGHT; \
-} \
-else i--;
-
-
-#define DO_OUTPUT_INT1 \
-CH->Old_OUTd = (CH->OUTd + CH->Old_OUTd) >> 1; \
-if ((int_cnt += YM2612.Inter_Step) & 0x04000) \
-{ \
- int_cnt &= 0x3FFF; \
- buf[0][i] += CH->Old_OUTd & CH->LEFT; \
- buf[1][i] += CH->Old_OUTd & CH->RIGHT; \
-} \
-else i--;
-
-
-#define DO_OUTPUT_INT2 \
-if ((int_cnt += YM2612.Inter_Step) & 0x04000) \
-{ \
- int_cnt &= 0x3FFF; \
- CH->Old_OUTd = (CH->OUTd + CH->Old_OUTd) >> 1; \
- buf[0][i] += CH->Old_OUTd & CH->LEFT; \
- buf[1][i] += CH->Old_OUTd & CH->RIGHT; \
-} \
-else i--; \
-CH->Old_OUTd = CH->OUTd;
-
-
-#define DO_OUTPUT_INT \
-if ((int_cnt += YM2612.Inter_Step) & 0x04000) \
-{ \
- int_cnt &= 0x3FFF; \
- CH->Old_OUTd = (((int_cnt ^ 0x3FFF) * CH->OUTd) + (int_cnt * CH->Old_OUTd)) >> 14; \
- buf[0][i] += CH->Old_OUTd & CH->LEFT; \
- buf[1][i] += CH->Old_OUTd & CH->RIGHT; \
-} \
-else i--; \
-CH->Old_OUTd = CH->OUTd;
-
-
-void Update_Chan_Algo0(channel_ *CH, int **buf, int lenght)
-{
- int i;
-
- if (CH->SLOT[S3].Ecnt == ENV_END) return;
-
-#if YM_DEBUG_LEVEL > 1
- fprintf(debug_file, "\n\nAlgo 0 len = %d\n\n", lenght);
-#endif
-
- for(i = 0; i < lenght; i++)
- {
- GET_CURRENT_PHASE
- UPDATE_PHASE
- GET_CURRENT_ENV
- UPDATE_ENV
- DO_ALGO_0
- DO_OUTPUT
- }
-}
-
-
-void Update_Chan_Algo1(channel_ *CH, int **buf, int lenght)
-{
- int i;
-
- if (CH->SLOT[S3].Ecnt == ENV_END) return;
-
-#if YM_DEBUG_LEVEL > 1
- fprintf(debug_file, "\n\nAlgo 1 len = %d\n\n", lenght);
-#endif
-
- for(i = 0; i < lenght; i++)
- {
- GET_CURRENT_PHASE
- UPDATE_PHASE
- GET_CURRENT_ENV
- UPDATE_ENV
- DO_ALGO_1
- DO_OUTPUT
- }
-}
-
-
-void Update_Chan_Algo2(channel_ *CH, int **buf, int lenght)
-{
- int i;
-
- if (CH->SLOT[S3].Ecnt == ENV_END) return;
-
-#if YM_DEBUG_LEVEL > 1
- fprintf(debug_file, "\n\nAlgo 2 len = %d\n\n", lenght);
-#endif
-
- for(i = 0; i < lenght; i++)
- {
- GET_CURRENT_PHASE
- UPDATE_PHASE
- GET_CURRENT_ENV
- UPDATE_ENV
- DO_ALGO_2
- DO_OUTPUT
- }
-}
-
-
-void Update_Chan_Algo3(channel_ *CH, int **buf, int lenght)
-{
- int i;
-
- if (CH->SLOT[S3].Ecnt == ENV_END) return;
-
-#if YM_DEBUG_LEVEL > 1
- fprintf(debug_file, "\n\nAlgo 3 len = %d\n\n", lenght);
-#endif
-
- for(i = 0; i < lenght; i++)
- {
- GET_CURRENT_PHASE
- UPDATE_PHASE
- GET_CURRENT_ENV
- UPDATE_ENV
- DO_ALGO_3
- DO_OUTPUT
- }
-}
-
-
-void Update_Chan_Algo4(channel_ *CH, int **buf, int lenght)
-{
- int i;
-
- if ((CH->SLOT[S1].Ecnt == ENV_END) && (CH->SLOT[S3].Ecnt == ENV_END)) return;
-
-#if YM_DEBUG_LEVEL > 1
- fprintf(debug_file, "\n\nAlgo 4 len = %d\n\n", lenght);
-#endif
-
- for(i = 0; i < lenght; i++)
- {
- GET_CURRENT_PHASE
- UPDATE_PHASE
- GET_CURRENT_ENV
- UPDATE_ENV
- DO_ALGO_4
- DO_OUTPUT
- }
-}
-
-
-void Update_Chan_Algo5(channel_ *CH, int **buf, int lenght)
-{
- int i;
-
- if ((CH->SLOT[S1].Ecnt == ENV_END) && (CH->SLOT[S2].Ecnt == ENV_END) && (CH->SLOT[S3].Ecnt == ENV_END)) return;
-
-#if YM_DEBUG_LEVEL > 1
- fprintf(debug_file, "\n\nAlgo 5 len = %d\n\n", lenght);
-#endif
-
- for(i = 0; i < lenght; i++)
- {
- GET_CURRENT_PHASE
- UPDATE_PHASE
- GET_CURRENT_ENV
- UPDATE_ENV
- DO_ALGO_5
- DO_OUTPUT
- }
-}
-
-
-void Update_Chan_Algo6(channel_ *CH, int **buf, int lenght)
-{
- int i;
-
- if ((CH->SLOT[S1].Ecnt == ENV_END) && (CH->SLOT[S2].Ecnt == ENV_END) && (CH->SLOT[S3].Ecnt == ENV_END)) return;
-
-#if YM_DEBUG_LEVEL > 1
- fprintf(debug_file, "\n\nAlgo 6 len = %d\n\n", lenght);
-#endif
-
- for(i = 0; i < lenght; i++)
- {
- GET_CURRENT_PHASE
- UPDATE_PHASE
- GET_CURRENT_ENV
- UPDATE_ENV
- DO_ALGO_6
- DO_OUTPUT
- }
-}
-
-
-void Update_Chan_Algo7(channel_ *CH, int **buf, int lenght)
-{
- int i;
-
- if ((CH->SLOT[S0].Ecnt == ENV_END) && (CH->SLOT[S1].Ecnt == ENV_END) && (CH->SLOT[S2].Ecnt == ENV_END) && (CH->SLOT[S3].Ecnt == ENV_END)) return;
-
-#if YM_DEBUG_LEVEL > 1
- fprintf(debug_file, "\n\nAlgo 7 len = %d\n\n", lenght);
-#endif
-
- for(i = 0; i < lenght; i++)
- {
- GET_CURRENT_PHASE
- UPDATE_PHASE
- GET_CURRENT_ENV
- UPDATE_ENV
- DO_ALGO_7
- DO_OUTPUT
- }
-}
-
-
-void Update_Chan_Algo0_LFO(channel_ *CH, int **buf, int lenght)
-{
- int i, env_LFO, freq_LFO;
-
- if (CH->SLOT[S3].Ecnt == ENV_END) return;
-
-#if YM_DEBUG_LEVEL > 1
- fprintf(debug_file, "\n\nAlgo 0 LFO len = %d\n\n", lenght);
-#endif
-
- for(i = 0; i < lenght; i++)
- {
- GET_CURRENT_PHASE
- UPDATE_PHASE_LFO
- GET_CURRENT_ENV_LFO
- UPDATE_ENV
- DO_ALGO_0
- DO_OUTPUT
- }
-}
-
-
-void Update_Chan_Algo1_LFO(channel_ *CH, int **buf, int lenght)
-{
- int i, env_LFO, freq_LFO;
-
- if (CH->SLOT[S3].Ecnt == ENV_END) return;
-
-#if YM_DEBUG_LEVEL > 1
- fprintf(debug_file, "\n\nAlgo 1 LFO len = %d\n\n", lenght);
-#endif
-
- for(i = 0; i < lenght; i++)
- {
- GET_CURRENT_PHASE
- UPDATE_PHASE_LFO
- GET_CURRENT_ENV_LFO
- UPDATE_ENV
- DO_ALGO_1
- DO_OUTPUT
- }
-}
-
-
-void Update_Chan_Algo2_LFO(channel_ *CH, int **buf, int lenght)
-{
- int i, env_LFO, freq_LFO;
-
- if (CH->SLOT[S3].Ecnt == ENV_END) return;
-
-#if YM_DEBUG_LEVEL > 1
- fprintf(debug_file, "\n\nAlgo 2 LFO len = %d\n\n", lenght);
-#endif
-
- for(i = 0; i < lenght; i++)
- {
- GET_CURRENT_PHASE
- UPDATE_PHASE_LFO
- GET_CURRENT_ENV_LFO
- UPDATE_ENV
- DO_ALGO_2
- DO_OUTPUT
- }
-}
-
-
-void Update_Chan_Algo3_LFO(channel_ *CH, int **buf, int lenght)
-{
- int i, env_LFO, freq_LFO;
-
- if (CH->SLOT[S3].Ecnt == ENV_END) return;
-
-#if YM_DEBUG_LEVEL > 1
- fprintf(debug_file, "\n\nAlgo 3 LFO len = %d\n\n", lenght);
-#endif
-
- for(i = 0; i < lenght; i++)
- {
- GET_CURRENT_PHASE
- UPDATE_PHASE_LFO
- GET_CURRENT_ENV_LFO
- UPDATE_ENV
- DO_ALGO_3
- DO_OUTPUT
- }
-}
-
-
-void Update_Chan_Algo4_LFO(channel_ *CH, int **buf, int lenght)
-{
- int i, env_LFO, freq_LFO;
-
- if ((CH->SLOT[S1].Ecnt == ENV_END) && (CH->SLOT[S3].Ecnt == ENV_END)) return;
-
-#if YM_DEBUG_LEVEL > 1
- fprintf(debug_file, "\n\nAlgo 4 LFO len = %d\n\n", lenght);
-#endif
-
- for(i = 0; i < lenght; i++)
- {
- GET_CURRENT_PHASE
- UPDATE_PHASE_LFO
- GET_CURRENT_ENV_LFO
- UPDATE_ENV
- DO_ALGO_4
- DO_OUTPUT
- }
-}
-
-
-void Update_Chan_Algo5_LFO(channel_ *CH, int **buf, int lenght)
-{
- int i, env_LFO, freq_LFO;
-
- if ((CH->SLOT[S1].Ecnt == ENV_END) && (CH->SLOT[S2].Ecnt == ENV_END) && (CH->SLOT[S3].Ecnt == ENV_END)) return;
-
-#if YM_DEBUG_LEVEL > 1
- fprintf(debug_file, "\n\nAlgo 5 LFO len = %d\n\n", lenght);
-#endif
-
- for(i = 0; i < lenght; i++)
- {
- GET_CURRENT_PHASE
- UPDATE_PHASE_LFO
- GET_CURRENT_ENV_LFO
- UPDATE_ENV
- DO_ALGO_5
- DO_OUTPUT
- }
-}
-
-
-void Update_Chan_Algo6_LFO(channel_ *CH, int **buf, int lenght)
-{
- int i, env_LFO, freq_LFO;
-
- if ((CH->SLOT[S1].Ecnt == ENV_END) && (CH->SLOT[S2].Ecnt == ENV_END) && (CH->SLOT[S3].Ecnt == ENV_END)) return;
-
-#if YM_DEBUG_LEVEL > 1
- fprintf(debug_file, "\n\nAlgo 6 LFO len = %d\n\n", lenght);
-#endif
-
- for(i = 0; i < lenght; i++)
- {
- GET_CURRENT_PHASE
- UPDATE_PHASE_LFO
- GET_CURRENT_ENV_LFO
- UPDATE_ENV
- DO_ALGO_6
- DO_OUTPUT
- }
-}
-
-
-void Update_Chan_Algo7_LFO(channel_ *CH, int **buf, int lenght)
-{
- int i, env_LFO, freq_LFO;
-
- if ((CH->SLOT[S0].Ecnt == ENV_END) && (CH->SLOT[S1].Ecnt == ENV_END) && (CH->SLOT[S2].Ecnt == ENV_END) && (CH->SLOT[S3].Ecnt == ENV_END)) return;
-
-#if YM_DEBUG_LEVEL > 1
- fprintf(debug_file, "\n\nAlgo 7 LFO len = %d\n\n", lenght);
-#endif
-
- for(i = 0; i < lenght; i++)
- {
- GET_CURRENT_PHASE
- UPDATE_PHASE_LFO
- GET_CURRENT_ENV_LFO
- UPDATE_ENV
- DO_ALGO_7
- DO_OUTPUT
- }
-}
-
-
-/******************************************************
- * Interpolated output *
- *****************************************************/
-
-
-void Update_Chan_Algo0_Int(channel_ *CH, int **buf, int lenght)
-{
- int i;
-
- if (CH->SLOT[S3].Ecnt == ENV_END) return;
-
-#if YM_DEBUG_LEVEL > 1
- fprintf(debug_file, "\n\nAlgo 0 len = %d\n\n", lenght);
-#endif
-
- int_cnt = YM2612.Inter_Cnt;
-
- for(i = 0; i < lenght; i++)
- {
- GET_CURRENT_PHASE
- UPDATE_PHASE
- GET_CURRENT_ENV
- UPDATE_ENV
- DO_ALGO_0
- DO_OUTPUT_INT
- }
-}
-
-
-void Update_Chan_Algo1_Int(channel_ *CH, int **buf, int lenght)
-{
- int i;
-
- if (CH->SLOT[S3].Ecnt == ENV_END) return;
-
-#if YM_DEBUG_LEVEL > 1
- fprintf(debug_file, "\n\nAlgo 1 len = %d\n\n", lenght);
-#endif
-
- int_cnt = YM2612.Inter_Cnt;
-
- for(i = 0; i < lenght; i++)
- {
- GET_CURRENT_PHASE
- UPDATE_PHASE
- GET_CURRENT_ENV
- UPDATE_ENV
- DO_ALGO_1
- DO_OUTPUT_INT
- }
-}
-
-
-void Update_Chan_Algo2_Int(channel_ *CH, int **buf, int lenght)
-{
- int i;
-
- if (CH->SLOT[S3].Ecnt == ENV_END) return;
-
-#if YM_DEBUG_LEVEL > 1
- fprintf(debug_file, "\n\nAlgo 2 len = %d\n\n", lenght);
-#endif
-
- int_cnt = YM2612.Inter_Cnt;
-
- for(i = 0; i < lenght; i++)
- {
- GET_CURRENT_PHASE
- UPDATE_PHASE
- GET_CURRENT_ENV
- UPDATE_ENV
- DO_ALGO_2
- DO_OUTPUT_INT
- }
-}
-
-
-void Update_Chan_Algo3_Int(channel_ *CH, int **buf, int lenght)
-{
- int i;
-
- if (CH->SLOT[S3].Ecnt == ENV_END) return;
-
-#if YM_DEBUG_LEVEL > 1
- fprintf(debug_file, "\n\nAlgo 3 len = %d\n\n", lenght);
-#endif
-
- int_cnt = YM2612.Inter_Cnt;
-
- for(i = 0; i < lenght; i++)
- {
- GET_CURRENT_PHASE
- UPDATE_PHASE
- GET_CURRENT_ENV
- UPDATE_ENV
- DO_ALGO_3
- DO_OUTPUT_INT
- }
-}
-
-
-void Update_Chan_Algo4_Int(channel_ *CH, int **buf, int lenght)
-{
- int i;
-
- if ((CH->SLOT[S1].Ecnt == ENV_END) && (CH->SLOT[S3].Ecnt == ENV_END)) return;
-
-#if YM_DEBUG_LEVEL > 1
- fprintf(debug_file, "\n\nAlgo 4 len = %d\n\n", lenght);
-#endif
-
- int_cnt = YM2612.Inter_Cnt;
-
- for(i = 0; i < lenght; i++)
- {
- GET_CURRENT_PHASE
- UPDATE_PHASE
- GET_CURRENT_ENV
- UPDATE_ENV
- DO_ALGO_4
- DO_OUTPUT_INT
- }
-}
-
-
-void Update_Chan_Algo5_Int(channel_ *CH, int **buf, int lenght)
-{
- int i;
-
- if ((CH->SLOT[S1].Ecnt == ENV_END) && (CH->SLOT[S2].Ecnt == ENV_END) && (CH->SLOT[S3].Ecnt == ENV_END)) return;
-
-#if YM_DEBUG_LEVEL > 1
- fprintf(debug_file, "\n\nAlgo 5 len = %d\n\n", lenght);
-#endif
-
- int_cnt = YM2612.Inter_Cnt;
-
- for(i = 0; i < lenght; i++)
- {
- GET_CURRENT_PHASE
- UPDATE_PHASE
- GET_CURRENT_ENV
- UPDATE_ENV
- DO_ALGO_5
- DO_OUTPUT_INT
- }
-}
-
-
-void Update_Chan_Algo6_Int(channel_ *CH, int **buf, int lenght)
-{
- int i;
-
- if ((CH->SLOT[S1].Ecnt == ENV_END) && (CH->SLOT[S2].Ecnt == ENV_END) && (CH->SLOT[S3].Ecnt == ENV_END)) return;
-
-#if YM_DEBUG_LEVEL > 1
- fprintf(debug_file, "\n\nAlgo 6 len = %d\n\n", lenght);
-#endif
-
- int_cnt = YM2612.Inter_Cnt;
-
- for(i = 0; i < lenght; i++)
- {
- GET_CURRENT_PHASE
- UPDATE_PHASE
- GET_CURRENT_ENV
- UPDATE_ENV
- DO_ALGO_6
- DO_OUTPUT_INT
- }
-}
-
-
-void Update_Chan_Algo7_Int(channel_ *CH, int **buf, int lenght)
-{
- int i;
-
- if ((CH->SLOT[S0].Ecnt == ENV_END) && (CH->SLOT[S1].Ecnt == ENV_END) && (CH->SLOT[S2].Ecnt == ENV_END) && (CH->SLOT[S3].Ecnt == ENV_END)) return;
-
-#if YM_DEBUG_LEVEL > 1
- fprintf(debug_file, "\n\nAlgo 7 len = %d\n\n", lenght);
-#endif
-
- int_cnt = YM2612.Inter_Cnt;
-
- for(i = 0; i < lenght; i++)
- {
- GET_CURRENT_PHASE
- UPDATE_PHASE
- GET_CURRENT_ENV
- UPDATE_ENV
- DO_ALGO_7
- DO_OUTPUT_INT
- }
-}
-
-
-void Update_Chan_Algo0_LFO_Int(channel_ *CH, int **buf, int lenght)
-{
- int i, env_LFO, freq_LFO;
-
- if (CH->SLOT[S3].Ecnt == ENV_END) return;
-
-#if YM_DEBUG_LEVEL > 1
- fprintf(debug_file, "\n\nAlgo 0 LFO len = %d\n\n", lenght);
-#endif
-
- int_cnt = YM2612.Inter_Cnt;
-
- for(i = 0; i < lenght; i++)
- {
- GET_CURRENT_PHASE
- UPDATE_PHASE_LFO
- GET_CURRENT_ENV_LFO
- UPDATE_ENV
- DO_ALGO_0
- DO_OUTPUT_INT
- }
-}
-
-
-void Update_Chan_Algo1_LFO_Int(channel_ *CH, int **buf, int lenght)
-{
- int i, env_LFO, freq_LFO;
-
- if (CH->SLOT[S3].Ecnt == ENV_END) return;
-
-#if YM_DEBUG_LEVEL > 1
- fprintf(debug_file, "\n\nAlgo 1 LFO len = %d\n\n", lenght);
-#endif
-
- int_cnt = YM2612.Inter_Cnt;
-
- for(i = 0; i < lenght; i++)
- {
- GET_CURRENT_PHASE
- UPDATE_PHASE_LFO
- GET_CURRENT_ENV_LFO
- UPDATE_ENV
- DO_ALGO_1
- DO_OUTPUT_INT
- }
-}
-
-
-void Update_Chan_Algo2_LFO_Int(channel_ *CH, int **buf, int lenght)
-{
- int i, env_LFO, freq_LFO;
-
- if (CH->SLOT[S3].Ecnt == ENV_END) return;
-
-#if YM_DEBUG_LEVEL > 1
- fprintf(debug_file, "\n\nAlgo 2 LFO len = %d\n\n", lenght);
-#endif
-
- int_cnt = YM2612.Inter_Cnt;
-
- for(i = 0; i < lenght; i++)
- {
- GET_CURRENT_PHASE
- UPDATE_PHASE_LFO
- GET_CURRENT_ENV_LFO
- UPDATE_ENV
- DO_ALGO_2
- DO_OUTPUT_INT
- }
-}
-
-
-void Update_Chan_Algo3_LFO_Int(channel_ *CH, int **buf, int lenght)
-{
- int i, env_LFO, freq_LFO;
-
- if (CH->SLOT[S3].Ecnt == ENV_END) return;
-
-#if YM_DEBUG_LEVEL > 1
- fprintf(debug_file, "\n\nAlgo 3 LFO len = %d\n\n", lenght);
-#endif
-
- int_cnt = YM2612.Inter_Cnt;
-
- for(i = 0; i < lenght; i++)
- {
- GET_CURRENT_PHASE
- UPDATE_PHASE_LFO
- GET_CURRENT_ENV_LFO
- UPDATE_ENV
- DO_ALGO_3
- DO_OUTPUT_INT
- }
-}
-
-
-void Update_Chan_Algo4_LFO_Int(channel_ *CH, int **buf, int lenght)
-{
- int i, env_LFO, freq_LFO;
-
- if ((CH->SLOT[S1].Ecnt == ENV_END) && (CH->SLOT[S3].Ecnt == ENV_END)) return;
-
-#if YM_DEBUG_LEVEL > 1
- fprintf(debug_file, "\n\nAlgo 4 LFO len = %d\n\n", lenght);
-#endif
-
- int_cnt = YM2612.Inter_Cnt;
-
- for(i = 0; i < lenght; i++)
- {
- GET_CURRENT_PHASE
- UPDATE_PHASE_LFO
- GET_CURRENT_ENV_LFO
- UPDATE_ENV
- DO_ALGO_4
- DO_OUTPUT_INT
- }
-}
-
-
-void Update_Chan_Algo5_LFO_Int(channel_ *CH, int **buf, int lenght)
-{
- int i, env_LFO, freq_LFO;
-
- if ((CH->SLOT[S1].Ecnt == ENV_END) && (CH->SLOT[S2].Ecnt == ENV_END) && (CH->SLOT[S3].Ecnt == ENV_END)) return;
-
-#if YM_DEBUG_LEVEL > 1
- fprintf(debug_file, "\n\nAlgo 5 LFO len = %d\n\n", lenght);
-#endif
-
- int_cnt = YM2612.Inter_Cnt;
-
- for(i = 0; i < lenght; i++)
- {
- GET_CURRENT_PHASE
- UPDATE_PHASE_LFO
- GET_CURRENT_ENV_LFO
- UPDATE_ENV
- DO_ALGO_5
- DO_OUTPUT_INT
- }
-}
-
-
-void Update_Chan_Algo6_LFO_Int(channel_ *CH, int **buf, int lenght)
-{
- int i, env_LFO, freq_LFO;
-
- if ((CH->SLOT[S1].Ecnt == ENV_END) && (CH->SLOT[S2].Ecnt == ENV_END) && (CH->SLOT[S3].Ecnt == ENV_END)) return;
-
-#if YM_DEBUG_LEVEL > 1
- fprintf(debug_file, "\n\nAlgo 6 LFO len = %d\n\n", lenght);
-#endif
-
- int_cnt = YM2612.Inter_Cnt;
-
- for(i = 0; i < lenght; i++)
- {
- GET_CURRENT_PHASE
- UPDATE_PHASE_LFO
- GET_CURRENT_ENV_LFO
- UPDATE_ENV
- DO_ALGO_6
- DO_OUTPUT_INT
- }
-}
-
-
-void Update_Chan_Algo7_LFO_Int(channel_ *CH, int **buf, int lenght)
-{
- int i, env_LFO, freq_LFO;
-
- if ((CH->SLOT[S0].Ecnt == ENV_END) && (CH->SLOT[S1].Ecnt == ENV_END) && (CH->SLOT[S2].Ecnt == ENV_END) && (CH->SLOT[S3].Ecnt == ENV_END)) return;
-
-#if YM_DEBUG_LEVEL > 1
- fprintf(debug_file, "\n\nAlgo 7 LFO len = %d\n\n", lenght);
-#endif
-
- int_cnt = YM2612.Inter_Cnt;
-
- for(i = 0; i < lenght; i++)
- {
- GET_CURRENT_PHASE
- UPDATE_PHASE_LFO
- GET_CURRENT_ENV_LFO
- UPDATE_ENV
- DO_ALGO_7
- DO_OUTPUT_INT
- }
-}
-
-
-
-/***********************************************
- * fonctions publiques *
- ***********************************************/
-
-
-// Initialisation de l'émulateur YM2612
-int YM2612_Init(int Clock, int Rate, int Interpolation)
-{
- int i, j;
- double x;
-
- if ((Rate == 0) || (Clock == 0)) return 1;
-
- memset(&YM2612, 0, sizeof(YM2612));
-
-#if YM_DEBUG_LEVEL > 0
- if (debug_file == NULL)
- {
- debug_file = fopen("ym2612.log", "w");
- fprintf(debug_file, "YM2612 logging :\n\n");
- }
-#endif
-
- YM2612.Clock = Clock;
- YM2612.Rate = Rate;
-
- // 144 = 12 * (prescale * 2) = 12 * 6 * 2
- // prescale set to 6 by default
-
- YM2612.Frequence = ((double) YM2612.Clock / (double) YM2612.Rate) / 144.0;
- YM2612.TimerBase = (int) (YM2612.Frequence * 4096.0);
-
- if ((Interpolation) && (YM2612.Frequence > 1.0))
- {
- YM2612.Inter_Step = (unsigned int) ((1.0 / YM2612.Frequence) * (double) (0x4000));
- YM2612.Inter_Cnt = 0;
-
- // We recalculate rate and frequence after interpolation
-
- YM2612.Rate = YM2612.Clock / 144;
- YM2612.Frequence = 1.0;
- }
- else
- {
- YM2612.Inter_Step = 0x4000;
- YM2612.Inter_Cnt = 0;
- }
-
-#if YM_DEBUG_LEVEL > 1
- fprintf(debug_file, "YM2612 frequence = %g rate = %d interp step = %.8X\n\n", YM2612.Frequence, YM2612.Rate, YM2612.Inter_Step);
-#endif
-
- // Tableau TL :
- // [0 - 4095] = +output [4095 - ...] = +output overflow (fill with 0)
- // [12288 - 16383] = -output [16384 - ...] = -output overflow (fill with 0)
-
- for(i = 0; i < TL_LENGHT; i++)
- {
- if (i >= PG_CUT_OFF) // YM2612 cut off sound after 78 dB (14 bits output ?)
- {
- TL_TAB[TL_LENGHT + i] = TL_TAB[i] = 0;
- }
- else
- {
- x = MAX_OUT; // Max output
- x /= pow(10, (ENV_STEP * i) / 20); // Decibel -> Voltage
-
- TL_TAB[i] = (int) x;
- TL_TAB[TL_LENGHT + i] = -TL_TAB[i];
- }
-
-#if YM_DEBUG_LEVEL > 2
- fprintf(debug_file, "TL_TAB[%d] = %.8X TL_TAB[%d] = %.8X\n", i, TL_TAB[i], TL_LENGHT + i, TL_TAB[TL_LENGHT + i]);
-#endif
- }
-
-#if YM_DEBUG_LEVEL > 2
- fprintf(debug_file, "\n\n\n\n");
-#endif
-
- // Tableau SIN :
- // SIN_TAB[x][y] = sin(x) * y;
- // x = phase and y = volume
-
- SIN_TAB[0] = SIN_TAB[SIN_LENGHT / 2] = &TL_TAB[(int)PG_CUT_OFF];
-
- for(i = 1; i <= SIN_LENGHT / 4; i++)
- {
- x = sin(2.0 * PI * (double) (i) / (double) (SIN_LENGHT)); // Sinus
- x = 20 * log10(1 / x); // convert to dB
-
- j = (int) (x / ENV_STEP); // Get TL range
-
- if (j > PG_CUT_OFF) j = (int) PG_CUT_OFF;
-
- SIN_TAB[i] = SIN_TAB[(SIN_LENGHT / 2) - i] = &TL_TAB[j];
- SIN_TAB[(SIN_LENGHT / 2) + i] = SIN_TAB[SIN_LENGHT - i] = &TL_TAB[TL_LENGHT + j];
-
-#if YM_DEBUG_LEVEL > 2
- fprintf(debug_file, "SIN[%d][0] = %.8X SIN[%d][0] = %.8X SIN[%d][0] = %.8X SIN[%d][0] = %.8X\n", i, SIN_TAB[i][0], (SIN_LENGHT / 2) - i, SIN_TAB[(SIN_LENGHT / 2) - i][0], (SIN_LENGHT / 2) + i, SIN_TAB[(SIN_LENGHT / 2) + i][0], SIN_LENGHT - i, SIN_TAB[SIN_LENGHT - i][0]);
-#endif
- }
-
-#if YM_DEBUG_LEVEL > 2
- fprintf(debug_file, "\n\n\n\n");
-#endif
-
- // Tableau LFO (LFO wav) :
-
- for(i = 0; i < LFO_LENGHT; i++)
- {
- x = sin(2.0 * PI * (double) (i) / (double) (LFO_LENGHT)); // Sinus
- x += 1.0;
- x /= 2.0; // positive only
- x *= 11.8 / ENV_STEP; // ajusted to MAX enveloppe modulation
-
- LFO_ENV_TAB[i] = (int) x;
-
- x = sin(2.0 * PI * (double) (i) / (double) (LFO_LENGHT)); // Sinus
- x *= (double) ((1 << (LFO_HBITS - 1)) - 1);
-
- LFO_FREQ_TAB[i] = (int) x;
-
-#if YM_DEBUG_LEVEL > 2
- fprintf(debug_file, "LFO[%d] = %.8X\n", i, LFO_ENV_TAB[i]);
-#endif
- }
-
-#if YM_DEBUG_LEVEL > 2
- fprintf(debug_file, "\n\n\n\n");
-#endif
-
- // Tableau Enveloppe :
- // ENV_TAB[0] -> ENV_TAB[ENV_LENGHT - 1] = attack curve
- // ENV_TAB[ENV_LENGHT] -> ENV_TAB[2 * ENV_LENGHT - 1] = decay curve
-
- for(i = 0; i < ENV_LENGHT; i++)
- {
- // Attack curve (x^8 - music level 2 Vectorman 2)
- x = pow(((double) ((ENV_LENGHT - 1) - i) / (double) (ENV_LENGHT)), 8);
- x *= ENV_LENGHT;
-
- ENV_TAB[i] = (int) x;
-
- // Decay curve (just linear)
- x = pow(((double) (i) / (double) (ENV_LENGHT)), 1);
- x *= ENV_LENGHT;
-
- ENV_TAB[ENV_LENGHT + i] = (int) x;
-
-#if YM_DEBUG_LEVEL > 2
- fprintf(debug_file, "ATTACK[%d] = %d DECAY[%d] = %d\n", i, ENV_TAB[i], i, ENV_TAB[ENV_LENGHT + i]);
-#endif
- }
-
- ENV_TAB[ENV_END >> ENV_LBITS] = ENV_LENGHT - 1; // for the stopped state
-
- // Tableau pour la conversion Attack -> Decay and Decay -> Attack
-
- for(i = 0, j = ENV_LENGHT - 1; i < ENV_LENGHT; i++)
- {
- while (j && (ENV_TAB[j] < (unsigned) i)) j--;
-
- DECAY_TO_ATTACK[i] = j << ENV_LBITS;
- }
-
- // Tableau pour le Substain Level
-
- for(i = 0; i < 15; i++)
- {
- x = i * 3; // 3 and not 6 (Mickey Mania first music for test)
- x /= ENV_STEP;
-
- j = (int) x;
- j <<= ENV_LBITS;
-
- SL_TAB[i] = j + ENV_DECAY;
- }
-
- j = ENV_LENGHT - 1; // special case : volume off
- j <<= ENV_LBITS;
- SL_TAB[15] = j + ENV_DECAY;
-
- // Tableau Frequency Step
-
- for(i = 0; i < 2048; i++)
- {
- x = (double) (i) * YM2612.Frequence;
-
-#if ((SIN_LBITS + SIN_HBITS - (21 - 7)) < 0)
- x /= (double) (1 << ((21 - 7) - SIN_LBITS - SIN_HBITS));
-#else
- x *= (double) (1 << (SIN_LBITS + SIN_HBITS - (21 - 7)));
-#endif
-
- x /= 2.0; // because MUL = value * 2
-
- FINC_TAB[i] = (unsigned int) x;
- }
-
- // Tableaux Attack & Decay Rate
-
- for(i = 0; i < 4; i++)
- {
- AR_TAB[i] = 0;
- DR_TAB[i] = 0;
- }
-
- for(i = 0; i < 60; i++)
- {
- x = YM2612.Frequence;
-
- x *= 1.0 + ((i & 3) * 0.25); // bits 0-1 : x1.00, x1.25, x1.50, x1.75
- x *= (double) (1 << ((i >> 2))); // bits 2-5 : shift bits (x2^0 - x2^15)
- x *= (double) (ENV_LENGHT << ENV_LBITS); // on ajuste pour le tableau ENV_TAB
-
- AR_TAB[i + 4] = (unsigned int) (x / AR_RATE);
- DR_TAB[i + 4] = (unsigned int) (x / DR_RATE);
- }
-
- for(i = 64; i < 96; i++)
- {
- AR_TAB[i] = AR_TAB[63];
- DR_TAB[i] = DR_TAB[63];
-
- NULL_RATE[i - 64] = 0;
- }
-
- // Tableau Detune
-
- for(i = 0; i < 4; i++)
- {
- for (j = 0; j < 32; j++)
- {
-#if ((SIN_LBITS + SIN_HBITS - 21) < 0)
- x = (double) DT_DEF_TAB[(i << 5) + j] * YM2612.Frequence / (double) (1 << (21 - SIN_LBITS - SIN_HBITS));
-#else
- x = (double) DT_DEF_TAB[(i << 5) + j] * YM2612.Frequence * (double) (1 << (SIN_LBITS + SIN_HBITS - 21));
-#endif
-
- DT_TAB[i + 0][j] = (int) x;
- DT_TAB[i + 4][j] = (int) -x;
- }
- }
-
- // Tableau LFO
-
- j = (YM2612.Rate * YM2612.Inter_Step) / 0x4000;
-
- LFO_INC_TAB[0] = (unsigned int) (3.98 * (double) (1 << (LFO_HBITS + LFO_LBITS)) / j);
- LFO_INC_TAB[1] = (unsigned int) (5.56 * (double) (1 << (LFO_HBITS + LFO_LBITS)) / j);
- LFO_INC_TAB[2] = (unsigned int) (6.02 * (double) (1 << (LFO_HBITS + LFO_LBITS)) / j);
- LFO_INC_TAB[3] = (unsigned int) (6.37 * (double) (1 << (LFO_HBITS + LFO_LBITS)) / j);
- LFO_INC_TAB[4] = (unsigned int) (6.88 * (double) (1 << (LFO_HBITS + LFO_LBITS)) / j);
- LFO_INC_TAB[5] = (unsigned int) (9.63 * (double) (1 << (LFO_HBITS + LFO_LBITS)) / j);
- LFO_INC_TAB[6] = (unsigned int) (48.1 * (double) (1 << (LFO_HBITS + LFO_LBITS)) / j);
- LFO_INC_TAB[7] = (unsigned int) (72.2 * (double) (1 << (LFO_HBITS + LFO_LBITS)) / j);
-
- YM2612_Reset();
-
- return 0;
-}
-
-
-int YM2612_End(void)
-{
-
-#if YM_DEBUG_LEVEL > 0
- if (debug_file) fclose(debug_file);
- debug_file = NULL;
-#endif
-
- return 0;
-}
-
-
-int YM2612_Reset(void)
-{
- int i, j;
-
-#if YM_DEBUG_LEVEL > 0
- fprintf(debug_file, "\n\nStarting reseting YM2612 ...\n\n");
-#endif
-
- YM2612.LFOcnt = 0;
- YM2612.TimerA = 0;
- YM2612.TimerAL = 0;
- YM2612.TimerAcnt = 0;
- YM2612.TimerB = 0;
- YM2612.TimerBL = 0;
- YM2612.TimerBcnt = 0;
- YM2612.DAC = 0;
- YM2612.DACdata = 0;
-
- YM2612.Status = 0;
-
- YM2612.OPNAadr = 0;
- YM2612.OPNBadr = 0;
- YM2612.Inter_Cnt = 0;
-
- for(i = 0; i < 6; i++)
- {
- YM2612.CHANNEL[i].Old_OUTd = 0;
- YM2612.CHANNEL[i].OUTd = 0;
- YM2612.CHANNEL[i].LEFT = 0xFFFFFFFF;
- YM2612.CHANNEL[i].RIGHT = 0xFFFFFFFF;
- YM2612.CHANNEL[i].ALGO = 0;;
- YM2612.CHANNEL[i].FB = 31;
- YM2612.CHANNEL[i].FMS = 0;
- YM2612.CHANNEL[i].AMS = 0;
-
- for(j = 0 ;j < 4 ; j++)
- {
- YM2612.CHANNEL[i].S0_OUT[j] = 0;
- YM2612.CHANNEL[i].FNUM[j] = 0;
- YM2612.CHANNEL[i].FOCT[j] = 0;
- YM2612.CHANNEL[i].KC[j] = 0;
-
- YM2612.CHANNEL[i].SLOT[j].Fcnt = 0;
- YM2612.CHANNEL[i].SLOT[j].Finc = 0;
- YM2612.CHANNEL[i].SLOT[j].Ecnt = ENV_END; // Put it at the end of Decay phase...
- YM2612.CHANNEL[i].SLOT[j].Einc = 0;
- YM2612.CHANNEL[i].SLOT[j].Ecmp = 0;
- YM2612.CHANNEL[i].SLOT[j].Ecurp = RELEASE;
-
- YM2612.CHANNEL[i].SLOT[j].ChgEnM = 0;
- }
- }
-
- for(i = 0; i < 0x100; i++)
- {
- YM2612.REG[0][i] = -1;
- YM2612.REG[1][i] = -1;
- }
-
- for(i = 0xB6; i >= 0xB4; i--)
- {
- YM2612_Write(0, (unsigned char) i);
- YM2612_Write(2, (unsigned char) i);
- YM2612_Write(1, 0xC0);
- YM2612_Write(3, 0xC0);
- }
-
- for(i = 0xB2; i >= 0x22; i--)
- {
- YM2612_Write(0, (unsigned char) i);
- YM2612_Write(2, (unsigned char) i);
- YM2612_Write(1, 0);
- YM2612_Write(3, 0);
- }
-
- YM2612_Write(0, 0x2A);
- YM2612_Write(1, 0x80);
-
-#if YM_DEBUG_LEVEL > 0
- fprintf(debug_file, "\n\nFinishing reseting YM2612 ...\n\n");
-#endif
-
- return 0;
-}
-
-
-int YM2612_Read(void)
-{
-/* static int cnt = 0;
-
- if (cnt++ == 50)
- {
- cnt = 0;
- return YM2612.Status;
- }
- else return YM2612.Status | 0x80;
-*/
- return YM2612.Status;
-}
-
-
-int YM2612_Write(unsigned char adr, unsigned char data)
-{
- int d;
-
- data &= 0xFF;
- adr &= 0x3;
-
- switch(adr)
- {
- case 0:
- YM2612.OPNAadr = data;
- break;
-
- case 1:
- // Trivial optimisation
-
- if (YM2612.OPNAadr == 0x2A)
- {
- YM2612.DACdata = ((int) data - 0x80) << 7;
- return 0;
- }
-
- d = YM2612.OPNAadr & 0xF0;
-
- if (d >= 0x30)
- {
- if (YM2612.REG[0][YM2612.OPNAadr] == data) return 2;
- YM2612.REG[0][YM2612.OPNAadr] = data;
-
- if (GYM_Dumping) Update_GYM_Dump(1, YM2612.OPNAadr, data);
-
- if (d < 0xA0) // SLOT
- {
- SLOT_SET(YM2612.OPNAadr, data);
- }
- else // CHANNEL
- {
- CHANNEL_SET(YM2612.OPNAadr, data);
- }
- }
- else // YM2612
- {
- YM2612.REG[0][YM2612.OPNAadr] = data;
-
- if ((GYM_Dumping) && ((YM2612.OPNAadr == 0x22) || (YM2612.OPNAadr == 0x27) || (YM2612.OPNAadr == 0x28))) Update_GYM_Dump(1, YM2612.OPNAadr, data);
-
- YM_SET(YM2612.OPNAadr, data);
- }
- break;
-
- case 2:
- YM2612.OPNBadr = data;
- break;
-
- case 3:
- d = YM2612.OPNBadr & 0xF0;
-
- if (d >= 0x30)
- {
- if (YM2612.REG[1][YM2612.OPNBadr] == data) return 2;
- YM2612.REG[1][YM2612.OPNBadr] = data;
-
- if (GYM_Dumping) Update_GYM_Dump(2, YM2612.OPNBadr, data);
-
- if (d < 0xA0) // SLOT
- {
- SLOT_SET(YM2612.OPNBadr + 0x100, data);
- }
- else // CHANNEL
- {
- CHANNEL_SET(YM2612.OPNBadr + 0x100, data);
- }
- }
- else return 1;
- break;
- }
-
- return 0;
-}
-
-
-void YM2612_Update(int **buf, int length)
-{
- int i, j, algo_type;
-
-#if YM_DEBUG_LEVEL > 1
- fprintf(debug_file, "\n\nStarting generating sound...\n\n");
-#endif
-
- // Mise à jour des pas des compteurs-fréquences s'ils ont été modifiés
-
- if (YM2612.CHANNEL[0].SLOT[0].Finc == -1) CALC_FINC_CH(&YM2612.CHANNEL[0]);
- if (YM2612.CHANNEL[1].SLOT[0].Finc == -1) CALC_FINC_CH(&YM2612.CHANNEL[1]);
- if (YM2612.CHANNEL[2].SLOT[0].Finc == -1)
- {
- if (YM2612.Mode & 0x40)
- {
- CALC_FINC_SL(&(YM2612.CHANNEL[2].SLOT[S0]), FINC_TAB[YM2612.CHANNEL[2].FNUM[2]] >> (7 - YM2612.CHANNEL[2].FOCT[2]), YM2612.CHANNEL[2].KC[2]);
- CALC_FINC_SL(&(YM2612.CHANNEL[2].SLOT[S1]), FINC_TAB[YM2612.CHANNEL[2].FNUM[3]] >> (7 - YM2612.CHANNEL[2].FOCT[3]), YM2612.CHANNEL[2].KC[3]);
- CALC_FINC_SL(&(YM2612.CHANNEL[2].SLOT[S2]), FINC_TAB[YM2612.CHANNEL[2].FNUM[1]] >> (7 - YM2612.CHANNEL[2].FOCT[1]), YM2612.CHANNEL[2].KC[1]);
- CALC_FINC_SL(&(YM2612.CHANNEL[2].SLOT[S3]), FINC_TAB[YM2612.CHANNEL[2].FNUM[0]] >> (7 - YM2612.CHANNEL[2].FOCT[0]), YM2612.CHANNEL[2].KC[0]);
- }
- else
- {
- CALC_FINC_CH(&YM2612.CHANNEL[2]);
- }
- }
- if (YM2612.CHANNEL[3].SLOT[0].Finc == -1) CALC_FINC_CH(&YM2612.CHANNEL[3]);
- if (YM2612.CHANNEL[4].SLOT[0].Finc == -1) CALC_FINC_CH(&YM2612.CHANNEL[4]);
- if (YM2612.CHANNEL[5].SLOT[0].Finc == -1) CALC_FINC_CH(&YM2612.CHANNEL[5]);
-
-/*
- CALC_FINC_CH(&YM2612.CHANNEL[0]);
- CALC_FINC_CH(&YM2612.CHANNEL[1]);
- if (YM2612.Mode & 0x40)
- {
- CALC_FINC_SL(&(YM2612.CHANNEL[2].SLOT[0]), FINC_TAB[YM2612.CHANNEL[2].FNUM[2]] >> (7 - YM2612.CHANNEL[2].FOCT[2]), YM2612.CHANNEL[2].KC[2]);
- CALC_FINC_SL(&(YM2612.CHANNEL[2].SLOT[1]), FINC_TAB[YM2612.CHANNEL[2].FNUM[3]] >> (7 - YM2612.CHANNEL[2].FOCT[3]), YM2612.CHANNEL[2].KC[3]);
- CALC_FINC_SL(&(YM2612.CHANNEL[2].SLOT[2]), FINC_TAB[YM2612.CHANNEL[2].FNUM[1]] >> (7 - YM2612.CHANNEL[2].FOCT[1]), YM2612.CHANNEL[2].KC[1]);
- CALC_FINC_SL(&(YM2612.CHANNEL[2].SLOT[3]), FINC_TAB[YM2612.CHANNEL[2].FNUM[0]] >> (7 - YM2612.CHANNEL[2].FOCT[0]), YM2612.CHANNEL[2].KC[0]);
- }
- else
- {
- CALC_FINC_CH(&YM2612.CHANNEL[2]);
- }
- CALC_FINC_CH(&YM2612.CHANNEL[3]);
- CALC_FINC_CH(&YM2612.CHANNEL[4]);
- CALC_FINC_CH(&YM2612.CHANNEL[5]);
-*/
-
- if (YM2612.Inter_Step & 0x04000) algo_type = 0;
- else algo_type = 16;
-
- if (YM2612.LFOinc)
- {
- // Precalcul LFO wav
-
- for(i = 0; i < length; i++)
- {
- j = ((YM2612.LFOcnt += YM2612.LFOinc) >> LFO_LBITS) & LFO_MASK;
-
- LFO_ENV_UP[i] = LFO_ENV_TAB[j];
- LFO_FREQ_UP[i] = LFO_FREQ_TAB[j];
-
-#if YM_DEBUG_LEVEL > 3
- fprintf(debug_file, "LFO_ENV_UP[%d] = %d LFO_FREQ_UP[%d] = %d\n", i, LFO_ENV_UP[i], i, LFO_FREQ_UP[i]);
-#endif
- }
-
- algo_type |= 8;
- }
-
- if (Chan_Enable[0]) UPDATE_CHAN[YM2612.CHANNEL[0].ALGO + algo_type](&(YM2612.CHANNEL[0]), buf, length);
- if (Chan_Enable[1]) UPDATE_CHAN[YM2612.CHANNEL[1].ALGO + algo_type](&(YM2612.CHANNEL[1]), buf, length);
- if (Chan_Enable[2]) UPDATE_CHAN[YM2612.CHANNEL[2].ALGO + algo_type](&(YM2612.CHANNEL[2]), buf, length);
- if (Chan_Enable[3]) UPDATE_CHAN[YM2612.CHANNEL[3].ALGO + algo_type](&(YM2612.CHANNEL[3]), buf, length);
- if (Chan_Enable[4]) UPDATE_CHAN[YM2612.CHANNEL[4].ALGO + algo_type](&(YM2612.CHANNEL[4]), buf, length);
- if (Chan_Enable[5]) if (!(YM2612.DAC)) UPDATE_CHAN[YM2612.CHANNEL[5].ALGO + algo_type](&(YM2612.CHANNEL[5]), buf, length);
-
- YM2612.Inter_Cnt = int_cnt;
-
-#if YM_DEBUG_LEVEL > 1
- fprintf(debug_file, "\n\nFinishing generating sound...\n\n");
-#endif
-
-}
-
-
-int YM2612_Save(unsigned char SAVE[0x200])
-{
- int i;
-
- for(i = 0; i < 0x100; i++)
- {
- SAVE[0x000 + i] = YM2612.REG[0][i];
- SAVE[0x100 + i] = YM2612.REG[1][i];
- }
-
- return 0;
-}
-
-
-int YM2612_Restore(unsigned char SAVE[0x200])
-{
- int i;
-
- YM2612_Reset();
-
- for(i = 0; i < 0x100; i++)
- {
- YM2612_Write(0, (unsigned char) i);
- YM2612_Write(1, SAVE[0x000 + i]);
- YM2612_Write(2, (unsigned char) i);
- YM2612_Write(3, SAVE[0x100 + i]);
- }
-
- return 0;
-}
-
-/* Gens */
-
-void YM2612_DacAndTimers_Update(int **buffer, int length)
-{
- int *bufL, *bufR;
- int i;
-
- if (YM2612.DAC && YM2612.DACdata && DAC_Enable)
- {
- bufL = buffer[0];
- bufR = buffer[1];
-
- for(i = 0; i < length; i++)
- {
- bufL[i] += YM2612.DACdata & YM2612.CHANNEL[5].LEFT;
- bufR[i] += YM2612.DACdata & YM2612.CHANNEL[5].RIGHT;
- }
- }
-
- i = YM2612.TimerBase * length;
-
- if (YM2612.Mode & 1) // Timer A ON ?
- {
-// if ((YM2612.TimerAcnt -= 14073) <= 0) // 13879=NTSC (old: 14475=NTSC 14586=PAL)
- if ((YM2612.TimerAcnt -= i) <= 0)
- {
- YM2612.Status |= (YM2612.Mode & 0x04) >> 2;
- YM2612.TimerAcnt += YM2612.TimerAL;
-
-#if YM_DEBUG_LEVEL > 0
- fprintf(debug_file, "Counter A overflow\n");
-#endif
-
- if (YM2612.Mode & 0x80) CSM_Key_Control();
- }
- }
-
- if (YM2612.Mode & 2) // Timer B ON ?
- {
-// if ((YM2612.TimerBcnt -= 14073) <= 0) // 13879=NTSC (old: 14475=NTSC 14586=PAL)
- if ((YM2612.TimerBcnt -= i) <= 0)
- {
- YM2612.Status |= (YM2612.Mode & 0x08) >> 2;
- YM2612.TimerBcnt += YM2612.TimerBL;
-
-#if YM_DEBUG_LEVEL > 0
- fprintf(debug_file, "Counter B overflow\n");
-#endif
- }
- }
-}
-
-
-void YM2612_Special_Update(void)
-{
- if (YM_Len && YM2612_Enable)
- {
- YM2612_Update(YM_Buf, YM_Len);
-
- YM_Buf[0] = Seg_L + Sound_Extrapol[VDP_Current_Line + 1][0];
- YM_Buf[1] = Seg_R + Sound_Extrapol[VDP_Current_Line + 1][0];
- YM_Len = 0;
- }
-}
-
-#ifdef __PORT__
-int _YM2612_Reset(void) __attribute__ (( alias ("YM2612_Reset")));
-int _YM2612_Read(void) __attribute__ ((alias ("YM2612_Read")));
-int _YM2612_Write(unsigned char adr, unsigned char data) __attribute__ ((alias ("YM2612_Write")));
-#endif
-
-/* end */
diff --git a/xbmc/cores/paplayer/GYMCodec/ym2612.h b/xbmc/cores/paplayer/GYMCodec/ym2612.h
deleted file mode 100644
index 12300812a7..0000000000
--- a/xbmc/cores/paplayer/GYMCodec/ym2612.h
+++ /dev/null
@@ -1,199 +0,0 @@
-/***************************************************************************
- * Gens: Yamaha YM2612 FM synthesis chip emulator. *
- * *
- * Copyright (c) 1999-2002 by Stéphane Dallongeville *
- * Copyright (c) 2003-2004 by Stéphane Akhoun *
- * Copyright (c) 2008-2009 by David Korth *
- * *
- * This program is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU General Public License as published by the *
- * Free Software Foundation; either version 2 of the License, or (at your *
- * option) any later version. *
- * *
- * This program 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 General Public License for more details. *
- * *
- * 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. *
- ***************************************************************************/
-
-#ifndef _YM2612_H_
-#define _YM2612_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-// Change it if you need to do long update
-#define MAX_UPDATE_LENGHT 2000
-
-// Gens always uses 16 bits sound (in 32 bits buffer) and do the convertion later if needed.
-#define OUTPUT_BITS 16
-
-// VC++ inline
-#define INLINE __inline
-
-typedef struct slot__ {
- unsigned int *DT; // paramètre detune
- int MUL; // paramètre "multiple de fréquence"
- int TL; // Total Level = volume lorsque l'enveloppe est au plus haut
- int TLL; // Total Level ajusted
- int SLL; // Sustin Level (ajusted) = volume où l'enveloppe termine sa première phase de régression
- int KSR_S; // Key Scale Rate Shift = facteur de prise en compte du KSL dans la variations de l'enveloppe
- int KSR; // Key Scale Rate = cette valeur est calculée par rapport à la fréquence actuelle, elle va influer
- // sur les différents paramètres de l'enveloppe comme l'attaque, le decay ... comme dans la réalité !
- int SEG; // Type enveloppe SSG
- unsigned int *AR; // Attack Rate (table pointeur) = Taux d'attaque (AR[KSR])
- unsigned int *DR; // Decay Rate (table pointeur) = Taux pour la régression (DR[KSR])
- unsigned int *SR; // Sustin Rate (table pointeur) = Taux pour le maintien (SR[KSR])
- unsigned int *RR; // Release Rate (table pointeur) = Taux pour le relâchement (RR[KSR])
- int Fcnt; // Frequency Count = compteur-fréquence pour déterminer l'amplitude actuelle (SIN[Finc >> 16])
- int Finc; // frequency step = pas d'incrémentation du compteur-fréquence
- // plus le pas est grand, plus la fréquence est aïgu (ou haute)
- int Ecurp; // Envelope current phase = cette variable permet de savoir dans quelle phase
- // de l'enveloppe on se trouve, par exemple phase d'attaque ou phase de maintenue ...
- // en fonction de la valeur de cette variable, on va appeler une fonction permettant
- // de mettre à jour l'enveloppe courante.
- int Ecnt; // Envelope counter = le compteur-enveloppe permet de savoir où l'on se trouve dans l'enveloppe
- int Einc; // Envelope step courant
- int Ecmp; // Envelope counter limite pour la prochaine phase
- int EincA; // Envelope step for Attack = pas d'incrémentation du compteur durant la phase d'attaque
- // cette valeur est égal à AR[KSR]
- int EincD; // Envelope step for Decay = pas d'incrémentation du compteur durant la phase de regression
- // cette valeur est égal à DR[KSR]
- int EincS; // Envelope step for Sustain = pas d'incrémentation du compteur durant la phase de maintenue
- // cette valeur est égal à SR[KSR]
- int EincR; // Envelope step for Release = pas d'incrémentation du compteur durant la phase de relâchement
- // cette valeur est égal à RR[KSR]
- int *OUTp; // pointeur of SLOT output = pointeur permettant de connecter la sortie de ce slot à l'entrée
- // d'un autre ou carrement à la sortie de la voie
- int INd; // input data of the slot = données en entrée du slot
- int ChgEnM; // Change envelop mask.
- int AMS; // AMS depth level of this SLOT = degré de modulation de l'amplitude par le LFO
- int AMSon; // AMS enable flag = drapeau d'activation de l'AMS
-} slot_;
-
-typedef struct channel__ {
- int S0_OUT[4]; // anciennes sorties slot 0 (pour le feed back)
- int Old_OUTd; // ancienne sortie de la voie (son brut)
- int OUTd; // sortie de la voie (son brut)
- int LEFT; // LEFT enable flag
- int RIGHT; // RIGHT enable flag
- int ALGO; // Algorythm = détermine les connections entre les opérateurs
- int FB; // shift count of self feed back = degré de "Feed-Back" du SLOT 1 (il est son unique entrée)
- int FMS; // Fréquency Modulation Sensitivity of channel = degré de modulation de la fréquence sur la voie par le LFO
- int AMS; // Amplitude Modulation Sensitivity of channel = degré de modulation de l'amplitude sur la voie par le LFO
- int FNUM[4]; // hauteur fréquence de la voie (+ 3 pour le mode spécial)
- int FOCT[4]; // octave de la voie (+ 3 pour le mode spécial)
- int KC[4]; // Key Code = valeur fonction de la fréquence (voir KSR pour les slots, KSR = KC >> KSR_S)
- struct slot__ SLOT[4]; // four slot.operators = les 4 slots de la voie
- int FFlag; // Frequency step recalculation flag
-} channel_;
-
-typedef struct ym2612__ {
- int Clock; // Horloge YM2612
- int Rate; // Sample Rate (11025/22050/44100)
- int TimerBase; // TimerBase calculation
- int Status; // YM2612 Status (timer overflow)
- int OPNAadr; // addresse pour l'écriture dans l'OPN A (propre à l'émulateur)
- int OPNBadr; // addresse pour l'écriture dans l'OPN B (propre à l'émulateur)
- int LFOcnt; // LFO counter = compteur-fréquence pour le LFO
- int LFOinc; // LFO step counter = pas d'incrémentation du compteur-fréquence du LFO
- // plus le pas est grand, plus la fréquence est grande
- int TimerA; // timerA limit = valeur jusqu'à laquelle le timer A doit compter
- int TimerAL;
- int TimerAcnt; // timerA counter = valeur courante du Timer A
- int TimerB; // timerB limit = valeur jusqu'à laquelle le timer B doit compter
- int TimerBL;
- int TimerBcnt; // timerB counter = valeur courante du Timer B
- int Mode; // Mode actuel des voie 3 et 6 (normal / spécial)
- int DAC; // DAC enabled flag
- int DACdata; // DAC data
- double Frequence; // Fréquence de base, se calcul par rapport à l'horlage et au sample rate
- unsigned int Inter_Cnt; // Interpolation Counter
- unsigned int Inter_Step; // Interpolation Step
- struct channel__ CHANNEL[6]; // Les 6 voies du YM2612
- int REG[2][0x100]; // Sauvegardes des valeurs de tout les registres, c'est facultatif
- // cela nous rend le débuggage plus facile
-} ym2612_;
-
-/* Gens */
-
-extern int YM2612_Enable;
-extern int YM2612_Improv;
-extern int DAC_Enable;
-extern int *YM_Buf[2];
-extern int YM_Len;
-
-extern int Chan_Enable[6];
-
-/* end */
-
-int YM2612_Init(int clock, int rate, int interpolation);
-int YM2612_End(void);
-int YM2612_Reset(void);
-int YM2612_Read(void);
-int YM2612_Write(unsigned char adr, unsigned char data);
-void YM2612_Update(int **buf, int length);
-int YM2612_Save(unsigned char SAVE[0x200]);
-int YM2612_Restore(unsigned char SAVE[0x200]);
-
-/* Gens */
-
-void YM2612_DacAndTimers_Update(int **buffer, int length);
-void YM2612_Special_Update(void);
-
-/* end */
-
-// used for foward...
-void Update_Chan_Algo0(channel_ *CH, int **buf, int lenght);
-void Update_Chan_Algo1(channel_ *CH, int **buf, int lenght);
-void Update_Chan_Algo2(channel_ *CH, int **buf, int lenght);
-void Update_Chan_Algo3(channel_ *CH, int **buf, int lenght);
-void Update_Chan_Algo4(channel_ *CH, int **buf, int lenght);
-void Update_Chan_Algo5(channel_ *CH, int **buf, int lenght);
-void Update_Chan_Algo6(channel_ *CH, int **buf, int lenght);
-void Update_Chan_Algo7(channel_ *CH, int **buf, int lenght);
-
-void Update_Chan_Algo0_LFO(channel_ *CH, int **buf, int lenght);
-void Update_Chan_Algo1_LFO(channel_ *CH, int **buf, int lenght);
-void Update_Chan_Algo2_LFO(channel_ *CH, int **buf, int lenght);
-void Update_Chan_Algo3_LFO(channel_ *CH, int **buf, int lenght);
-void Update_Chan_Algo4_LFO(channel_ *CH, int **buf, int lenght);
-void Update_Chan_Algo5_LFO(channel_ *CH, int **buf, int lenght);
-void Update_Chan_Algo6_LFO(channel_ *CH, int **buf, int lenght);
-void Update_Chan_Algo7_LFO(channel_ *CH, int **buf, int lenght);
-
-void Update_Chan_Algo0_Int(channel_ *CH, int **buf, int lenght);
-void Update_Chan_Algo1_Int(channel_ *CH, int **buf, int lenght);
-void Update_Chan_Algo2_Int(channel_ *CH, int **buf, int lenght);
-void Update_Chan_Algo3_Int(channel_ *CH, int **buf, int lenght);
-void Update_Chan_Algo4_Int(channel_ *CH, int **buf, int lenght);
-void Update_Chan_Algo5_Int(channel_ *CH, int **buf, int lenght);
-void Update_Chan_Algo6_Int(channel_ *CH, int **buf, int lenght);
-void Update_Chan_Algo7_Int(channel_ *CH, int **buf, int lenght);
-
-void Update_Chan_Algo0_LFO_Int(channel_ *CH, int **buf, int lenght);
-void Update_Chan_Algo1_LFO_Int(channel_ *CH, int **buf, int lenght);
-void Update_Chan_Algo2_LFO_Int(channel_ *CH, int **buf, int lenght);
-void Update_Chan_Algo3_LFO_Int(channel_ *CH, int **buf, int lenght);
-void Update_Chan_Algo4_LFO_Int(channel_ *CH, int **buf, int lenght);
-void Update_Chan_Algo5_LFO_Int(channel_ *CH, int **buf, int lenght);
-void Update_Chan_Algo6_LFO_Int(channel_ *CH, int **buf, int lenght);
-void Update_Chan_Algo7_LFO_Int(channel_ *CH, int **buf, int lenght);
-
-// used for foward...
-void Env_Attack_Next(slot_ *SL);
-void Env_Decay_Next(slot_ *SL);
-void Env_Substain_Next(slot_ *SL);
-void Env_Release_Next(slot_ *SL);
-void Env_NULL_Next(slot_ *SL);
-
-#ifdef __cplusplus
-};
-#endif
-
-#endif
diff --git a/xbmc/cores/paplayer/Makefile.in b/xbmc/cores/paplayer/Makefile.in
index 8c79d5c875..6a40652b99 100644
--- a/xbmc/cores/paplayer/Makefile.in
+++ b/xbmc/cores/paplayer/Makefile.in
@@ -9,7 +9,7 @@ endif
CFLAGS+=-DHAS_ALSA
-SRCS=AC3CDDACodec.cpp AC3Codec.cpp ADPCMCodec.cpp AIFFcodec.cpp AudioDecoder.cpp CDDAcodec.cpp CodecFactory.cpp VGMCodec.cpp FLACcodec.cpp GYMCodec.cpp MP3codec.cpp NSFCodec.cpp OGGcodec.cpp ReplayGain.cpp SIDCodec.cpp TimidityCodec.cpp WAVcodec.cpp WAVPackcodec.cpp YMCodec.cpp DVDPlayerCodec.cpp DTSCodec.cpp DTSCDDACodec.cpp PAPlayer.cpp OggCallback.cpp ModplugCodec.cpp
+SRCS=AC3CDDACodec.cpp AC3Codec.cpp ADPCMCodec.cpp AIFFcodec.cpp AudioDecoder.cpp CDDAcodec.cpp CodecFactory.cpp VGMCodec.cpp FLACcodec.cpp MP3codec.cpp NSFCodec.cpp OGGcodec.cpp ReplayGain.cpp SIDCodec.cpp TimidityCodec.cpp WAVcodec.cpp WAVPackcodec.cpp YMCodec.cpp DVDPlayerCodec.cpp DTSCodec.cpp DTSCDDACodec.cpp PAPlayer.cpp OggCallback.cpp ModplugCodec.cpp
ifeq (@USE_ASAP_CODEC@,1)
SRCS+=ASAPCodec.cpp