Drop the HRTF source and cache options

The kernel renders the Rosella .personalized_headphone model or an already
compiled .jochrtf field, and only the first is a user-facing input: the SOFA
reader and its compile cache left the library. joc-hrtf-source, joc-hrtf-cache
and joc-hrtf-cache-dir go with them, and the default file is now
binaural.personalized_headphone only.

The plugin sets personalized_headphone_path directly, and the disk-cache retry
path disappears with the cache itself. The headers in third_party/joc/include
and fork/files/audio/decode follow the new kernel, so the config structs no
longer carry hrtf_sofa_path, hrtf_cache_policy, hrtf_cache_dir or hrtf_radius_m,
and the rosella filterbank no longer needs its SOFA exception.

The example config and the option tables in both READMEs drop the removed keys.
Builds against the kernel with tools/build.ps1 -JocCoreSource.
This commit is contained in:
TheM14 committed 2026-11-01 19:38:41 +08:00
1 parent 0b94c75fd6
commit 19b4a49407
12 files changed
+25 -160

No files matched your search

+2 -5
View File
@@ -66,7 +66,7 @@ then `<plugin dir>\\joc_core.dll`, then `<plugin dir>\\..\\joc_core.dll`, then `
Add to `mpv.conf`: Add to `mpv.conf`:
```ini ```ini
script-opts=joc-output=binaural,joc-hrtf-source=sofa script-opts=joc-output=binaural
``` ```
Or load it explicitly: Or load it explicitly:
@@ -85,8 +85,7 @@ ignored and reported in `joc_decoder.log`.
| `joc-enabled` | yes / no | yes | disable the plugin entirely | | `joc-enabled` | yes / no | yes | disable the plugin entirely |
| `joc-output` | binaural / speaker | binaural | output form | | `joc-output` | binaural / speaker | binaural | output form |
| `joc-layout` | 2.0 3.1 4.0 5.1 7.1 5.1.2 5.1.4 7.1.2 7.1.4 9.1.4 9.1.6 | 7.1 | speaker layout; used only with `speaker` | | `joc-layout` | 2.0 3.1 4.0 5.1 7.1 5.1.2 5.1.4 7.1.2 7.1.4 9.1.4 9.1.6 | 7.1 | speaker layout; used only with `speaker` |
| `joc-hrtf-source` | sofa / rosella | sofa | binaural HRTF input | | `joc-rosella-filterbank` | 1 / 2 (or public / captured) | 1 | Rosella filterbank: 1 = the public 13-tap / 6-slot bank, 2 = the captured 11-tap / 3-slot bank that matches the reference renderer |
| `joc-rosella-filterbank` | 1 / 2 (or public / captured) | 1 | Rosella filterbank: 1 = the public 13-tap / 6-slot bank, 2 = the captured 11-tap / 3-slot bank that matches the reference renderer; only read with `joc-hrtf-source=rosella` |
| `joc-hrtf` | path | empty | empty: default name under `<plugin>\\HRTF\\` or `<plugin>\\..\\HRTF\\` | | `joc-hrtf` | path | empty | empty: default name under `<plugin>\\HRTF\\` or `<plugin>\\..\\HRTF\\` |
| `joc-mode` | near / mid / far | mid | binaural mode | | `joc-mode` | near / mid / far | mid | binaural mode |
| `joc-gain-db` | float (dB) | 0 | render gain (binaural can exceed full scale) | | `joc-gain-db` | float (dB) | 0 | render gain (binaural can exceed full scale) |
@@ -100,8 +99,6 @@ ignored and reported in `joc_decoder.log`.
| `joc-exclusive` | yes / no | no | sets `audio-exclusive=yes` | | `joc-exclusive` | yes / no | no | sets `audio-exclusive=yes` |
| `joc-chunk` | seconds | 2.0 | audio bytes written per HTTP chunk | | `joc-chunk` | seconds | 2.0 | audio bytes written per HTTP chunk |
| `joc-mute-until-ready` | yes / no | yes | silence the file's own track until the rendered one is selected | | `joc-mute-until-ready` | yes / no | yes | silence the file's own track until the rendered one is selected |
| `joc-hrtf-cache` | auto / memory / disk / none | auto | compiled-HRTF cache; auto = `<mpv config dir>\\joc-hrtf-cache` |
| `joc-hrtf-cache-dir` | path | empty | explicit cache directory |
| `joc-attach` | yes / no | yes | no: serve the stream without adding the track (capture/verification) | | `joc-attach` | yes / no | yes | no: serve the stream without adding the track (capture/verification) |
| `joc-verbose` | yes / no | no | log every HTTP request and reposition | | `joc-verbose` | yes / no | no | log every HTTP request and reposition |
| `joc-log` | path | empty | log file; empty: `<mpv config dir>\\joc_decoder.log` | | `joc-log` | path | empty | log file; empty: `<mpv config dir>\\joc_decoder.log` |
+2 -5
View File
@@ -80,7 +80,7 @@ mpv-joc/
然后编辑 `mpv.conf`(同一目录): 然后编辑 `mpv.conf`(同一目录):
```ini ```ini
script-opts=joc-output=binaural,joc-hrtf-source=sofa script-opts=joc-output=binaural
``` ```
也可以显式加载: 也可以显式加载:
@@ -99,8 +99,7 @@ mpv --script="C:\\path\\to\\joc_mpv.dll" --script-opts=joc-output=speaker,joc-la
| `joc-enabled` | yes / no | yes | 关掉后插件完全不介入 | | `joc-enabled` | yes / no | yes | 关掉后插件完全不介入 |
| `joc-output` | binaural / speaker | binaural | 输出形式 | | `joc-output` | binaural / speaker | binaural | 输出形式 |
| `joc-layout` | 2.0 3.1 4.0 5.1 7.1 5.1.2 5.1.4 7.1.2 7.1.4 9.1.4 9.1.6 | 7.1 | 扬声器布局;仅 `speaker` 使用 | | `joc-layout` | 2.0 3.1 4.0 5.1 7.1 5.1.2 5.1.4 7.1.2 7.1.4 9.1.4 9.1.6 | 7.1 | 扬声器布局;仅 `speaker` 使用 |
| `joc-hrtf-source` | sofa / rosella | sofa | 双耳用哪种 HRTF 输入 | | `joc-rosella-filterbank` | 1 / 2(或 public / captured) | 1 | Rosella 滤波器组:1=13 taps/6 slots 的公开版,2=11 taps/3 slots 的捕获版(与参考渲染器一致) |
| `joc-rosella-filterbank` | 1 / 2(或 public / captured) | 1 | Rosella 滤波器组:1=13 taps/6 slots 的公开版,2=11 taps/3 slots 的捕获版(与参考渲染器一致);仅 `joc-hrtf-source=rosella` 使用 |
| `joc-hrtf` | 路径 | 空 | 空则用 `<插件目录>\\HRTF\\` 或 `<插件目录>\\..\\HRTF\\` 下的默认文件名 | | `joc-hrtf` | 路径 | 空 | 空则用 `<插件目录>\\HRTF\\` 或 `<插件目录>\\..\\HRTF\\` 下的默认文件名 |
| `joc-mode` | near / mid / far | mid | 双耳模式 | | `joc-mode` | near / mid / far | mid | 双耳模式 |
| `joc-gain-db` | 浮点(dB) | 0 | 渲染增益;双耳可能超过满刻度,需要时在这里衰减 | | `joc-gain-db` | 浮点(dB) | 0 | 渲染增益;双耳可能超过满刻度,需要时在这里衰减 |
@@ -114,8 +113,6 @@ mpv --script="C:\\path\\to\\joc_mpv.dll" --script-opts=joc-output=speaker,joc-la
| `joc-exclusive` | yes / no | no | 设置 `audio-exclusive=yes`(WASAPI 独占) | | `joc-exclusive` | yes / no | no | 设置 `audio-exclusive=yes`(WASAPI 独占) |
| `joc-chunk` | 秒 | 2.0 | 每次写入 mpv 的音频块大小(0.25–10) | | `joc-chunk` | 秒 | 2.0 | 每次写入 mpv 的音频块大小(0.25–10) |
| `joc-mute-until-ready` | yes / no | yes | 渲染轨就绪前先把文件自带音轨静音,片头不会先播一遍普通 bed | | `joc-mute-until-ready` | yes / no | yes | 渲染轨就绪前先把文件自带音轨静音,片头不会先播一遍普通 bed |
| `joc-hrtf-cache` | auto / memory / disk / none | auto | 编译后的 HRTF(`.jochrtf`)缓存位置;auto = `<mpv 配置目录>\\joc-hrtf-cache` |
| `joc-hrtf-cache-dir` | 路径 | 空 | 显式指定缓存目录 |
| `joc-attach` | yes / no | yes | no = 只提供音频端点、不向播放器加轨(抓取/验证用) | | `joc-attach` | yes / no | yes | no = 只提供音频端点、不向播放器加轨(抓取/验证用) |
| `joc-verbose` | yes / no | no | 在日志里记录每个 HTTP 请求与跳转 | | `joc-verbose` | yes / no | no | 在日志里记录每个 HTTP 请求与跳转 |
| `joc-log` | 路径 | 空 | 日志文件;空则写 `<mpv 配置目录>\\joc_decoder.log` | | `joc-log` | 路径 | 空 | 日志文件;空则写 `<mpv 配置目录>\\joc_decoder.log` |
+2 -3
View File
@@ -2,9 +2,9 @@
# #
# 所有键都在 mpv 自己的 --script-opts 命名空间里,前缀 joc-。 # 所有键都在 mpv 自己的 --script-opts 命名空间里,前缀 joc-。
# 只有一行也可以: # 只有一行也可以:
# script-opts=joc-output=binaural,joc-hrtf-source=sofa # script-opts=joc-output=binaural
# #
script-opts=joc-output=binaural,joc-hrtf-source=sofa,joc-mode=mid,joc-gain-db=0 script-opts=joc-output=binaural,joc-mode=mid,joc-gain-db=0
# 想让插件强制走 WASAPI(默认 auto:不动 mpv 的 ao 选择): # 想让插件强制走 WASAPI(默认 auto:不动 mpv 的 ao 选择):
# script-opts-append=joc-wasapi=yes # script-opts-append=joc-wasapi=yes
@@ -19,7 +19,6 @@ script-opts=joc-output=binaural,joc-hrtf-source=sofa,joc-mode=mid,joc-gain-db=0
# script-opts-append=joc-hrtf=D:/hrtf/MyMeasurements.sofa # script-opts-append=joc-hrtf=D:/hrtf/MyMeasurements.sofa
# #
# Rosella 模型用捕获版滤波器组(与参考渲染器一致;默认 1 = 公开版): # Rosella 模型用捕获版滤波器组(与参考渲染器一致;默认 1 = 公开版):
# script-opts-append=joc-hrtf-source=rosella
# script-opts-append=joc-rosella-filterbank=2 # script-opts-append=joc-rosella-filterbank=2
# #
# 交付 24bit 定点: # 交付 24bit 定点:
+3 -16
View File
@@ -358,14 +358,6 @@ typedef enum joc_clip_action {
JOC_CLIP_ABORT = 3 /* fail the task */ JOC_CLIP_ABORT = 3 /* fail the task */
} joc_clip_action; } joc_clip_action;
/* Compiled-HRTF cache policy for a SOFA input; the .jochrtf itself is an
* internal artifact of the compile step. */
typedef enum joc_hrtf_cache_policy {
JOC_HRTF_CACHE_NONE = 0, /* compile and discard */
JOC_HRTF_CACHE_MEMORY = 1, /* compile and keep in this process (default) */
JOC_HRTF_CACHE_DISK = 2 /* compile, reuse and write <cache_dir>/<name>.jochrtf */
} joc_hrtf_cache_policy;
/* Which 64-QMF / 77-hybrid filterbank the Rosella .personalized_headphone path /* Which 64-QMF / 77-hybrid filterbank the Rosella .personalized_headphone path
* renders through. The two banks differ in coefficients, hybrid tap count, * renders through. The two banks differ in coefficients, hybrid tap count,
* high-band slot delay and total latency, so they are not interchangeable; the * high-band slot delay and total latency, so they are not interchangeable; the
@@ -424,16 +416,11 @@ typedef struct joc_task_config {
joc_cancel_token* cancel; /* optional */ joc_cancel_token* cancel; /* optional */
/* Binaural HRTF input (config version 2): when hrtf_sofa_path is set the /* Binaural input (config version 2): a compiled .jochrtf field (hrtf_path)
* library compiles it with hrtf_cache_policy / hrtf_cache_dir / hrtf_radius_m * or a Rosella .personalized_headphone model. */
* and hrtf_path is unused. hrtf_path stays the advanced override that reads
* a .jochrtf directly. */
const char* hrtf_sofa_path; /* SOFA SimpleFreeFieldHRIR input */
const char* personalized_headphone_path; /* Rosella .personalized_headphone input */ const char* personalized_headphone_path; /* Rosella .personalized_headphone input */
const char* hrtf_cache_dir; /* disk policy directory */
uint32_t hrtf_cache_policy; /* joc_hrtf_cache_policy */
uint32_t rosella_filterbank; /* joc_rosella_filterbank; 0 = PUBLIC */ uint32_t rosella_filterbank; /* joc_rosella_filterbank; 0 = PUBLIC */
double hrtf_radius_m; /* SOFA measurement-radius shell */ uint32_t jochrtf_room; /* non-zero enables the project room */
} joc_task_config; } joc_task_config;
typedef enum joc_task_status { typedef enum joc_task_status {
+3 -9
View File
@@ -64,16 +64,10 @@ typedef struct joc_stream_config {
double gain_db; /* default 0 */ double gain_db; /* default 0 */
uint32_t native_threads; uint32_t native_threads;
uint32_t rosella_filterbank; /* joc_rosella_filterbank; Rosella input, 0 = PUBLIC */ uint32_t rosella_filterbank; /* joc_rosella_filterbank; Rosella input, 0 = PUBLIC */
/* Binaural HRTF input, the same three shapes joc_task_config accepts: when /* Binaural input, the same shapes joc_task_config accepts: a compiled
* hrtf_sofa_path is set the library compiles it with hrtf_cache_policy / * .jochrtf field (hrtf_path) or a Rosella .personalized_headphone model. */
* hrtf_cache_dir / hrtf_radius_m and hrtf_path is unused; when
* personalized_headphone_path is set the Rosella runtime renders instead.
* hrtf_path stays the fallback/advanced input that reads a .jochrtf directly. */
const char* hrtf_sofa_path; /* SOFA SimpleFreeFieldHRIR input */
const char* personalized_headphone_path; /* Rosella .personalized_headphone input */ const char* personalized_headphone_path; /* Rosella .personalized_headphone input */
const char* hrtf_cache_dir; /* disk cache directory for SOFA compilation */ uint32_t jochrtf_room; /* non-zero enables the project room */
uint32_t hrtf_cache_policy; /* joc_hrtf_cache_policy: 0 none, 1 memory, 2 disk */
double hrtf_radius_m; /* SOFA measurement-radius shell, default 1.0 */
} joc_stream_config; } joc_stream_config;
typedef struct joc_stream_buffer { typedef struct joc_stream_buffer {
+4 -49
View File
@@ -55,8 +55,7 @@ bool file_exists(const std::string& path) {
// The default HRTF lives next to the plugin, or one level up when the plugin // The default HRTF lives next to the plugin, or one level up when the plugin
// sits in <mpv>\scripts and the data in <mpv> itself. // sits in <mpv>\scripts and the data in <mpv> itself.
std::string default_hrtf_file(const joc_mpv::Config& config) { std::string default_hrtf_file(const joc_mpv::Config& config) {
const char* name = (config.hrtf_source == 0) ? "binaural.sofa" const char* name = "binaural.personalized_headphone";
: "binaural.personalized_headphone";
const std::string directory = plugin_directory(); const std::string directory = plugin_directory();
const std::string candidates[] = {directory + "\\HRTF\\" + name, const std::string candidates[] = {directory + "\\HRTF\\" + name,
directory + "\\..\\HRTF\\" + name}; directory + "\\..\\HRTF\\" + name};
@@ -315,16 +314,8 @@ struct Plugin {
settings.output = (config.output == 0) ? joc_decode::Output::kBinaural settings.output = (config.output == 0) ? joc_decode::Output::kBinaural
: joc_decode::Output::kSpeaker; : joc_decode::Output::kSpeaker;
settings.speaker_layout = config.layout; settings.speaker_layout = config.layout;
settings.hrtf_source = (config.hrtf_source == 0) ? joc_decode::HrtfSource::kSofa
: joc_decode::HrtfSource::kRosella;
settings.rosella_filterbank = settings.rosella_filterbank =
static_cast<std::uint32_t>(config.rosella_filterbank); static_cast<std::uint32_t>(config.rosella_filterbank);
if (config.rosella_filterbank != 0 &&
settings.hrtf_source != joc_decode::HrtfSource::kRosella) {
joc_log::line("config: joc-rosella-filterbank=%d ignored: it applies to "
"joc-hrtf-source=rosella only",
config.rosella_filterbank);
}
settings.hrtf_file = config.hrtf_file; settings.hrtf_file = config.hrtf_file;
if (settings.hrtf_file.empty() && settings.output == joc_decode::Output::kBinaural) { if (settings.hrtf_file.empty() && settings.output == joc_decode::Output::kBinaural) {
settings.hrtf_file = default_hrtf_file(config); settings.hrtf_file = default_hrtf_file(config);
@@ -337,31 +328,6 @@ struct Plugin {
settings.native_threads = config.native_threads; settings.native_threads = config.native_threads;
settings.ffmpeg_path = config.ffmpeg; settings.ffmpeg_path = config.ffmpeg;
settings.core_path = config.core_dll; settings.core_path = config.core_dll;
// The compiled SOFA field is the dominant part of the startup cost;
// keeping it on disk makes every later file (and every seek restart-free
// start) skip that work.
if (config.verbose) {
joc_log::line("config: hrtf-cache=%s dir=%s", config.hrtf_cache.c_str(),
config.hrtf_cache_dir.c_str());
}
if (config.hrtf_cache == "none") {
settings.hrtf_cache_policy = 0;
} else if (config.hrtf_cache == "memory") {
settings.hrtf_cache_policy = 1;
} else {
// disk and auto: the config directory is the natural place for a
// cache; without one the renderer compiles in memory as before.
std::string directory = config.hrtf_cache_dir;
if (directory.empty() && !config_dir.empty()) {
directory = config_dir + "\\joc-hrtf-cache";
}
if (!directory.empty()) {
settings.hrtf_cache_policy = 2;
settings.hrtf_cache_dir = directory;
} else {
settings.hrtf_cache_policy = 1;
}
}
settings.pipeline_delay_samples = joc_decode::kJocSeekPipelineDelaySamples; settings.pipeline_delay_samples = joc_decode::kJocSeekPipelineDelaySamples;
settings.seek_preroll_frames = joc_decode::kJocSeekPrerollFrames; settings.seek_preroll_frames = joc_decode::kJocSeekPrerollFrames;
@@ -385,20 +351,9 @@ struct Plugin {
auto source = std::make_shared<joc_mpv::Source>(); auto source = std::make_shared<joc_mpv::Source>();
std::string error; std::string error;
if (!source->open(path, settings, duration, &error)) { if (!source->open(path, settings, duration, &error)) {
// A disk cache that cannot be used must not cost playback: retry the joc_log::line("start: renderer failed for %s: %s", path.c_str(), error.c_str());
// way this worked before the cache existed. osd(mpv, "JOC: " + error);
if (settings.hrtf_cache_policy == 2) { return false;
joc_log::line("prepare: disk HRTF cache unusable (%s); retrying in memory",
error.c_str());
settings.hrtf_cache_policy = 1;
settings.hrtf_cache_dir.clear();
error.clear();
}
if (!source->open(path, settings, duration, &error)) {
joc_log::line("start: renderer failed for %s: %s", path.c_str(), error.c_str());
osd(mpv, "JOC: " + error);
return false;
}
} }
auto created = std::make_shared<Stream>(); auto created = std::make_shared<Stream>();
+3 -14
View File
@@ -497,9 +497,7 @@ std::string resolve_hrtf_file(const Settings& settings) {
if (directory.empty()) return {}; if (directory.empty()) return {};
// Same convention as the reference CLI next to its executable: // Same convention as the reference CLI next to its executable:
// <base>\HRTF\binaural.sofa or <base>\HRTF\binaural.personalized_headphone. // <base>\HRTF\binaural.sofa or <base>\HRTF\binaural.personalized_headphone.
const char* name = (settings.hrtf_source == HrtfSource::kRosella) const char* name = "binaural.personalized_headphone";
? "binaural.personalized_headphone"
: "binaural.sofa";
return directory + "\\HRTF\\" + name; return directory + "\\HRTF\\" + name;
} }
@@ -1053,16 +1051,8 @@ bool Engine::start(const std::string& input_path, const Settings& settings, std:
} }
return false; return false;
} }
if (settings.hrtf_source == HrtfSource::kRosella) { config.personalized_headphone_path = hrtf_file.c_str();
config.personalized_headphone_path = hrtf_file.c_str();
} else {
config.hrtf_sofa_path = hrtf_file.c_str();
}
} }
config.hrtf_cache_policy = settings.hrtf_cache_policy;
config.hrtf_cache_dir =
settings.hrtf_cache_dir.empty() ? nullptr : settings.hrtf_cache_dir.c_str();
config.hrtf_radius_m = settings.hrtf_radius_m;
config.binaural_tail_seconds = settings.tail_seconds; config.binaural_tail_seconds = settings.tail_seconds;
config.object_delay_samples = settings.object_delay_samples; config.object_delay_samples = settings.object_delay_samples;
config.gain_db = settings.gain_db; config.gain_db = settings.gain_db;
@@ -1089,8 +1079,7 @@ bool Engine::start(const std::string& input_path, const Settings& settings, std:
joc_log::line("core: stream created, %u output channel(s), layout=%s, hrtf=%s", impl.channels, joc_log::line("core: stream created, %u output channel(s), layout=%s, hrtf=%s", impl.channels,
settings.speaker_layout.c_str(), settings.speaker_layout.c_str(),
hrtf_in_use.empty() ? "(none)" : hrtf_in_use.c_str()); hrtf_in_use.empty() ? "(none)" : hrtf_in_use.c_str());
if (settings.output == Output::kBinaural && if (settings.output == Output::kBinaural) {
settings.hrtf_source == HrtfSource::kRosella) {
joc_log::line("core: rosella filterbank=%s", joc_log::line("core: rosella filterbank=%s",
settings.rosella_filterbank == 2u ? "captured" : "public"); settings.rosella_filterbank == 2u ? "captured" : "public");
} }
-11
View File
@@ -44,13 +44,6 @@ enum class Output {
kSpeaker = 1, // N channels, named layout kSpeaker = 1, // N channels, named layout
}; };
// Which HRTF to render with. Both inputs are user-facing model/data files; how
// the renderer gets from them to its internal filter field is its own business.
enum class HrtfSource {
kSofa = 0,
kRosella = 1,
};
// Where the E-AC-3 syncframes come from. A bare stream is read straight from the // Where the E-AC-3 syncframes come from. A bare stream is read straight from the
// file; inside a container the track has to be extracted first (ffmpeg, stream copy). // file; inside a container the track has to be extracted first (ffmpeg, stream copy).
enum class InputKind { enum class InputKind {
@@ -64,15 +57,11 @@ struct Settings {
// Which of the container's audio tracks holds the E-AC-3 stream, 0-based. // Which of the container's audio tracks holds the E-AC-3 stream, 0-based.
unsigned audio_index = 0; unsigned audio_index = 0;
std::string speaker_layout = "7.1"; std::string speaker_layout = "7.1";
HrtfSource hrtf_source = HrtfSource::kSofa;
// Filterbank of the Rosella path: 0 = the renderer's default (public bank), // Filterbank of the Rosella path: 0 = the renderer's default (public bank),
// 2 = the captured bank. Only the Rosella input reads it. // 2 = the captured bank. Only the Rosella input reads it.
std::uint32_t rosella_filterbank = 0; std::uint32_t rosella_filterbank = 0;
// Empty means the default file in the default folder, see resolve_hrtf_file(). // Empty means the default file in the default folder, see resolve_hrtf_file().
std::string hrtf_file; std::string hrtf_file;
std::string hrtf_cache_dir; // SOFA compile cache (disk policy)
unsigned hrtf_cache_policy = 1; // 0 none, 1 memory, 2 disk
double hrtf_radius_m = 1.0; // SOFA measurement-radius shell
std::uint32_t binaural_mode = 3; // JOC_BINAURAL_MID std::uint32_t binaural_mode = 3; // JOC_BINAURAL_MID
double gain_db = 0.0; double gain_db = 0.0;
double tail_seconds = 5.0; double tail_seconds = 5.0;
-16
View File
@@ -83,14 +83,6 @@ Config parse_config(const std::string& script_opts, std::string* warnings) {
} else { } else {
unsupported(key + "=" + value); unsupported(key + "=" + value);
} }
} else if (key == "joc-hrtf-source") {
if (value == "sofa") {
config.hrtf_source = 0;
} else if (value == "rosella" || value == "personalized") {
config.hrtf_source = 1;
} else {
unsupported(key + "=" + value);
}
} else if (key == "joc-rosella-filterbank") { } else if (key == "joc-rosella-filterbank") {
if (value == "1" || value == "public") { if (value == "1" || value == "public") {
config.rosella_filterbank = 1; config.rosella_filterbank = 1;
@@ -133,14 +125,6 @@ Config parse_config(const std::string& script_opts, std::string* warnings) {
config.log_path = value; config.log_path = value;
} else if (key == "joc-mute-until-ready") { } else if (key == "joc-mute-until-ready") {
config.mute_until_ready = truthy(value); config.mute_until_ready = truthy(value);
} else if (key == "joc-hrtf-cache") {
if (value == "auto" || value == "memory" || value == "disk" || value == "none") {
config.hrtf_cache = value;
} else {
unsupported(key + "=" + value);
}
} else if (key == "joc-hrtf-cache-dir") {
config.hrtf_cache_dir = value;
} else if (key == "joc-chunk") { } else if (key == "joc-chunk") {
const double seconds = std::atof(value.c_str()); const double seconds = std::atof(value.c_str());
config.chunk_seconds = (seconds >= 0.25 && seconds <= 10.0) ? seconds : 2.0; config.chunk_seconds = (seconds >= 0.25 && seconds <= 10.0) ? seconds : 2.0;
-7
View File
@@ -11,10 +11,7 @@ struct Config {
// 0 = binaural (2 channels), 1 = speaker layout (N channels). // 0 = binaural (2 channels), 1 = speaker layout (N channels).
int output = 0; int output = 0;
std::string layout = "7.1"; std::string layout = "7.1";
// 0 = SOFA, 1 = Rosella personalized headphone model.
int hrtf_source = 0;
// Rosella filterbank: 0 = the renderer's default (public bank), 2 = captured. // Rosella filterbank: 0 = the renderer's default (public bank), 2 = captured.
// Only the Rosella input reads it; the SOFA and .jochrtf paths ignore it.
int rosella_filterbank = 0; int rosella_filterbank = 0;
std::string hrtf_file; // empty: <plugin dir>\\HRTF\\binaural.<ext> std::string hrtf_file; // empty: <plugin dir>\\HRTF\\binaural.<ext>
// 1 = near, 2 = far, 3 = mid (the renderer's own default). // 1 = near, 2 = far, 3 = mid (the renderer's own default).
@@ -37,10 +34,6 @@ struct Config {
// the opening moments are not the plain bed. Only candidate inputs are // the opening moments are not the plain bed. Only candidate inputs are
// muted, and only for as long as the probe takes. // muted, and only for as long as the probe takes.
bool mute_until_ready = true; bool mute_until_ready = true;
// SOFA compilation cache: auto (disk under the mpv config directory, memory
// if that is unavailable), memory, disk, none.
std::string hrtf_cache = "auto";
std::string hrtf_cache_dir;
// Log file path; empty means <mpv config dir>\joc_decoder.log. // Log file path; empty means <mpv config dir>\joc_decoder.log.
std::string log_path; std::string log_path;
// Samples requested per HTTP response, in seconds of audio. A bounded // Samples requested per HTTP response, in seconds of audio. A bounded
+3 -16
View File
@@ -358,14 +358,6 @@ typedef enum joc_clip_action {
JOC_CLIP_ABORT = 3 /* fail the task */ JOC_CLIP_ABORT = 3 /* fail the task */
} joc_clip_action; } joc_clip_action;
/* Compiled-HRTF cache policy for a SOFA input; the .jochrtf itself is an
* internal artifact of the compile step. */
typedef enum joc_hrtf_cache_policy {
JOC_HRTF_CACHE_NONE = 0, /* compile and discard */
JOC_HRTF_CACHE_MEMORY = 1, /* compile and keep in this process (default) */
JOC_HRTF_CACHE_DISK = 2 /* compile, reuse and write <cache_dir>/<name>.jochrtf */
} joc_hrtf_cache_policy;
/* Which 64-QMF / 77-hybrid filterbank the Rosella .personalized_headphone path /* Which 64-QMF / 77-hybrid filterbank the Rosella .personalized_headphone path
* renders through. The two banks differ in coefficients, hybrid tap count, * renders through. The two banks differ in coefficients, hybrid tap count,
* high-band slot delay and total latency, so they are not interchangeable; the * high-band slot delay and total latency, so they are not interchangeable; the
@@ -424,16 +416,11 @@ typedef struct joc_task_config {
joc_cancel_token* cancel; /* optional */ joc_cancel_token* cancel; /* optional */
/* Binaural HRTF input (config version 2): when hrtf_sofa_path is set the /* Binaural input (config version 2): a compiled .jochrtf field (hrtf_path)
* library compiles it with hrtf_cache_policy / hrtf_cache_dir / hrtf_radius_m * or a Rosella .personalized_headphone model. */
* and hrtf_path is unused. hrtf_path stays the advanced override that reads
* a .jochrtf directly. */
const char* hrtf_sofa_path; /* SOFA SimpleFreeFieldHRIR input */
const char* personalized_headphone_path; /* Rosella .personalized_headphone input */ const char* personalized_headphone_path; /* Rosella .personalized_headphone input */
const char* hrtf_cache_dir; /* disk policy directory */
uint32_t hrtf_cache_policy; /* joc_hrtf_cache_policy */
uint32_t rosella_filterbank; /* joc_rosella_filterbank; 0 = PUBLIC */ uint32_t rosella_filterbank; /* joc_rosella_filterbank; 0 = PUBLIC */
double hrtf_radius_m; /* SOFA measurement-radius shell */ uint32_t jochrtf_room; /* non-zero enables the project room */
} joc_task_config; } joc_task_config;
typedef enum joc_task_status { typedef enum joc_task_status {
+3 -9
View File
@@ -64,16 +64,10 @@ typedef struct joc_stream_config {
double gain_db; /* default 0 */ double gain_db; /* default 0 */
uint32_t native_threads; uint32_t native_threads;
uint32_t rosella_filterbank; /* joc_rosella_filterbank; Rosella input, 0 = PUBLIC */ uint32_t rosella_filterbank; /* joc_rosella_filterbank; Rosella input, 0 = PUBLIC */
/* Binaural HRTF input, the same three shapes joc_task_config accepts: when /* Binaural input, the same shapes joc_task_config accepts: a compiled
* hrtf_sofa_path is set the library compiles it with hrtf_cache_policy / * .jochrtf field (hrtf_path) or a Rosella .personalized_headphone model. */
* hrtf_cache_dir / hrtf_radius_m and hrtf_path is unused; when
* personalized_headphone_path is set the Rosella runtime renders instead.
* hrtf_path stays the fallback/advanced input that reads a .jochrtf directly. */
const char* hrtf_sofa_path; /* SOFA SimpleFreeFieldHRIR input */
const char* personalized_headphone_path; /* Rosella .personalized_headphone input */ const char* personalized_headphone_path; /* Rosella .personalized_headphone input */
const char* hrtf_cache_dir; /* disk cache directory for SOFA compilation */ uint32_t jochrtf_room; /* non-zero enables the project room */
uint32_t hrtf_cache_policy; /* joc_hrtf_cache_policy: 0 none, 1 memory, 2 disk */
double hrtf_radius_m; /* SOFA measurement-radius shell, default 1.0 */
} joc_stream_config; } joc_stream_config;
typedef struct joc_stream_buffer { typedef struct joc_stream_buffer {