Skip to content

Commit 46a6cd0

Browse files
Merge branch 'develop'
2 parents 667dcd2 + 3574e55 commit 46a6cd0

12 files changed

+11533
-87
lines changed

README.md

+3
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ By popular demand there now is a web based configuration editor. Gone are the da
168168
"stereoBass": true,
169169
"expandSurround": true,
170170
"lfeGain": -3,
171+
"centerGain": 3,
171172
"lowPass": {
172173
"type": "BUTTERWORTH",
173174
"order": 5,
@@ -275,6 +276,8 @@ By popular demand there now is a web based configuration editor. Gone are the da
275276
* lfeGain: Gain offset for mixing the LFE signal with other channels.
276277
* Default value: 0
277278
* Works with both subwoofers and front speakers.
279+
* centerGain: Gain offset for mixing the center signal with other channels.
280+
* Default value: 0
278281
* lowPass: Filter configuration for low pass filter. Is applied to Sub channels.
279282
* Default value: Butterworth 80Hz 5order(30dB/oct)
280283
* highPass: Filter configuration for high pass filter. Is applied to Small channels.

lib/ConfigEditor/package-lock.json

+11,441-25
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/ConfigEditor/pom.xml

+6-7
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
43
<modelVersion>4.0.0</modelVersion>
54
<groupId>com.github.andreasarvidsson</groupId>
65
<artifactId>windsp-config-editor</artifactId>
7-
<version>1.0.0-SNAPSHOT</version>
6+
<version>1.0.0</version>
87
<packaging>war</packaging>
98
<name>WinDSP-configEditor</name>
109

@@ -46,10 +45,10 @@
4645
</execution>
4746
</executions>
4847
<configuration>
49-
<finalName>${project.name}</finalName>
48+
<finalName>${project.name}</finalName>
5049
</configuration>
5150
</plugin>
52-
51+
5352
<!-- Run npm -->
5453
<plugin>
5554
<groupId>org.codehaus.mojo</groupId>
@@ -73,7 +72,7 @@
7372
</execution>
7473
</executions>
7574
</plugin>
76-
75+
7776
</plugins>
7877
</build>
7978

@@ -84,6 +83,6 @@
8483
<version>8.0</version>
8584
<scope>provided</scope>
8685
</dependency>
87-
86+
8887
</dependencies>
8988
</project>
+49-34
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,58 @@
1-
21
import React from "react";
32
import PropTypes from "prop-types";
43
import InputBase from "./InputBase";
54

65
export default class Dropdown extends InputBase {
6+
static propTypes = {
7+
json: PropTypes.object.isRequired,
8+
field: PropTypes.string.isRequired,
9+
label: PropTypes.string.isRequired,
10+
values: PropTypes.array.isRequired,
11+
onChange: PropTypes.func,
12+
disabled: PropTypes.bool,
13+
};
714

8-
static propTypes = {
9-
json: PropTypes.object.isRequired,
10-
field: PropTypes.string.isRequired,
11-
label: PropTypes.string.isRequired,
12-
values: PropTypes.array.isRequired,
13-
onChange: PropTypes.func,
14-
disabled: PropTypes.bool
15-
};
16-
17-
getInput = () => {
18-
return (
19-
<select
20-
id={this.uuid}
21-
className="custom-select"
22-
disabled={this.props.disabled}
23-
value={this.state.value}
24-
onChange={e => this.onChange(e.target.value)}
25-
>
26-
{this.state.value === undefined && this.getMissingOption()}
27-
{this.props.values.map(this.getOption)}
28-
</select>
29-
);
30-
}
15+
getInput = () => {
16+
return (
17+
<select
18+
id={this.uuid}
19+
className="custom-select"
20+
disabled={this.props.disabled}
21+
value={this.state.value}
22+
onChange={(e) => {
23+
// `e.target.value` is always a string. Find actual value.
24+
const value = this.props.values
25+
.map((v) => parseValue(v).value)
26+
.find((v) => v == e.target.value);
27+
this.onChange(value);
28+
}}
29+
>
30+
{this.state.value === undefined && this.getMissingOption()}
31+
{this.props.values.map(this.getOption)}
32+
</select>
33+
);
34+
};
3135

32-
getMissingOption() {
33-
return <option key={undefined} value={undefined}>Select value</option>;
34-
}
36+
getMissingOption() {
37+
return (
38+
<option key={undefined} value={undefined}>
39+
Select value
40+
</option>
41+
);
42+
}
3543

36-
getOption(v) {
37-
if (typeof v === "object") {
38-
return <option key={v.value} value={v.value}>{v.text}</option>;
39-
}
40-
return <option key={v} value={v}>{v}</option>;
41-
}
44+
getOption(v) {
45+
const { text, value } = parseValue(v);
46+
return (
47+
<option key={value} value={value}>
48+
{text}
49+
</option>
50+
);
51+
}
52+
}
4253

43-
}
54+
function parseValue(v) {
55+
return typeof v === "object"
56+
? { text: v.text, value: v.value }
57+
: { text: v, value: v };
58+
}

lib/ConfigEditor/srcWeb/routing/BasicRouting.js

+1
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ const BasicRouting = ({ jsonContext }) => {
7777
<Dropdown json={json} field="surround" label="Surround" values={values4} onChange={onChange} />
7878
<Dropdown json={json} field="surroundBack" label="Surround back" values={values4} onChange={onChange} />
7979
<Number json={json} field="lfeGain" label="LFE gain" onChange={onChange} />
80+
<Number json={json} field="centerGain" label="Center gain" onChange={onChange} />
8081
<Checkbox
8182
json={json}
8283
field={stereoBassFields}

release/WinDSP-configEditor.jar

-23 Bytes
Binary file not shown.

release/WinDSP.exe

1 KB
Binary file not shown.

release/WinDSP.json

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"stereoBass": false,
1515
"expandSurround": false,
1616
"lfeGain": 0,
17+
"centerGain": 0,
1718
"lowPass": {
1819
"type": "BUTTERWORTH",
1920
"order": 5,

release/config_examples.json

+1
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@
7171
"stereoBass": true,
7272
"expandSurround": true,
7373
"lfeGain": -3,
74+
"centerGain": 3,
7475
"lowPass": {
7576
"type": "BUTTERWORTH",
7677
"order": 5,

src/Config.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -92,14 +92,14 @@ class Config {
9292
void parseChannel(unordered_map<Channel, SpeakerType>& result, const shared_ptr<JsonNode>& pNode, const string& field, const vector<Channel>& channels, const vector<SpeakerType>& allowed, const string& path) const;
9393
const vector<Channel> getChannelsByType(const unordered_map<Channel, SpeakerType>& channelsMap, const SpeakerType targetType) const;
9494
const double getLfeGain(const shared_ptr<JsonNode>& pBasicNode, const bool useSubwoofers, const bool hasSmalls, const string& path) const;
95-
void routeChannels(const unordered_map<Channel, SpeakerType>& channelsMap, const bool stereoBass, const vector<Channel> subs, const vector<Channel> subLs, const vector<Channel> subRs, const double lfeGain);
96-
void addBassRoute(Input& input, const bool stereoBass, const vector<Channel> subs, const vector<Channel> subLs, const vector<Channel> subRs, const double lfeGain) const;
95+
void routeChannels(const unordered_map<Channel, SpeakerType>& channelsMap, const bool stereoBass, const vector<Channel> subs, const vector<Channel> subLs, const vector<Channel> subRs, const double lfeGain, const double centerGain);
96+
void addBassRoute(Input& input, const bool stereoBass, const vector<Channel> subs, const vector<Channel> subLs, const vector<Channel> subRs, const double lfeGain, const double centerGain = 0) const;
9797
void addSwRoute(Input& input, const bool stereoBass, const vector<Channel> subs, const vector<Channel> subLs, const vector<Channel> subRs, const double gain) const;
9898
void addFrontBassRoute(Input& input, const bool stereoBass, const double gain) const;
9999
void addRoutes(Input& input, const vector<Channel> channels, const double gain) const;
100100
void addRoute(Input& input, const Channel channel, const double gain = 0, const bool addLP = false) const;
101101
const SpeakerType addRoute(const unordered_map<Channel, SpeakerType>& channelsMap, Input& input, const vector<Channel>& channels) const;
102-
void downmix(const unordered_map<Channel, SpeakerType>& channelsMap, Input& input, const bool stereoBass, const vector<Channel> subs, const vector<Channel> subLs, const vector<Channel> subRs, const double lfeGain) const;
102+
void downmix(const unordered_map<Channel, SpeakerType>& channelsMap, Input& input, const bool stereoBass, const vector<Channel> subs, const vector<Channel> subLs, const vector<Channel> subRs, const double lfeGain, const double centerGain) const;
103103
const bool getUseSubwoofers(const vector<Channel>& subs, const vector<Channel>& subLs, const vector<Channel>& subRs) const;
104104
void parseExpandSurround(const shared_ptr<JsonNode>& pBasicNode, const unordered_map<Channel, SpeakerType>& channelsMap, const string& path);
105105
void addIfRoute(Input& input, const Channel channel) const;

src/ConfigParserBasic.cpp

+27-17
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,12 @@ void Config::parseBasic() {
2727
const unordered_map<Channel, SpeakerType> channelsMap = parseChannels(pBasicNode, stereoBass, subs, subLs, subRs, smalls, path);
2828
const bool useSubwoofers = getUseSubwoofers(subs, subLs, subRs);
2929
const double lfeGain = getLfeGain(pBasicNode, useSubwoofers, smalls.size(), path);
30+
const double centerGain = tryGetDoubleValue(pBasicNode, "centerGain", path);
3031

3132
//Parse crossover config
3233
parseBasicCrossovers(pBasicNode, channelsMap, path);
3334
//Route input to output channels
34-
routeChannels(channelsMap, stereoBass, subs, subLs, subRs, lfeGain);
35+
routeChannels(channelsMap, stereoBass, subs, subLs, subRs, lfeGain, centerGain);
3536
//Add conditional routing to surrounds
3637
parseExpandSurround(pBasicNode, channelsMap, path);
3738
}
@@ -83,7 +84,7 @@ void Config::parseExpandSurround(const shared_ptr<JsonNode>& pBasicNode, const u
8384
}
8485
}
8586

86-
void Config::routeChannels(const unordered_map<Channel, SpeakerType>& channelsMap, const bool stereoBass, const vector<Channel> subs, const vector<Channel> subLs, const vector<Channel> subRs, const double lfeGain) {
87+
void Config::routeChannels(const unordered_map<Channel, SpeakerType>& channelsMap, const bool stereoBass, const vector<Channel> subs, const vector<Channel> subLs, const vector<Channel> subRs, const double lfeGain, const double centerGain) {
8788
for (size_t i = 0; i < _numChannelsIn; ++i) {
8889
const Channel channel = (Channel)i;
8990
Input input(channel);
@@ -100,15 +101,15 @@ void Config::routeChannels(const unordered_map<Channel, SpeakerType>& channelsMa
100101
break;
101102
//Downmix
102103
case SpeakerType::OFF:
103-
downmix(channelsMap, input, stereoBass, subs, subLs, subRs, lfeGain);
104+
downmix(channelsMap, input, stereoBass, subs, subLs, subRs, lfeGain, centerGain);
104105
break;
105106
//Sub or downmix
106107
case SpeakerType::SUB:
107108
if (channel == Channel::SW) {
108109
addSwRoute(input, stereoBass, subs, subLs, subRs, lfeGain);
109110
}
110111
else {
111-
downmix(channelsMap, input, stereoBass, subs, subLs, subRs, lfeGain);
112+
downmix(channelsMap, input, stereoBass, subs, subLs, subRs, lfeGain, centerGain);
112113
}
113114
break;
114115
default:
@@ -118,7 +119,7 @@ void Config::routeChannels(const unordered_map<Channel, SpeakerType>& channelsMa
118119
}
119120
}
120121

121-
void Config::downmix(const unordered_map<Channel, SpeakerType>& channelsMap, Input& input, const bool stereoBass, const vector<Channel> subs, const vector<Channel> subLs, const vector<Channel> subRs, const double lfeGain) const {
122+
void Config::downmix(const unordered_map<Channel, SpeakerType>& channelsMap, Input& input, const bool stereoBass, const vector<Channel> subs, const vector<Channel> subLs, const vector<Channel> subRs, const double lfeGain, const double centerGain) const {
122123
SpeakerType type = SpeakerType::OFF;
123124
switch (input.getChannel()) {
124125
case Channel::SL:
@@ -133,11 +134,13 @@ void Config::downmix(const unordered_map<Channel, SpeakerType>& channelsMap, Inp
133134
case Channel::SBR:
134135
type = addRoute(channelsMap, input, { Channel::SR , Channel::R });
135136
break;
136-
case Channel::C:
137-
addRoute(input, Channel::L, PHANTOM_CENTER_GAIN);
138-
addRoute(input, Channel::R, PHANTOM_CENTER_GAIN);
137+
case Channel::C: {
138+
const double gain = PHANTOM_CENTER_GAIN + centerGain;
139+
addRoute(input, Channel::L, gain);
140+
addRoute(input, Channel::R, gain);
139141
type = channelsMap.at(Channel::L);
140142
break;
143+
}
141144
case Channel::SW:
142145
type = SpeakerType::SMALL;
143146
break;
@@ -146,13 +149,22 @@ void Config::downmix(const unordered_map<Channel, SpeakerType>& channelsMap, Inp
146149
}
147150
//Downmixed a small speaker. Add to subs as well.
148151
if (type == SpeakerType::SMALL) {
149-
addBassRoute(input, stereoBass, subs, subLs, subRs, lfeGain);
152+
addBassRoute(input, stereoBass, subs, subLs, subRs, lfeGain, centerGain);
150153
}
151154
}
152155

153-
void Config::addBassRoute(Input& input, const bool stereoBass, const vector<Channel> subs, const vector<Channel> subLs, const vector<Channel> subRs, const double lfeGain) const {
154-
const Channel channel = input.getChannel();
155-
const double gain = (channel == Channel::SW ? lfeGain : 0);
156+
void Config::addBassRoute(Input& input, const bool stereoBass, const vector<Channel> subs, const vector<Channel> subLs, const vector<Channel> subRs, const double lfeGain, const double centerGain) const {
157+
double gain;
158+
switch (input.getChannel()) {
159+
case Channel::SW:
160+
gain = lfeGain;
161+
break;
162+
case Channel::C:
163+
gain = centerGain;
164+
break;
165+
default:
166+
gain = 0;
167+
}
156168
if (getUseSubwoofers(subs, subLs, subRs)) {
157169
addSwRoute(input, stereoBass, subs, subLs, subRs, gain);
158170
}
@@ -370,11 +382,9 @@ const vector<Channel> Config::getChannelsByType(const unordered_map<Channel, Spe
370382

371383
const double Config::getLfeGain(const shared_ptr<JsonNode>& pBasicNode, const bool useSubwoofers, const bool hasSmalls, const string& path) const {
372384
const double lfeGain = tryGetDoubleValue(pBasicNode, "lfeGain", path);
373-
if (useSubwoofers) {
374-
//Playing subwoofer and no small speakers. IE LFE is not going to get mixed with other channels.
375-
if (!hasSmalls) {
376-
return 0;
377-
}
385+
//Playing subwoofer and no small speakers. IE LFE is not going to get mixed with other channels.
386+
if (useSubwoofers && !hasSmalls) {
387+
return 0;
378388
}
379389
return lfeGain + LFE_GAIN;
380390
}

src/Main.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
using std::exception;
2525
using std::make_shared;
2626

27-
#define VERSION "0.22.0b"
27+
#define VERSION "1.0.0"
2828

2929
#ifdef DEBUG
3030
#include "MemoryManager.h"

0 commit comments

Comments
 (0)