Skip to content

Commit 3d6381b

Browse files
lmanganicursoragent
andcommitted
Fully disable debug UI unless MAGENTART_DEBUG_LOG is explicitly enabled.
Only define MAGENTART_DEBUG_LOG when the CMake option is ON, gate addDebugLog/writeDiskLog behind the preprocessor, remove the React debug overlay, and bump the ccache key so release builds recompile the AU host. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent e9abc45 commit 3d6381b

4 files changed

Lines changed: 9 additions & 38 deletions

File tree

.github/actions/setup-build/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ runs:
1717
uses: actions/cache@v4
1818
with:
1919
path: ${{ github.workspace }}/.ccache
20-
key: mrt2-au3-ccache-${{ runner.os }}-${{ hashFiles('CMakeLists.txt', 'magenta-realtime/core/**', 'MagentaRT_AudioUnit.mm', 'MagentaRT_AUHostApp.mm') }}
20+
key: mrt2-au3-ccache-${{ runner.os }}-${{ hashFiles('CMakeLists.txt', 'magenta-realtime/core/**', 'MagentaRT_AudioUnit.mm', 'MagentaRT_AUHostApp.mm', 'react_ui/src/App.tsx') }}
2121
restore-keys: |
2222
mrt2-au3-ccache-${{ runner.os }}-
2323

CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,6 @@ endfunction()
176176
option(MAGENTART_DEBUG_LOG "Enable AUv3 debug overlay + mrt_debug.log file writer" OFF)
177177
if(MAGENTART_DEBUG_LOG)
178178
add_compile_definitions(MAGENTART_DEBUG_LOG=1)
179-
else()
180-
add_compile_definitions(MAGENTART_DEBUG_LOG=0)
181179
endif()
182180

183181
add_custom_target(npm_install_root

MagentaRT_AudioUnit.mm

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -945,14 +945,14 @@ - (AUAudioUnit*)createAudioUnitWithComponentDescription:(AudioComponentDescripti
945945
}
946946

947947
- (void)addDebugLog:(NSString*)msg {
948-
dispatch_async(dispatch_get_main_queue(), ^{
949948
#if MAGENTART_DEBUG_LOG
949+
dispatch_async(dispatch_get_main_queue(), ^{
950950
if (self->_debugLabel) {
951951
self->_debugLabel.stringValue = [self->_debugLabel.stringValue stringByAppendingFormat:@"%@\n", msg];
952952
}
953-
#endif
954953
[self sendStateUpdate:@{@"debugLog": msg}];
955954
});
955+
#endif
956956
}
957957

958958
- (void)writeDiskLog:(NSString*)msg {
@@ -987,9 +987,13 @@ - (void)writeDiskLog:(NSString*)msg {
987987
if (accessGranted) {
988988
[modelsDir stopAccessingSecurityScopedResource];
989989
}
990+
dispatch_async(dispatch_get_main_queue(), ^{
991+
if (self->_debugLabel) {
992+
self->_debugLabel.stringValue = [self->_debugLabel.stringValue stringByAppendingFormat:@"%@\n", msg];
993+
}
994+
[self sendStateUpdate:@{@"debugLog": msg}];
995+
});
990996
#endif
991-
992-
[self sendStateUpdate:@{@"debugLog": msg}];
993997
}
994998

995999
- (void)loadView {

react_ui/src/App.tsx

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,6 @@ export default function App() {
151151
const [resourcesMissing, setResourcesMissing] = useState(false);
152152
const [resourcesProgress, setResourcesProgress] = useState<any>(null);
153153
const [isFetchingModels, setIsFetchingModels] = useState(true);
154-
const [debugLogs, setDebugLogs] = useState<string[]>([]);
155154

156155

157156
const [bankStatus, setBankStatus] = useState([false, false, false]);
@@ -444,9 +443,6 @@ export default function App() {
444443
if (state.resourcesMissing !== undefined) setResourcesMissing(state.resourcesMissing);
445444
if (state.resourcesProgress !== undefined) setResourcesProgress(state.resourcesProgress);
446445
if (state.downloadPath !== undefined) setDownloadPath(state.downloadPath);
447-
if (state.debugLog !== undefined) {
448-
setDebugLogs(prev => [...prev.slice(-199), String(state.debugLog)]);
449-
}
450446

451447
if (state.bankStatus !== undefined) setBankStatus(state.bankStatus);
452448
if (state.midiSources !== undefined) setMidiSources(state.midiSources);
@@ -1402,33 +1398,6 @@ export default function App() {
14021398
/>
14031399
)}
14041400

1405-
{debugLogs.length > 0 && (
1406-
<div
1407-
style={{
1408-
position: 'fixed',
1409-
right: 8,
1410-
bottom: 8,
1411-
width: 440,
1412-
maxHeight: 160,
1413-
overflow: 'auto',
1414-
padding: '8px 10px',
1415-
background: 'rgba(0,0,0,0.88)',
1416-
border: '1px solid rgba(113,250,222,0.35)',
1417-
borderRadius: 8,
1418-
fontFamily: 'ui-monospace, SFMono-Regular, Menlo, monospace',
1419-
fontSize: 10,
1420-
lineHeight: 1.35,
1421-
color: '#71fade',
1422-
zIndex: 10000,
1423-
pointerEvents: 'none',
1424-
}}
1425-
>
1426-
{debugLogs.map((line, i) => (
1427-
<div key={i}>{line}</div>
1428-
))}
1429-
</div>
1430-
)}
1431-
14321401
</div>
14331402
);
14341403
}

0 commit comments

Comments
 (0)