[Scummvm-git-logs] scummvm master -> 5f848c916207590e6552b5847bf5ee50798268d2
dreammaster
dreammaster at scummvm.org
Tue Feb 9 02:03:27 UTC 2021
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
ff276f88ff AGS: Refactor audio code
5f848c9162 AGS: Refactor the SOUNDCLIP object
Commit: ff276f88ff68952f2a3572116cca6375ec04de2e
https://github.com/scummvm/scummvm/commit/ff276f88ff68952f2a3572116cca6375ec04de2e
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2021-02-08T18:03:22-08:00
Commit Message:
AGS: Refactor audio code
Changed paths:
R engines/ags/engine/media/audio/audiointernaldefs.h
R engines/ags/engine/media/audio/clip_myjgmod.cpp
R engines/ags/engine/media/audio/clip_myjgmod.h
R engines/ags/engine/util/thread.h
R engines/ags/engine/util/thread_psp.h
R engines/ags/engine/util/thread_pthread.h
R engines/ags/engine/util/thread_std.h
R engines/ags/engine/util/thread_wii.h
R engines/ags/engine/util/thread_windows.h
R engines/ags/lib/allegro/sound.cpp
R engines/ags/lib/audio/digi.cpp
R engines/ags/lib/audio/digi.h
R engines/ags/lib/audio/midi.cpp
R engines/ags/lib/audio/midi.h
R engines/ags/lib/audio/mod.cpp
R engines/ags/lib/audio/mod.h
R engines/ags/lib/audio/sound.cpp
R engines/ags/lib/audio/sound.h
engines/ags/engine/ac/draw.cpp
engines/ags/engine/ac/event.cpp
engines/ags/engine/ac/gamesetup.cpp
engines/ags/engine/ac/gamesetup.h
engines/ags/engine/ac/global_audio.cpp
engines/ags/engine/ac/global_debug.cpp
engines/ags/engine/ac/global_video.cpp
engines/ags/engine/ac/system.cpp
engines/ags/engine/debugging/debug.cpp
engines/ags/engine/globals.h
engines/ags/engine/main/config.cpp
engines/ags/engine/main/config.h
engines/ags/engine/main/engine.cpp
engines/ags/engine/main/game_run.cpp
engines/ags/engine/main/quit.cpp
engines/ags/engine/media/audio/audio.cpp
engines/ags/engine/media/audio/audio.h
engines/ags/engine/media/audio/audiodefines.h
engines/ags/engine/media/audio/clip_mymidi.cpp
engines/ags/engine/media/audio/sound.cpp
engines/ags/engine/media/audio/sound.h
engines/ags/engine/media/audio/soundcache.cpp
engines/ags/engine/media/audio/soundcache.h
engines/ags/engine/media/audio/soundclip.h
engines/ags/engine/platform/base/agsplatformdriver.cpp
engines/ags/engine/platform/windows/setup/winsetup.cpp
engines/ags/engine/script/script.cpp
engines/ags/lib/allegro.h
engines/ags/lib/std/thread.h
engines/ags/module.mk
engines/ags/music.cpp
engines/ags/music.h
engines/ags/plugins/agsplugin.cpp
diff --git a/engines/ags/engine/ac/draw.cpp b/engines/ags/engine/ac/draw.cpp
index 29ff6b9ea1..d304e37cfe 100644
--- a/engines/ags/engine/ac/draw.cpp
+++ b/engines/ags/engine/ac/draw.cpp
@@ -2179,7 +2179,6 @@ void construct_game_scene(bool full_redraw) {
if (play.screen_is_faded_out == 0 && is_complete_overlay == 0) {
if (displayed_room >= 0) {
construct_room_view();
- update_polled_mp3();
} else if (!gfxDriver->RequiresFullRedrawEachFrame()) {
// black it out so we don't get cursor trails
// TODO: this is possible to do with dirty rects system now too (it can paint black rects outside of room viewport)
diff --git a/engines/ags/engine/ac/event.cpp b/engines/ags/engine/ac/event.cpp
index 005542c0da..8e2672d3a7 100644
--- a/engines/ags/engine/ac/event.cpp
+++ b/engines/ags/engine/ac/event.cpp
@@ -276,7 +276,6 @@ void process_event(EventHappened *evp) {
temp_scr->Blit(saved_backbuf, lxp, lyp, lxp, lyp,
boxwid, boxhit);
render_to_screen();
- update_polled_mp3();
WaitForNextFrame();
}
gfxDriver->SetMemoryBackBuffer(saved_backbuf);
diff --git a/engines/ags/engine/ac/gamesetup.cpp b/engines/ags/engine/ac/gamesetup.cpp
index 3c7a2b8a7f..adf07e0196 100644
--- a/engines/ags/engine/ac/gamesetup.cpp
+++ b/engines/ags/engine/ac/gamesetup.cpp
@@ -26,9 +26,7 @@
namespace AGS3 {
GameSetup::GameSetup() {
- digicard = DIGI_AUTODETECT;
- midicard = MIDI_AUTODETECT;
- mod_player = 1;
+ audio_backend = 1;
no_speech_pack = false;
textheight = 0;
enable_antialiasing = false;
diff --git a/engines/ags/engine/ac/gamesetup.h b/engines/ags/engine/ac/gamesetup.h
index 2b207176b3..280df15d5c 100644
--- a/engines/ags/engine/ac/gamesetup.h
+++ b/engines/ags/engine/ac/gamesetup.h
@@ -53,9 +53,7 @@ using AGS::Shared::String;
// that engine may use a "config" object or combo of objects to store
// current user config, which may also be changed from script, and saved.
struct GameSetup {
- int digicard;
- int midicard;
- int mod_player;
+ int audio_backend; // abstract option, currently only works as on/off
int textheight; // text height used on the certain built-in GUI // TODO: move out to game class?
bool no_speech_pack;
bool enable_antialiasing;
diff --git a/engines/ags/engine/ac/global_audio.cpp b/engines/ags/engine/ac/global_audio.cpp
index 78c535537d..41629df09a 100644
--- a/engines/ags/engine/ac/global_audio.cpp
+++ b/engines/ags/engine/ac/global_audio.cpp
@@ -365,7 +365,10 @@ void SetDigitalMasterVolume(int newvol) {
if ((newvol < 0) | (newvol > 100))
quit("!SetDigitalMasterVolume: invalid volume - must be from 0-100");
play.digital_master_volume = newvol;
- set_volume((newvol * 255) / 100, -1);
+#if !AGS_PLATFORM_SCUMMVM
+ auto newvol_f = static_cast<float>(newvol) / 100.0;
+ audio_core_set_master_volume(newvol_f);
+#endif
}
int GetCurrentMusic() {
@@ -439,7 +442,6 @@ void PlaySilentMIDI(int mnum) {
if (current_music_type == MUS_MIDI)
quit("!PlaySilentMIDI: proper midi music is in progress");
- set_volume(-1, 0);
play.silent_midi = mnum;
play.silent_midi_channel = SCHAN_SPEECH;
stop_and_destroy_channel(play.silent_midi_channel);
diff --git a/engines/ags/engine/ac/global_debug.cpp b/engines/ags/engine/ac/global_debug.cpp
index 35ae916ad8..b92209ad87 100644
--- a/engines/ags/engine/ac/global_debug.cpp
+++ b/engines/ags/engine/ac/global_debug.cpp
@@ -90,8 +90,6 @@ String GetRuntimeInfo() {
runtimeInfo.Append("[Using translation ");
runtimeInfo.Append(transFileName);
}
- if (usetup.mod_player == 0)
- runtimeInfo.Append("[(mod/xm player discarded)");
return runtimeInfo;
}
diff --git a/engines/ags/engine/ac/global_video.cpp b/engines/ags/engine/ac/global_video.cpp
index c8f7f29aa2..a711418210 100644
--- a/engines/ags/engine/ac/global_video.cpp
+++ b/engines/ags/engine/ac/global_video.cpp
@@ -44,7 +44,7 @@ void scrPlayVideo(const char *name, int skip, int flags) {
if (debug_flags & DBG_NOVIDEO)
return;
- if ((flags < 10) && (usetup.digicard == DIGI_NONE)) {
+ if ((flags < 10) && (usetup.audio_backend == 0)) {
// if game audio is disabled in Setup, then don't
// play any sound on the video either
flags += 10;
diff --git a/engines/ags/engine/ac/system.cpp b/engines/ags/engine/ac/system.cpp
index abeb62a4dd..a390118928 100644
--- a/engines/ags/engine/ac/system.cpp
+++ b/engines/ags/engine/ac/system.cpp
@@ -192,20 +192,11 @@ void System_SetVolume(int newvol) {
if ((newvol < 0) || (newvol > 100))
quit("!System.Volume: invalid volume - must be from 0-100");
- if (newvol == play.digital_master_volume)
- return;
-
play.digital_master_volume = newvol;
- set_volume((newvol * 255) / 100, (newvol * 255) / 100);
-
- // allegro's set_volume can lose the volumes of all the channels
- // if it was previously set low; so restore them
- AudioChannelsLock lock;
- for (int i = 0; i <= MAX_SOUND_CHANNELS; i++) {
- auto *ch = lock.GetChannelIfPlaying(i);
- if (ch)
- ch->adjust_volume();
- }
+#if !AGS_PLATFORM_SCUMMVM
+ auto newvol_f = static_cast<float>(newvol) / 100.0;
+ audio_core_set_master_volume(newvol_f);
+#endif
}
const char *System_GetRuntimeInfo() {
diff --git a/engines/ags/engine/debugging/debug.cpp b/engines/ags/engine/debugging/debug.cpp
index 09602126ff..92d9eea7fa 100644
--- a/engines/ags/engine/debugging/debug.cpp
+++ b/engines/ags/engine/debugging/debug.cpp
@@ -489,7 +489,6 @@ bool send_exception_to_editor(const char *qmsg) {
return false;
while ((check_for_messages_from_editor() == 0) && (_G(want_exit) == 0)) {
- update_polled_mp3();
platform->Delay(10);
}
#endif
diff --git a/engines/ags/engine/globals.h b/engines/ags/engine/globals.h
index eaccbb7e17..73bc2e40c0 100644
--- a/engines/ags/engine/globals.h
+++ b/engines/ags/engine/globals.h
@@ -94,13 +94,12 @@ public:
#if ! AGS_PLATFORM_DEFINES_PSP_VARS
int _psp_video_framedrop = 1;
- int _psp_audio_enabled = 1;
- int _psp_midi_enabled = 1;
int _psp_ignore_acsetup_cfg_file = 0;
- int _psp_clear_cache_on_room_change = 0;
+ int _psp_clear_cache_on_room_change = 0; // clear --sprite cache-- when room is unloaded
- int _psp_midi_preload_patches = 0;
+#if AGS_PLATFORM_SCUMMVM
int _psp_audio_cachesize = 10;
+#endif
const char *_psp_game_file_name = "";
const char *_psp_translation = "default";
diff --git a/engines/ags/engine/main/config.cpp b/engines/ags/engine/main/config.cpp
index 93b11d64e1..b81713fc92 100644
--- a/engines/ags/engine/main/config.cpp
+++ b/engines/ags/engine/main/config.cpp
@@ -197,63 +197,6 @@ int convert_fp_to_scaling(uint32_t scaling) {
return scaling >= kUnit ? (scaling >> kShift) : -kUnit / (int32_t)scaling;
}
-AlIDStr AlIDToChars(int al_id) {
- if (al_id == 0)
- return AlIDStr{ { 'N', 'O', 'N', 'E', '\0' } };
- else if (al_id == -1)
- return AlIDStr{ { 'A', 'U', 'T', 'O', '\0' } };
- else
- return AlIDStr{ {
- static_cast<char>((al_id >> 24) & 0xFF),
- static_cast<char>((al_id >> 16) & 0xFF),
- static_cast<char>((al_id >> 8) & 0xFF),
- static_cast<char>((al_id) & 0xFF),
- '\0'
- } };
-}
-
-AlIDStr AlIDToChars(const String &s) {
- AlIDStr id_str;
- size_t i = 0;
- for (; i < s.GetLength(); ++i)
- id_str.s[i] = toupper(s[i]);
- for (; i < 4; ++i)
- id_str.s[i] = ' ';
- id_str.s[4] = 0;
- return id_str;
-}
-
-int StringToAlID(const char *cstr) {
- return (int)(AL_ID(cstr[0u], cstr[1u], cstr[2u], cstr[3u]));
-}
-
-// Parses a config string which may hold plain driver's ID or 4-char ID packed
-// as a 32-bit integer.
-int parse_driverid(const String &id) {
- int asint;
- if (StrUtil::StringToInt(id, asint, 0) == StrUtil::kNoError)
- return asint;
- if (id.GetLength() > 4)
- return -1; // autodetect
- if (id.CompareNoCase("AUTO") == 0)
- return -1; // autodetect
- if (id.CompareNoCase("NONE") == 0)
- return 0; // no driver
- return StringToAlID(AlIDToChars(id).s);
-}
-
-// Reads driver ID from config, where it may be represented as string or number
-int read_driverid(const ConfigTree &cfg, const String §n, const String &item, int def_value) {
- String s = INIreadstring(cfg, sectn, item);
- if (s.IsEmpty())
- return def_value;
- return parse_driverid(s);
-}
-
-void write_driverid(ConfigTree &cfg, const String §n, const String &item, int value) {
- INIwritestring(cfg, sectn, item, AlIDToChars(value).s);
-}
-
void graphics_mode_get_defaults(bool windowed, ScreenSizeSetup &scsz_setup, GameFrameSetup &frame_setup) {
scsz_setup.Size = Size();
if (windowed) {
@@ -300,10 +243,7 @@ void config_defaults() {
#else
usetup.Screen.DriverID = "ScummVM";
#endif
-#if AGS_PLATFORM_OS_WINDOWS
- usetup.digicard = DIGI_DIRECTAMX(0);
-#endif
- usetup.midicard = MIDI_AUTODETECT;
+ usetup.audio_backend = 1;
usetup.translation = "";
}
@@ -325,32 +265,6 @@ void read_game_data_location(const ConfigTree &cfg) {
usetup.main_data_filename = INIreadstring(cfg, "misc", "datafile", usetup.main_data_filename);
}
-void read_legacy_audio_config(const ConfigTree &cfg) {
-#if AGS_PLATFORM_OS_WINDOWS
- int idx = INIreadint(cfg, "sound", "digiwinindx", -1);
- if (idx == 0)
- idx = DIGI_DIRECTAMX(0);
- else if (idx == 1)
- idx = DIGI_WAVOUTID(0);
- else if (idx == 2)
- idx = DIGI_NONE;
- else if (idx == 3)
- idx = DIGI_DIRECTX(0);
- else
- idx = DIGI_AUTODETECT;
- usetup.digicard = idx;
-
- idx = INIreadint(cfg, "sound", "midiwinindx", -1);
- if (idx == 1)
- idx = MIDI_NONE;
- else if (idx == 2)
- idx = MIDI_WIN32MAPPER;
- else
- idx = MIDI_AUTODETECT;
- usetup.midicard = idx;
-#endif
-}
-
void read_legacy_graphics_config(const ConfigTree &cfg) {
usetup.Screen.DisplayMode.Windowed = INIreadint(cfg, "misc", "windowed") > 0;
usetup.Screen.DriverID = INIreadstring(cfg, "misc", "gfxdriver", usetup.Screen.DriverID);
@@ -426,21 +340,7 @@ void override_config_ext(ConfigTree &cfg) {
void apply_config(const ConfigTree &cfg) {
{
- // Legacy settings has to be translated into new options;
- // they must be read first, to let newer options override them, if ones are present
- read_legacy_audio_config(cfg);
- if (_G(psp_audio_enabled)) {
- usetup.digicard = read_driverid(cfg, "sound", "digiid", usetup.digicard);
- if (_G(psp_midi_enabled))
- usetup.midicard = read_driverid(cfg, "sound", "midiid", usetup.midicard);
- else
- usetup.midicard = MIDI_NONE;
- } else {
- usetup.digicard = DIGI_NONE;
- usetup.midicard = MIDI_NONE;
- }
-
- psp_audio_multithreaded = INIreadint(cfg, "sound", "threaded", psp_audio_multithreaded);
+ usetup.audio_backend = INIreadint(cfg, "sound", "enabled", usetup.audio_backend);
// Legacy graphics settings has to be translated into new options;
// they must be read first, to let newer options override them, if ones are present
diff --git a/engines/ags/engine/main/config.h b/engines/ags/engine/main/config.h
index 9c9c10ec6e..75dabacf55 100644
--- a/engines/ags/engine/main/config.h
+++ b/engines/ags/engine/main/config.h
@@ -59,19 +59,6 @@ int convert_fp_to_scaling(uint32_t scaling);
// Fill in setup structs with default settings for the given mode (windowed or fullscreen)
void graphics_mode_get_defaults(bool windowed, ScreenSizeSetup &scsz_setup, GameFrameSetup &frame_setup);
-typedef struct {
- char s[5];
-} AlIDStr;
-// Converts Allegro driver ID type to 4-char string
-AlIDStr AlIDToChars(int al_id);
-AlIDStr AlIDToChars(const String &s);
-// Converts C-string into Allegro's driver ID; string must be at least 4 character long
-int StringToAlID(const char *cstr);
-// Reads driver ID from config, where it may be represented as string or number
-int read_driverid(const ConfigTree &cfg, const String §n, const String &item, int def_value);
-// Writes driver ID to config
-void write_driverid(ConfigTree &cfg, const String §n, const String &item, int value);
-
bool INIreaditem(const ConfigTree &cfg, const String §n, const String &item, String &value);
int INIreadint(const ConfigTree &cfg, const String §n, const String &item, int def_value = 0);
diff --git a/engines/ags/engine/main/engine.cpp b/engines/ags/engine/main/engine.cpp
index ed3911a7aa..cf877f8f1d 100644
--- a/engines/ags/engine/main/engine.cpp
+++ b/engines/ags/engine/main/engine.cpp
@@ -400,149 +400,24 @@ void engine_init_timer() {
skipMissedTicks();
}
-bool try_install_sound(int digi_id, int midi_id, String *p_err_msg = nullptr) {
- Debug::Printf(kDbgMsg_Info, "Trying to init: digital driver ID: '%s' (0x%x), MIDI driver ID: '%s' (0x%x)",
- AlIDToChars(digi_id).s, digi_id, AlIDToChars(midi_id).s, midi_id);
-
- if (install_sound(digi_id, midi_id, nullptr) == 0)
- return true;
- // Allegro does not let you try digital and MIDI drivers separately,
- // and does not indicate which driver failed by return value.
- // Therefore we try to guess.
- if (p_err_msg)
- *p_err_msg = get_allegro_error();
- if (midi_id != MIDI_NONE) {
- Debug::Printf(kDbgMsg_Error, "Failed to init one of the drivers; Error: '%s'.\nWill try to start without MIDI", get_allegro_error());
- if (install_sound(digi_id, MIDI_NONE, nullptr) == 0)
- return true;
- }
- if (digi_id != DIGI_NONE) {
- Debug::Printf(kDbgMsg_Error, "Failed to init one of the drivers; Error: '%s'.\nWill try to start without DIGI", get_allegro_error());
- if (install_sound(DIGI_NONE, midi_id, nullptr) == 0)
- return true;
- }
- Debug::Printf(kDbgMsg_Error, "Failed to init sound drivers. Error: %s", get_allegro_error());
- return false;
-}
-
-// Attempts to predict a digital driver Allegro would chose, and get its maximal voices
-std::pair<int, int> autodetect_driver(_DRIVER_INFO *driver_list, int (*detect_audio_driver)(int), const char *type) {
- for (int i = 0; driver_list[i].driver; ++i) {
- if (driver_list[i].autodetect) {
- int voices = detect_audio_driver(driver_list[i].id);
- if (voices != 0)
- return std::make_pair(driver_list[i].id, voices);
- Debug::Printf(kDbgMsg_Warn, "Failed to detect %s driver %s; Error: '%s'.",
- type, AlIDToChars(driver_list[i].id).s, get_allegro_error());
- }
- }
- return std::make_pair(0, 0);
-}
-
-// Decides which audio driver to request from Allegro.
-// Returns a pair of audio card ID and max available voices.
-std::pair<int, int> decide_audiodriver(int try_id, _DRIVER_INFO *driver_list,
- int(*detect_audio_driver)(int), int &al_drv_id, const char *type) {
- if (try_id == 0)
- // No driver
- return std::make_pair(0, 0);
- al_drv_id = 0;
-
- if (try_id > 0) {
- int voices = detect_audio_driver(try_id);
- if (al_drv_id == try_id && voices != 0) {
- // found and detected
- return std::make_pair(try_id, voices);
- }
- if (voices == 0) // found in list but detect failed
- Debug::Printf(kDbgMsg_Error, "Failed to detect %s driver %s; Error: '%s'.", type, AlIDToChars(try_id).s, get_allegro_error());
- else // not found at all
- Debug::Printf(kDbgMsg_Error, "Unknown %s driver: %s, will try to find suitable one.", type, AlIDToChars(try_id).s);
- }
-
- al_drv_id = 1;
- return autodetect_driver(driver_list, detect_audio_driver, type);
-}
-
void engine_init_audio() {
- Debug::Printf("Initializing sound drivers");
- int digi_id = usetup.digicard;
- int midi_id = usetup.midicard;
- int digi_voices = -1;
- int midi_voices = -1;
- // MOD player would need certain minimal number of voices
- // TODO: find out if this is still relevant?
- if (usetup.mod_player)
- digi_voices = NUM_DIGI_VOICES;
-
- Debug::Printf(kDbgMsg_Info, "Sound settings: digital driver ID: '%s' (0x%x), MIDI driver ID: '%s' (0x%x)",
- AlIDToChars(digi_id).s, digi_id, AlIDToChars(midi_id).s, midi_id);
-
- // First try if drivers are supported, and switch to autodetect if explicit option failed
- _DRIVER_INFO *digi_drivers = system_driver->digi_drivers ? system_driver->digi_drivers() : _digi_driver_list;
- std::pair<int, int> digi_drv = decide_audiodriver(digi_id, digi_drivers, detect_digi_driver, digi_card, "digital");
- _DRIVER_INFO *midi_drivers = system_driver->midi_drivers ? system_driver->midi_drivers() : _midi_driver_list;
- std::pair<int, int> midi_drv = decide_audiodriver(midi_id, midi_drivers, detect_midi_driver, midi_card, "MIDI");
-
- // Now, knowing which drivers we suppose to install, decide on which voices we reserve
- digi_id = digi_drv.first;
- midi_id = midi_drv.first;
- const int max_digi_voices = digi_drv.second;
- //const int max_midi_voices = midi_drv.second;
- if (digi_voices > max_digi_voices)
- digi_voices = max_digi_voices;
- // NOTE: we do not specify number of MIDI voices, so don't have to calculate available here
-
- reserve_voices(digi_voices, midi_voices);
- // maybe this line will solve the sound volume? [??? wth is this]
- set_volume_per_voice(1);
-
- String err_msg;
- bool sound_res = try_install_sound(digi_id, midi_id, &err_msg);
- if (!sound_res) {
- Debug::Printf(kDbgMsg_Error, "Everything failed, disabling sound.");
- reserve_voices(0, 0);
- install_sound(DIGI_NONE, MIDI_NONE, nullptr);
- }
- // Only display a warning if they wanted a sound card
- const bool digi_failed = usetup.digicard != DIGI_NONE && digi_card == DIGI_NONE;
- const bool midi_failed = usetup.midicard != MIDI_NONE && midi_card == MIDI_NONE;
- if (digi_failed || midi_failed) {
- platform->DisplayAlert("Warning: cannot enable %s.\nProblem: %s.\n\nYou may supress this message by disabling %s in the game setup.",
- (digi_failed && midi_failed ? "game audio" : (digi_failed ? "digital audio" : "MIDI audio")),
- (err_msg.IsEmpty() ? "No compatible drivers found in the system" : err_msg.GetCStr()),
- (digi_failed && midi_failed ? "sound" : (digi_failed ? "digital sound" : "MIDI sound")));
+#if !AGS_PLATFORM_SCUMMVM
+ if (usetup.audio_backend != 0) {
+ Debug::Printf("Initializing audio");
+ audio_core_init(); // audio core system
}
+#endif
+ our_eip = -181;
- usetup.digicard = digi_card;
- usetup.midicard = midi_card;
-
- Debug::Printf(kDbgMsg_Info, "Installed digital driver ID: '%s' (0x%x), MIDI driver ID: '%s' (0x%x)",
- AlIDToChars(digi_card).s, digi_card, AlIDToChars(midi_card).s, midi_card);
-
- if (digi_card == DIGI_NONE) {
- // disable speech and music if no digital sound
- // therefore the MIDI soundtrack will be used if present,
+ if (usetup.audio_backend == 0) {
+ // all audio is disabled
// and the voice mode should not go to Voice Only
play.want_speech = -2;
play.separate_music_lib = 0;
}
- if (usetup.mod_player && digi_driver->voices < NUM_DIGI_VOICES) {
- // disable MOD player if there's not enough digital voices
- // TODO: find out if this is still relevant?
- usetup.mod_player = 0;
- }
-
-#if AGS_PLATFORM_OS_WINDOWS
- if (digi_card == DIGI_DIRECTX(0)) {
- // DirectX mixer seems to buffer an extra sample itself
- use_extra_sound_offset = 1;
- }
-#endif
}
void engine_init_debug() {
- //set_volume(255,-1);
if ((debug_flags & (~DBG_DEBUGMODE)) > 0) {
platform->DisplayAlert("Engine debugging enabled.\n"
"\nNOTE: You have selected to enable one or more engine debugging options.\n"
@@ -728,25 +603,6 @@ int engine_check_font_was_loaded() {
return 0;
}
-void engine_init_modxm_player() {
-#ifndef PSP_NO_MOD_PLAYBACK
- if (game.options[OPT_NOMODMUSIC])
- usetup.mod_player = 0;
-
- if (usetup.mod_player) {
- Debug::Printf(kDbgMsg_Info, "Initializing MOD/XM player");
-
- if (init_mod_player(NUM_MOD_DIGI_VOICES) < 0) {
- platform->DisplayAlert("Warning: install_mod: MOD player failed to initialize.");
- usetup.mod_player = 0;
- }
- }
-#else
- usetup.mod_player = 0;
- Debug::Printf(kDbgMsg_Info, "Compiled without MOD/XM player");
-#endif
-}
-
// Do the preload graphic if available
void show_preload() {
color temppal[256];
@@ -1060,33 +916,13 @@ void engine_setup_scsystem_auxiliary() {
}
}
-void engine_update_mp3_thread() {
- update_mp3_thread();
- platform->Delay(50);
-}
-
-void engine_start_multithreaded_audio() {
- // PSP: Initialize the sound cache.
- clear_sound_cache();
-
- // Create sound update thread. This is a workaround for sound stuttering.
- if (psp_audio_multithreaded) {
- if (!audioThread.CreateAndStart(engine_update_mp3_thread, true)) {
- Debug::Printf(kDbgMsg_Info, "Failed to start audio thread, audio will be processed on the main thread");
- psp_audio_multithreaded = 0;
- } else {
- Debug::Printf(kDbgMsg_Info, "Audio thread started");
- }
- } else {
- Debug::Printf(kDbgMsg_Info, "Audio is processed on the main thread");
- }
-}
-
void engine_prepare_to_start_game() {
Debug::Printf("Prepare to start game");
engine_setup_scsystem_auxiliary();
- engine_start_multithreaded_audio();
+#if AGS_PLATFORM_SCUMMVM
+ clear_sound_cache();
+#endif
#if AGS_PLATFORM_OS_ANDROID
if (psp_load_latest_savegame)
@@ -1439,8 +1275,6 @@ int initialize_engine(const ConfigTree &startup_opts) {
our_eip = -179;
- engine_init_modxm_player();
-
engine_init_resolution_settings(game.GetGameRes());
// Attempt to initialize graphics mode
diff --git a/engines/ags/engine/main/game_run.cpp b/engines/ags/engine/main/game_run.cpp
index 166f7104b8..3488225ffe 100644
--- a/engines/ags/engine/main/game_run.cpp
+++ b/engines/ags/engine/main/game_run.cpp
@@ -733,8 +733,6 @@ void UpdateGameOnce(bool checkControls, IDriverDependantBitmap *extraBitmap, int
int res;
- update_polled_mp3();
-
numEventsAtStartOfFunction = numevents;
if (_G(want_exit)) {
@@ -1008,8 +1006,6 @@ void update_polled_stuff_if_runtime() {
quit("||exit!");
}
- update_polled_mp3();
-
if (_G(editor_debugging_initialized))
check_for_messages_from_editor();
}
diff --git a/engines/ags/engine/main/quit.cpp b/engines/ags/engine/main/quit.cpp
index ae010b4acf..eb09c135d4 100644
--- a/engines/ags/engine/main/quit.cpp
+++ b/engines/ags/engine/main/quit.cpp
@@ -121,16 +121,7 @@ void quit_shutdown_platform(QuitReason qreason) {
void quit_shutdown_audio() {
our_eip = 9917;
game.options[OPT_CROSSFADEMUSIC] = 0;
- stopmusic();
-#ifndef PSP_NO_MOD_PLAYBACK
- if (usetup.mod_player)
- remove_mod_player();
-#endif
-
- // Quit the sound thread.
- audioThread.Stop();
-
- remove_sound();
+ shutdown_sound();
}
QuitReason quit_check_for_error_state(const char *&qmsg, String &alertis) {
diff --git a/engines/ags/engine/media/audio/audio.cpp b/engines/ags/engine/media/audio/audio.cpp
index 90b4a96829..1ef3500aaa 100644
--- a/engines/ags/engine/media/audio/audio.cpp
+++ b/engines/ags/engine/media/audio/audio.cpp
@@ -21,7 +21,6 @@
*/
#include "ags/shared/core/platform.h"
-#include "ags/shared/util/wgt2allg.h"
#include "ags/engine/media/audio/audio.h"
#include "ags/shared/ac/audiocliptype.h"
#include "ags/shared/ac/gamesetupstruct.h"
@@ -43,7 +42,6 @@
#include "ags/shared/core/assetmanager.h"
#include "ags/engine/ac/timer.h"
#include "ags/engine/main/game_run.h"
-#include "ags/lib/audio/sound.h"
#include "ags/ags.h"
namespace AGS3 {
@@ -113,16 +111,10 @@ extern CharacterInfo *playerchar;
extern volatile int switching_away_from_game;
-#if ! AGS_PLATFORM_OS_IOS && ! AGS_PLATFORM_OS_ANDROID
-volatile int psp_audio_multithreaded = 0;
-#endif
-
ScriptAudioChannel scrAudioChannel[MAX_SOUND_CHANNELS + 1];
char acaudio_buffer[256];
int reserved_channel_count = 0;
-AGS::Engine::Thread audioThread;
-
void calculate_reserved_channel_count() {
int reservedChannels = 0;
for (size_t i = 0; i < game.audioClipTypes.size(); i++) {
@@ -220,8 +212,7 @@ static int find_free_audio_channel(ScriptAudioClip *clip, int priority, bool int
}
bool is_audiotype_allowed_to_play(AudioFileType type) {
- return (type == eAudioFileMIDI && usetup.midicard != MIDI_NONE) ||
- (type != eAudioFileMIDI && usetup.digicard != DIGI_NONE);
+ return usetup.audio_backend != 0;
}
SOUNDCLIP *load_sound_clip(ScriptAudioClip *audioClip, bool repeat) {
@@ -248,11 +239,7 @@ SOUNDCLIP *load_sound_clip(ScriptAudioClip *audioClip, bool repeat) {
soundClip = my_load_midi(asset_name, repeat);
break;
case eAudioFileMOD:
-#ifndef PSP_NO_MOD_PLAYBACK
soundClip = my_load_mod(asset_name, repeat);
-#else
- soundClip = NULL;
-#endif
break;
default:
quitprintf("AudioClip.Play: invalid audio file type encountered: %d", audioClip->fileType);
@@ -355,8 +342,6 @@ static void queue_audio_clip_to_play(ScriptAudioClip *clip, int priority, int re
play.new_music_queue[play.new_music_queue_size].cachedClip = cachedClip;
play.new_music_queue_size++;
}
-
- update_polled_mp3();
}
ScriptAudioChannel *play_audio_clip_on_channel(int channel, ScriptAudioClip *clip, int priority, int repeat, int fromOffset, SOUNDCLIP *soundfx) {
@@ -540,12 +525,6 @@ SOUNDCLIP *load_sound_clip_from_old_style_number(bool isMusic, int indexNumber,
//=============================================================================
-void force_audiostream_include() {
- // This should never happen, but the call is here to make it
- // link the audiostream libraries
- stop_audio_stream(nullptr);
-}
-
// TODO: double check that ambient sounds array actually needs +1
std::array<AmbientSound> ambient(MAX_SOUND_CHANNELS + 1);
@@ -643,24 +622,20 @@ SOUNDCLIP *load_sound_and_play(ScriptAudioClip *aclip, bool repeat) {
}
void stop_all_sound_and_music() {
- int a;
stopmusic();
stop_voice_nonblocking();
// make sure it doesn't start crossfading when it comes back
crossFading = 0;
// any ambient sound will be aborted
- for (a = 0; a <= MAX_SOUND_CHANNELS; a++)
- stop_and_destroy_channel(a);
+ for (int i = 0; i <= MAX_SOUND_CHANNELS; i++)
+ stop_and_destroy_channel(i);
}
void shutdown_sound() {
- stop_all_sound_and_music();
-
-#ifndef PSP_NO_MOD_PLAYBACK
- if (usetup.mod_player)
- remove_mod_player();
+ stop_all_sound_and_music(); // game logic
+#if !AGS_PLATFORM_SCUMMVM
+ audio_core_shutdown(); // audio core system
#endif
- remove_sound();
}
// the sound will only be played if there is a free channel or
@@ -844,30 +819,6 @@ void update_volume_drop_if_voiceover() {
apply_volume_drop_modifier(play.speech_has_voice);
}
-void update_mp3_thread() {
- if (switching_away_from_game) {
- return;
- }
-
- AudioChannelsLock lock;
-
- for (int i = 0; i <= MAX_SOUND_CHANNELS; ++i) {
- auto *ch = lock.GetChannel(i);
- if (ch)
- ch->poll();
- }
-}
-
-//this is called at various points to give streaming logic a chance to update
-//it seems those calls have been littered around and points where it ameliorated skipping
-//a better solution would be to forcibly thread the streaming logic
-void update_polled_mp3() {
- if (psp_audio_multithreaded) {
- return;
- }
- update_mp3_thread();
-}
-
// Update the music, and advance the crossfade on a step
// (this should only be called once per game loop)
void update_audio_system_on_game_loop() {
diff --git a/engines/ags/engine/media/audio/audio.h b/engines/ags/engine/media/audio/audio.h
index ec12575e5e..abdcdd4ff9 100644
--- a/engines/ags/engine/media/audio/audio.h
+++ b/engines/ags/engine/media/audio/audio.h
@@ -30,7 +30,6 @@
#include "ags/engine/media/audio/ambientsound.h"
#include "ags/engine/util/mutex.h"
#include "ags/engine/util/mutex_lock.h"
-#include "ags/engine/util/thread.h"
#include "ags/engine/ac/timer.h"
namespace AGS3 {
@@ -92,9 +91,6 @@ SOUNDCLIP *load_sound_clip_from_old_style_number(bool isMusic, int indexNumber,
//=============================================================================
-int init_mod_player(int numVoices);
-void remove_mod_player();
-void force_audiostream_include();
int get_volume_adjusted_for_distance(int volume, int sndX, int sndY, int sndMaxDist);
void update_directional_sound_vol();
void update_ambient_sound_vol();
@@ -134,12 +130,7 @@ ScriptAudioClip *get_audio_clip_for_music(int mnum);
SOUNDCLIP *load_music_from_disk(int mnum, bool doRepeat);
void newmusic(int mnum);
-extern AGS::Engine::Thread audioThread;
extern volatile bool _audio_doing_crossfade;
-extern volatile int psp_audio_multithreaded;
-
-void update_polled_mp3();
-void update_mp3_thread();
extern void cancel_scheduled_music_update();
extern void schedule_music_update_at(AGS_Clock::time_point);
diff --git a/engines/ags/engine/media/audio/audiodefines.h b/engines/ags/engine/media/audio/audiodefines.h
index 9f8cf7d7be..3b49709121 100644
--- a/engines/ags/engine/media/audio/audiodefines.h
+++ b/engines/ags/engine/media/audio/audiodefines.h
@@ -29,10 +29,6 @@
#define MUS_MOD 4
#define MUS_OGG 5
-#ifndef PSP_NO_MOD_PLAYBACK
-#define DUMB_MOD_PLAYER
-#endif
-
#define MAX_SOUND_CHANNELS 8
#define SPECIAL_CROSSFADE_CHANNEL 8
diff --git a/engines/ags/engine/media/audio/audiointernaldefs.h b/engines/ags/engine/media/audio/audiointernaldefs.h
deleted file mode 100644
index 94fb568bc1..0000000000
--- a/engines/ags/engine/media/audio/audiointernaldefs.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * 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 AGS_ENGINE_MEDIA_AUDIO_SOUNDINTERNALDEFS_H
-#define AGS_ENGINE_MEDIA_AUDIO_SOUNDINTERNALDEFS_H
-
-//#define MP3CHUNKSIZE 100000
-#define MP3CHUNKSIZE 32768
-
-#endif
diff --git a/engines/ags/engine/media/audio/clip_myjgmod.cpp b/engines/ags/engine/media/audio/clip_myjgmod.cpp
deleted file mode 100644
index 73fd0004de..0000000000
--- a/engines/ags/engine/media/audio/clip_myjgmod.cpp
+++ /dev/null
@@ -1,94 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * 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.
- *
- */
-
-#include "ags/engine/media/audio/audiodefines.h"
-
-#ifdef JGMOD_MOD_PLAYER
-
-#include "ags/engine/media/audio/clip_myjgmod.h"
-#include "ags/engine/media/audio/audiointernaldefs.h"
-
-namespace AGS3 {
-
-int MYMOD::poll() {
- if (done)
- return done;
-
- if (is_mod_playing() == 0)
- done = 1;
-
- return done;
-}
-
-void MYMOD::set_volume(int newvol) {
- vol = newvol;
- if (!done)
- set_mod_volume(newvol);
-}
-
-void MYMOD::destroy() {
- stop_mod();
- destroy_mod(tune);
- tune = NULL;
-}
-
-void MYMOD::seek(int patnum) {
- if (is_mod_playing() != 0)
- goto_mod_track(patnum);
-}
-
-int MYMOD::get_pos() {
- if (!is_mod_playing())
- return -1;
- return mi.trk;
-}
-
-int MYMOD::get_pos_ms() {
- return 0; // we don't know ms offset
-}
-
-int MYMOD::get_length_ms() {
- // we don't know ms
- return 0;
-}
-
-int MYMOD::get_voice() {
- // MOD uses so many different voices it's not practical to keep track
- return -1;
-}
-
-int MYMOD::get_sound_type() {
- return MUS_MOD;
-}
-
-int MYMOD::play() {
- play_mod(tune, repeat);
-
- return 1;
-}
-
-MYMOD::MYMOD() : SOUNDCLIP() {
-}
-
-} // namespace AGS3
-
-#endif
diff --git a/engines/ags/engine/media/audio/clip_myjgmod.h b/engines/ags/engine/media/audio/clip_myjgmod.h
deleted file mode 100644
index ad5058e8d4..0000000000
--- a/engines/ags/engine/media/audio/clip_myjgmod.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * 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 AGS_ENGINE_MEDIA_AUDIO_CLIP_MYJGMOD_H
-#define AGS_ENGINE_MEDIA_AUDIO_CLIP_MYJGMOD_H
-
-#include "ags/lib/audio/mod.h"
-#include "ags/engine/media/audio/soundclip.h"
-
-namespace AGS3 {
-
-// MOD/XM (JGMOD)
-struct MYMOD : public SOUNDCLIP {
- JGMOD *tune;
-
- int poll();
-
- void set_volume(int newvol);
-
- void destroy();
-
- void seek(int patnum);
-
- int get_pos();
-
- int get_pos_ms();
-
- int get_length_ms();
-
- int get_voice();
-
- int get_sound_type();
-
- int play();
-
- MYMOD();
-};
-
-} // namespace AGS3
-
-#endif
diff --git a/engines/ags/engine/media/audio/clip_mymidi.cpp b/engines/ags/engine/media/audio/clip_mymidi.cpp
index 84b7b80298..4ed6809c22 100644
--- a/engines/ags/engine/media/audio/clip_mymidi.cpp
+++ b/engines/ags/engine/media/audio/clip_mymidi.cpp
@@ -23,7 +23,8 @@
#include "ags/engine/media/audio/audiodefines.h"
#include "ags/shared/util/wgt2allg.h"
#include "ags/engine/media/audio/clip_mymidi.h"
-#include "ags/engine/media/audio/audiointernaldefs.h"
+#include "ags/ags.h"
+#include "ags/music.h"
namespace AGS3 {
diff --git a/engines/ags/engine/media/audio/sound.cpp b/engines/ags/engine/media/audio/sound.cpp
index 81c148e332..ac1f294ade 100644
--- a/engines/ags/engine/media/audio/sound.cpp
+++ b/engines/ags/engine/media/audio/sound.cpp
@@ -26,17 +26,11 @@
//
//=============================================================================
-#include "ags/shared/core/platform.h"
-#include "ags/shared/util/wgt2allg.h"
-#include "ags/engine/ac/file.h"
#include "ags/engine/media/audio/audiodefines.h"
#include "ags/engine/media/audio/sound.h"
-#include "ags/engine/media/audio/audiointernaldefs.h"
#include "ags/engine/media/audio/soundcache.h"
+#include "ags/engine/media/audio/soundclip.h"
#include "ags/engine/media/audio/clip_mymidi.h"
-#include "ags/engine/util/mutex_lock.h"
-#include "ags/ags.h"
-#include "common/memstream.h"
#include "audio/mods/mod_xm_s3m.h"
#include "audio/decoders/mp3.h"
#include "audio/decoders/vorbis.h"
@@ -44,17 +38,6 @@
namespace AGS3 {
-#if defined JGMOD_MOD_PLAYER && defined DUMB_MOD_PLAYER
-#error JGMOD_MOD_PLAYER and DUMB_MOD_PLAYER macros cannot be defined at the same time.
-#endif
-
-#if !defined PSP_NO_MOD_PLAYBACK && !defined JGMOD_MOD_PLAYER && !defined DUMB_MOD_PLAYER
-#error Either JGMOD_MOD_PLAYER or DUMB_MOD_PLAYER should be defined.
-#endif
-
-int use_extra_sound_offset = 0;
-
-
SOUNDCLIP *my_load_wave(const AssetPath &asset_name, int voll, int loop) {
Common::SeekableReadStream *data = get_cached_sound(asset_name);
if (data) {
@@ -120,11 +103,4 @@ SOUNDCLIP *my_load_mod(const AssetPath &asset_name, bool repeat) {
}
}
-int init_mod_player(int numVoices) {
- return 0;
-}
-
-void remove_mod_player() {
-}
-
} // namespace AGS3
diff --git a/engines/ags/engine/media/audio/sound.h b/engines/ags/engine/media/audio/sound.h
index c8ccdde425..2cdd176b86 100644
--- a/engines/ags/engine/media/audio/sound.h
+++ b/engines/ags/engine/media/audio/sound.h
@@ -22,7 +22,7 @@
//=============================================================================
//
-// ACSOUND - AGS sound system wrapper
+// SOUNDCLIP factory methods.
//
//=============================================================================
@@ -42,8 +42,6 @@ SOUNDCLIP *my_load_ogg(const AssetPath &asset_name, int voll);
SOUNDCLIP *my_load_midi(const AssetPath &asset_name, bool repeat);
SOUNDCLIP *my_load_mod(const AssetPath &asset_name, bool repeat);
-extern int use_extra_sound_offset;
-
} // namespace AGS3
#endif
diff --git a/engines/ags/engine/media/audio/soundcache.cpp b/engines/ags/engine/media/audio/soundcache.cpp
index adf41fa9cd..470cfd1a5f 100644
--- a/engines/ags/engine/media/audio/soundcache.cpp
+++ b/engines/ags/engine/media/audio/soundcache.cpp
@@ -23,7 +23,6 @@
#include "ags/engine/ac/file.h"
#include "ags/shared/util/wgt2allg.h"
#include "ags/engine/media/audio/soundcache.h"
-#include "ags/engine/media/audio/audiointernaldefs.h"
#include "ags/engine/util/mutex.h"
#include "ags/engine/util/mutex_lock.h"
#include "ags/shared/util/string.h"
@@ -59,11 +58,11 @@ void clear_sound_cache() {
}
}
-void sound_cache_free(char *buffer, bool is_wave) {
+void sound_cache_free(char *buffer) {
AGS::Engine::MutexLock _lock(::AGS::g_vm->_soundCacheMutex);
#ifdef SOUND_CACHE_DEBUG
- Debug::Printf("sound_cache_free(%p %d)\n", buffer, (unsigned int)is_wave);
+ Debug::Printf("sound_cache_free(%p)\n", buffer);
#endif
int i;
for (i = 0; i < _G(psp_audio_cachesize); i++) {
@@ -84,19 +83,16 @@ void sound_cache_free(char *buffer, bool is_wave) {
// Sound is uncached
if (i == _G(psp_audio_cachesize)) {
- if (is_wave)
- destroy_sample((SAMPLE *)buffer);
- else
- free(buffer);
+ free(buffer);
}
}
-char *get_cached_sound(const AssetPath &asset_name, bool is_wave, size_t &size) {
+char *get_cached_sound(const AssetPath &asset_name, size_t &size) {
AGS::Engine::MutexLock _lock(::AGS::g_vm->_soundCacheMutex);
#ifdef SOUND_CACHE_DEBUG
- Debug::Printf("get_cached_sound(%s %d)\n", asset_name.first.GetCStr(), (unsigned int)is_wave);
+ Debug::Printf("get_cached_sound(%s)\n", asset_name.first.GetCStr());
#endif
size = 0;
@@ -120,19 +116,10 @@ char *get_cached_sound(const AssetPath &asset_name, bool is_wave, size_t &size)
// Not found
PACKFILE *mp3in = nullptr;
- SAMPLE *wave = nullptr;
- if (is_wave) {
- PACKFILE *wavin = PackfileFromAsset(asset_name, size);
- if (wavin != nullptr) {
- wave = load_wav_pf(wavin);
- pack_fclose(wavin);
- }
- } else {
- mp3in = PackfileFromAsset(asset_name, size);
- if (mp3in == nullptr) {
- return nullptr;
- }
+ mp3in = PackfileFromAsset(asset_name, size);
+ if (mp3in == nullptr) {
+ return nullptr;
}
// Find free slot
@@ -161,21 +148,16 @@ char *get_cached_sound(const AssetPath &asset_name, bool is_wave, size_t &size)
// Load new file
char *newdata;
- if (is_wave) {
- size = 0; // ??? CHECKME
- newdata = (char *)wave;
- } else {
- newdata = (char *)malloc(size);
-
- if (newdata == nullptr) {
- pack_fclose(mp3in);
- return nullptr;
- }
+ newdata = (char *)malloc(size);
- pack_fread(newdata, size, mp3in);
+ if (newdata == nullptr) {
pack_fclose(mp3in);
+ return nullptr;
}
+ pack_fread(newdata, size, mp3in);
+ pack_fclose(mp3in);
+
if (i == -1) {
// No cache slot empty, return uncached data
#ifdef SOUND_CACHE_DEBUG
@@ -189,10 +171,7 @@ char *get_cached_sound(const AssetPath &asset_name, bool is_wave, size_t &size)
#endif
if (sound_cache_entries[i].data) {
- if (sound_cache_entries[i].is_wave)
- destroy_sample((SAMPLE *)sound_cache_entries[i].data);
- else
- free(sound_cache_entries[i].data);
+ free(sound_cache_entries[i].data);
}
sound_cache_entries[i].size = size;
@@ -204,7 +183,6 @@ char *get_cached_sound(const AssetPath &asset_name, bool is_wave, size_t &size)
strcpy(sound_cache_entries[i].file_name, asset_name.second);
sound_cache_entries[i].reference = 1;
sound_cache_entries[i].last_used = sound_cache_counter++;
- sound_cache_entries[i].is_wave = is_wave;
return sound_cache_entries[i].data;
}
@@ -212,7 +190,7 @@ char *get_cached_sound(const AssetPath &asset_name, bool is_wave, size_t &size)
Common::SeekableReadStream *get_cached_sound(const AssetPath &asset_name) {
size_t muslen = 0;
- const byte *data = (byte *)get_cached_sound(asset_name, false, muslen);
+ const byte *data = (byte *)get_cached_sound(asset_name, muslen);
if (data == nullptr)
return nullptr;
diff --git a/engines/ags/engine/media/audio/soundcache.h b/engines/ags/engine/media/audio/soundcache.h
index 8020d417ce..1d2811f55d 100644
--- a/engines/ags/engine/media/audio/soundcache.h
+++ b/engines/ags/engine/media/audio/soundcache.h
@@ -42,12 +42,11 @@ typedef struct {
unsigned int size;
char *data;
int reference;
- bool is_wave;
} sound_cache_entry_t;
void clear_sound_cache();
-void sound_cache_free(char *buffer, bool is_wave);
-char *get_cached_sound(const AssetPath &asset_name, bool is_wave, size_t &size);
+void sound_cache_free(char *buffer);
+char *get_cached_sound(const AssetPath &asset_name, size_t &size);
Common::SeekableReadStream *get_cached_sound(const AssetPath &asset_name);
} // namespace AGS3
diff --git a/engines/ags/engine/media/audio/soundclip.h b/engines/ags/engine/media/audio/soundclip.h
index 3580f72def..16b93c4551 100644
--- a/engines/ags/engine/media/audio/soundclip.h
+++ b/engines/ags/engine/media/audio/soundclip.h
@@ -36,9 +36,6 @@
namespace AGS3 {
-// JJS: This is needed for the derieved classes
-extern volatile int psp_audio_multithreaded;
-
// TODO: one of the biggest problems with sound clips currently is that it
// provides several methods of applying volume, which may ignore or override
// each other, and does not shape a consistent interface.
diff --git a/engines/ags/engine/platform/base/agsplatformdriver.cpp b/engines/ags/engine/platform/base/agsplatformdriver.cpp
index 5fff43d8c0..684be05c02 100644
--- a/engines/ags/engine/platform/base/agsplatformdriver.cpp
+++ b/engines/ags/engine/platform/base/agsplatformdriver.cpp
@@ -38,6 +38,7 @@
#include "ags/engine/media/audio/audio_system.h"
#include "ags/lib/system/datetime.h"
#include "ags/lib/std/algorithm.h"
+#include "ags/lib/std/thread.h"
#if defined (AGS_HAS_CD_AUDIO)
#include "libcda.h"
@@ -254,7 +255,6 @@ void AGSPlatformDriver::Delay(int millis) {
// don't allow it to check for debug messages, since this Delay()
// call might be from within a debugger polling loop
- update_polled_mp3();
now = AGS_Clock::now(); // update now
}
}
diff --git a/engines/ags/engine/platform/windows/setup/winsetup.cpp b/engines/ags/engine/platform/windows/setup/winsetup.cpp
index 3ee704f376..27b3bea92a 100644
--- a/engines/ags/engine/platform/windows/setup/winsetup.cpp
+++ b/engines/ags/engine/platform/windows/setup/winsetup.cpp
@@ -99,9 +99,6 @@ struct WinConfig {
bool RenderAtScreenRes;
bool AntialiasSprites;
- int DigiID;
- int MidiID;
- bool ThreadedAudio;
bool UseVoicePack;
bool MouseAutoLock;
@@ -141,9 +138,6 @@ void WinConfig::SetDefaults() {
MouseAutoLock = false;
MouseSpeed = 1.f;
- DigiID = -1; // autodetect
- MidiID = -1;
- ThreadedAudio = false;
UseVoicePack = true;
SpriteCacheSize = 1024 * 128;
@@ -179,9 +173,6 @@ void WinConfig::Load(const ConfigTree &cfg) {
AntialiasSprites = INIreadint(cfg, "misc", "antialias", AntialiasSprites ? 1 : 0) != 0;
- DigiID = read_driverid(cfg, "sound", "digiid", DigiID);
- MidiID = read_driverid(cfg, "sound", "midiid", MidiID);
- ThreadedAudio = INIreadint(cfg, "sound", "threaded", ThreadedAudio ? 1 : 0) != 0;
UseVoicePack = INIreadint(cfg, "sound", "usespeech", UseVoicePack ? 1 : 0) != 0;
MouseAutoLock = INIreadint(cfg, "mouse", "auto_lock", MouseAutoLock ? 1 : 0) != 0;
@@ -213,9 +204,6 @@ void WinConfig::Save(ConfigTree &cfg) {
INIwriteint(cfg, "misc", "antialias", AntialiasSprites ? 1 : 0);
- write_driverid(cfg, "sound", "digiid", DigiID);
- write_driverid(cfg, "sound", "midiid", MidiID);
- INIwriteint(cfg, "sound", "threaded", ThreadedAudio ? 1 : 0);
INIwriteint(cfg, "sound", "usespeech", UseVoicePack ? 1 : 0);
INIwriteint(cfg, "mouse", "auto_lock", MouseAutoLock ? 1 : 0);
@@ -613,18 +601,6 @@ INT_PTR WinSetupDialog::OnInitDialog(HWND hwnd) {
SetCheck(_hRenderAtScreenRes, _winCfg.RenderAtScreenRes);
- AddString(_hDigiDriverList, "No Digital Sound", DIGI_NONE);
- AddString(_hDigiDriverList, "Default device (auto)", MIDI_AUTODETECT);
- AddString(_hDigiDriverList, "Default DirectSound Device", DIGI_DIRECTAMX(0));
- AddString(_hDigiDriverList, "Default WaveOut Device", DIGI_WAVOUTID(0));
- AddString(_hDigiDriverList, "DirectSound (Hardware mixer)", DIGI_DIRECTX(0));
- SetCurSelToItemData(_hDigiDriverList, _winCfg.DigiID);
-
- AddString(_hMidiDriverList, "No MIDI music", MIDI_NONE);
- AddString(_hMidiDriverList, "Default device (auto)", MIDI_AUTODETECT);
- AddString(_hMidiDriverList, "Win32 MIDI Mapper", MIDI_WIN32MAPPER);
- SetCurSelToItemData(_hMidiDriverList, _winCfg.MidiID);
-
FillLanguageList();
SetCheck(_hMouseLock, _winCfg.MouseAutoLock);
@@ -645,7 +621,6 @@ INT_PTR WinSetupDialog::OnInitDialog(HWND hwnd) {
SetCheck(_hRefresh85Hz, _winCfg.RefreshRate == 85);
SetCheck(_hAntialiasSprites, _winCfg.AntialiasSprites);
- SetCheck(_hThreadedAudio, _winCfg.ThreadedAudio);
SetCheck(_hUseVoicePack, _winCfg.UseVoicePack);
if (!File::TestReadFile("speech.vox"))
EnableWindow(_hUseVoicePack, FALSE);
@@ -1061,15 +1036,11 @@ void WinSetupDialog::SaveSetup() {
_winCfg.UserSaveDir = "";
}
- _winCfg.DigiID = GetCurItemData(_hDigiDriverList);
- _winCfg.MidiID = GetCurItemData(_hMidiDriverList);
-
if (GetCurSel(_hLanguageList) == 0)
_winCfg.Language.Empty();
else
_winCfg.Language = GetText(_hLanguageList);
_winCfg.SpriteCacheSize = GetCurItemData(_hSpriteCacheList) * 1024;
- _winCfg.ThreadedAudio = GetCheck(_hThreadedAudio);
_winCfg.UseVoicePack = GetCheck(_hUseVoicePack);
_winCfg.VSync = GetCheck(_hVSync);
_winCfg.RenderAtScreenRes = GetCheck(_hRenderAtScreenRes);
diff --git a/engines/ags/engine/script/script.cpp b/engines/ags/engine/script/script.cpp
index aef7b4e188..67a35c374d 100644
--- a/engines/ags/engine/script/script.cpp
+++ b/engines/ags/engine/script/script.cpp
@@ -221,7 +221,6 @@ int run_interaction_script(InteractionScripts *nint, int evnt, int chkAny, int i
RuntimeScriptValue rval_null;
- update_polled_mp3();
if ((strstr(evblockbasename, "character") != nullptr) || (strstr(evblockbasename, "inventory") != nullptr)) {
// Character or Inventory (global script)
QueueScriptFunction(kScInstGame, nint->ScriptFuncNames[evnt]);
@@ -229,7 +228,6 @@ int run_interaction_script(InteractionScripts *nint, int evnt, int chkAny, int i
// Other (room script)
QueueScriptFunction(kScInstRoom, nint->ScriptFuncNames[evnt]);
}
- update_polled_mp3();
int retval = 0;
// if the room changed within the action
@@ -678,7 +676,6 @@ int run_interaction_commandlist(InteractionCommandList *nicl, int *timesrun, int
{ // Run script
TempEip tempip(4001);
RuntimeScriptValue rval_null;
- update_polled_mp3();
if ((strstr(evblockbasename, "character") != nullptr) || (strstr(evblockbasename, "inventory") != nullptr)) {
// Character or Inventory (global script)
const char *torun = make_ts_func_name(evblockbasename, evblocknum, nicl->Cmds[i].Data[0].Value);
@@ -689,7 +686,6 @@ int run_interaction_commandlist(InteractionCommandList *nicl, int *timesrun, int
const char *torun = make_ts_func_name(evblockbasename, evblocknum, nicl->Cmds[i].Data[0].Value);
QueueScriptFunction(kScInstRoom, torun);
}
- update_polled_mp3();
break;
}
case 2: // Add score (first time)
diff --git a/engines/ags/engine/util/thread.h b/engines/ags/engine/util/thread.h
deleted file mode 100644
index e57cb48c4b..0000000000
--- a/engines/ags/engine/util/thread.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * 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 AGS_ENGINE_UTIL_THREAD_H
-#define AGS_ENGINE_UTIL_THREAD_H
-
-namespace AGS3 {
-namespace AGS {
-namespace Engine {
-
-class BaseThread {
-public:
- typedef void(*AGSThreadEntry)();
-
- BaseThread() {}
- virtual ~BaseThread() {}
-
- BaseThread &operator=(const BaseThread &) = delete;
- BaseThread(const BaseThread &) = delete;
-
- virtual bool Create(AGSThreadEntry entryPoint, bool looping) = 0;
- virtual bool Start() = 0;
- virtual bool Stop() = 0;
-
- inline bool CreateAndStart(AGSThreadEntry entryPoint, bool looping) {
- if (!Create(entryPoint, looping)) {
- return false;
- }
- return Start();
- }
-};
-
-} // namespace Engine
-} // namespace AGS
-} // namespace AGS3
-
-#if 0
-// insert platforms here
-#else
-#include "ags/engine/util/thread_std.h"
-#endif
-
-
-#endif
diff --git a/engines/ags/engine/util/thread_psp.h b/engines/ags/engine/util/thread_psp.h
deleted file mode 100644
index 4e2a967478..0000000000
--- a/engines/ags/engine/util/thread_psp.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * 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 AGS_ENGINE_UTIL_PSP_THREAD_H
-#define AGS_ENGINE_UTIL_PSP_THREAD_H
-
-//include <pspsdk.h>
-//include <pspkernel.h>
-//include <pspthreadman.h>
-
-namespace AGS3 {
-namespace AGS {
-namespace Engine {
-
-class PSPThread : public BaseThread {
-public:
- PSPThread() {
- _thread = -1;
- _entry = NULL;
- _running = false;
- _looping = false;
- }
-
- ~PSPThread() {
- Stop();
- }
-
- inline bool Create(AGSThreadEntry entryPoint, bool looping) {
- _looping = looping;
- _entry = entryPoint;
- _thread = sceKernelCreateThread("ags", _thread_start, 0x20, 0x10000, THREAD_ATTR_USER, 0);
-
- return (_thread > -1);
- }
-
- inline bool Start() {
- if ((_thread > -1) && (!_running)) {
- PSPThread *thisPointer = this;
- SceUID result = sceKernelStartThread(_thread, sizeof(this), &thisPointer);
-
- _running = (result > -1);
- return _running;
- } else {
- return false;
- }
- }
-
- bool Stop() {
- if ((_thread > -1) && (_running)) {
- if (_looping) {
- _looping = false;
- sceKernelWaitThreadEnd(_thread, 0);
- }
-
- _running = false;
- return (sceKernelTerminateDeleteThread(_thread) > -1);
- } else {
- return false;
- }
- }
-
-private:
- SceUID _thread;
- bool _running;
- bool _looping;
-
- AGSThreadEntry _entry;
-
- static int _thread_start(SceSize args, void *argp) {
- AGSThreadEntry entry = (*(PSPThread **)argp)->_entry;
- bool *looping = &(*(PSPThread **)argp)->_looping;
-
- do {
- entry();
- } while (*looping);
- }
-};
-
-
-typedef PSPThread Thread;
-
-} // namespace Engine
-} // namespace AGS
-} // namespace AGS3
-
-#endif
diff --git a/engines/ags/engine/util/thread_pthread.h b/engines/ags/engine/util/thread_pthread.h
deleted file mode 100644
index 83108f5c6e..0000000000
--- a/engines/ags/engine/util/thread_pthread.h
+++ /dev/null
@@ -1,104 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * 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 AGS_ENGINE_UTIL_THREAD_PTHREAD_H
-#define AGS_ENGINE_UTIL_THREAD_PTHREAD_H
-
-#include <pthread.h>
-
-namespace AGS3 {
-namespace AGS {
-namespace Engine {
-
-class PThreadThread : public BaseThread {
-public:
- PThreadThread() {
- _thread = 0;
- _entry = NULL;
- _running = false;
- _looping = false;
- }
-
- ~PThreadThread() {
- Stop();
- }
-
- inline bool Create(AGSThreadEntry entryPoint, bool looping) {
- _looping = looping;
- _entry = entryPoint;
-
- // Thread creation is delayed till the thread is started
- return true;
- }
-
- inline bool Start() {
- if (!_running) {
- _running = (pthread_create(&_thread, NULL, _thread_start, this) == 0);
-
- return _running;
- } else {
- return false;
- }
- }
-
- bool Stop() {
- if (_running) {
- if (_looping) {
- _looping = false;
- }
-
- pthread_join(_thread, NULL);
-
- _running = false;
- return true;
- } else {
- return false;
- }
- }
-
-private:
- pthread_t _thread;
- bool _running;
- bool _looping;
-
- AGSThreadEntry _entry;
-
- static void *_thread_start(void *arg) {
- AGSThreadEntry entry = ((PThreadThread *)arg)->_entry;
- bool *looping = &((PThreadThread *)arg)->_looping;
-
- do {
- entry();
- } while (*looping);
-
- return NULL;
- }
-};
-
-
-typedef PThreadThread Thread;
-
-} // namespace Engine
-} // namespace AGS
-} // namespace AGS3
-
-#endif
diff --git a/engines/ags/engine/util/thread_std.h b/engines/ags/engine/util/thread_std.h
deleted file mode 100644
index 1ad4477838..0000000000
--- a/engines/ags/engine/util/thread_std.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * 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 AGS_ENGINE_UTIL_THREAD_STD_H
-#define AGS_ENGINE_UTIL_THREAD_STD_H
-
-//include <system_error>
-#include "ags/engine/util/thread.h"
-#include "ags/lib/std/thread.h"
-
-namespace AGS3 {
-namespace AGS {
-namespace Engine {
-
-class StdThread : public BaseThread {
-public:
- StdThread() : thread_(), entry_(nullptr), looping_(false) {
- }
-
- ~StdThread() override {
- Stop();
- }
-
- StdThread &operator=(const StdThread &) = delete;
- StdThread(const StdThread &) = delete;
-
- bool Create(AGSThreadEntry entryPoint, bool looping) override {
- if (!entryPoint) {
- return false;
- }
-
- entry_ = entryPoint;
- looping_ = looping;
- return true;
- }
-
- bool Start() override {
- if (thread_.joinable()) {
- return true;
- }
- if (!entry_) {
- return false;
- }
-
-// try {
- thread_ = std::thread(thread_start_, this);
-// } catch (std::system_error) {
-// return false;
-// }
- return thread_.joinable();
- }
-
- bool Stop() override {
- if (!thread_.joinable()) {
- return true;
- }
-
- looping_ = false; // signal thread to stop
- thread_.join();
- return true;
- }
-
-private:
- std::thread thread_;
- AGSThreadEntry entry_;
- bool looping_;
-
- static void thread_start_(StdThread *self) {
- auto entry = self->entry_;
- for (;;) {
- entry();
- if (!self->looping_) {
- break;
- }
- std::this_thread::yield();
- }
- }
-};
-
-typedef StdThread Thread;
-
-} // namespace Engine
-} // namespace AGS
-} // namespace AGS3
-
-#endif
diff --git a/engines/ags/engine/util/thread_wii.h b/engines/ags/engine/util/thread_wii.h
deleted file mode 100644
index 633b7a521b..0000000000
--- a/engines/ags/engine/util/thread_wii.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * 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 AGS_ENGINE_UTIL_THREAD_WII_H
-#define AGS_ENGINE_UTIL_THREAD_WII_H
-
-//include <gccore.h>
-
-namespace AGS3 {
-namespace AGS {
-namespace Engine {
-
-class WiiThread : public BaseThread {
-public:
- WiiThread() {
- _thread = (lwp_t)NULL;
- _entry = NULL;
- _running = false;
- _looping = false;
- }
-
- ~WiiThread() {
- Stop();
- }
-
- inline bool Create(AGSThreadEntry entryPoint, bool looping) {
- _looping = looping;
- _entry = entryPoint;
-
- // Thread creation is delayed till the thread is started
- return true;
- }
-
- inline bool Start() {
- if (!_running) {
- _running = (LWP_CreateThread(&_thread, _thread_start, this, 0, 8 * 1024, 64) != 0);
-
- return _running;
- } else {
- return false;
- }
- }
-
- bool Stop() {
- if (_running) {
- if (_looping) {
- _looping = false;
- }
-
- LWP_JoinThread(_thread, NULL);
-
- _running = false;
- return true;
- } else {
- return false;
- }
- }
-
-private:
- lwp_t _thread;
- bool _running;
- bool _looping;
-
- AGSThreadEntry _entry;
-
- static void *_thread_start(void *arg) {
- AGSThreadEntry entry = ((WiiThread *)arg)->_entry;
- bool *looping = &((WiiThread *)arg)->_looping;
-
- do {
- entry();
- } while (*looping);
-
- return NULL;
- }
-};
-
-
-typedef WiiThread Thread;
-
-
-} // namespace Engine
-} // namespace AGS
-} // namespace AGS3
-
-#endif
diff --git a/engines/ags/engine/util/thread_windows.h b/engines/ags/engine/util/thread_windows.h
deleted file mode 100644
index 77e3622b46..0000000000
--- a/engines/ags/engine/util/thread_windows.h
+++ /dev/null
@@ -1,104 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * 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 AGS_ENGINE_UTIL_THREAD_WINDOWS_H
-#define AGS_ENGINE_UTIL_THREAD_WINDOWS_H
-
-namespace AGS3 {
-namespace AGS {
-namespace Engine {
-
-class WindowsThread : public BaseThread {
-public:
- WindowsThread() {
- _thread = NULL;
- _entry = NULL;
- _running = false;
- _looping = false;
- }
-
- ~WindowsThread() {
- Stop();
- }
-
- inline bool Create(AGSThreadEntry entryPoint, bool looping) {
- _looping = looping;
- _entry = entryPoint;
- _thread = CreateThread(NULL, 0, _thread_start, this, CREATE_SUSPENDED, NULL);
-
- return (_thread != NULL);
- }
-
- inline bool Start() {
- if ((_thread != NULL) && (!_running)) {
- DWORD result = ResumeThread(_thread);
-
- _running = (result != (DWORD)-1);
- return _running;
- } else {
- return false;
- }
- }
-
- bool Stop() {
- if ((_thread != NULL) && (_running)) {
- if (_looping) {
- _looping = false;
- WaitForSingleObject(_thread, INFINITE);
- }
-
- CloseHandle(_thread);
-
- _running = false;
- _thread = NULL;
- return true;
- } else {
- return false;
- }
- }
-
-private:
- HANDLE _thread;
- bool _running;
- bool _looping;
-
- AGSThreadEntry _entry;
-
- static DWORD __stdcall _thread_start(LPVOID lpParam) {
- AGSThreadEntry entry = ((WindowsThread *)lpParam)->_entry;
- bool *looping = &((WindowsThread *)lpParam)->_looping;
-
- do {
- entry();
- } while (*looping);
-
- return 0;
- }
-};
-
-typedef WindowsThread Thread;
-
-} // namespace Engine
-} // namespace AGS
-} // namespace AGS3
-
-#endif
diff --git a/engines/ags/lib/allegro.h b/engines/ags/lib/allegro.h
index 879029da10..ea838a54ea 100644
--- a/engines/ags/lib/allegro.h
+++ b/engines/ags/lib/allegro.h
@@ -41,10 +41,6 @@
#include "ags/lib/allegro/system.h"
#include "ags/lib/allegro/unicode.h"
-#include "ags/lib/audio/sound.h"
-#include "ags/lib/audio/digi.h"
-#include "ags/lib/audio/midi.h"
-
namespace AGS3 {
extern int install_allegro();
diff --git a/engines/ags/lib/allegro/sound.cpp b/engines/ags/lib/allegro/sound.cpp
deleted file mode 100644
index 46b9d1b909..0000000000
--- a/engines/ags/lib/allegro/sound.cpp
+++ /dev/null
@@ -1,111 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * 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.
- *
- */
-
-#include "ags/lib/audio/sound.h"
-#include "common/textconsole.h"
-
-namespace AGS3 {
-
-_DRIVER_INFO _digi_driver_list[] = {
- { 0, nullptr, 0 }
-};
-
-
-int install_sound(int digi, int midi, const char *cfg_path) {
- // TODO: install_sound
- return 0;
-}
-
-void remove_sound() {
- // TODO: remove_sound
-}
-
-void reserve_voices(int digi_voices, int midi_voices) {
- error("reserve_voices");
-}
-
-void set_volume_per_voice(int scale) {
- error("set_volume_per_voice");
-
-}
-
-int install_sound_input(int digi, int midi) {
- error("install_sound_input");
-}
-
-void remove_sound_input() {
- error("remove_sound_input");
-}
-
-void set_volume(int digi_volume, int midi_volume) {
- error("set_volume");
-}
-
-void set_hardware_volume(int digi_volume, int midi_volume) {
- error("set_hardware_volume");
-}
-
-void get_volume(int *digi_volume, int *midi_volume) {
- error("get_volume");
-}
-
-void get_hardware_volume(int *digi_volume, int *midi_volume) {
- error("get_hardware_volume");
-}
-
-void set_mixer_quality(int quality) {
- error("set_mixer_quality");
-}
-
-int get_mixer_quality() {
- error("get_mixer_quality");
-}
-
-int get_mixer_frequency() {
- error("get_mixer_frequency");
-}
-
-int get_mixer_bits() {
- error("get_mixer_bits");
-}
-
-int get_mixer_channels() {
- error("get_mixer_channels");
-}
-
-int get_mixer_voices() {
- error("get_mixer_voices");
-}
-
-int get_mixer_buffer_length() {
- error("get_mixer_buffer_length");
-}
-
-
-void stop_audio_stream(AUDIOSTREAM *stream) {
- warning("TODO: stop_audio_stream");
-}
-
-void set_volume(int channel, int vol) {
- warning("TODO: set_volume(%d, %d)", channel, vol);
-}
-} // namespace AGS3
diff --git a/engines/ags/lib/audio/digi.cpp b/engines/ags/lib/audio/digi.cpp
deleted file mode 100644
index c28fe3eb73..0000000000
--- a/engines/ags/lib/audio/digi.cpp
+++ /dev/null
@@ -1,155 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * 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.
- *
- */
-
-#include "ags/lib/audio/digi.h"
-#include "common/textconsole.h"
-
-namespace AGS3 {
-
-/*------------------------------------------------------------------*/
-
-DIGI_DRIVER::DIGI_DRIVER() :
- id(0), name(nullptr),
- desc(nullptr),
- ascii_name(nullptr),
- voices(0),
- basevoice(0),
- max_voices(0),
- def_voices(0),
- detect(nullptr),
- init(nullptr),
- exit_(nullptr),
- set_mixer_volume(nullptr),
- get_mixer_volume(nullptr),
- lock_voice(nullptr),
- unlock_voice(nullptr),
- buffer_size(nullptr),
- init_voice(nullptr),
- release_voice(nullptr),
- start_voice(nullptr),
- stop_voice(nullptr),
- loop_voice(nullptr),
- get_position(nullptr),
- set_position(nullptr),
- get_volume(nullptr),
- set_volume(nullptr),
- ramp_volume(nullptr),
- stop_volume_ramp(nullptr),
- get_frequency(nullptr),
- set_frequency(nullptr),
- sweep_frequency(nullptr),
- stop_frequency_sweep(nullptr),
- get_pan(nullptr),
- set_pan(nullptr),
- sweep_pan(nullptr),
- stop_pan_sweep(nullptr),
- set_echo(nullptr),
- set_tremolo(nullptr),
- set_vibrato(nullptr),
- rec_cap_bits(0),
- rec_cap_stereo(0),
- rec_cap_rate(nullptr),
- rec_cap_parm(nullptr),
- rec_source(nullptr),
- rec_start(nullptr),
- rec_stop(nullptr),
- rec_read(nullptr) {
-}
-
-/*------------------------------------------------------------------*/
-
-class ScummVMDigiDriver : public DIGI_DRIVER {
-};
-
-/*------------------------------------------------------------------*/
-
-DIGI_DRIVER *digi_driver;
-
-DIGI_DRIVER *digi_input_driver;
-
-int digi_card;
-
-int digi_input_card;
-
-static byte dummy_driver_data[1] = { 0 };
-
-BEGIN_DIGI_DRIVER_LIST
- { SCUMMVM_ID, &dummy_driver_data, true },
-END_DIGI_DRIVER_LIST
-
-
-int detect_digi_driver(int driver_id) {
- assert(driver_id == SCUMMVM_ID);
- digi_driver = new ScummVMDigiDriver();
- return 16;
-}
-
-SAMPLE *load_wav_pf(PACKFILE *f) {
- warning("TODO: load_wav_pf");
- return nullptr;
-}
-
-void destroy_sample(SAMPLE *spl) {
- delete spl;
-}
-
-int play_sample(SAMPLE *spl, int vol, int pan, int freq, int loop) {
- warning("TODO: play_sample");
- return 0;
-}
-
-void stop_sample(SAMPLE *spl) {
- warning("TODO: stop_sample");
-}
-
-
-void voice_start(int voice) {
- warning("TODO: voice_start");
-}
-
-void voice_stop(int voice) {
- warning("TODO: voice_stop");
-}
-
-int voice_get_position(int voice) {
- warning("TODO: voice_get_position");
- return 0;
-}
-
-void voice_set_position(int voice, int position) {
- warning("TODO: voice_set_position");
-}
-
-void voice_set_volume(int voice, int volume) {
- warning("TODO: voice_set_volume");
-}
-
-int voice_get_frequency(int voice) {
- warning("TODO: voice_get_frequency");
- return 0;
-}
-
-void voice_set_pan(int voice, int pan) {
- warning("TODO: voice_set_pan");
-}
-
-} // namespace AGS3
diff --git a/engines/ags/lib/audio/digi.h b/engines/ags/lib/audio/digi.h
deleted file mode 100644
index da058b11df..0000000000
--- a/engines/ags/lib/audio/digi.h
+++ /dev/null
@@ -1,162 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * 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 AGS_LIB_AUDIO_DIGI_H
-#define AGS_LIB_AUDIO_DIGI_H
-
-#include "common/scummsys.h"
-#include "ags/lib/allegro/base.h"
-#include "ags/lib/allegro/alconfig.h"
-#include "ags/lib/allegro/file.h"
-
-namespace AGS3 {
-
-
-#define DIGI_VOICES 64 /* Theoretical maximums: */
-/* actual drivers may not be */
-/* able to handle this many */
-
-/* a sample */
-struct SAMPLE {
- int bits; /* 8 or 16 */
- int stereo; /* sample type flag */
- int freq; /* sample frequency */
- int priority; /* 0-255 */
- unsigned long len; /* length (in samples) */
- unsigned long loop_start; /* loop start position */
- unsigned long loop_end; /* loop finish position */
- unsigned long param; /* for internal use by the driver */
- void *data; /* sample data */
-};
-
-
-#define DIGI_AUTODETECT -1 /* for passing to install_sound() */
-#define DIGI_NONE 0
-
-/* driver for playing digital sfx */
-struct DIGI_DRIVER {
- int id; /* driver ID code */
- AL_CONST char *name; /* driver name */
- AL_CONST char *desc; /* description string */
- AL_CONST char *ascii_name; /* ASCII format name string */
- int voices; /* available voices */
- int basevoice; /* voice number offset */
- int max_voices; /* maximum voices we can support */
- int def_voices; /* default number of voices to use */
-
- /* setup routines */
- AL_METHOD(int, detect, (int input));
- AL_METHOD(int, init, (int input, int voices));
- AL_METHOD(void, exit_, (int input));
- AL_METHOD(int, set_mixer_volume, (int volume));
- AL_METHOD(int, get_mixer_volume, (void));
-
- /* for use by the audiostream functions */
- AL_METHOD(void *, lock_voice, (int voice, int start, int end));
- AL_METHOD(void, unlock_voice, (int voice));
- AL_METHOD(int, buffer_size, (void));
-
- /* voice control functions */
- AL_METHOD(void, init_voice, (int voice, AL_CONST SAMPLE *sample));
- AL_METHOD(void, release_voice, (int voice));
- AL_METHOD(void, start_voice, (int voice));
- AL_METHOD(void, stop_voice, (int voice));
- AL_METHOD(void, loop_voice, (int voice, int playmode));
-
- /* position control functions */
- AL_METHOD(int, get_position, (int voice));
- AL_METHOD(void, set_position, (int voice, int position));
-
- /* volume control functions */
- AL_METHOD(int, get_volume, (int voice));
- AL_METHOD(void, set_volume, (int voice, int volume));
- AL_METHOD(void, ramp_volume, (int voice, int tyme, int endvol));
- AL_METHOD(void, stop_volume_ramp, (int voice));
-
- /* pitch control functions */
- AL_METHOD(int, get_frequency, (int voice));
- AL_METHOD(void, set_frequency, (int voice, int frequency));
- AL_METHOD(void, sweep_frequency, (int voice, int tyme, int endfreq));
- AL_METHOD(void, stop_frequency_sweep, (int voice));
-
- /* pan control functions */
- AL_METHOD(int, get_pan, (int voice));
- AL_METHOD(void, set_pan, (int voice, int pan));
- AL_METHOD(void, sweep_pan, (int voice, int tyme, int endpan));
- AL_METHOD(void, stop_pan_sweep, (int voice));
-
- /* effect control functions */
- AL_METHOD(void, set_echo, (int voice, int strength, int delay));
- AL_METHOD(void, set_tremolo, (int voice, int rate, int depth));
- AL_METHOD(void, set_vibrato, (int voice, int rate, int depth));
-
- /* input functions */
- int rec_cap_bits;
- int rec_cap_stereo;
- AL_METHOD(int, rec_cap_rate, (int bits, int stereo));
- AL_METHOD(int, rec_cap_parm, (int rate, int bits, int stereo));
- AL_METHOD(int, rec_source, (int source));
- AL_METHOD(int, rec_start, (int rate, int bits, int stereo));
- AL_METHOD(void, rec_stop, (void));
- AL_METHOD(int, rec_read, (void *buf));
-
- DIGI_DRIVER();
-};
-
-AL_ARRAY(_DRIVER_INFO, _digi_driver_list);
-
-/* macros for constructing the driver lists */
-#define BEGIN_DIGI_DRIVER_LIST \
- _DRIVER_INFO _digi_driver_list[] = \
- {
-
-#define END_DIGI_DRIVER_LIST \
- { 0, nullptr, 0 } \
- };
-
-AL_VAR(DIGI_DRIVER *, digi_driver);
-
-AL_VAR(DIGI_DRIVER *, digi_input_driver);
-
-AL_VAR(int, digi_card);
-
-AL_VAR(int, digi_input_card);
-
-AL_FUNC(int, detect_digi_driver, (int driver_id));
-
-
-extern SAMPLE *load_wav_pf(PACKFILE *f);
-extern void destroy_sample(SAMPLE *spl);
-extern int play_sample(SAMPLE *spl, int vol, int pan, int freq, int loop);
-extern void stop_sample(SAMPLE *spl);
-
-extern void voice_start(int voice);
-extern void voice_stop(int voice);
-extern int voice_get_position(int voice);
-extern void voice_set_position(int voice, int position);
-extern void voice_set_volume(int voice, int volume);
-extern int voice_get_frequency(int voice);
-extern void voice_set_pan(int voice, int pan);
-
-} // namespace AGS3
-
-#endif
diff --git a/engines/ags/lib/audio/midi.cpp b/engines/ags/lib/audio/midi.cpp
deleted file mode 100644
index 2b8056554d..0000000000
--- a/engines/ags/lib/audio/midi.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * 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.
- *
- */
-
-#include "ags/lib/audio/midi.h"
-#include "ags/lib/allegro/file.h"
-#include "ags/music.h"
-#include "common/textconsole.h"
-
-namespace AGS3 {
-
-static byte dummy_driver_data[1] = { 0 };
-
-BEGIN_MIDI_DRIVER_LIST
-{ SCUMMVM_ID, &dummy_driver_data, true },
-END_MIDI_DRIVER_LIST
-
-int midi_card;
-int midi_input_card;
-
-int detect_midi_driver(int driver_id) {
- return 16;
-}
-
-int load_midi_patches() {
- warning("TODO: load_midi_patches");
- return 0;
-}
-
-} // namespace AGS3
diff --git a/engines/ags/lib/audio/midi.h b/engines/ags/lib/audio/midi.h
deleted file mode 100644
index ae24b041ce..0000000000
--- a/engines/ags/lib/audio/midi.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * 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 AGS_LIB_AUDIO_MIDI_H
-#define AGS_LIB_AUDIO_MIDI_H
-
-#include "common/scummsys.h"
-#include "common/array.h"
-#include "ags/lib/allegro/base.h"
-#include "ags/lib/allegro/alconfig.h"
-#include "ags/music.h"
-
-namespace AGS3 {
-
-#define MIDI_AUTODETECT -1
-#define MIDI_NONE 0
-#define MIDI_DIGMID AL_ID('D','I','G','I')
-
-AL_ARRAY(_DRIVER_INFO, _midi_driver_list);
-
-/* macros for constructing the driver lists */
-#define BEGIN_MIDI_DRIVER_LIST \
- _DRIVER_INFO _midi_driver_list[] = \
- {
-
-#define END_MIDI_DRIVER_LIST \
- { 0, NULL, 0 } \
- };
-
-#define MIDI_DRIVER_DIGMID \
- { MIDI_DIGMID, &midi_digmid, TRUE },
-
-
-AL_VAR(int, midi_card);
-
-AL_VAR(int, midi_input_card);
-
-AL_VAR(long, midi_loop_start); /* where to loop back to at EOF */
-AL_VAR(long, midi_loop_end); /* loop when we hit this position */
-
-
-AL_FUNC(int, detect_midi_driver, (int driver_id));
-AL_FUNC(int, load_midi_patches, ());
-
-} // namespace AGS3
-
-#endif
diff --git a/engines/ags/lib/audio/mod.cpp b/engines/ags/lib/audio/mod.cpp
deleted file mode 100644
index 29c9acadb7..0000000000
--- a/engines/ags/lib/audio/mod.cpp
+++ /dev/null
@@ -1,34 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * 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.
- *
- */
-
-#include "ags/lib/audio/ogg.h"
-#include "common/textconsole.h"
-#include "ags/ags.h"
-
-namespace AGS3 {
-
-int alogg_poll_ogg(ALOGG_OGG *ogg) {
- return ::AGS::g_vm->_mixer->isSoundHandleActive(ogg->_handle) ? 0 : ALOGG_POLL_PLAYJUSTFINISHED;
-}
-
-
-} // namespace AGS3
diff --git a/engines/ags/lib/audio/mod.h b/engines/ags/lib/audio/mod.h
deleted file mode 100644
index 5fcf46c3fa..0000000000
--- a/engines/ags/lib/audio/mod.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * 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 AGS_LIB_AUDIO_MOD_H
-#define AGS_LIB_AUDIO_MOD_H
-
-#include "audio/audiostream.h"
-#include "audio/mixer.h"
-
-namespace AGS3 {
-
-
-} // namespace AGS3
-
-#endif
diff --git a/engines/ags/lib/audio/sound.cpp b/engines/ags/lib/audio/sound.cpp
deleted file mode 100644
index f87fdef389..0000000000
--- a/engines/ags/lib/audio/sound.cpp
+++ /dev/null
@@ -1,110 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * 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.
- *
- */
-
-#include "ags/lib/audio/sound.h"
-#include "common/textconsole.h"
-#include "ags/ags.h"
-#include "audio/mixer.h"
-
-namespace AGS3 {
-
-int install_sound(int digi, int midi, const char *cfg_path) {
- // TODO: install_sound
- return 0;
-}
-
-void remove_sound() {
- // TODO: remove_sound
-}
-
-void reserve_voices(int digi_voices, int midi_voices) {
- // TODO: reserve_voices
-}
-
-void set_volume_per_voice(int scale) {
- // TODO: set_volume_per_voice
-}
-
-int install_sound_input(int digi, int midi) {
- // TODO: install_sound_input
- return 0;
-}
-
-void remove_sound_input() {
- // TODO: remove_sound_input
-}
-
-void set_volume(int digi_volume, int midi_volume) {
- // TODO: set_volume
-}
-
-void set_hardware_volume(int digi_volume, int midi_volume) {
- // TODO: set_hardware_volume
-}
-
-void get_volume(int *digi_volume, int *midi_volume) {
- // TODO: get_volume
- *digi_volume = 255;
- *midi_volume = 255;
-}
-
-void get_hardware_volume(int *digi_volume, int *midi_volume) {
- // TODO: get_hardware_volume
-}
-
-void set_mixer_quality(int quality) {
- // TODO: set_mixer_quality
-}
-
-int get_mixer_quality() {
- warning("TODO: get_mixer_quality");
- return 0;
-}
-
-int get_mixer_frequency() {
- return ::AGS::g_vm->_mixer->getOutputRate();
-}
-
-int get_mixer_bits() {
- return 16;
-}
-
-int get_mixer_channels() {
- warning("TODO: get_mixer_channels");
- return 10;
-}
-
-int get_mixer_voices() {
- warning("TODO: get_mixer_voices");
- return 1;
-}
-
-int get_mixer_buffer_length() {
- warning("TODO: get_mixer_buffer_length");
- return 22040;
-}
-
-void stop_audio_stream(AUDIOSTREAM *stream) {
- warning("TODO: stop_audio_stream");
-}
-
-} // namespace AGS3
diff --git a/engines/ags/lib/audio/sound.h b/engines/ags/lib/audio/sound.h
deleted file mode 100644
index d8c046de25..0000000000
--- a/engines/ags/lib/audio/sound.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * 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 AGS_LIB_ALLEGRO_SOUND_H
-#define AGS_LIB_ALLEGRO_SOUND_H
-
-#include "common/scummsys.h"
-#include "ags/lib/allegro/base.h"
-#include "ags/lib/allegro/alconfig.h"
-
-namespace AGS3 {
-
-struct SAMPLE;
-
-struct AUDIOSTREAM {
- int voice = -1;
- SAMPLE *samp = nullptr;
- bool active = false;
- void *locked = nullptr;
-};
-
-AL_FUNC(void, reserve_voices, (int digi_voices, int midi_voices));
-AL_FUNC(void, set_volume_per_voice, (int scale));
-
-AL_FUNC(int, install_sound, (int digi, int midi, AL_CONST char *cfg_path));
-AL_FUNC(void, remove_sound, (void));
-
-AL_FUNC(int, install_sound_input, (int digi, int midi));
-AL_FUNC(void, remove_sound_input, (void));
-
-AL_FUNC(void, set_volume, (int digi_volume, int midi_volume));
-AL_FUNC(void, set_hardware_volume, (int digi_volume, int midi_volume));
-
-AL_FUNC(void, get_volume, (int *digi_volume, int *midi_volume));
-AL_FUNC(void, get_hardware_volume, (int *digi_volume, int *midi_volume));
-
-AL_FUNC(void, set_mixer_quality, (int quality));
-AL_FUNC(int, get_mixer_quality, (void));
-AL_FUNC(int, get_mixer_frequency, (void));
-AL_FUNC(int, get_mixer_bits, (void));
-AL_FUNC(int, get_mixer_channels, (void));
-AL_FUNC(int, get_mixer_voices, (void));
-AL_FUNC(int, get_mixer_buffer_length, (void));
-
-
-extern void stop_audio_stream(AUDIOSTREAM *stream);
-extern void set_volume(int channel, int vol);
-
-} // namespace AGS3
-
-#endif
diff --git a/engines/ags/lib/std/thread.h b/engines/ags/lib/std/thread.h
index 3577b7747d..427d3d17ba 100644
--- a/engines/ags/lib/std/thread.h
+++ b/engines/ags/lib/std/thread.h
@@ -29,26 +29,6 @@
namespace AGS3 {
namespace std {
-class thread {
-public:
- template <class _Fn, class... _Args>
- explicit thread(_Fn &&_Fx, _Args &&... _Ax) {
- warning("TODO: thread::constructor");
- }
-
- thread() {
- warning("TODO: thread::constructor");
- }
-
- void join() {
- warning("TODO: thread::join");
- }
- bool joinable() const {
- // TODO: thread::joinable
- return false;
- }
-};
-
class this_thread {
public:
static void yield() {
diff --git a/engines/ags/module.mk b/engines/ags/module.mk
index efef4746f6..7527e888ec 100644
--- a/engines/ags/module.mk
+++ b/engines/ags/module.mk
@@ -25,9 +25,6 @@ MODULE_OBJS = \
lib/allegro/mouse.o \
lib/allegro/system.o \
lib/allegro/unicode.o \
- lib/audio/digi.o \
- lib/audio/midi.o \
- lib/audio/sound.o \
lib/hq2x/hq2x3x.o \
lib/std/std.o \
lib/system/datetime.o \
diff --git a/engines/ags/music.cpp b/engines/ags/music.cpp
index a3142d8023..1d2452361c 100644
--- a/engines/ags/music.cpp
+++ b/engines/ags/music.cpp
@@ -22,7 +22,6 @@
#include "ags/music.h"
#include "ags/engine/main/main.h"
-#include "ags/lib/audio/midi.h"
#include "ags/engine/globals.h"
#include "audio/midiparser.h"
@@ -31,7 +30,7 @@ namespace AGS {
Music *g_music;
Music::Music(Audio::Mixer *mixer) :
- Audio::MidiPlayer(), _mixer(mixer), _isFirstTime(true) {
+ Audio::MidiPlayer(), _mixer(mixer) {
g_music = this;
Audio::MidiPlayer::createDriver();
@@ -65,12 +64,6 @@ void Music::sendToChannel(byte channel, uint32 b) {
}
void Music::playMusic(Common::SeekableReadStream *midi, bool repeat) {
- if (_isFirstTime) {
- if (_G(psp_midi_preload_patches))
- ::AGS3::load_midi_patches();
- _isFirstTime = false;
- }
-
stop();
// Load MIDI resource data
diff --git a/engines/ags/music.h b/engines/ags/music.h
index 2ea8f81662..fa1af52d33 100644
--- a/engines/ags/music.h
+++ b/engines/ags/music.h
@@ -35,7 +35,6 @@ private:
Audio::Mixer *_mixer;
Audio::SoundHandle _soundHandle;
Common::Array<byte> _midiData;
- bool _isFirstTime;
protected:
// Overload Audio::MidiPlayer method
void sendToChannel(byte channel, uint32 b) override;
diff --git a/engines/ags/plugins/agsplugin.cpp b/engines/ags/plugins/agsplugin.cpp
index 026d09bcfc..c76111ab28 100644
--- a/engines/ags/plugins/agsplugin.cpp
+++ b/engines/ags/plugins/agsplugin.cpp
@@ -76,6 +76,8 @@
#include "ags/engine/globals.h"
#include "ags/engine/util/library.h"
#include "ags/engine/util/library_scummvm.h"
+#include "ags/ags.h"
+#include "ags/music.h"
namespace AGS3 {
@@ -591,14 +593,10 @@ void IAGSEngine::PlaySoundChannel(int32 channel, int32 soundType, int32 volume,
quit("!IAGSEngine::PlaySoundChannel: MIDI already in use");
newcha = my_load_midi(asset_name, loop);
newcha->set_volume(volume);
- }
-#ifndef PSP_NO_MOD_PLAYBACK
- else if (soundType == PSND_MOD) {
+ } else if (soundType == PSND_MOD) {
newcha = my_load_mod(asset_name, loop);
newcha->set_volume(volume);
- }
-#endif
- else
+ } else
quit("!IAGSEngine::PlaySoundChannel: unknown sound type");
set_clip_to_channel(channel, newcha);
@@ -669,10 +667,7 @@ int IAGSEngine::IsSpriteAlphaBlended(int32 slot) {
// disable AGS's sound engine
void IAGSEngine::DisableSound() {
shutdown_sound();
- usetup.digicard = DIGI_NONE;
- usetup.midicard = MIDI_NONE;
- reserve_voices(0, 0);
- install_sound(DIGI_NONE, MIDI_NONE, nullptr);
+ usetup.audio_backend = 0;
}
int IAGSEngine::CanRunScriptFunctionNow() {
if (inside_script)
Commit: 5f848c916207590e6552b5847bf5ee50798268d2
https://github.com/scummvm/scummvm/commit/5f848c916207590e6552b5847bf5ee50798268d2
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2021-02-08T18:03:22-08:00
Commit Message:
AGS: Refactor the SOUNDCLIP object
Changed paths:
engines/ags/engine/media/audio/clip_mymidi.cpp
engines/ags/engine/media/audio/clip_mymidi.h
engines/ags/engine/media/audio/soundclip.cpp
engines/ags/engine/media/audio/soundclip.h
diff --git a/engines/ags/engine/media/audio/clip_mymidi.cpp b/engines/ags/engine/media/audio/clip_mymidi.cpp
index 4ed6809c22..0a5ee30595 100644
--- a/engines/ags/engine/media/audio/clip_mymidi.cpp
+++ b/engines/ags/engine/media/audio/clip_mymidi.cpp
@@ -20,7 +20,6 @@
*
*/
-#include "ags/engine/media/audio/audiodefines.h"
#include "ags/shared/util/wgt2allg.h"
#include "ags/engine/media/audio/clip_mymidi.h"
#include "ags/ags.h"
@@ -29,16 +28,25 @@
namespace AGS3 {
MYMIDI::MYMIDI(Common::SeekableReadStream *data, bool repeat) :
- _data(data), lengthInSeconds(0) {
+ _state(SoundClipInitial), _data(data), lengthInSeconds(0) {
+ _mixer = ::AGS::g_vm->_mixer;
_repeat = repeat;
}
void MYMIDI::destroy() {
- stop();
+ ::AGS::g_music->stop();
delete _data;
_data = nullptr;
}
+void MYMIDI::poll() {
+ bool playing = is_playing();
+ if (playing)
+ _state = SoundClipPlaying;
+ else if (_state == SoundClipPlaying)
+ _state = SoundClipStopped;
+}
+
void MYMIDI::seek(int pos) {
warning("TODO: MYMIDI::seek");
}
@@ -77,8 +85,14 @@ int MYMIDI::play() {
return 1;
}
-void MYMIDI::stop() {
- ::AGS::g_music->stop();
+int MYMIDI::play_from(int position) {
+ // TODO: Implement playing from arbitrary positions
+ if (position == 0) {
+ play();
+ return 1;
+ } else {
+ return 0;
+ }
}
bool MYMIDI::is_playing() const {
@@ -93,11 +107,13 @@ void MYMIDI::set_panning(int newPanning) {
// No implementation for MIDI
}
-/*
-int MYMIDI::get_voice() {
- // voice is N/A for midi
- return -1;
+void MYMIDI::set_speed(int new_speed) {
+ warning("TODO: MYMIDI::set_speed");
+ _speed = new_speed;
+}
+
+void MYMIDI::adjust_volume() {
+ // TODO: See if this method is needed
}
-*/
} // namespace AGS3
diff --git a/engines/ags/engine/media/audio/clip_mymidi.h b/engines/ags/engine/media/audio/clip_mymidi.h
index 3e1d22e786..ee42f1301a 100644
--- a/engines/ags/engine/media/audio/clip_mymidi.h
+++ b/engines/ags/engine/media/audio/clip_mymidi.h
@@ -24,19 +24,24 @@
#define AGS_ENGINE_MEDIA_AUDIO_CLIP_MYMIDI_H
#include "ags/engine/media/audio/soundclip.h"
+#include "ags/engine/media/audio/audiodefines.h"
namespace AGS3 {
// MIDI
struct MYMIDI : public SOUNDCLIP {
+ Audio::Mixer *_mixer;
Common::SeekableReadStream *_data;
int lengthInSeconds;
+ SoundClipState _state;
MYMIDI(Common::SeekableReadStream *data, bool repeat);
- ~MYMIDI() override {}
+ ~MYMIDI() override { destroy(); }
void destroy() override;
+ void poll() override;
+
void seek(int pos) override;
int get_pos() override;
@@ -54,10 +59,12 @@ struct MYMIDI : public SOUNDCLIP {
}
int play() override;
- void stop() override;
+ int play_from(int position) override;
bool is_playing() const override;
void set_volume(int volume) override;
void set_panning(int newPanning) override;
+ void set_speed(int new_speed) override;
+ void adjust_volume() override;
};
} // namespace AGS3
diff --git a/engines/ags/engine/media/audio/soundclip.cpp b/engines/ags/engine/media/audio/soundclip.cpp
index f48ae074af..2bd9bda831 100644
--- a/engines/ags/engine/media/audio/soundclip.cpp
+++ b/engines/ags/engine/media/audio/soundclip.cpp
@@ -25,49 +25,16 @@
namespace AGS3 {
-SOUNDCLIP::SOUNDCLIP() : _state(SoundClipInitial), _panning(128), _panningAsPercentage(0),
+SOUNDCLIP::SOUNDCLIP() : _panning(12./8), _panningAsPercentage(0),
_sourceClip(nullptr), _sourceClipType(0), _speed(1000), _priority(50),
_xSource(-1), _ySource(-1), _maximumPossibleDistanceAway(0), _muted(false),
- _volAsPercentage(0), _vol(0), _volModifier(0), _repeat(false) {
- _mixer = ::AGS::g_vm->_mixer;
-}
-
-void SOUNDCLIP::poll() {
- bool playing = is_playing();
- if (playing)
- _state = SoundClipPlaying;
- else if (_state == SoundClipPlaying)
- _state = SoundClipStopped;
-}
-
-SOUNDCLIP::~SOUNDCLIP() {
- destroy();
-}
-
-void SOUNDCLIP::set_speed(int new_speed) {
- warning("TODO: SOUNDCLIP::set_speed");
- _speed = new_speed;
-}
-
-void SOUNDCLIP::adjust_volume() {
- // TODO: See if this method is needed
-}
-
-int SOUNDCLIP::play_from(int position) {
- // TODO: Implement playing from arbitrary positions
- if (position == 0) {
- play();
- return 1;
- } else {
- return 0;
- }
+ _volAsPercentage(0), _vol(0), _volModifier(0), _repeat(false), _directionalVolModifier(0) {
}
-
/*------------------------------------------------------------------*/
SoundClipWaveBase::SoundClipWaveBase(Audio::AudioStream *stream, int volume, bool repeat) :
- SOUNDCLIP(), _stream(stream) {
+ SOUNDCLIP(), _state(SoundClipInitial), _stream(stream) {
_mixer = ::AGS::g_vm->_mixer;
_repeat = repeat;
_vol = volume;
@@ -80,19 +47,33 @@ SoundClipWaveBase::SoundClipWaveBase(Audio::AudioStream *stream, int volume, boo
}
void SoundClipWaveBase::destroy() {
- stop();
+ _mixer->stopHandle(_soundHandle);
delete _stream;
_stream = nullptr;
}
+void SoundClipWaveBase::poll() {
+ bool playing = is_playing();
+ if (playing)
+ _state = SoundClipPlaying;
+ else if (_state == SoundClipPlaying)
+ _state = SoundClipStopped;
+}
+
int SoundClipWaveBase::play() {
_mixer->playStream(Audio::Mixer::kSFXSoundType, &_soundHandle, _stream,
-1, 255, 0, DisposeAfterUse::NO);
return 1;
}
-void SoundClipWaveBase::stop() {
- _mixer->stopHandle(_soundHandle);
+int SoundClipWaveBase::play_from(int position) {
+ // TODO: Implement playing from arbitrary positions
+ if (position == 0) {
+ play();
+ return 1;
+ } else {
+ return 0;
+ }
}
void SoundClipWaveBase::pause() {
@@ -135,4 +116,13 @@ void SoundClipWaveBase::set_panning(int newPanning) {
_mixer->setChannelBalance(_soundHandle, newPanning);
}
+void SoundClipWaveBase::set_speed(int new_speed) {
+ warning("TODO: SoundClipWaveBase::set_speed");
+ _speed = new_speed;
+}
+
+void SoundClipWaveBase::adjust_volume() {
+ // TODO: See if this method is needed
+}
+
} // namespace AGS3
diff --git a/engines/ags/engine/media/audio/soundclip.h b/engines/ags/engine/media/audio/soundclip.h
index 16b93c4551..e66c15e540 100644
--- a/engines/ags/engine/media/audio/soundclip.h
+++ b/engines/ags/engine/media/audio/soundclip.h
@@ -47,42 +47,43 @@ enum SoundClipState {
};
struct SOUNDCLIP {
- Audio::Mixer *_mixer;
- SoundClipState _state;
+ int _priority;
+ int _sourceClipType;
+ int _vol;
+ int _volAsPercentage;
+ int _volModifier;
int _panning;
int _panningAsPercentage;
- void *_sourceClip; // Pointer to source object that spawned the clip
- int _sourceClipType;
- int _speed;
int _xSource, _ySource; // Used for positioning sounds in game rooms
int _maximumPossibleDistanceAway;
- int _priority;
- bool _muted;
- int _volAsPercentage;
- int _vol;
- int _volModifier;
+ int _directionalVolModifier;
bool _repeat;
+ void *_sourceClip; // Pointer to source object that spawned the clip
- SOUNDCLIP();
- virtual ~SOUNDCLIP();
-
- virtual void destroy() {}
- virtual int play() = 0;
- virtual void stop() = 0;
- virtual void pause() = 0;
- virtual void resume() = 0;
- virtual bool is_playing() const = 0;
+ virtual void poll() = 0;
+ virtual void destroy() = 0;
+ // apply volume directly to playback; volume is given in units of 255
+ // NOTE: this completely ignores volAsPercentage and muted property
+ virtual void set_volume(int volume) = 0;
virtual void seek(int offset) = 0;
- virtual int get_pos() = 0;
- virtual int get_pos_ms() = 0;
+ virtual int get_pos() = 0; // return 0 to indicate seek not supported
+ virtual int get_pos_ms() = 0; // this must always return valid value if poss
virtual int get_length_ms() = 0; // return total track length in ms (or 0)
virtual int get_sound_type() const = 0;
- virtual void set_volume(int volume) = 0;
+ virtual int play() = 0;
+ virtual int play_from(int position) = 0;
+
virtual void set_panning(int newPanning) = 0;
- inline int get_speed() const { return _speed; }
- virtual void set_speed(int new_speed);
+ virtual void set_speed(int new_speed) = 0;
- void poll();
+ virtual void pause() = 0;
+ virtual void resume() = 0;
+
+ virtual bool is_playing() const = 0; // true if playing or paused. false if never played or stopped.
+
+ inline int get_speed() const {
+ return _speed;
+ }
// Gets clip's volume property, as percentage (0 - 100);
// note this may not be the real volume of playback (which could e.g. be muted)
@@ -90,23 +91,16 @@ struct SOUNDCLIP {
return _volAsPercentage;
}
+ inline bool is_muted() const {
+ return _muted;
+ }
+
// Sets the current volume property, as percentage (0 - 100).
inline void set_volume_percent(int volume) {
_volAsPercentage = volume;
if (!_muted)
set_volume((volume * 255) / 100);
}
- void adjust_volume();
- int play_from(int position);
-
- /**
- * Apply permanent directional volume modifier, in absolute units (0 - 255)
- * this is distinct value that is used in conjunction with current volume
- * (can be both positive and negative).
- */
- inline void apply_directional_modifier(int mod) {
- warning("TODO: SOUNDCLIP::apply_directional_modifier");
- }
/**
* Explicitly defines both percentage and absolute volume value,
@@ -138,54 +132,49 @@ struct SOUNDCLIP {
adjust_volume();
}
- /*
- inline bool is_playing() const {
- return state_ == SoundClipPlaying || state_ == SoundClipPaused;
- }
-
- inline bool is_muted() const {
- return muted;
+ /**
+ * Apply permanent directional volume modifier, in absolute units (0 - 255)
+ * this is distinct value that is used in conjunction with current volume
+ * (can be both positive and negative).
+ */
+ inline void apply_directional_modifier(int mod) {
+ _directionalVolModifier = mod;
+ adjust_volume();
}
virtual void adjust_volume() = 0;
SOUNDCLIP();
- virtual ~SOUNDCLIP();
-
+ virtual ~SOUNDCLIP() {}
protected:
-
- SoundClipState state_;
-
// mute mode overrides the volume; if set, any volume assigned is stored
// in properties, but not applied to playback itself
- bool muted;
+ bool _muted;
// speed of playback, in clip ms per real second
- int speed;
-
- // Return the allegro voice number (or -1 if none)
- // Used by generic pause/resume functions.
- virtual int get_voice() = 0;
+ int _speed;
// helper function for calculating volume with applied modifiers
inline int get_final_volume() const {
- int final_vol = vol + volModifier + directionalVolModifier;
+ int final_vol = _vol + _volModifier + _directionalVolModifier;
return final_vol >= 0 ? final_vol : 0;
}
- */
};
struct SoundClipWaveBase : public SOUNDCLIP {
+ Audio::Mixer *_mixer;
Audio::AudioStream *_stream;
Audio::SoundHandle _soundHandle;
+ SoundClipState _state;
SoundClipWaveBase(Audio::AudioStream *stream, int volume, bool repeat = false);
- ~SoundClipWaveBase() override {}
+ ~SoundClipWaveBase() override { destroy(); }
void destroy() override;
+ void poll() override;
int play() override;
- void stop() override;
+ int play_from(int position) override;
void pause() override;
void resume() override;
bool is_playing() const override;
@@ -195,6 +184,8 @@ struct SoundClipWaveBase : public SOUNDCLIP {
int get_length_ms() override;
void set_volume(int volume) override;
void set_panning(int newPanning) override;
+ void set_speed(int new_speed) override;
+ void adjust_volume() override;
};
template<int SOUND_TYPE>
More information about the Scummvm-git-logs
mailing list