- modules/Screen_Record/audio_source.jai: WASAPI, in loopback from the default output device (what the computer plays) and from the default input device (the microphone), asked for as 48 kHz stereo float, which Windows converts any device to; a device that will not convert is taken as it is when it gives 48 kHz float. Packets carry the time they were heard. A device lost (unplugged, default changed) is opened again from the new default once a second. - An audio thread mixes them onto the video's own timeline: the same time 0, less the same pauses (record_pause now keeps one account of time paused for both threads). A packet within 30 ms of where its source left off follows on exactly; a source that sends nothing is silence, passed 200 ms late. Each 1024 samples every source has covered become an AAC frame. - encoder.jai: an AAC stream (FFmpeg's aac, 160 kb/s) beside the video, written from the audio thread; both threads' packets meet in the file under a lock. The remux keeps it. - [video] system_audio (true) and microphone (false). capture.json: Audio, AudioSources. A toast when a source asked for could not be opened. - record-probe: -audio system|mic|both, the sound read back (length, level), and -sync-test, which flashes a white square and beeps together every 2 s, then finds both in the file. - Measured: 20 s, beeps 0-21 ms from their flashes, no drift; both sources mixed, 5-18 ms; a 6 s pause cuts the same 6 s from sound and video; 3 min, 85 of 90 beeps within 3-24 ms and -14 ms from first to last, with 5 outliers (53-147 ms) where two beeps went missing. Tests: an MP4 with sound keeps its AAC stream through the remux into the library (30 checks).
52 lines
1.6 KiB
Plaintext
52 lines
1.6 KiB
Plaintext
// Type-checks src/App.jai for another OS without producing or linking a binary, to catch errors
|
|
// in code your machine does not build:
|
|
//
|
|
// jai check_targets.jai - linux (from any OS)
|
|
// jai check_targets.jai - macos (from a Mac only: the Objective_C module runs code at compile time)
|
|
//
|
|
// The constants below stand in for the ones first.jai generates; keep their names in step.
|
|
#run,stallable {
|
|
set_build_options_dc(.{do_output = false});
|
|
args := get_build_options().compile_time_command_line;
|
|
target := Operating_System_Tag.LINUX;
|
|
cpu := CPU_Tag.X64;
|
|
if array_find(args, "macos") { target = .MACOS; cpu = .ARM64; }
|
|
|
|
options := get_build_options();
|
|
options.os_target = target;
|
|
options.cpu_target = cpu;
|
|
options.output_type = .NO_OUTPUT;
|
|
options.backend = .LLVM;
|
|
options.output_executable_name = "check";
|
|
options.output_path = ".build";
|
|
|
|
w := compiler_create_workspace("check");
|
|
set_build_options(options, w);
|
|
compiler_begin_intercept(w);
|
|
add_build_file("src/App.jai", w);
|
|
add_build_string(#string S
|
|
APP_NAME :: "mcap";
|
|
APP_FOLDER_NAME :: "mcap";
|
|
GIT_BRANCH :: "check";
|
|
GIT_HASH :: "-";
|
|
VERSION :: "0.1.8";
|
|
BUILD_DATE :: "-";
|
|
DEBUG :: true;
|
|
COMPILE_TESTS :: true;
|
|
COMPILE_ARGS :: "";
|
|
NO_CRASH_DIALOG :: false;
|
|
S, w);
|
|
while true {
|
|
message := compiler_wait_for_message();
|
|
if message.kind == .COMPLETE {
|
|
m := cast(*Message_Complete) message;
|
|
log("% check: %", target, m.error_code);
|
|
break;
|
|
}
|
|
}
|
|
compiler_end_intercept(w);
|
|
}
|
|
|
|
#import "Basic";
|
|
#import "Compiler";
|