Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/dosbox-staging/dosbox-staging.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Novak <john@johnovak.net>2022-06-02 15:14:25 +0300
committerJohn Novak <john@johnovak.net>2022-06-02 15:14:25 +0300
commit5ae8bd92bed77e6dd14e1c066af18f2d9f59a07a (patch)
tree0d86ece0ce3060e36ca825af3bd828b45334acfb
parent6f98d75bded8a52148dd48f2bcbbca714af9e024 (diff)
Implement CMS output filterjnovak/cms-filter
-rw-r--r--src/dosbox.cpp5
-rw-r--r--src/hardware/gameblaster.cpp19
-rw-r--r--src/hardware/gameblaster.h6
3 files changed, 26 insertions, 4 deletions
diff --git a/src/dosbox.cpp b/src/dosbox.cpp
index 95d7c3169..3244ce36d 100644
--- a/src/dosbox.cpp
+++ b/src/dosbox.cpp
@@ -812,6 +812,11 @@ void DOSBOX_Init() {
" Use the filter of this Sound Blaster model.\n"
" none: Don't filter the output.");
+ Pstring = secprop->Add_string("cms_filter", when_idle, "on");
+ Pstring->Set_help("Filter for the Sound Blaster CMS output:\n"
+ " on: Filter the output (default).\n"
+ " none: Don't filter the output.");
+
// Configure Gravis UltraSound emulation
GUS_AddConfigSection(control);
diff --git a/src/hardware/gameblaster.cpp b/src/hardware/gameblaster.cpp
index 69b5a271d..10537177d 100644
--- a/src/hardware/gameblaster.cpp
+++ b/src/hardware/gameblaster.cpp
@@ -25,7 +25,8 @@
#include "support.h"
#include "pic.h"
-void GameBlaster::Open(const int port_choice, const std::string_view card_choice)
+void GameBlaster::Open(const int port_choice, const std::string &card_choice,
+ const std::string &filter_choice)
{
Close();
assert(!is_open);
@@ -88,6 +89,18 @@ void GameBlaster::Open(const int port_choice, const std::string_view card_choice
ChannelFeature::ReverbSend,
ChannelFeature::ChorusSend});
+ if (filter_choice == "on") {
+ channel->ConfigureLowPassFilter(1, 6000);
+ channel->SetLowPassFilter(FilterState::On);
+ } else {
+ if (filter_choice != "off")
+ LOG_WARNING("%s: Invalid filter setting '%s', using off",
+ CardName(),
+ filter_choice.c_str());
+
+ channel->SetLowPassFilter(FilterState::Off);
+ }
+
channel->RegisterLevelCallBack(level_callback);
// Calculate rates and ratio based on the mixer's rate
@@ -290,7 +303,9 @@ GameBlaster gameblaster;
void CMS_Init(Section *configuration)
{
Section_prop *section = static_cast<Section_prop *>(configuration);
- gameblaster.Open(section->Get_hex("sbbase"), section->Get_string("sbtype"));
+ gameblaster.Open(section->Get_hex("sbbase"),
+ section->Get_string("sbtype"),
+ section->Get_string("cms_filter"));
}
void CMS_ShutDown([[maybe_unused]] Section* sec) {
gameblaster.Close();
diff --git a/src/hardware/gameblaster.h b/src/hardware/gameblaster.h
index 3d2462ed1..c64f90cce 100644
--- a/src/hardware/gameblaster.h
+++ b/src/hardware/gameblaster.h
@@ -26,7 +26,7 @@
#include <array>
#include <memory>
#include <queue>
-#include <string_view>
+#include <string>
#include <vector>
#include "inout.h"
@@ -40,7 +40,9 @@
class GameBlaster {
public:
- void Open(const int port_choice, const std::string_view card_choice);
+ void Open(const int port_choice, const std::string &card_choice,
+ const std::string &filter_choice);
+
void Close();
~GameBlaster() { Close(); }