More Amiga V2/V3 sound updates from _Q_:

1. A Player_MOD class, basically acts as a simplified mixer that mixes at 60Hz intervals (or whatever interval you specify), this gives smooth music playback in player_v3a
2. Some changes to player_v3a as a result of #1, including reduced music volume
3. player_v2a, and the necessary additions to scummvm.cpp/scumm.h

svn-id: r10392
This commit is contained in:
Travis Howell 2003-09-24 06:56:30 +00:00
parent 09a01e4cbe
commit 4a62eb3e3b
13 changed files with 2794 additions and 1151 deletions

980
scumm.dsp
View file

@ -1,482 +1,498 @@
# Microsoft Developer Studio Project File - Name="scumm" - Package Owner=<4> # Microsoft Developer Studio Project File - Name="scumm" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00 # Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT ** # ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Static Library" 0x0104 # TARGTYPE "Win32 (x86) Static Library" 0x0104
CFG=scumm - Win32 mad mp3 Debug CFG=scumm - Win32 mad mp3 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run !MESSAGE use the Export Makefile command and run
!MESSAGE !MESSAGE
!MESSAGE NMAKE /f "scumm.mak". !MESSAGE NMAKE /f "scumm.mak".
!MESSAGE !MESSAGE
!MESSAGE You can specify a configuration when running NMAKE !MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example: !MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE !MESSAGE
!MESSAGE NMAKE /f "scumm.mak" CFG="scumm - Win32 mad mp3 Debug" !MESSAGE NMAKE /f "scumm.mak" CFG="scumm - Win32 mad mp3 Debug"
!MESSAGE !MESSAGE
!MESSAGE Possible choices for configuration are: !MESSAGE Possible choices for configuration are:
!MESSAGE !MESSAGE
!MESSAGE "scumm - Win32 Release" (based on "Win32 (x86) Static Library") !MESSAGE "scumm - Win32 Release" (based on "Win32 (x86) Static Library")
!MESSAGE "scumm - Win32 Debug" (based on "Win32 (x86) Static Library") !MESSAGE "scumm - Win32 Debug" (based on "Win32 (x86) Static Library")
!MESSAGE "scumm - Win32 mad mp3 Debug" (based on "Win32 (x86) Static Library") !MESSAGE "scumm - Win32 mad mp3 Debug" (based on "Win32 (x86) Static Library")
!MESSAGE "scumm - Win32 mad mp3 Release" (based on "Win32 (x86) Static Library") !MESSAGE "scumm - Win32 mad mp3 Release" (based on "Win32 (x86) Static Library")
!MESSAGE !MESSAGE
# Begin Project # Begin Project
# PROP AllowPerConfigDependencies 0 # PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName "" # PROP Scc_ProjName ""
# PROP Scc_LocalPath "" # PROP Scc_LocalPath ""
CPP=cl.exe CPP=cl.exe
RSC=rc.exe RSC=rc.exe
!IF "$(CFG)" == "scumm - Win32 Release" !IF "$(CFG)" == "scumm - Win32 Release"
# PROP BASE Use_MFC 0 # PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0 # PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release" # PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release" # PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir "" # PROP BASE Target_Dir ""
# PROP Use_MFC 0 # PROP Use_MFC 0
# PROP Use_Debug_Libraries 0 # PROP Use_Debug_Libraries 0
# PROP Output_Dir "scumm___Release" # PROP Output_Dir "scumm___Release"
# PROP Intermediate_Dir "scumm___Release" # PROP Intermediate_Dir "scumm___Release"
# PROP Target_Dir "" # PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
# ADD CPP /nologo /G6 /MT /W3 /WX /GR /GX /O2 /I "." /I "common" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /D "USE_ADLIB" /D "BYPASS_COPY_PROT" /YX /FD /c # ADD CPP /nologo /G6 /MT /W3 /WX /GR /GX /O2 /I "." /I "common" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /D "USE_ADLIB" /D "BYPASS_COPY_PROT" /YX /FD /c
# ADD BASE RSC /l 0x415 /d "NDEBUG" # ADD BASE RSC /l 0x415 /d "NDEBUG"
# ADD RSC /l 0x415 /d "NDEBUG" # ADD RSC /l 0x415 /d "NDEBUG"
BSC32=bscmake.exe BSC32=bscmake.exe
# ADD BASE BSC32 /nologo # ADD BASE BSC32 /nologo
# ADD BSC32 /nologo # ADD BSC32 /nologo
LIB32=link.exe -lib LIB32=link.exe -lib
# ADD BASE LIB32 /nologo # ADD BASE LIB32 /nologo
# ADD LIB32 /nologo # ADD LIB32 /nologo
!ELSEIF "$(CFG)" == "scumm - Win32 Debug" !ELSEIF "$(CFG)" == "scumm - Win32 Debug"
# PROP BASE Use_MFC 0 # PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1 # PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "scumm___Win32_Debug" # PROP BASE Output_Dir "scumm___Win32_Debug"
# PROP BASE Intermediate_Dir "scumm___Win32_Debug" # PROP BASE Intermediate_Dir "scumm___Win32_Debug"
# PROP BASE Target_Dir "" # PROP BASE Target_Dir ""
# PROP Use_MFC 0 # PROP Use_MFC 0
# PROP Use_Debug_Libraries 1 # PROP Use_Debug_Libraries 1
# PROP Output_Dir "scumm___Debug" # PROP Output_Dir "scumm___Debug"
# PROP Intermediate_Dir "scumm___Debug" # PROP Intermediate_Dir "scumm___Debug"
# PROP Target_Dir "" # PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
# ADD CPP /nologo /MTd /W3 /WX /Gm /GR /GX /ZI /Od /I "." /I "common" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /D "BYPASS_COPY_PROT" /D "USE_ADLIB" /YX /FD /GZ /c # ADD CPP /nologo /MTd /W3 /WX /Gm /GR /GX /ZI /Od /I "." /I "common" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /D "BYPASS_COPY_PROT" /D "USE_ADLIB" /YX /FD /GZ /c
# ADD BASE RSC /l 0x415 /d "_DEBUG" # ADD BASE RSC /l 0x415 /d "_DEBUG"
# ADD RSC /l 0x415 /d "_DEBUG" # ADD RSC /l 0x415 /d "_DEBUG"
BSC32=bscmake.exe BSC32=bscmake.exe
# ADD BASE BSC32 /nologo # ADD BASE BSC32 /nologo
# ADD BSC32 /nologo # ADD BSC32 /nologo
LIB32=link.exe -lib LIB32=link.exe -lib
# ADD BASE LIB32 /nologo # ADD BASE LIB32 /nologo
# ADD LIB32 /nologo # ADD LIB32 /nologo
!ELSEIF "$(CFG)" == "scumm - Win32 mad mp3 Debug" !ELSEIF "$(CFG)" == "scumm - Win32 mad mp3 Debug"
# PROP BASE Use_MFC 0 # PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1 # PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "scumm___Win32_mad mp3_Debug" # PROP BASE Output_Dir "scumm___Win32_mad mp3_Debug"
# PROP BASE Intermediate_Dir "scumm___Win32_mad mp3_Debug" # PROP BASE Intermediate_Dir "scumm___Win32_mad mp3_Debug"
# PROP BASE Target_Dir "" # PROP BASE Target_Dir ""
# PROP Use_MFC 0 # PROP Use_MFC 0
# PROP Use_Debug_Libraries 1 # PROP Use_Debug_Libraries 1
# PROP Output_Dir "scumm___mad_mp3_Debug" # PROP Output_Dir "scumm___mad_mp3_Debug"
# PROP Intermediate_Dir "scumm___mad_mp3_Debug" # PROP Intermediate_Dir "scumm___mad_mp3_Debug"
# PROP Target_Dir "" # PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /I "." /I "common" /I "scumm" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /D "BYPASS_COPY_PROT" /D "USE_ADLIB" /YX /FD /GZ /c # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /I "." /I "common" /I "scumm" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /D "BYPASS_COPY_PROT" /D "USE_ADLIB" /YX /FD /GZ /c
# ADD CPP /nologo /MTd /W3 /WX /Gm /vmg /GR /GX /ZI /Od /I "." /I "common" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /D "USE_ADLIB" /D "BYPASS_COPY_PROT" /D "USE_MAD" /YX /FD /GZ /c # ADD CPP /nologo /MTd /W3 /WX /Gm /vmg /GR /GX /ZI /Od /I "." /I "common" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /D "USE_ADLIB" /D "BYPASS_COPY_PROT" /D "USE_MAD" /YX /FD /GZ /c
# ADD BASE RSC /l 0x415 /d "_DEBUG" # ADD BASE RSC /l 0x415 /d "_DEBUG"
# ADD RSC /l 0x415 /d "_DEBUG" # ADD RSC /l 0x415 /d "_DEBUG"
BSC32=bscmake.exe BSC32=bscmake.exe
# ADD BASE BSC32 /nologo # ADD BASE BSC32 /nologo
# ADD BSC32 /nologo # ADD BSC32 /nologo
LIB32=link.exe -lib LIB32=link.exe -lib
# ADD BASE LIB32 /nologo # ADD BASE LIB32 /nologo
# ADD LIB32 /nologo # ADD LIB32 /nologo
!ELSEIF "$(CFG)" == "scumm - Win32 mad mp3 Release" !ELSEIF "$(CFG)" == "scumm - Win32 mad mp3 Release"
# PROP BASE Use_MFC 0 # PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0 # PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "scumm___Win32_mad mp3_Release" # PROP BASE Output_Dir "scumm___Win32_mad mp3_Release"
# PROP BASE Intermediate_Dir "scumm___Win32_mad mp3_Release" # PROP BASE Intermediate_Dir "scumm___Win32_mad mp3_Release"
# PROP BASE Target_Dir "" # PROP BASE Target_Dir ""
# PROP Use_MFC 0 # PROP Use_MFC 0
# PROP Use_Debug_Libraries 0 # PROP Use_Debug_Libraries 0
# PROP Output_Dir "scumm___mad_mp3_Release" # PROP Output_Dir "scumm___mad_mp3_Release"
# PROP Intermediate_Dir "scumm___mad_mp3_Release" # PROP Intermediate_Dir "scumm___mad_mp3_Release"
# PROP Target_Dir "" # PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /I "." /I "common" /I "scumm" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /D "USE_ADLIB" /YX /FD /c # ADD BASE CPP /nologo /W3 /GX /O2 /I "." /I "common" /I "scumm" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /D "USE_ADLIB" /YX /FD /c
# ADD CPP /nologo /G6 /MT /W3 /WX /GR /GX /O2 /I "." /I "common" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /D "USE_ADLIB" /D "BYPASS_COPY_PROT" /D "USE_MAD" /YX /FD /c # ADD CPP /nologo /G6 /MT /W3 /WX /GR /GX /O2 /I "." /I "common" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /D "USE_ADLIB" /D "BYPASS_COPY_PROT" /D "USE_MAD" /YX /FD /c
# ADD BASE RSC /l 0x415 /d "NDEBUG" # ADD BASE RSC /l 0x415 /d "NDEBUG"
# ADD RSC /l 0x415 /d "NDEBUG" # ADD RSC /l 0x415 /d "NDEBUG"
BSC32=bscmake.exe BSC32=bscmake.exe
# ADD BASE BSC32 /nologo # ADD BASE BSC32 /nologo
# ADD BSC32 /nologo # ADD BSC32 /nologo
LIB32=link.exe -lib LIB32=link.exe -lib
# ADD BASE LIB32 /nologo # ADD BASE LIB32 /nologo
# ADD LIB32 /nologo # ADD LIB32 /nologo
!ENDIF !ENDIF
# Begin Target # Begin Target
# Name "scumm - Win32 Release" # Name "scumm - Win32 Release"
# Name "scumm - Win32 Debug" # Name "scumm - Win32 Debug"
# Name "scumm - Win32 mad mp3 Debug" # Name "scumm - Win32 mad mp3 Debug"
# Name "scumm - Win32 mad mp3 Release" # Name "scumm - Win32 mad mp3 Release"
# Begin Group "Source Files" # Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Group "smush" # Begin Group "smush"
# PROP Default_Filter "" # PROP Default_Filter ""
# Begin Source File # Begin Source File
SOURCE=.\scumm\smush\channel.h SOURCE=.\scumm\smush\channel.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\scumm\smush\chunk.cpp SOURCE=.\scumm\smush\chunk.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\scumm\smush\chunk.h SOURCE=.\scumm\smush\chunk.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\scumm\smush\chunk_type.h SOURCE=.\scumm\smush\chunk_type.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\scumm\smush\codec1.cpp SOURCE=.\scumm\smush\codec1.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\scumm\smush\codec37.cpp SOURCE=.\scumm\smush\codec37.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\scumm\smush\codec37.h SOURCE=.\scumm\smush\codec37.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\scumm\smush\codec47.cpp SOURCE=.\scumm\smush\codec47.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\scumm\smush\codec47.h SOURCE=.\scumm\smush\codec47.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\scumm\smush\imuse_channel.cpp SOURCE=.\scumm\smush\imuse_channel.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\scumm\smush\saud_channel.cpp SOURCE=.\scumm\smush\saud_channel.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\scumm\smush\smush_font.cpp SOURCE=.\scumm\smush\smush_font.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\scumm\smush\smush_font.h SOURCE=.\scumm\smush\smush_font.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\scumm\smush\smush_mixer.cpp SOURCE=.\scumm\smush\smush_mixer.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\scumm\smush\smush_mixer.h SOURCE=.\scumm\smush\smush_mixer.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\scumm\smush\smush_player.cpp SOURCE=.\scumm\smush\smush_player.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\scumm\smush\smush_player.h SOURCE=.\scumm\smush\smush_player.h
# End Source File # End Source File
# End Group # End Group
# Begin Source File # Begin Source File
SOURCE=.\scumm\actor.cpp SOURCE=.\scumm\actor.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\scumm\actor.h SOURCE=.\scumm\actor.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\scumm\akos.cpp SOURCE=.\scumm\akos.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\scumm\akos.h SOURCE=.\scumm\akos.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=".\scumm\base-costume.cpp" SOURCE=".\scumm\base-costume.cpp"
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=".\scumm\base-costume.h" SOURCE=".\scumm\base-costume.h"
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\scumm\bomp.cpp SOURCE=.\scumm\bomp.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\scumm\bomp.h SOURCE=.\scumm\bomp.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\scumm\boxes.cpp SOURCE=.\scumm\boxes.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\scumm\boxes.h SOURCE=.\scumm\boxes.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\scumm\bundle.cpp SOURCE=.\scumm\bundle.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\scumm\bundle.h SOURCE=.\scumm\bundle.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\scumm\camera.cpp SOURCE=.\scumm\camera.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\scumm\charset.cpp SOURCE=.\scumm\charset.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\scumm\charset.h SOURCE=.\scumm\charset.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\scumm\costume.cpp SOURCE=.\scumm\costume.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\scumm\costume.h SOURCE=.\scumm\costume.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\scumm\debugger.cpp SOURCE=.\scumm\debugger.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\scumm\debugger.h SOURCE=.\scumm\debugger.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\scumm\dialogs.cpp SOURCE=.\scumm\dialogs.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\scumm\dialogs.h SOURCE=.\scumm\dialogs.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\scumm\gfx.cpp SOURCE=.\scumm\gfx.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\scumm\gfx.h SOURCE=.\scumm\gfx.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\scumm\help.cpp SOURCE=.\scumm\help.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\scumm\help.h SOURCE=.\scumm\help.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\scumm\imuse.cpp SOURCE=.\scumm\imuse.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\scumm\imuse.h SOURCE=.\scumm\imuse.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\scumm\imuse_digi.cpp SOURCE=.\scumm\imuse_digi.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\scumm\imuse_digi.h SOURCE=.\scumm\imuse_digi.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\scumm\imuse_internal.h SOURCE=.\scumm\imuse_internal.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\scumm\imuse_player.cpp SOURCE=.\scumm\imuse_player.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\scumm\instrument.cpp SOURCE=.\scumm\instrument.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\scumm\instrument.h SOURCE=.\scumm\instrument.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\scumm\intern.h SOURCE=.\scumm\intern.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\scumm\midiparser_eup.cpp SOURCE=.\scumm\midiparser_eup.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\scumm\midiparser_ro.cpp SOURCE=.\scumm\midiparser_ro.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\scumm\nut_renderer.cpp SOURCE=.\scumm\nut_renderer.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\scumm\nut_renderer.h SOURCE=.\scumm\nut_renderer.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\scumm\object.cpp SOURCE=.\scumm\object.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\scumm\object.h SOURCE=.\scumm\object.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\scumm\player_v1.cpp SOURCE=.\scumm\player_mod.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\scumm\player_v1.h SOURCE=.\scumm\player_mod.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\scumm\player_v2.cpp SOURCE=.\scumm\player_v1.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\scumm\player_v2.h SOURCE=.\scumm\player_v1.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\scumm\player_v3a.cpp SOURCE=.\scumm\player_v2.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\scumm\player_v3a.h SOURCE=.\scumm\player_v2.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\scumm\resource.cpp SOURCE=.\scumm\player_v2a.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\scumm\resource.h SOURCE=.\scumm\player_v2a.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\scumm\resource_v2.cpp SOURCE=.\scumm\player_v3a.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\scumm\resource_v3.cpp SOURCE=.\scumm\player_v3a.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\scumm\resource_v4.cpp SOURCE=.\scumm\resource.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\scumm\saveload.cpp SOURCE=.\scumm\resource.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\scumm\saveload.h SOURCE=.\scumm\resource_v2.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\scumm\script.cpp SOURCE=.\scumm\resource_v3.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\scumm\script_v2.cpp SOURCE=.\scumm\resource_v4.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\scumm\script_v5.cpp SOURCE=.\scumm\saveload.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\scumm\script_v6.cpp SOURCE=.\scumm\saveload.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\scumm\script_v8.cpp SOURCE=.\scumm\script.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\scumm\scumm.h SOURCE=.\scumm\script_v2.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\scumm\scummvm.cpp SOURCE=.\scumm\script_v5.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\scumm\sound.cpp SOURCE=.\scumm\script_v6.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\scumm\sound.h SOURCE=.\scumm\script_v8.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\scumm\string.cpp SOURCE=.\scumm\scumm.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\scumm\usage_bits.cpp SOURCE=.\scumm\scummvm.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\scumm\usage_bits.h SOURCE=.\scumm\sound.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\scumm\vars.cpp SOURCE=.\scumm\sound.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\scumm\verbs.cpp SOURCE=.\scumm\string.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\scumm\verbs.h SOURCE=.\scumm\usage_bits.cpp
# End Source File # End Source File
# End Group # Begin Source File
# End Target
# End Project SOURCE=.\scumm\usage_bits.h
# End Source File
# Begin Source File
SOURCE=.\scumm\vars.cpp
# End Source File
# Begin Source File
SOURCE=.\scumm\verbs.cpp
# End Source File
# Begin Source File
SOURCE=.\scumm\verbs.h
# End Source File
# End Group
# End Target
# End Project

View file

@ -361,7 +361,7 @@ bool ScummDebugger::Cmd_Restart(int argc, const char **argv) {
} }
bool ScummDebugger::Cmd_IMuse(int argc, const char **argv) { bool ScummDebugger::Cmd_IMuse(int argc, const char **argv) {
if (!_s->_imuse && !_s->_playerV2) { if (!_s->_imuse && !_s->_musicEngine) {
Debug_Printf("No iMuse engine is active.\n"); Debug_Printf("No iMuse engine is active.\n");
return true; return true;
} }

View file

@ -22,9 +22,11 @@ MODULE_OBJS := \
scumm/midiparser_eup.o \ scumm/midiparser_eup.o \
scumm/nut_renderer.o \ scumm/nut_renderer.o \
scumm/object.o \ scumm/object.o \
scumm/player_v1.o\ scumm/player_mod.o \
scumm/player_v2.o\ scumm/player_v1.o \
scumm/player_v3a.o\ scumm/player_v2.o \
scumm/player_v2a.o \
scumm/player_v3a.o \
scumm/resource.o \ scumm/resource.o \
scumm/resource_v2.o \ scumm/resource_v2.o \
scumm/resource_v3.o \ scumm/resource_v3.o \

188
scumm/player_mod.cpp Normal file
View file

@ -0,0 +1,188 @@
/* ScummVM - Scumm Interpreter
* Copyright (C) 2001 Ludvig Strigeus
* Copyright (C) 2001-2003 The ScummVM project
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Header$
*
*/
#include "player_mod.h"
////////////////////////////////////////
//
// Generic Amiga MOD mixer - provides a 60Hz 'update' routine.
//
////////////////////////////////////////
Player_MOD::Player_MOD(Scumm *scumm) {
int i;
_mixer = scumm->_mixer;
_samplerate = scumm->_system->property(OSystem::PROP_GET_SAMPLE_RATE, 0);
_mixamt = 0;
_mixpos = 0;
for (i = 0; i < MOD_MAXCHANS; i++) {
_channels[i].id = 0;
_channels[i].vol = 0;
_channels[i].freq = 0;
_channels[i].ptr = NULL;
_channels[i].converter = NULL;
_channels[i].input = NULL;
}
_playproc = NULL;
_playparam = NULL;
_mixer->setupPremix(premix_proc, this);
}
Player_MOD::~Player_MOD() {
// Detach the premix callback handler
_mixer->setupPremix(0, 0);
for (int i = 0; i < MOD_MAXCHANS; i++) {
if (!_channels[i].id)
continue;
delete _channels[i].ptr;
delete _channels[i].converter;
delete _channels[i].input;
}
}
void Player_MOD::setMasterVolume (int vol) {
_maxvol = vol;
}
void Player_MOD::setUpdateProc(ModUpdateProc *proc, void *param, int freq) {
_playproc = proc;
_playparam = param;
_mixamt = _samplerate / freq;
}
void Player_MOD::clearUpdateProc() {
_playproc = NULL;
_playparam = NULL;
_mixamt = 0;
}
void Player_MOD::startChannel (int id, const char *data, int size, int rate, uint8 vol, int loopStart, int loopEnd, int8 pan) {
int i;
if (id == 0)
error("player_mod - attempted to start channel id 0");
for (i = 0; i < MOD_MAXCHANS; i++) {
if (!_channels[i].id)
break;
}
if (i == MOD_MAXCHANS) {
warning("player_mod - too many music channels playing (%i max)",MOD_MAXCHANS);
return;
}
_channels[i].id = id;
_channels[i].vol = vol;
_channels[i].pan = pan;
_channels[i].ptr = (byte *)data;
_channels[i].freq = rate;
_channels[i].input = makeLinearInputStream(SoundMixer::FLAG_AUTOFREE | (loopStart != loopEnd ? SoundMixer::FLAG_LOOP : 0), (byte *)data, size, loopStart, loopEnd - loopStart);
_channels[i].converter = makeRateConverter(rate, _mixer->getOutputRate(), false, false);
}
void Player_MOD::stopChannel(int id) {
if (id == 0)
error("player_mod - attempted to stop channel id 0");
for (int i = 0; i < MOD_MAXCHANS; i++) {
if (_channels[i].id == id) {
delete _channels[i].ptr;
_channels[i].ptr = NULL;
delete _channels[i].converter;
_channels[i].converter = NULL;
delete _channels[i].input;
_channels[i].input = NULL;
_channels[i].id = 0;
_channels[i].vol = 0;
_channels[i].freq = 0;
}
}
}
void Player_MOD::setChannelVol(int id, uint8 vol) {
if (id == 0)
error("player_mod - attempted to set volume for channel id 0");
for (int i = 0; i < MOD_MAXCHANS; i++) {
if (_channels[i].id == id) {
_channels[i].vol = vol;
break;
}
}
}
void Player_MOD::setChannelPan(int id, int8 pan) {
if (id == 0)
error("player_mod - attempted to set pan for channel id 0");
for (int i = 0; i < MOD_MAXCHANS; i++) {
if (_channels[i].id == id) {
_channels[i].pan = pan;
break;
}
}
}
void Player_MOD::setChannelFreq(int id, int freq) {
if (id == 0)
error("player_mod - attempted to set frequency for channel id 0");
for (int i = 0; i < MOD_MAXCHANS; i++) {
if (_channels[i].id == id) {
_channels[i].freq = freq;
delete _channels[i].converter;
_channels[i].converter = makeRateConverter(freq, _mixer->getOutputRate(), false, false);
break;
}
}
}
void Player_MOD::premix_proc(void *param, int16 *buf, uint len) {
((Player_MOD *) param)->do_mix(buf, len);
}
void Player_MOD::do_mix (int16 *data, uint len) {
int i;
int dpos = 0;
uint dlen = 0;
memset(data, 0, 2 * len * sizeof(int16));
while (len) {
if (_playproc) {
dlen = _mixamt - _mixpos;
if (!_mixpos)
_playproc(_playparam);
if (dlen <= len) {
_mixpos = 0;
len -= dlen;
} else {
_mixpos = _mixamt - len;
dlen = len;
len = 0;
}
} else {
dlen = len;
len = 0;
}
for (i = 0; i < MOD_MAXCHANS; i++)
if (_channels[i].id) {
st_volume_t vol_l = (127 - _channels[i].pan) * _channels[i].vol / 127;
st_volume_t vol_r = (127 + _channels[i].pan) * _channels[i].vol / 127;
_channels[i].converter->flow(*_channels[i].input, &data[dpos*2], dlen, vol_l, vol_r);
}
dpos += dlen;
}
}

77
scumm/player_mod.h Normal file
View file

@ -0,0 +1,77 @@
/* ScummVM - Scumm Interpreter
* Copyright (C) 2001 Ludvig Strigeus
* Copyright (C) 2001-2003 The ScummVM project
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Header$
*
*/
#ifndef PLAYER_MOD_H
#define PLAYER_MOD_H
#include "scumm.h"
#include "sound/mixer.h"
#include "sound/audiostream.h"
#include "sound/rate.h"
#define MOD_MAXCHANS 16
class Player_MOD {
public:
Player_MOD(Scumm *scumm);
virtual ~Player_MOD();
virtual void setMasterVolume(int vol);
virtual void startChannel(int id, const char *data, int size, int rate, uint8 vol, int loopStart = 0, int loopEnd = 0, int8 pan = 0);
virtual void stopChannel(int id);
virtual void setChannelVol(int id, uint8 vol);
virtual void setChannelPan(int id, int8 pan);
virtual void setChannelFreq(int id, int freq);
typedef void ModUpdateProc(void *param);
virtual void setUpdateProc(ModUpdateProc *proc, void *param, int freq);
virtual void clearUpdateProc();
private:
SoundMixer *_mixer;
uint32 _mixamt;
uint32 _mixpos;
int _samplerate;
struct soundChan
{
int id;
uint8 vol;
int8 pan;
uint16 freq;
byte *ptr;
RateConverter *converter;
AudioInputStream *input;
} _channels[MOD_MAXCHANS];
uint8 _maxvol;
static void premix_proc(void *param, int16 *buf, uint len);
virtual void do_mix(int16 *buf, uint len);
ModUpdateProc *_playproc;
void *_playparam;
};
#endif

1307
scumm/player_v2a.cpp Normal file

File diff suppressed because it is too large Load diff

66
scumm/player_v2a.h Normal file
View file

@ -0,0 +1,66 @@
/* ScummVM - Scumm Interpreter
* Copyright (C) 2001 Ludvig Strigeus
* Copyright (C) 2001-2003 The ScummVM project
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Header$
*
*/
#ifndef PLAYER_V2A_H
#define PLAYER_V2A_H
#include "common/scummsys.h"
#include "common/system.h"
#include "scumm/music.h"
#include "scumm/player_mod.h"
#define V2A_MAXSLOTS 8
class Scumm;
class SoundMixer;
class V2A_Sound;
class Player_V2A : public MusicEngine {
public:
Player_V2A(Scumm *scumm);
virtual ~Player_V2A();
virtual void setMasterVolume(int vol);
virtual void startSound(int nr);
virtual void stopSound(int nr);
virtual void stopAllSounds();
virtual int getMusicTimer() const;
virtual int getSoundStatus(int nr) const;
private:
OSystem *_system;
Scumm *_scumm;
Player_MOD *_mod;
struct soundSlot
{
int id;
V2A_Sound *sound;
} _slot[V2A_MAXSLOTS];
int getSoundSlot (int id = 0) const;
static void update_proc(void *param);
void updateSound();
};
#endif

View file

@ -24,8 +24,6 @@
#include "base/engine.h" #include "base/engine.h"
#include "player_v3a.h" #include "player_v3a.h"
#include "scumm.h" #include "scumm.h"
#include "sound/mixer.h"
#include "common/timer.h"
static const uint16 note_freqs[4][12] = { static const uint16 note_freqs[4][12] = {
{0x06B0,0x0650,0x05F4,0x05A0,0x054C,0x0500,0x04B8,0x0474,0x0434,0x03F8,0x03C0,0x0388}, {0x06B0,0x0650,0x05F4,0x05A0,0x054C,0x0500,0x04B8,0x0474,0x0434,0x03F8,0x03C0,0x0388},
@ -44,13 +42,14 @@ Player_V3A::Player_V3A(Scumm *scumm) {
int i; int i;
_scumm = scumm; _scumm = scumm;
_system = scumm->_system; _system = scumm->_system;
_mixer = scumm->_mixer; for (i = 0; i < V3A_MAXMUS; i++) {
_mus[i].id = 0;
for (i = 0; i < V3A_MAXSFX; i++) _mus[i].dur = 0;
_sfx[i].id = _sfx[i].dur = 0; }
for (i = 0; i < V3A_MAXSFX; i++) {
for (i = 0; i < V3A_MAXMUS; i++) _sfx[i].id = 0;
_mus[i].id = _mus[i].dur = 0; _sfx[i].dur = 0;
}
_curSong = 0; _curSong = 0;
_songData = NULL; _songData = NULL;
@ -59,36 +58,63 @@ Player_V3A::Player_V3A(Scumm *scumm) {
_music_timer = 0; _music_timer = 0;
_maxvol = 255;
scumm->_timer->installProcedure(timerHandler, 16666, this);
_isinit = false; _isinit = false;
_mod = new Player_MOD(scumm);
_mod->setUpdateProc(update_proc, this, 60);
} }
Player_V3A::~Player_V3A() { Player_V3A::~Player_V3A() {
_scumm->_timer->releaseProcedure(timerHandler); int i;
if (!_isinit) delete _mod;
return; if (_isinit) {
for (int i = 0; _wavetable[i] != NULL; i++) { for (i = 0; _wavetable[i] != NULL; i++) {
for (int j = 0; j < 6; j++) { for (int j = 0; j < 6; j++) {
free(_wavetable[i]->_idat[j]); free(_wavetable[i]->_idat[j]);
free(_wavetable[i]->_ldat[j]); free(_wavetable[i]->_ldat[j]);
}
free(_wavetable[i]);
} }
free(_wavetable[i]); free(_wavetable);
} }
free(_wavetable);
} }
void Player_V3A::setMasterVolume (int vol) { void Player_V3A::setMasterVolume (int vol) {
_maxvol = vol; _mod->setMasterVolume(vol);
}
int Player_V3A::getMusChan (int id) const {
int i;
for (i = 0; i < V3A_MAXMUS; i++) {
if (_mus[i].id == id)
break;
}
if (i == V3A_MAXMUS) {
if (id == 0)
warning("player_v3a - out of music channels");
return -1;
}
return i;
}
int Player_V3A::getSfxChan (int id) const {
int i;
for (i = 0; i < V3A_MAXSFX; i++) {
if (_sfx[i].id == id)
break;
}
if (i == V3A_MAXSFX) {
if (id == 0)
warning("player_v3a - out of sfx channels");
return -1;
}
return i;
} }
void Player_V3A::stopAllSounds() { void Player_V3A::stopAllSounds() {
int i; int i;
for (i = 0; i < V3A_MAXMUS; i++) { for (i = 0; i < V3A_MAXMUS; i++) {
if (_mus[i].id) if (_mus[i].id)
_mixer->stopID(V3A_MUS_BASEID + i); _mod->stopChannel(_mus[i].id);
_mus[i].id = 0; _mus[i].id = 0;
_mus[i].dur = 0; _mus[i].dur = 0;
} }
@ -98,7 +124,7 @@ void Player_V3A::stopAllSounds() {
_songData = NULL; _songData = NULL;
for (i = 0; i < V3A_MAXSFX; i++) { for (i = 0; i < V3A_MAXSFX; i++) {
if (_sfx[i].id) if (_sfx[i].id)
_mixer->stopID(V3A_SFX_BASEID + i); _mod->stopChannel(_sfx[i].id | 0x100);
_sfx[i].id = 0; _sfx[i].id = 0;
_sfx[i].dur = 0; _sfx[i].dur = 0;
} }
@ -106,10 +132,14 @@ void Player_V3A::stopAllSounds() {
void Player_V3A::stopSound(int nr) { void Player_V3A::stopSound(int nr) {
int i; int i;
if (nr == 0) { // Amiga Loom does this near the end, when Chaos casts SILENCE on Hetchel
stopAllSounds();
return;
}
if (nr == _curSong) { if (nr == _curSong) {
for (i = 0; i < V3A_MAXMUS; i++) { for (i = 0; i < V3A_MAXMUS; i++) {
if (_mus[i].id) if (_mus[i].id)
_mixer->stopID(V3A_MUS_BASEID + i); _mod->stopChannel(_mus[i].id);
_mus[i].id = 0; _mus[i].id = 0;
_mus[i].dur = 0; _mus[i].dur = 0;
} }
@ -118,59 +148,21 @@ void Player_V3A::stopSound(int nr) {
_songDelay = 0; _songDelay = 0;
_songData = NULL; _songData = NULL;
} else { } else {
for (i = 0; i < V3A_MAXSFX; i++) { i = getSfxChan(nr);
if (_sfx[i].id == nr) { if (i != -1) {
_mixer->stopID(V3A_SFX_BASEID + i); _mod->stopChannel(nr | 0x100);
_sfx[i].id = 0; _sfx[i].id = 0;
_sfx[i].dur = 0; _sfx[i].dur = 0;
break;
}
} }
} }
} }
void Player_V3A::playSoundSFX (int nr, char *data, int size, int rate, int vol, int tl, bool looped, int loopStart, int loopEnd) {
int i;
for (i = 0; i < V3A_MAXSFX; i++) {
if (!_sfx[i].id)
break;
}
if (i == V3A_MAXSFX) {
warning("player_v3a - too many sound effects playing (%i max)",V3A_MAXSFX);
return;
}
_sfx[i].id = nr;
_sfx[i].dur = tl;
vol = (vol * _maxvol) / 255;
_mixer->playRaw(NULL, data, size, rate, SoundMixer::FLAG_AUTOFREE | (looped ? SoundMixer::FLAG_LOOP : 0),
V3A_SFX_BASEID + i, vol, 0, loopStart, loopEnd);
}
void Player_V3A::playSoundMUS (char *data, int size, int rate, int vol, int tl, bool looped, int loopStart, int loopEnd) {
int i;
for (i = 0; i < V3A_MAXMUS; i++) {
if (!_mus[i].id)
break;
}
if (i == V3A_MAXMUS) {
warning("player_v3a - too many music channels playing (%i max)",V3A_MAXMUS);
return;
}
_mus[i].id = i + 1;
_mus[i].dur = tl;
vol = (vol * _maxvol) / 255;
_mixer->playRaw(NULL, data, size, rate, SoundMixer::FLAG_AUTOFREE | (looped ? SoundMixer::FLAG_LOOP : 0),
V3A_MUS_BASEID + i, vol, 0, loopStart, loopEnd);
}
void Player_V3A::startSound(int nr) { void Player_V3A::startSound(int nr) {
assert(_scumm); assert(_scumm);
byte *data = _scumm->getResourceAddress(rtSound, nr); byte *data = _scumm->getResourceAddress(rtSound, nr);
assert(data); assert(data);
if (_scumm->_gameId != GID_INDY3 && _scumm->_gameId != GID_LOOM) if ((_scumm->_gameId != GID_INDY3) && (_scumm->_gameId != GID_LOOM))
error("player_v3a - unknown game!"); error("player_v3a - unknown game!");
if (!_isinit) { if (!_isinit) {
@ -223,6 +215,8 @@ void Player_V3A::startSound(int nr) {
stopSound(nr); // if a sound is playing, restart it stopSound(nr); // if a sound is playing, restart it
if (data[26]) { if (data[26]) {
if (_curSong)
stopSound(_curSong);
_curSong = nr; _curSong = nr;
_songData = data; _songData = data;
_songPtr = 0x1C; _songPtr = 0x1C;
@ -232,43 +226,49 @@ void Player_V3A::startSound(int nr) {
int size = READ_BE_UINT16(data + 12); int size = READ_BE_UINT16(data + 12);
int rate = 3579545 / READ_BE_UINT16(data + 20); int rate = 3579545 / READ_BE_UINT16(data + 20);
char *sound = (char *)malloc(size); char *sound = (char *)malloc(size);
int vol = (data[24] << 2) | (data[24] >> 4); int vol = (data[24] << 1) | (data[24] >> 5); // if I boost this to 0-255, it gets too loud and starts to clip
memcpy(sound,data + READ_BE_UINT16(data + 8),size); memcpy(sound,data + READ_BE_UINT16(data + 8),size);
int loopStart = 0, loopEnd = 0;
bool looped = false;
if ((READ_BE_UINT16(data + 16) || READ_BE_UINT16(data + 6))) { if ((READ_BE_UINT16(data + 16) || READ_BE_UINT16(data + 6))) {
// the first check is for complex (pitch-bending) looped sounds loopStart = READ_BE_UINT16(data + 10) - READ_BE_UINT16(data + 8);
// the second check is for simple looped sounds loopEnd = READ_BE_UINT16(data + 14);
int loopStart = READ_BE_UINT16(data + 10) - READ_BE_UINT16(data + 8); looped = true;
int loopEnd = READ_BE_UINT16(data + 14);
int tl = -1;
if ((_scumm->_gameId == GID_INDY3) && (nr == 60))
tl = 240; // the "airplane dive" sound needs to end on its own - the game won't stop it
playSoundSFX(nr, sound, size, rate, vol, tl, true, loopStart, loopEnd);
} else {
int tl = 1 + 60 * size / rate;
playSoundSFX(nr, sound, size, rate, vol, tl, false);
} }
int i = getSfxChan();
_sfx[i].id = nr;
_sfx[i].dur = looped ? -1 : (1 + 60 * size / rate);
if ((_scumm->_gameId == GID_INDY3) && (nr == 60))
_sfx[i].dur = 240;
_mod->startChannel(nr | 0x100, sound, size, rate, vol, loopStart, loopEnd);
} }
} }
void Player_V3A::timerHandler(void *refCon) { void Player_V3A::update_proc(void *param) {
Player_V3A *player = (Player_V3A *)refCon; ((Player_V3A *)param)->playMusic();
assert(player);
player->playMusic();
} }
void Player_V3A::playMusic() { void Player_V3A::playMusic() {
int i; int i;
for (i = 0; i < V3A_MAXSFX; i++) {
if ((_sfx[i].dur) && (!--_sfx[i].dur))
stopSound(_sfx[i].id);
}
for (i = 0; i < V3A_MAXMUS; i++) { for (i = 0; i < V3A_MAXMUS; i++) {
if ((_mus[i].dur) && (!--_mus[i].dur)) { if (_mus[i].id) {
_scumm->_mixer->stopID(V3A_MUS_BASEID + i); _mus[i].dur--;
if (_mus[i].dur)
continue;
_mod->stopChannel(_mus[i].id);
_mus[i].id = 0; _mus[i].id = 0;
_mus[i].dur = 0;
} }
} }
for (i = 0; i < V3A_MAXSFX; i++) {
if (_sfx[i].id) {
_sfx[i].dur--;
if (_sfx[i].dur)
continue;
_mod->stopChannel(_sfx[i].id | 0x100);
_sfx[i].id = 0;
}
}
_music_timer++; _music_timer++;
if (!_curSong) if (!_curSong)
return; return;
@ -295,8 +295,7 @@ void Player_V3A::playMusic() {
} }
inst &= 0xF; inst &= 0xF;
pit = _songData[_songPtr++]; pit = _songData[_songPtr++];
vol = _songData[_songPtr++] & 0x7F; vol = _songData[_songPtr++] & 0x7F; // if I boost this to 0-255, it gets too loud and starts to clip
vol = (vol << 1) | (vol >> 7); // 7-bit volume (Amiga drops the bottom bit), convert to 8-bit
dur = _songData[_songPtr++]; dur = _songData[_songPtr++];
if (pit == 0) { if (pit == 0) {
_songDelay = dur; _songDelay = dur;
@ -309,13 +308,18 @@ void Player_V3A::playMusic() {
oct = 0; oct = 0;
if (oct > 5) if (oct > 5)
oct = 5; oct = 5;
int rate = 3579545 / note_freqs[_wavetable[inst]->_oct[oct]][pit];
char *data = (char *)malloc(_wavetable[inst]->_ilen[oct] + _wavetable[inst]->_llen[oct]); char *data = (char *)malloc(_wavetable[inst]->_ilen[oct] + _wavetable[inst]->_llen[oct]);
if (_wavetable[inst]->_idat[oct]) if (_wavetable[inst]->_idat[oct])
memcpy(data, _wavetable[inst]->_idat[oct], _wavetable[inst]->_ilen[oct]); memcpy(data, _wavetable[inst]->_idat[oct], _wavetable[inst]->_ilen[oct]);
if (_wavetable[inst]->_ldat[oct]) if (_wavetable[inst]->_ldat[oct])
memcpy(data + _wavetable[inst]->_ilen[oct], _wavetable[inst]->_ldat[oct], _wavetable[inst]->_llen[oct]); memcpy(data + _wavetable[inst]->_ilen[oct], _wavetable[inst]->_ldat[oct], _wavetable[inst]->_llen[oct]);
playSoundMUS(data, _wavetable[inst]->_ilen[oct] + _wavetable[inst]->_llen[oct], 3579545 / note_freqs[_wavetable[inst]->_oct[oct]][pit], vol, dur,
(_wavetable[inst]->_ldat[oct] != NULL), _wavetable[inst]->_ilen[oct], _wavetable[inst]->_ilen[oct] + _wavetable[inst]->_llen[oct]); i = getMusChan();
_mus[i].id = i + 1;
_mus[i].dur = dur;
_mod->startChannel(_mus[i].id, data, _wavetable[inst]->_ilen[oct] + _wavetable[inst]->_llen[oct], rate, vol,
_wavetable[inst]->_ilen[oct], _wavetable[inst]->_ilen[oct] + _wavetable[inst]->_llen[oct]);
} }
} }
@ -326,8 +330,7 @@ int Player_V3A::getMusicTimer() const {
int Player_V3A::getSoundStatus(int nr) const { int Player_V3A::getSoundStatus(int nr) const {
if (nr == _curSong) if (nr == _curSong)
return 1; return 1;
for (int i = 0; i < V3A_MAXSFX; i++) if (getSfxChan(nr) != -1)
if (_sfx[i].id == nr) return 1;
return 1;
return 0; return 0;
} }

View file

@ -26,12 +26,10 @@
#include "common/scummsys.h" #include "common/scummsys.h"
#include "common/system.h" #include "common/system.h"
#include "scumm/music.h" #include "scumm/music.h"
#include "scumm/player_mod.h"
#define V3A_MAXMUS 8 #define V3A_MAXMUS 8
#define V3A_MAXSFX 8 #define V3A_MAXSFX 8
#define V3A_MUS_BASEID (1)
#define V3A_SFX_BASEID (V3A_MUS_BASEID + V3A_MAXMUS)
class Scumm; class Scumm;
class SoundMixer; class SoundMixer;
@ -42,26 +40,31 @@ public:
virtual ~Player_V3A(); virtual ~Player_V3A();
virtual void setMasterVolume(int vol); virtual void setMasterVolume(int vol);
virtual void startSound(int nr); virtual void startSound(int nr);
virtual void stopSound(int nr); virtual void stopSound(int nr);
virtual void stopAllSounds(); virtual void stopAllSounds();
virtual int getMusicTimer() const; virtual int getMusicTimer() const;
virtual int getSoundStatus(int nr) const; virtual int getSoundStatus(int nr) const;
protected: private:
SoundMixer *_mixer;
OSystem *_system; OSystem *_system;
Scumm *_scumm; Scumm *_scumm;
Player_MOD *_mod;
struct soundChan struct musChan
{ {
uint16 id; int id;
uint16 dur; int dur;
} _mus[V3A_MAXMUS], _sfx[V3A_MAXSFX]; } _mus[V3A_MAXMUS];
int getMusChan (int id = 0) const;
uint8 _maxvol;
struct sfxChan
{
int id;
int dur;
// SFX will eventually have pitch bends
} _sfx[V3A_MAXSFX];
int getSfxChan (int id = 0) const;
int _curSong; int _curSong;
uint8 *_songData; uint8 *_songData;
@ -80,11 +83,8 @@ protected:
int16 _pitadjust; int16 _pitadjust;
} **_wavetable; } **_wavetable;
void playSoundSFX (int nr, char *data, int size, int rate, int vol, int tl, bool looped, int loopStart = 0, int loopEnd = 0); static void update_proc(void *param);
void playSoundMUS (char *data, int size, int rate, int vol, int tl, bool looped, int loopStart = 0, int loopEnd = 0);
void playMusic(); void playMusic();
static void timerHandler(void *engine);
}; };
#endif #endif

View file

@ -43,6 +43,7 @@ class IMuseDigital;
class MusicEngine; class MusicEngine;
class NewGui; class NewGui;
class Player_V2; class Player_V2;
class Player_V2A;
class Player_V3A; class Player_V3A;
class Scumm; class Scumm;
class ScummDebugger; class ScummDebugger;
@ -260,6 +261,7 @@ public:
IMuse *_imuse; IMuse *_imuse;
IMuseDigital *_imuseDigital; IMuseDigital *_imuseDigital;
Player_V2 *_playerV2; Player_V2 *_playerV2;
Player_V2A *_playerV2A;
Player_V3A *_playerV3A; Player_V3A *_playerV3A;
MusicEngine *_musicEngine; MusicEngine *_musicEngine;
Sound *_sound; Sound *_sound;

View file

@ -44,6 +44,7 @@
#include "scumm/object.h" #include "scumm/object.h"
#include "scumm/player_v1.h" #include "scumm/player_v1.h"
#include "scumm/player_v2.h" #include "scumm/player_v2.h"
#include "scumm/player_v2a.h"
#include "scumm/player_v3a.h" #include "scumm/player_v3a.h"
#include "scumm/resource.h" #include "scumm/resource.h"
#include "scumm/scumm.h" #include "scumm/scumm.h"
@ -719,10 +720,13 @@ Scumm::Scumm (GameDetector *detector, OSystem *syst)
_imuse = NULL; _imuse = NULL;
_imuseDigital = NULL; _imuseDigital = NULL;
_playerV2 = NULL; _playerV2 = NULL;
_playerV2A = NULL;
_playerV3A = NULL; _playerV3A = NULL;
_musicEngine = NULL; _musicEngine = NULL;
if (_features & GF_DIGI_IMUSE) { if (_features & GF_DIGI_IMUSE) {
_musicEngine = _imuseDigital = new IMuseDigital(this); _musicEngine = _imuseDigital = new IMuseDigital(this);
} else if ((_features & GF_AMIGA) && (_version == 2)) {
_musicEngine = _playerV2A = new Player_V2A(this);
} else if ((_features & GF_AMIGA) && (_version == 3)) { } else if ((_features & GF_AMIGA) && (_version == 3)) {
_musicEngine = _playerV3A = new Player_V3A(this); _musicEngine = _playerV3A = new Player_V3A(this);
} else if ((_features & GF_AMIGA) && (_version < 5)) { } else if ((_features & GF_AMIGA) && (_version < 5)) {
@ -1329,6 +1333,8 @@ int Scumm::scummLoop(int delta) {
// Covered automatically by the Sound class // Covered automatically by the Sound class
} else if (_playerV2) { } else if (_playerV2) {
VAR(VAR_MUSIC_TIMER) = _playerV2->getMusicTimer(); VAR(VAR_MUSIC_TIMER) = _playerV2->getMusicTimer();
} else if (_playerV2A) {
VAR(VAR_MUSIC_TIMER) = _playerV2A->getMusicTimer();
} else if (_playerV3A) { } else if (_playerV3A) {
VAR(VAR_MUSIC_TIMER) = _playerV3A->getMusicTimer(); VAR(VAR_MUSIC_TIMER) = _playerV3A->getMusicTimer();
} else if (_imuse) { } else if (_imuse) {

View file

@ -25,8 +25,6 @@
#include "bundle.h" #include "bundle.h"
#include "imuse.h" #include "imuse.h"
#include "imuse_digi.h" #include "imuse_digi.h"
#include "player_v2.h"
#include "player_v3a.h"
#include "scumm.h" #include "scumm.h"
#include "sound.h" #include "sound.h"
@ -439,28 +437,6 @@ void Sound::playSound(int soundID) {
memcpy(sound,ptr + READ_BE_UINT16(ptr + 8), size); memcpy(sound,ptr + READ_BE_UINT16(ptr + 8), size);
_scumm->_mixer->playRaw(NULL, sound, size, rate, SoundMixer::FLAG_AUTOFREE, soundID, vol, 0); _scumm->_mixer->playRaw(NULL, sound, size, rate, SoundMixer::FLAG_AUTOFREE, soundID, vol, 0);
} }
else if ((_scumm->_features & GF_AMIGA) && (_scumm->_version <= 2) && READ_BE_UINT16(ptr + 14) == 0x0880) {
size = READ_BE_UINT16(ptr + 6);
int start = READ_BE_UINT16(ptr + 8);
start += 10;
rate = 11000;
int vol = 255;
int i = 0;
while (i < start) {
if ((READ_BE_UINT16(ptr) == 0x357c) && (READ_BE_UINT16(ptr + 4) == 6))
rate = 3579545 / READ_BE_UINT16(ptr + 2);
if ((READ_BE_UINT16(ptr) == 0x357c) && (READ_BE_UINT16(ptr + 4) == 8))
vol = READ_BE_UINT16(ptr + 2) * 4;
ptr += 2;
i += 2;
}
sound = (char *)malloc(size);
memcpy(sound, ptr, size);
_scumm->_mixer->playRaw(NULL, sound, size, rate, SoundMixer::FLAG_AUTOFREE, soundID, vol, 0);
}
else { else {
if (_scumm->_gameId == GID_MONKEY_VGA || _scumm->_gameId == GID_MONKEY_EGA) { if (_scumm->_gameId == GID_MONKEY_VGA || _scumm->_gameId == GID_MONKEY_EGA) {

File diff suppressed because it is too large Load diff