- Since we have two OPL cores now, what's one more? Added a straight, (highly) unoptimized port

of the Java OPL3 emulator.

SVN r3967 (trunk)
This commit is contained in:
Randy Heit 2012-11-15 05:23:24 +00:00
parent 3f02444ffe
commit e59d7bc8b8
6 changed files with 1792 additions and 31 deletions

View File

@ -813,6 +813,7 @@ add_executable( zdoom WIN32
oplsynth/music_opl_mididevice.cpp oplsynth/music_opl_mididevice.cpp
oplsynth/opl_mus_player.cpp oplsynth/opl_mus_player.cpp
oplsynth/dosbox/opl.cpp oplsynth/dosbox/opl.cpp
oplsynth/OPL3.cpp
resourcefiles/ancientzip.cpp resourcefiles/ancientzip.cpp
resourcefiles/file_7z.cpp resourcefiles/file_7z.cpp
resourcefiles/file_grp.cpp resourcefiles/file_grp.cpp

1783
src/oplsynth/OPL3.cpp Normal file

File diff suppressed because it is too large Load Diff

View File

@ -323,7 +323,7 @@ int OPLio::OPLinit(uint numchips, bool stereo, bool initopl3)
{ {
assert(numchips >= 1 && numchips <= countof(chips)); assert(numchips >= 1 && numchips <= countof(chips));
uint i; uint i;
IsOPL3 = (opl_core == 1); IsOPL3 = (opl_core == 1 || opl_core == 2);
memset(chips, 0, sizeof(chips)); memset(chips, 0, sizeof(chips));
if (IsOPL3) if (IsOPL3)
@ -332,7 +332,7 @@ int OPLio::OPLinit(uint numchips, bool stereo, bool initopl3)
} }
for (i = 0; i < numchips; ++i) for (i = 0; i < numchips; ++i)
{ {
OPLEmul *chip = IsOPL3 ? DBOPLCreate(stereo) : YM3812Create(stereo); OPLEmul *chip = IsOPL3 ? (opl_core == 1 ? DBOPLCreate(stereo) : JavaOPLCreate(stereo)) : YM3812Create(stereo);
if (chip == NULL) if (chip == NULL)
{ {
break; break;

View File

@ -20,5 +20,6 @@ public:
OPLEmul *YM3812Create(bool stereo); OPLEmul *YM3812Create(bool stereo);
OPLEmul *DBOPLCreate(bool stereo); OPLEmul *DBOPLCreate(bool stereo);
OPLEmul *JavaOPLCreate(bool stereo);
#endif #endif

View File

@ -28,7 +28,7 @@ OPLMUSSong::OPLMUSSong (FILE *file, BYTE *musiccache, int len)
Music = new OPLmusicFile (file, musiccache, len); Music = new OPLmusicFile (file, musiccache, len);
m_Stream = GSnd->CreateStream (FillStream, samples*4, m_Stream = GSnd->CreateStream (FillStream, samples*4,
(opl_core != 1 ? SoundStream::Mono : 0) | SoundStream::Float, int(OPL_SAMPLE_RATE), this); (opl_core == 0 ? SoundStream::Mono : 0) | SoundStream::Float, int(OPL_SAMPLE_RATE), this);
if (m_Stream == NULL) if (m_Stream == NULL)
{ {
Printf (PRINT_BOLD, "Could not create music stream.\n"); Printf (PRINT_BOLD, "Could not create music stream.\n");

View File

@ -2618,6 +2618,10 @@
RelativePath=".\src\oplsynth\opl.h" RelativePath=".\src\oplsynth\opl.h"
> >
</File> </File>
<File
RelativePath=".\src\oplsynth\OPL3.cpp"
>
</File>
<File <File
RelativePath=".\src\oplsynth\opl_mus_player.cpp" RelativePath=".\src\oplsynth\opl_mus_player.cpp"
> >
@ -2632,34 +2636,6 @@
<File <File
RelativePath=".\src\oplsynth\dosbox\opl.cpp" RelativePath=".\src\oplsynth\dosbox\opl.cpp"
> >
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
</File> </File>
<File <File
RelativePath=".\src\oplsynth\dosbox\opl.h" RelativePath=".\src\oplsynth\dosbox\opl.h"