@drop-ai/core 0.2.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.md +734 -316
- package/dist/actions/ActionRegistry.d.ts.map +1 -1
- package/dist/actions/ActionRegistry.js +7 -2
- package/dist/actions/ActionRegistry.js.map +1 -1
- package/dist/actions/types.d.ts +7 -1
- package/dist/actions/types.d.ts.map +1 -1
- package/dist/analysis/AudioAnalyzer.d.ts +69 -0
- package/dist/analysis/AudioAnalyzer.d.ts.map +1 -0
- package/dist/analysis/AudioAnalyzer.js +567 -0
- package/dist/analysis/AudioAnalyzer.js.map +1 -0
- package/dist/audio/AudioEngine.d.ts +14 -1
- package/dist/audio/AudioEngine.d.ts.map +1 -1
- package/dist/audio/AudioEngine.js +115 -35
- package/dist/audio/AudioEngine.js.map +1 -1
- package/dist/audio/Auditioner.d.ts +102 -0
- package/dist/audio/Auditioner.d.ts.map +1 -0
- package/dist/audio/Auditioner.js +237 -0
- package/dist/audio/Auditioner.js.map +1 -0
- package/dist/audio/BWFMetadata.d.ts +114 -0
- package/dist/audio/BWFMetadata.d.ts.map +1 -0
- package/dist/audio/BWFMetadata.js +392 -0
- package/dist/audio/BWFMetadata.js.map +1 -0
- package/dist/audio/BufferPool.d.ts +0 -3
- package/dist/audio/BufferPool.d.ts.map +1 -1
- package/dist/audio/BufferPool.js +0 -3
- package/dist/audio/BufferPool.js.map +1 -1
- package/dist/audio/ChannelSplitter.d.ts +36 -0
- package/dist/audio/ChannelSplitter.d.ts.map +1 -0
- package/dist/audio/ChannelSplitter.js +81 -0
- package/dist/audio/ChannelSplitter.js.map +1 -0
- package/dist/audio/ExportAnalyzer.d.ts +38 -0
- package/dist/audio/ExportAnalyzer.d.ts.map +1 -0
- package/dist/audio/ExportAnalyzer.js +75 -0
- package/dist/audio/ExportAnalyzer.js.map +1 -0
- package/dist/audio/LufsNormalizer.d.ts +36 -0
- package/dist/audio/LufsNormalizer.d.ts.map +1 -0
- package/dist/audio/LufsNormalizer.js +216 -0
- package/dist/audio/LufsNormalizer.js.map +1 -0
- package/dist/audio/MeterUtils.d.ts +0 -2
- package/dist/audio/MeterUtils.d.ts.map +1 -1
- package/dist/audio/MeterUtils.js +0 -2
- package/dist/audio/MeterUtils.js.map +1 -1
- package/dist/audio/OfflineExporter.d.ts +1 -7
- package/dist/audio/OfflineExporter.d.ts.map +1 -1
- package/dist/audio/OfflineExporter.js +31 -11
- package/dist/audio/OfflineExporter.js.map +1 -1
- package/dist/audio/ProcessingGraph.d.ts +0 -1
- package/dist/audio/ProcessingGraph.d.ts.map +1 -1
- package/dist/audio/ProcessingGraph.js +0 -1
- package/dist/audio/ProcessingGraph.js.map +1 -1
- package/dist/audio/RoutingGraph.d.ts +134 -0
- package/dist/audio/RoutingGraph.d.ts.map +1 -0
- package/dist/audio/RoutingGraph.js +547 -0
- package/dist/audio/RoutingGraph.js.map +1 -0
- package/dist/audio/SampleRateConverter.d.ts +20 -0
- package/dist/audio/SampleRateConverter.d.ts.map +1 -0
- package/dist/audio/SampleRateConverter.js +83 -0
- package/dist/audio/SampleRateConverter.js.map +1 -0
- package/dist/audio/SilencePadding.d.ts +27 -0
- package/dist/audio/SilencePadding.d.ts.map +1 -0
- package/dist/audio/SilencePadding.js +84 -0
- package/dist/audio/SilencePadding.js.map +1 -0
- package/dist/audio/SourceCache.d.ts +13 -19
- package/dist/audio/SourceCache.d.ts.map +1 -1
- package/dist/audio/SourceCache.js +21 -36
- package/dist/audio/SourceCache.js.map +1 -1
- package/dist/audio/engine/Declick.d.ts +97 -0
- package/dist/audio/engine/Declick.d.ts.map +1 -0
- package/dist/audio/engine/Declick.js +203 -0
- package/dist/audio/engine/Declick.js.map +1 -0
- package/dist/audio/engine/DiskIO.d.ts +170 -0
- package/dist/audio/engine/DiskIO.d.ts.map +1 -0
- package/dist/audio/engine/DiskIO.js +382 -0
- package/dist/audio/engine/DiskIO.js.map +1 -0
- package/dist/audio/engine/LatencyCompensator.d.ts +46 -0
- package/dist/audio/engine/LatencyCompensator.d.ts.map +1 -0
- package/dist/audio/engine/LatencyCompensator.js +84 -0
- package/dist/audio/engine/LatencyCompensator.js.map +1 -0
- package/dist/audio/engine/MultiTrackRecorder.d.ts +144 -0
- package/dist/audio/engine/MultiTrackRecorder.d.ts.map +1 -0
- package/dist/audio/engine/MultiTrackRecorder.js +359 -0
- package/dist/audio/engine/MultiTrackRecorder.js.map +1 -0
- package/dist/audio/engine/PlaylistEngine.d.ts +1 -1
- package/dist/audio/engine/PlaylistEngine.d.ts.map +1 -1
- package/dist/audio/engine/PlaylistEngine.js +10 -3
- package/dist/audio/engine/PlaylistEngine.js.map +1 -1
- package/dist/audio/engine/PunchRecordManager.d.ts +111 -0
- package/dist/audio/engine/PunchRecordManager.d.ts.map +1 -0
- package/dist/audio/engine/PunchRecordManager.js +191 -0
- package/dist/audio/engine/PunchRecordManager.js.map +1 -0
- package/dist/audio/engine/RoutingGraph.d.ts +133 -0
- package/dist/audio/engine/RoutingGraph.d.ts.map +1 -0
- package/dist/audio/engine/RoutingGraph.js +436 -0
- package/dist/audio/engine/RoutingGraph.js.map +1 -0
- package/dist/audio/engine/SidechainRouter.d.ts +137 -0
- package/dist/audio/engine/SidechainRouter.d.ts.map +1 -0
- package/dist/audio/engine/SidechainRouter.js +290 -0
- package/dist/audio/engine/SidechainRouter.js.map +1 -0
- package/dist/audio/engine/XrunTracker.d.ts +71 -0
- package/dist/audio/engine/XrunTracker.d.ts.map +1 -0
- package/dist/audio/engine/XrunTracker.js +118 -0
- package/dist/audio/engine/XrunTracker.js.map +1 -0
- package/dist/audio/export/CDMarkerExporter.d.ts +60 -0
- package/dist/audio/export/CDMarkerExporter.d.ts.map +1 -0
- package/dist/audio/export/CDMarkerExporter.js +162 -0
- package/dist/audio/export/CDMarkerExporter.js.map +1 -0
- package/dist/audio/export/ExportGraphBuilder.d.ts +119 -0
- package/dist/audio/export/ExportGraphBuilder.d.ts.map +1 -0
- package/dist/audio/export/ExportGraphBuilder.js +520 -0
- package/dist/audio/export/ExportGraphBuilder.js.map +1 -0
- package/dist/audio/export/ExportPresetManager.d.ts +85 -0
- package/dist/audio/export/ExportPresetManager.d.ts.map +1 -0
- package/dist/audio/export/ExportPresetManager.js +304 -0
- package/dist/audio/export/ExportPresetManager.js.map +1 -0
- package/dist/automation/AutomationList.d.ts +0 -1
- package/dist/automation/AutomationList.d.ts.map +1 -1
- package/dist/automation/AutomationList.js +0 -1
- package/dist/automation/AutomationList.js.map +1 -1
- package/dist/automation/AutomationMode.d.ts +0 -1
- package/dist/automation/AutomationMode.d.ts.map +1 -1
- package/dist/automation/AutomationMode.js +0 -1
- package/dist/automation/AutomationMode.js.map +1 -1
- package/dist/commands/CommandHistory.d.ts +1 -4
- package/dist/commands/CommandHistory.d.ts.map +1 -1
- package/dist/commands/CommandHistory.js +6 -9
- package/dist/commands/CommandHistory.js.map +1 -1
- package/dist/commands/CommandRegistry.d.ts +1 -2
- package/dist/commands/CommandRegistry.d.ts.map +1 -1
- package/dist/commands/CommandRegistry.js +1 -2
- package/dist/commands/CommandRegistry.js.map +1 -1
- package/dist/commands/UndoTransaction.d.ts +0 -2
- package/dist/commands/UndoTransaction.d.ts.map +1 -1
- package/dist/commands/UndoTransaction.js +1 -3
- package/dist/commands/UndoTransaction.js.map +1 -1
- package/dist/commands/handlers/HistoryHandler.d.ts +5 -5
- package/dist/commands/handlers/HistoryHandler.js +10 -10
- package/dist/commands/handlers/HistoryHandler.js.map +1 -1
- package/dist/commands/handlers/MarkerHandler.d.ts +0 -1
- package/dist/commands/handlers/MarkerHandler.d.ts.map +1 -1
- package/dist/commands/handlers/MarkerHandler.js +0 -1
- package/dist/commands/handlers/MarkerHandler.js.map +1 -1
- package/dist/commands/handlers/RegionHandler.d.ts.map +1 -1
- package/dist/commands/handlers/RegionHandler.js +25 -1
- package/dist/commands/handlers/RegionHandler.js.map +1 -1
- package/dist/commands/handlers/TrackHandler.js +1 -1
- package/dist/commands/handlers/TrackHandler.js.map +1 -1
- package/dist/commands/impl/CopyRegionCommand.d.ts +0 -1
- package/dist/commands/impl/CopyRegionCommand.d.ts.map +1 -1
- package/dist/commands/impl/CopyRegionCommand.js +0 -1
- package/dist/commands/impl/CopyRegionCommand.js.map +1 -1
- package/dist/commands/impl/DuplicateRegionCommand.d.ts +0 -1
- package/dist/commands/impl/DuplicateRegionCommand.d.ts.map +1 -1
- package/dist/commands/impl/DuplicateRegionCommand.js +0 -1
- package/dist/commands/impl/DuplicateRegionCommand.js.map +1 -1
- package/dist/commands/impl/ExportCommand.d.ts +0 -1
- package/dist/commands/impl/ExportCommand.d.ts.map +1 -1
- package/dist/commands/impl/ExportCommand.js +0 -1
- package/dist/commands/impl/ExportCommand.js.map +1 -1
- package/dist/commands/impl/FreezeTrackCommand.d.ts +1 -1
- package/dist/commands/impl/FreezeTrackCommand.d.ts.map +1 -1
- package/dist/commands/impl/FreezeTrackCommand.js +38 -37
- package/dist/commands/impl/FreezeTrackCommand.js.map +1 -1
- package/dist/commands/impl/PasteRegionCommand.d.ts +0 -1
- package/dist/commands/impl/PasteRegionCommand.d.ts.map +1 -1
- package/dist/commands/impl/PasteRegionCommand.js +0 -1
- package/dist/commands/impl/PasteRegionCommand.js.map +1 -1
- package/dist/commands/impl/SaveSnapshotCommand.d.ts +1 -1
- package/dist/commands/impl/SaveSnapshotCommand.js +1 -1
- package/dist/commands/impl/SetLoopRangeCommand.d.ts +0 -1
- package/dist/commands/impl/SetLoopRangeCommand.d.ts.map +1 -1
- package/dist/commands/impl/SetLoopRangeCommand.js +0 -1
- package/dist/commands/impl/SetLoopRangeCommand.js.map +1 -1
- package/dist/commands/impl/SetPunchRangeCommand.d.ts +0 -1
- package/dist/commands/impl/SetPunchRangeCommand.d.ts.map +1 -1
- package/dist/commands/impl/SetPunchRangeCommand.js +0 -1
- package/dist/commands/impl/SetPunchRangeCommand.js.map +1 -1
- package/dist/commands/impl/SetRegionTimeDomainCommand.d.ts.map +1 -1
- package/dist/commands/impl/SetRegionTimeDomainCommand.js +3 -3
- package/dist/commands/impl/SetRegionTimeDomainCommand.js.map +1 -1
- package/dist/commands/impl/SplitAtPlayheadCommand.d.ts +0 -2
- package/dist/commands/impl/SplitAtPlayheadCommand.d.ts.map +1 -1
- package/dist/commands/impl/SplitAtPlayheadCommand.js +0 -2
- package/dist/commands/impl/SplitAtPlayheadCommand.js.map +1 -1
- package/dist/commands/impl/SplitRegionCommand.d.ts +0 -1
- package/dist/commands/impl/SplitRegionCommand.d.ts.map +1 -1
- package/dist/commands/impl/SplitRegionCommand.js +0 -1
- package/dist/commands/impl/SplitRegionCommand.js.map +1 -1
- package/dist/commands/impl/StripSilenceCommand.d.ts +0 -1
- package/dist/commands/impl/StripSilenceCommand.d.ts.map +1 -1
- package/dist/commands/impl/StripSilenceCommand.js +0 -1
- package/dist/commands/impl/StripSilenceCommand.js.map +1 -1
- package/dist/commands/impl/TimeStretchRegionCommand.d.ts +1 -2
- package/dist/commands/impl/TimeStretchRegionCommand.d.ts.map +1 -1
- package/dist/commands/impl/TimeStretchRegionCommand.js +1 -2
- package/dist/commands/impl/TimeStretchRegionCommand.js.map +1 -1
- package/dist/commands/impl/ToggleLoopCommand.d.ts +1 -0
- package/dist/commands/impl/ToggleLoopCommand.d.ts.map +1 -1
- package/dist/commands/impl/ToggleLoopCommand.js +10 -0
- package/dist/commands/impl/ToggleLoopCommand.js.map +1 -1
- package/dist/commands/impl/TrimRegionCommand.d.ts +14 -1
- package/dist/commands/impl/TrimRegionCommand.d.ts.map +1 -1
- package/dist/commands/impl/TrimRegionCommand.js +138 -33
- package/dist/commands/impl/TrimRegionCommand.js.map +1 -1
- package/dist/commands/impl/TrimRegionToPlayheadCommand.d.ts +26 -0
- package/dist/commands/impl/TrimRegionToPlayheadCommand.d.ts.map +1 -0
- package/dist/commands/impl/TrimRegionToPlayheadCommand.js +68 -0
- package/dist/commands/impl/TrimRegionToPlayheadCommand.js.map +1 -0
- package/dist/commands/impl/TrimRegionToRangeCommand.d.ts +27 -0
- package/dist/commands/impl/TrimRegionToRangeCommand.d.ts.map +1 -0
- package/dist/commands/impl/TrimRegionToRangeCommand.js +68 -0
- package/dist/commands/impl/TrimRegionToRangeCommand.js.map +1 -0
- package/dist/commands/impl/TrimToAdjacentRegionCommand.d.ts +26 -0
- package/dist/commands/impl/TrimToAdjacentRegionCommand.d.ts.map +1 -0
- package/dist/commands/impl/TrimToAdjacentRegionCommand.js +76 -0
- package/dist/commands/impl/TrimToAdjacentRegionCommand.js.map +1 -0
- package/dist/commands/types.d.ts +19 -0
- package/dist/commands/types.d.ts.map +1 -1
- package/dist/commands/types.js +21 -0
- package/dist/commands/types.js.map +1 -1
- package/dist/domain/ABComparison.d.ts +0 -1
- package/dist/domain/ABComparison.d.ts.map +1 -1
- package/dist/domain/ABComparison.js +0 -1
- package/dist/domain/ABComparison.js.map +1 -1
- package/dist/domain/CDMarker.d.ts +0 -1
- package/dist/domain/CDMarker.d.ts.map +1 -1
- package/dist/domain/CDMarker.js +0 -1
- package/dist/domain/CDMarker.js.map +1 -1
- package/dist/domain/ClockMode.d.ts +0 -1
- package/dist/domain/ClockMode.d.ts.map +1 -1
- package/dist/domain/ClockMode.js +0 -1
- package/dist/domain/ClockMode.js.map +1 -1
- package/dist/domain/Crossfade.d.ts +78 -0
- package/dist/domain/Crossfade.d.ts.map +1 -0
- package/dist/domain/Crossfade.js +216 -0
- package/dist/domain/Crossfade.js.map +1 -0
- package/dist/domain/DragManager.d.ts +0 -2
- package/dist/domain/DragManager.d.ts.map +1 -1
- package/dist/domain/DragManager.js +0 -2
- package/dist/domain/DragManager.js.map +1 -1
- package/dist/domain/EditMode.d.ts +0 -1
- package/dist/domain/EditMode.d.ts.map +1 -1
- package/dist/domain/EditMode.js +0 -1
- package/dist/domain/EditMode.js.map +1 -1
- package/dist/domain/ExportConfig.d.ts +98 -2
- package/dist/domain/ExportConfig.d.ts.map +1 -1
- package/dist/domain/ExportConfig.js +154 -2
- package/dist/domain/ExportConfig.js.map +1 -1
- package/dist/domain/ExportPreset.d.ts +60 -0
- package/dist/domain/ExportPreset.d.ts.map +1 -0
- package/dist/domain/ExportPreset.js +77 -0
- package/dist/domain/ExportPreset.js.map +1 -0
- package/dist/domain/ExportStatus.d.ts +0 -1
- package/dist/domain/ExportStatus.d.ts.map +1 -1
- package/dist/domain/ExportStatus.js +0 -1
- package/dist/domain/ExportStatus.js.map +1 -1
- package/dist/domain/GridSettings.d.ts +0 -3
- package/dist/domain/GridSettings.d.ts.map +1 -1
- package/dist/domain/GridSettings.js +0 -3
- package/dist/domain/GridSettings.js.map +1 -1
- package/dist/domain/ImportStatus.d.ts +40 -0
- package/dist/domain/ImportStatus.d.ts.map +1 -0
- package/dist/domain/ImportStatus.js +86 -0
- package/dist/domain/ImportStatus.js.map +1 -0
- package/dist/domain/Marker.d.ts +0 -1
- package/dist/domain/Marker.d.ts.map +1 -1
- package/dist/domain/Marker.js +0 -1
- package/dist/domain/Marker.js.map +1 -1
- package/dist/domain/MeterData.d.ts +0 -2
- package/dist/domain/MeterData.d.ts.map +1 -1
- package/dist/domain/MeterType.d.ts +0 -2
- package/dist/domain/MeterType.d.ts.map +1 -1
- package/dist/domain/MeterType.js +0 -2
- package/dist/domain/MeterType.js.map +1 -1
- package/dist/domain/MonitorMode.d.ts +0 -1
- package/dist/domain/MonitorMode.d.ts.map +1 -1
- package/dist/domain/MonitorMode.js +0 -1
- package/dist/domain/MonitorMode.js.map +1 -1
- package/dist/domain/MouseMode.d.ts +0 -1
- package/dist/domain/MouseMode.d.ts.map +1 -1
- package/dist/domain/MouseMode.js +0 -1
- package/dist/domain/MouseMode.js.map +1 -1
- package/dist/domain/OverlapType.d.ts +0 -2
- package/dist/domain/OverlapType.d.ts.map +1 -1
- package/dist/domain/OverlapType.js +0 -2
- package/dist/domain/OverlapType.js.map +1 -1
- package/dist/domain/Playlist.d.ts +72 -0
- package/dist/domain/Playlist.d.ts.map +1 -1
- package/dist/domain/Playlist.js +231 -6
- package/dist/domain/Playlist.js.map +1 -1
- package/dist/domain/Range.d.ts +0 -1
- package/dist/domain/Range.d.ts.map +1 -1
- package/dist/domain/Range.js +0 -1
- package/dist/domain/Range.js.map +1 -1
- package/dist/domain/RecordMode.d.ts +0 -1
- package/dist/domain/RecordMode.d.ts.map +1 -1
- package/dist/domain/RecordMode.js +0 -1
- package/dist/domain/RecordMode.js.map +1 -1
- package/dist/domain/Region.d.ts +76 -0
- package/dist/domain/Region.d.ts.map +1 -1
- package/dist/domain/Region.js +234 -1
- package/dist/domain/Region.js.map +1 -1
- package/dist/domain/RegionClipboard.d.ts +1 -3
- package/dist/domain/RegionClipboard.d.ts.map +1 -1
- package/dist/domain/RegionClipboard.js +1 -2
- package/dist/domain/RegionClipboard.js.map +1 -1
- package/dist/domain/Route.d.ts +43 -3
- package/dist/domain/Route.d.ts.map +1 -1
- package/dist/domain/Route.js +92 -6
- package/dist/domain/Route.js.map +1 -1
- package/dist/domain/RulerType.d.ts +0 -1
- package/dist/domain/RulerType.d.ts.map +1 -1
- package/dist/domain/RulerType.js +0 -1
- package/dist/domain/RulerType.js.map +1 -1
- package/dist/domain/SelectionHistory.d.ts +0 -3
- package/dist/domain/SelectionHistory.d.ts.map +1 -1
- package/dist/domain/SelectionHistory.js +0 -3
- package/dist/domain/SelectionHistory.js.map +1 -1
- package/dist/domain/SendBus.d.ts +0 -1
- package/dist/domain/SendBus.d.ts.map +1 -1
- package/dist/domain/SendBus.js +0 -1
- package/dist/domain/SendBus.js.map +1 -1
- package/dist/domain/Session.d.ts +31 -0
- package/dist/domain/Session.d.ts.map +1 -1
- package/dist/domain/Session.js +70 -0
- package/dist/domain/Session.js.map +1 -1
- package/dist/domain/SidechainConfig.d.ts +0 -1
- package/dist/domain/SidechainConfig.d.ts.map +1 -1
- package/dist/domain/SidechainConfig.js +0 -1
- package/dist/domain/SidechainConfig.js.map +1 -1
- package/dist/domain/Source.d.ts +145 -1
- package/dist/domain/Source.d.ts.map +1 -1
- package/dist/domain/Source.js +144 -1
- package/dist/domain/Source.js.map +1 -1
- package/dist/domain/Take.d.ts +0 -1
- package/dist/domain/Take.d.ts.map +1 -1
- package/dist/domain/Take.js +0 -1
- package/dist/domain/Take.js.map +1 -1
- package/dist/domain/ThawList.d.ts +36 -0
- package/dist/domain/ThawList.d.ts.map +1 -0
- package/dist/domain/ThawList.js +72 -0
- package/dist/domain/ThawList.js.map +1 -0
- package/dist/domain/Track.d.ts +93 -1
- package/dist/domain/Track.d.ts.map +1 -1
- package/dist/domain/Track.js +136 -0
- package/dist/domain/Track.js.map +1 -1
- package/dist/domain/TrackGroup.d.ts +0 -1
- package/dist/domain/TrackGroup.d.ts.map +1 -1
- package/dist/domain/TrackGroup.js +0 -1
- package/dist/domain/TrackGroup.js.map +1 -1
- package/dist/domain/TransportFSM.d.ts +0 -1
- package/dist/domain/TransportFSM.d.ts.map +1 -1
- package/dist/domain/TransportFSM.js +0 -1
- package/dist/domain/TransportFSM.js.map +1 -1
- package/dist/domain/TransportMode.d.ts +0 -1
- package/dist/domain/TransportMode.d.ts.map +1 -1
- package/dist/domain/TransportMode.js +0 -1
- package/dist/domain/TransportMode.js.map +1 -1
- package/dist/domain/TriggerBox.d.ts +121 -0
- package/dist/domain/TriggerBox.d.ts.map +1 -0
- package/dist/domain/TriggerBox.js +428 -0
- package/dist/domain/TriggerBox.js.map +1 -0
- package/dist/domain/VCATrack.d.ts +63 -2
- package/dist/domain/VCATrack.d.ts.map +1 -1
- package/dist/domain/VCATrack.js +127 -2
- package/dist/domain/VCATrack.js.map +1 -1
- package/dist/domain/VideoExportConfig.d.ts +116 -0
- package/dist/domain/VideoExportConfig.d.ts.map +1 -0
- package/dist/domain/VideoExportConfig.js +243 -0
- package/dist/domain/VideoExportConfig.js.map +1 -0
- package/dist/domain/VideoExportStatus.d.ts +89 -0
- package/dist/domain/VideoExportStatus.d.ts.map +1 -0
- package/dist/domain/VideoExportStatus.js +192 -0
- package/dist/domain/VideoExportStatus.js.map +1 -0
- package/dist/domain/VideoMetadata.d.ts +46 -0
- package/dist/domain/VideoMetadata.d.ts.map +1 -0
- package/dist/domain/VideoMetadata.js +2 -0
- package/dist/domain/VideoMetadata.js.map +1 -0
- package/dist/domain/ZoomFocus.d.ts +0 -1
- package/dist/domain/ZoomFocus.d.ts.map +1 -1
- package/dist/domain/ZoomFocus.js +0 -1
- package/dist/domain/ZoomFocus.js.map +1 -1
- package/dist/domain/index.d.ts +5 -0
- package/dist/domain/index.d.ts.map +1 -1
- package/dist/domain/index.js +5 -0
- package/dist/domain/index.js.map +1 -1
- package/dist/domain/temporal/TempoMap.d.ts +198 -2
- package/dist/domain/temporal/TempoMap.d.ts.map +1 -1
- package/dist/domain/temporal/TempoMap.js +464 -30
- package/dist/domain/temporal/TempoMap.js.map +1 -1
- package/dist/domain/temporal/types.d.ts +1 -1
- package/dist/domain/temporal/types.d.ts.map +1 -1
- package/dist/domain/temporal/types.js +1 -1
- package/dist/domain/temporal/types.js.map +1 -1
- package/dist/index.d.ts +43 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +32 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/Signal.d.ts +1 -1
- package/dist/lib/ThawList.d.ts +98 -0
- package/dist/lib/ThawList.d.ts.map +1 -0
- package/dist/lib/ThawList.js +151 -0
- package/dist/lib/ThawList.js.map +1 -0
- package/dist/midi/MidiFileParser.d.ts +32 -0
- package/dist/midi/MidiFileParser.d.ts.map +1 -0
- package/dist/midi/MidiFileParser.js +245 -0
- package/dist/midi/MidiFileParser.js.map +1 -0
- package/dist/midi/MidiFileWriter.d.ts +30 -0
- package/dist/midi/MidiFileWriter.d.ts.map +1 -0
- package/dist/midi/MidiFileWriter.js +159 -0
- package/dist/midi/MidiFileWriter.js.map +1 -0
- package/dist/midi/MidiImporter.d.ts +37 -0
- package/dist/midi/MidiImporter.d.ts.map +1 -0
- package/dist/midi/MidiImporter.js +62 -0
- package/dist/midi/MidiImporter.js.map +1 -0
- package/dist/plugins/PluginManager.js +2 -2
- package/dist/plugins/PluginManager.js.map +1 -1
- package/dist/plugins/PluginPresetManager.d.ts +86 -0
- package/dist/plugins/PluginPresetManager.d.ts.map +1 -0
- package/dist/plugins/PluginPresetManager.js +140 -0
- package/dist/plugins/PluginPresetManager.js.map +1 -0
- package/dist/plugins/impl/ExpanderPlugin.d.ts +1 -1
- package/dist/plugins/impl/ExpanderPlugin.js +1 -1
- package/dist/plugins/impl/ParametricEQPlugin.d.ts +1 -1
- package/dist/plugins/impl/ParametricEQPlugin.js +1 -1
- package/dist/processing/IO.d.ts +15 -1
- package/dist/processing/IO.d.ts.map +1 -1
- package/dist/processing/IO.js +29 -1
- package/dist/processing/IO.js.map +1 -1
- package/dist/processing/InternalSend.d.ts +102 -0
- package/dist/processing/InternalSend.d.ts.map +1 -0
- package/dist/processing/InternalSend.js +175 -0
- package/dist/processing/InternalSend.js.map +1 -0
- package/dist/processing/MeterDSP.d.ts +165 -0
- package/dist/processing/MeterDSP.d.ts.map +1 -0
- package/dist/processing/MeterDSP.js +753 -0
- package/dist/processing/MeterDSP.js.map +1 -0
- package/dist/processing/MeterProcessor.d.ts +0 -1
- package/dist/processing/MeterProcessor.d.ts.map +1 -1
- package/dist/processing/MeterProcessor.js +0 -1
- package/dist/processing/MeterProcessor.js.map +1 -1
- package/dist/processing/Panner.d.ts +144 -0
- package/dist/processing/Panner.d.ts.map +1 -0
- package/dist/processing/Panner.js +280 -0
- package/dist/processing/Panner.js.map +1 -0
- package/dist/processing/PluginInsert.d.ts +56 -1
- package/dist/processing/PluginInsert.d.ts.map +1 -1
- package/dist/processing/PluginInsert.js +180 -2
- package/dist/processing/PluginInsert.js.map +1 -1
- package/dist/processing/PolarityProcessor.d.ts +1 -1
- package/dist/processing/PolarityProcessor.js +1 -1
- package/dist/processing/Processor.d.ts +38 -0
- package/dist/processing/Processor.d.ts.map +1 -1
- package/dist/processing/Processor.js +60 -1
- package/dist/processing/Processor.js.map +1 -1
- package/dist/processing/SendProcessor.d.ts +0 -1
- package/dist/processing/SendProcessor.d.ts.map +1 -1
- package/dist/processing/SendProcessor.js +0 -1
- package/dist/processing/SendProcessor.js.map +1 -1
- package/dist/processing/SurroundPanner.d.ts +120 -0
- package/dist/processing/SurroundPanner.d.ts.map +1 -0
- package/dist/processing/SurroundPanner.js +374 -0
- package/dist/processing/SurroundPanner.js.map +1 -0
- package/dist/processing/TruePeakLimiter.d.ts +32 -0
- package/dist/processing/TruePeakLimiter.d.ts.map +1 -0
- package/dist/processing/TruePeakLimiter.js +142 -0
- package/dist/processing/TruePeakLimiter.js.map +1 -0
- package/dist/storage/ExportPresetStorage.d.ts +33 -0
- package/dist/storage/ExportPresetStorage.d.ts.map +1 -0
- package/dist/storage/ExportPresetStorage.js +121 -0
- package/dist/storage/ExportPresetStorage.js.map +1 -0
- package/dist/storage/SessionArchive.d.ts +73 -0
- package/dist/storage/SessionArchive.d.ts.map +1 -0
- package/dist/storage/SessionArchive.js +211 -0
- package/dist/storage/SessionArchive.js.map +1 -0
- package/dist/storage/SessionStorage.d.ts +1 -1
- package/dist/storage/SessionTemplate.d.ts +74 -5
- package/dist/storage/SessionTemplate.d.ts.map +1 -1
- package/dist/storage/SessionTemplate.js +247 -53
- package/dist/storage/SessionTemplate.js.map +1 -1
- package/dist/utils/BwfMetadataWriter.d.ts +41 -0
- package/dist/utils/BwfMetadataWriter.d.ts.map +1 -0
- package/dist/utils/BwfMetadataWriter.js +130 -0
- package/dist/utils/BwfMetadataWriter.js.map +1 -0
- package/dist/utils/DitherProcessor.d.ts +0 -1
- package/dist/utils/DitherProcessor.d.ts.map +1 -1
- package/dist/utils/DitherProcessor.js +0 -1
- package/dist/utils/DitherProcessor.js.map +1 -1
- package/dist/utils/FilenameTemplate.d.ts +39 -0
- package/dist/utils/FilenameTemplate.d.ts.map +1 -0
- package/dist/utils/FilenameTemplate.js +77 -0
- package/dist/utils/FilenameTemplate.js.map +1 -0
- package/dist/utils/FlacEncoder.d.ts +0 -1
- package/dist/utils/FlacEncoder.d.ts.map +1 -1
- package/dist/utils/FlacEncoder.js +0 -1
- package/dist/utils/FlacEncoder.js.map +1 -1
- package/dist/utils/Logger.d.ts +28 -0
- package/dist/utils/Logger.d.ts.map +1 -0
- package/dist/utils/Logger.js +46 -0
- package/dist/utils/Logger.js.map +1 -0
- package/dist/utils/Mp4ChapterGenerator.d.ts +16 -0
- package/dist/utils/Mp4ChapterGenerator.d.ts.map +1 -0
- package/dist/utils/Mp4ChapterGenerator.js +32 -0
- package/dist/utils/Mp4ChapterGenerator.js.map +1 -0
- package/dist/utils/OggEncoder.d.ts +19 -21
- package/dist/utils/OggEncoder.d.ts.map +1 -1
- package/dist/utils/OggEncoder.js +113 -51
- package/dist/utils/OggEncoder.js.map +1 -1
- package/dist/utils/TocGenerator.d.ts +16 -0
- package/dist/utils/TocGenerator.d.ts.map +1 -0
- package/dist/utils/TocGenerator.js +46 -0
- package/dist/utils/TocGenerator.js.map +1 -0
- package/package.json +7 -8
|
@@ -0,0 +1,436 @@
|
|
|
1
|
+
import { Signal } from '../../lib/Signal';
|
|
2
|
+
export class RoutingGraph {
|
|
3
|
+
constructor() {
|
|
4
|
+
this._nodes = new Map();
|
|
5
|
+
this.graphChanged = new Signal();
|
|
6
|
+
this.feedbackDetected = new Signal();
|
|
7
|
+
}
|
|
8
|
+
// ─── Node management ────────────────────────────────────────────────────
|
|
9
|
+
/**
|
|
10
|
+
* Add a node to the graph.
|
|
11
|
+
* If a node with the same ID already exists, it is updated in place.
|
|
12
|
+
*/
|
|
13
|
+
addNode(id, name, type) {
|
|
14
|
+
const existing = this._nodes.get(id);
|
|
15
|
+
if (existing) {
|
|
16
|
+
existing.name = name;
|
|
17
|
+
existing.type = type;
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
this._nodes.set(id, {
|
|
21
|
+
id,
|
|
22
|
+
name,
|
|
23
|
+
type,
|
|
24
|
+
inputs: new Set(),
|
|
25
|
+
outputs: new Set(),
|
|
26
|
+
processed: false,
|
|
27
|
+
depth: 0,
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
this.graphChanged.emit();
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Remove a node and all edges that reference it.
|
|
34
|
+
*/
|
|
35
|
+
removeNode(id) {
|
|
36
|
+
const node = this._nodes.get(id);
|
|
37
|
+
if (!node)
|
|
38
|
+
return;
|
|
39
|
+
// Remove this node from the inputs/outputs of all connected nodes
|
|
40
|
+
for (const outputId of node.outputs) {
|
|
41
|
+
const target = this._nodes.get(outputId);
|
|
42
|
+
if (target)
|
|
43
|
+
target.inputs.delete(id);
|
|
44
|
+
}
|
|
45
|
+
for (const inputId of node.inputs) {
|
|
46
|
+
const source = this._nodes.get(inputId);
|
|
47
|
+
if (source)
|
|
48
|
+
source.outputs.delete(id);
|
|
49
|
+
}
|
|
50
|
+
this._nodes.delete(id);
|
|
51
|
+
this.graphChanged.emit();
|
|
52
|
+
}
|
|
53
|
+
// ─── Edge management ────────────────────────────────────────────────────
|
|
54
|
+
/**
|
|
55
|
+
* Add a directed edge from one node to another.
|
|
56
|
+
* Both nodes must already exist in the graph.
|
|
57
|
+
*/
|
|
58
|
+
addEdge(fromId, toId) {
|
|
59
|
+
const from = this._nodes.get(fromId);
|
|
60
|
+
const to = this._nodes.get(toId);
|
|
61
|
+
if (!from || !to)
|
|
62
|
+
return;
|
|
63
|
+
from.outputs.add(toId);
|
|
64
|
+
to.inputs.add(fromId);
|
|
65
|
+
this.graphChanged.emit();
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Remove a directed edge between two nodes.
|
|
69
|
+
*/
|
|
70
|
+
removeEdge(fromId, toId) {
|
|
71
|
+
const from = this._nodes.get(fromId);
|
|
72
|
+
const to = this._nodes.get(toId);
|
|
73
|
+
if (!from || !to)
|
|
74
|
+
return;
|
|
75
|
+
from.outputs.delete(toId);
|
|
76
|
+
to.inputs.delete(fromId);
|
|
77
|
+
this.graphChanged.emit();
|
|
78
|
+
}
|
|
79
|
+
// ─── Bulk rebuild ───────────────────────────────────────────────────────
|
|
80
|
+
/**
|
|
81
|
+
* Rebuild the entire graph from session state.
|
|
82
|
+
* Clears all existing nodes/edges and reconstructs from the provided
|
|
83
|
+
* track descriptors. Typically called after bulk routing changes.
|
|
84
|
+
*/
|
|
85
|
+
rebuild(tracks) {
|
|
86
|
+
this._nodes.clear();
|
|
87
|
+
// First pass: create all nodes
|
|
88
|
+
for (const track of tracks) {
|
|
89
|
+
this._nodes.set(track.id, {
|
|
90
|
+
id: track.id,
|
|
91
|
+
name: track.name,
|
|
92
|
+
type: track.type,
|
|
93
|
+
inputs: new Set(),
|
|
94
|
+
outputs: new Set(),
|
|
95
|
+
processed: false,
|
|
96
|
+
depth: 0,
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
// Second pass: wire up edges
|
|
100
|
+
for (const track of tracks) {
|
|
101
|
+
const from = this._nodes.get(track.id);
|
|
102
|
+
if (!from)
|
|
103
|
+
continue;
|
|
104
|
+
// Direct output (e.g. track -> master bus)
|
|
105
|
+
if (track.outputTarget && this._nodes.has(track.outputTarget)) {
|
|
106
|
+
from.outputs.add(track.outputTarget);
|
|
107
|
+
this._nodes.get(track.outputTarget).inputs.add(track.id);
|
|
108
|
+
}
|
|
109
|
+
// Send connections (e.g. track -> aux bus)
|
|
110
|
+
for (const sendTarget of track.sendTargets) {
|
|
111
|
+
if (this._nodes.has(sendTarget)) {
|
|
112
|
+
from.outputs.add(sendTarget);
|
|
113
|
+
this._nodes.get(sendTarget).inputs.add(track.id);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
// Compute node depths
|
|
118
|
+
this._computeDepths();
|
|
119
|
+
// Detect feedback loops and emit signals for any found
|
|
120
|
+
const loops = this.detectFeedback();
|
|
121
|
+
for (const loop of loops) {
|
|
122
|
+
this.feedbackDetected.emit(loop);
|
|
123
|
+
}
|
|
124
|
+
this.graphChanged.emit();
|
|
125
|
+
}
|
|
126
|
+
// ─── Topological sort (Kahn's algorithm) ────────────────────────────────
|
|
127
|
+
/**
|
|
128
|
+
* Compute a valid processing order using Kahn's algorithm for
|
|
129
|
+
* topological sorting. Leaf nodes (no inputs) are processed first,
|
|
130
|
+
* working upward to the master bus.
|
|
131
|
+
*
|
|
132
|
+
* If cycles exist, the returned order will be incomplete (nodes
|
|
133
|
+
* involved in cycles are omitted). Use detectFeedback() to identify
|
|
134
|
+
* those cycles.
|
|
135
|
+
*
|
|
136
|
+
* @returns An array of node IDs in processing order.
|
|
137
|
+
*/
|
|
138
|
+
getProcessingOrder() {
|
|
139
|
+
// Build a working copy of in-degree counts
|
|
140
|
+
const inDegree = new Map();
|
|
141
|
+
for (const [id, node] of this._nodes) {
|
|
142
|
+
inDegree.set(id, node.inputs.size);
|
|
143
|
+
}
|
|
144
|
+
// Seed the queue with all nodes that have zero in-degree (leaf nodes)
|
|
145
|
+
const queue = [];
|
|
146
|
+
for (const [id, degree] of inDegree) {
|
|
147
|
+
if (degree === 0) {
|
|
148
|
+
queue.push(id);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
const order = [];
|
|
152
|
+
while (queue.length > 0) {
|
|
153
|
+
const current = queue.shift();
|
|
154
|
+
order.push(current);
|
|
155
|
+
const node = this._nodes.get(current);
|
|
156
|
+
if (!node)
|
|
157
|
+
continue;
|
|
158
|
+
// For each outgoing edge, reduce the in-degree of the target
|
|
159
|
+
for (const outputId of node.outputs) {
|
|
160
|
+
const deg = inDegree.get(outputId);
|
|
161
|
+
if (deg === undefined)
|
|
162
|
+
continue;
|
|
163
|
+
const newDeg = deg - 1;
|
|
164
|
+
inDegree.set(outputId, newDeg);
|
|
165
|
+
if (newDeg === 0) {
|
|
166
|
+
queue.push(outputId);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
return order;
|
|
171
|
+
}
|
|
172
|
+
// ─── Feedback detection (DFS cycle detection) ───────────────────────────
|
|
173
|
+
/**
|
|
174
|
+
* Detect all feedback loops (cycles) in the graph using DFS.
|
|
175
|
+
* Returns an array of FeedbackLoop descriptors, each containing the
|
|
176
|
+
* ordered path of node IDs that form the cycle.
|
|
177
|
+
*/
|
|
178
|
+
detectFeedback() {
|
|
179
|
+
const loops = [];
|
|
180
|
+
// Track visited state: 'unvisited', 'visiting' (on current DFS stack), 'visited'
|
|
181
|
+
const state = new Map();
|
|
182
|
+
for (const id of this._nodes.keys()) {
|
|
183
|
+
state.set(id, 'unvisited');
|
|
184
|
+
}
|
|
185
|
+
// DFS path stack for reconstructing cycle paths
|
|
186
|
+
const pathStack = [];
|
|
187
|
+
const pathSet = new Set(); // fast lookup for cycle extraction
|
|
188
|
+
const dfs = (nodeId) => {
|
|
189
|
+
state.set(nodeId, 'visiting');
|
|
190
|
+
pathStack.push(nodeId);
|
|
191
|
+
pathSet.add(nodeId);
|
|
192
|
+
const node = this._nodes.get(nodeId);
|
|
193
|
+
if (node) {
|
|
194
|
+
for (const neighborId of node.outputs) {
|
|
195
|
+
const neighborState = state.get(neighborId);
|
|
196
|
+
if (neighborState === 'visiting' && pathSet.has(neighborId)) {
|
|
197
|
+
// Found a cycle - extract the cycle path from the stack
|
|
198
|
+
const cycleStartIdx = pathStack.indexOf(neighborId);
|
|
199
|
+
const cyclePath = pathStack.slice(cycleStartIdx);
|
|
200
|
+
// Close the cycle by appending the start node
|
|
201
|
+
cyclePath.push(neighborId);
|
|
202
|
+
const nodeNames = cyclePath.map(id => {
|
|
203
|
+
const n = this._nodes.get(id);
|
|
204
|
+
return n ? n.name : id;
|
|
205
|
+
});
|
|
206
|
+
loops.push({
|
|
207
|
+
path: cyclePath,
|
|
208
|
+
description: `Feedback loop: ${nodeNames.join(' -> ')}`,
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
else if (neighborState === 'unvisited') {
|
|
212
|
+
dfs(neighborId);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
pathStack.pop();
|
|
217
|
+
pathSet.delete(nodeId);
|
|
218
|
+
state.set(nodeId, 'visited');
|
|
219
|
+
};
|
|
220
|
+
for (const id of this._nodes.keys()) {
|
|
221
|
+
if (state.get(id) === 'unvisited') {
|
|
222
|
+
dfs(id);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
return loops;
|
|
226
|
+
}
|
|
227
|
+
// ─── Reachability queries ───────────────────────────────────────────────
|
|
228
|
+
/**
|
|
229
|
+
* Check whether route A feeds (directly or indirectly) into route B.
|
|
230
|
+
* Uses BFS from A, following output edges, to determine reachability.
|
|
231
|
+
*/
|
|
232
|
+
feeds(fromId, toId) {
|
|
233
|
+
if (fromId === toId)
|
|
234
|
+
return false;
|
|
235
|
+
if (!this._nodes.has(fromId) || !this._nodes.has(toId))
|
|
236
|
+
return false;
|
|
237
|
+
const visited = new Set();
|
|
238
|
+
const queue = [fromId];
|
|
239
|
+
visited.add(fromId);
|
|
240
|
+
while (queue.length > 0) {
|
|
241
|
+
const current = queue.shift();
|
|
242
|
+
const node = this._nodes.get(current);
|
|
243
|
+
if (!node)
|
|
244
|
+
continue;
|
|
245
|
+
for (const outputId of node.outputs) {
|
|
246
|
+
if (outputId === toId)
|
|
247
|
+
return true;
|
|
248
|
+
if (!visited.has(outputId)) {
|
|
249
|
+
visited.add(outputId);
|
|
250
|
+
queue.push(outputId);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
return false;
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* Check whether route A directly feeds into route B (single hop).
|
|
258
|
+
*/
|
|
259
|
+
directFeeds(fromId, toId) {
|
|
260
|
+
const from = this._nodes.get(fromId);
|
|
261
|
+
if (!from)
|
|
262
|
+
return false;
|
|
263
|
+
return from.outputs.has(toId);
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* Get all routes that feed (directly or indirectly) into the given route.
|
|
267
|
+
* Traverses backward from the target, following input edges via BFS.
|
|
268
|
+
*/
|
|
269
|
+
getUpstream(nodeId) {
|
|
270
|
+
if (!this._nodes.has(nodeId))
|
|
271
|
+
return [];
|
|
272
|
+
const visited = new Set();
|
|
273
|
+
const queue = [nodeId];
|
|
274
|
+
visited.add(nodeId);
|
|
275
|
+
const upstream = [];
|
|
276
|
+
while (queue.length > 0) {
|
|
277
|
+
const current = queue.shift();
|
|
278
|
+
const node = this._nodes.get(current);
|
|
279
|
+
if (!node)
|
|
280
|
+
continue;
|
|
281
|
+
for (const inputId of node.inputs) {
|
|
282
|
+
if (!visited.has(inputId)) {
|
|
283
|
+
visited.add(inputId);
|
|
284
|
+
upstream.push(inputId);
|
|
285
|
+
queue.push(inputId);
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
return upstream;
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* Get all routes that the given route feeds (directly or indirectly) into.
|
|
293
|
+
* Traverses forward from the source, following output edges via BFS.
|
|
294
|
+
*/
|
|
295
|
+
getDownstream(nodeId) {
|
|
296
|
+
if (!this._nodes.has(nodeId))
|
|
297
|
+
return [];
|
|
298
|
+
const visited = new Set();
|
|
299
|
+
const queue = [nodeId];
|
|
300
|
+
visited.add(nodeId);
|
|
301
|
+
const downstream = [];
|
|
302
|
+
while (queue.length > 0) {
|
|
303
|
+
const current = queue.shift();
|
|
304
|
+
const node = this._nodes.get(current);
|
|
305
|
+
if (!node)
|
|
306
|
+
continue;
|
|
307
|
+
for (const outputId of node.outputs) {
|
|
308
|
+
if (!visited.has(outputId)) {
|
|
309
|
+
visited.add(outputId);
|
|
310
|
+
downstream.push(outputId);
|
|
311
|
+
queue.push(outputId);
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
return downstream;
|
|
316
|
+
}
|
|
317
|
+
// ─── Parallel processing groups ─────────────────────────────────────────
|
|
318
|
+
/**
|
|
319
|
+
* Find groups of nodes that can be processed in parallel.
|
|
320
|
+
* Nodes at the same depth in the topological ordering have no
|
|
321
|
+
* dependencies on each other and can safely run concurrently.
|
|
322
|
+
*
|
|
323
|
+
* Uses a BFS-based level assignment: leaf nodes (in-degree 0) are
|
|
324
|
+
* at level 0, their consumers at level 1, and so on. Nodes at the
|
|
325
|
+
* same level form a parallel group.
|
|
326
|
+
*
|
|
327
|
+
* @returns An array of groups, where each group is an array of node IDs
|
|
328
|
+
* that can be processed simultaneously. Groups are returned in
|
|
329
|
+
* processing order (group 0 first, then group 1, etc.).
|
|
330
|
+
*/
|
|
331
|
+
getParallelGroups() {
|
|
332
|
+
var _a;
|
|
333
|
+
// Compute levels using a variant of Kahn's algorithm that tracks depth
|
|
334
|
+
const inDegree = new Map();
|
|
335
|
+
const level = new Map();
|
|
336
|
+
for (const [id, node] of this._nodes) {
|
|
337
|
+
inDegree.set(id, node.inputs.size);
|
|
338
|
+
level.set(id, 0);
|
|
339
|
+
}
|
|
340
|
+
// Seed with zero in-degree nodes at level 0
|
|
341
|
+
const queue = [];
|
|
342
|
+
for (const [id, degree] of inDegree) {
|
|
343
|
+
if (degree === 0) {
|
|
344
|
+
queue.push(id);
|
|
345
|
+
level.set(id, 0);
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
const visited = new Set();
|
|
349
|
+
let maxLevel = 0;
|
|
350
|
+
while (queue.length > 0) {
|
|
351
|
+
const current = queue.shift();
|
|
352
|
+
visited.add(current);
|
|
353
|
+
const currentLevel = level.get(current);
|
|
354
|
+
const node = this._nodes.get(current);
|
|
355
|
+
if (!node)
|
|
356
|
+
continue;
|
|
357
|
+
for (const outputId of node.outputs) {
|
|
358
|
+
// The consumer's level is at least one more than this node's level
|
|
359
|
+
const newLevel = currentLevel + 1;
|
|
360
|
+
if (newLevel > ((_a = level.get(outputId)) !== null && _a !== void 0 ? _a : 0)) {
|
|
361
|
+
level.set(outputId, newLevel);
|
|
362
|
+
}
|
|
363
|
+
if (newLevel > maxLevel) {
|
|
364
|
+
maxLevel = newLevel;
|
|
365
|
+
}
|
|
366
|
+
const deg = inDegree.get(outputId);
|
|
367
|
+
if (deg === undefined)
|
|
368
|
+
continue;
|
|
369
|
+
const newDeg = deg - 1;
|
|
370
|
+
inDegree.set(outputId, newDeg);
|
|
371
|
+
if (newDeg === 0) {
|
|
372
|
+
queue.push(outputId);
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
// Collect nodes into groups by level
|
|
377
|
+
const groups = [];
|
|
378
|
+
for (let i = 0; i <= maxLevel; i++) {
|
|
379
|
+
groups.push([]);
|
|
380
|
+
}
|
|
381
|
+
for (const [id, lvl] of level) {
|
|
382
|
+
// Only include nodes that were reachable (part of the DAG portion)
|
|
383
|
+
if (visited.has(id)) {
|
|
384
|
+
groups[lvl].push(id);
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
// Filter out any empty groups (shouldn't happen, but be safe)
|
|
388
|
+
return groups.filter(g => g.length > 0);
|
|
389
|
+
}
|
|
390
|
+
// ─── Accessors ──────────────────────────────────────────────────────────
|
|
391
|
+
/**
|
|
392
|
+
* Get a single node by ID.
|
|
393
|
+
*/
|
|
394
|
+
getNode(id) {
|
|
395
|
+
return this._nodes.get(id);
|
|
396
|
+
}
|
|
397
|
+
/**
|
|
398
|
+
* Get all nodes as a read-only array.
|
|
399
|
+
*/
|
|
400
|
+
get nodes() {
|
|
401
|
+
return Array.from(this._nodes.values());
|
|
402
|
+
}
|
|
403
|
+
/**
|
|
404
|
+
* Clear all nodes and edges, resetting the graph to an empty state.
|
|
405
|
+
*/
|
|
406
|
+
clear() {
|
|
407
|
+
this._nodes.clear();
|
|
408
|
+
this.graphChanged.emit();
|
|
409
|
+
}
|
|
410
|
+
// ─── Private helpers ────────────────────────────────────────────────────
|
|
411
|
+
/**
|
|
412
|
+
* Compute the depth of each node (longest path from any leaf to this node).
|
|
413
|
+
* Leaf nodes (no inputs) have depth 0. Used for parallel group assignment
|
|
414
|
+
* and rendering the graph visualization.
|
|
415
|
+
*/
|
|
416
|
+
_computeDepths() {
|
|
417
|
+
// Reset depths
|
|
418
|
+
for (const node of this._nodes.values()) {
|
|
419
|
+
node.depth = 0;
|
|
420
|
+
}
|
|
421
|
+
// Use topological order to compute longest-path depths
|
|
422
|
+
const order = this.getProcessingOrder();
|
|
423
|
+
for (const id of order) {
|
|
424
|
+
const node = this._nodes.get(id);
|
|
425
|
+
if (!node)
|
|
426
|
+
continue;
|
|
427
|
+
for (const outputId of node.outputs) {
|
|
428
|
+
const target = this._nodes.get(outputId);
|
|
429
|
+
if (target) {
|
|
430
|
+
target.depth = Math.max(target.depth, node.depth + 1);
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
//# sourceMappingURL=RoutingGraph.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RoutingGraph.js","sourceRoot":"","sources":["../../../src/audio/engine/RoutingGraph.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAiC1C,MAAM,OAAO,YAAY;IAAzB;QACY,WAAM,GAA2B,IAAI,GAAG,EAAE,CAAC;QAEnC,iBAAY,GAAG,IAAI,MAAM,EAAQ,CAAC;QAClC,qBAAgB,GAAG,IAAI,MAAM,EAAgB,CAAC;IA0elE,CAAC;IAxeG,2EAA2E;IAE3E;;;OAGG;IACH,OAAO,CAAC,EAAU,EAAE,IAAY,EAAE,IAAuB;QACrD,MAAM,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QACrC,IAAI,QAAQ,EAAE,CAAC;YACX,QAAQ,CAAC,IAAI,GAAG,IAAI,CAAC;YACrB,QAAQ,CAAC,IAAI,GAAG,IAAI,CAAC;QACzB,CAAC;aAAM,CAAC;YACJ,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,EAAE;gBAChB,EAAE;gBACF,IAAI;gBACJ,IAAI;gBACJ,MAAM,EAAE,IAAI,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;IACL,CAAC;CACJ"}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { Signal } from '../../lib/Signal';
|
|
2
|
+
import { SidechainConfig } from '../../domain/SidechainConfig';
|
|
3
|
+
import { TrackId } from '../../domain/types';
|
|
4
|
+
/**
|
|
5
|
+
* SidechainRouter manages the actual audio signal routing for sidechain connections.
|
|
6
|
+
*
|
|
7
|
+
* In the Web Audio context, sidechain routing works by:
|
|
8
|
+
* 1. Tapping the source track's audio output (pre or post fader)
|
|
9
|
+
* 2. Optionally applying a high-pass filter
|
|
10
|
+
* 3. Feeding it into the target processor's sidechain input
|
|
11
|
+
*
|
|
12
|
+
* The router maintains a buffer-per-config that holds the latest audio block
|
|
13
|
+
* from the source track, available for the target processor to read.
|
|
14
|
+
*/
|
|
15
|
+
export declare class SidechainRouter {
|
|
16
|
+
private _configs;
|
|
17
|
+
/** Buffer storage: configId -> latest audio block from source */
|
|
18
|
+
private _sidechainBuffers;
|
|
19
|
+
/** HPF filter state per config (one state per channel, keyed by configId) */
|
|
20
|
+
private _filterStates;
|
|
21
|
+
/** Sample rate used for HPF coefficient computation */
|
|
22
|
+
private _sampleRate;
|
|
23
|
+
readonly routingChanged: Signal<void>;
|
|
24
|
+
/**
|
|
25
|
+
* @param sampleRate - The audio sample rate (e.g. 44100, 48000)
|
|
26
|
+
*/
|
|
27
|
+
constructor(sampleRate?: number);
|
|
28
|
+
/**
|
|
29
|
+
* Register a sidechain configuration.
|
|
30
|
+
* Initialises the buffer and filter state for the new config.
|
|
31
|
+
*/
|
|
32
|
+
addConfig(config: SidechainConfig): void;
|
|
33
|
+
/**
|
|
34
|
+
* Remove a sidechain configuration and clean up its resources.
|
|
35
|
+
*/
|
|
36
|
+
removeConfig(configId: string): void;
|
|
37
|
+
/**
|
|
38
|
+
* Get config by ID.
|
|
39
|
+
*/
|
|
40
|
+
getConfig(configId: string): SidechainConfig | undefined;
|
|
41
|
+
/**
|
|
42
|
+
* Get all configs targeting a specific track.
|
|
43
|
+
*/
|
|
44
|
+
getConfigsForTarget(trackId: TrackId): SidechainConfig[];
|
|
45
|
+
/**
|
|
46
|
+
* Get all configs sourcing from a specific track.
|
|
47
|
+
*/
|
|
48
|
+
getConfigsForSource(trackId: TrackId): SidechainConfig[];
|
|
49
|
+
/**
|
|
50
|
+
* Called by the audio engine when a source track produces audio.
|
|
51
|
+
* Stores the audio block for later retrieval by target processors.
|
|
52
|
+
*
|
|
53
|
+
* For every config that sources from the given trackId, we copy the
|
|
54
|
+
* audio data into the config's sidechain buffer.
|
|
55
|
+
*
|
|
56
|
+
* @param trackId - The source track that just produced audio
|
|
57
|
+
* @param audioData - Per-channel audio data (e.g. [leftChannel, rightChannel])
|
|
58
|
+
* @param blockSize - Number of samples per channel in this block
|
|
59
|
+
*/
|
|
60
|
+
feedSourceAudio(trackId: TrackId, audioData: Float32Array[], blockSize: number): void;
|
|
61
|
+
/**
|
|
62
|
+
* Called by the target processor to get the sidechain input.
|
|
63
|
+
* Returns the latest audio block from the source track (with optional HPF applied),
|
|
64
|
+
* or null if no valid data is available.
|
|
65
|
+
*
|
|
66
|
+
* @param configId - The sidechain configuration ID
|
|
67
|
+
* @returns Per-channel audio data, or null if unavailable
|
|
68
|
+
*/
|
|
69
|
+
getSidechainInput(configId: string): Float32Array[] | null;
|
|
70
|
+
/**
|
|
71
|
+
* Apply a 2nd-order Butterworth high-pass filter to the sidechain signal.
|
|
72
|
+
* Processes in-place on copies of the input channels.
|
|
73
|
+
*
|
|
74
|
+
* The Butterworth HPF transfer function is implemented as a Direct Form I
|
|
75
|
+
* biquad filter: y[n] = b0*x[n] + b1*x[n-1] + b2*x[n-2] - a1*y[n-1] - a2*y[n-2]
|
|
76
|
+
*/
|
|
77
|
+
private _applyHPF;
|
|
78
|
+
/**
|
|
79
|
+
* Rebuild the filter state for a given config.
|
|
80
|
+
* Called when the config is added or its filter parameters change.
|
|
81
|
+
*/
|
|
82
|
+
private _rebuildFilterState;
|
|
83
|
+
/**
|
|
84
|
+
* Reset all buffers and filter states.
|
|
85
|
+
* Typically called when transport stops or seeks.
|
|
86
|
+
*/
|
|
87
|
+
reset(): void;
|
|
88
|
+
/**
|
|
89
|
+
* Update the sample rate. Recomputes all HPF filter coefficients.
|
|
90
|
+
*/
|
|
91
|
+
setSampleRate(sampleRate: number): void;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Biquad HPF state for the sidechain filter (Direct Form I).
|
|
95
|
+
* Stores both the filter coefficients and the delay-line state.
|
|
96
|
+
*/
|
|
97
|
+
interface BiquadFilterState {
|
|
98
|
+
/** Input delay line */
|
|
99
|
+
x1: number;
|
|
100
|
+
x2: number;
|
|
101
|
+
/** Output delay line */
|
|
102
|
+
y1: number;
|
|
103
|
+
y2: number;
|
|
104
|
+
/** Numerator (feedforward) coefficients */
|
|
105
|
+
b0: number;
|
|
106
|
+
b1: number;
|
|
107
|
+
b2: number;
|
|
108
|
+
/** Denominator (feedback) coefficients (negated convention: y = ... - a1*y1 - a2*y2) */
|
|
109
|
+
a1: number;
|
|
110
|
+
a2: number;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Compute the biquad filter coefficients for a 2nd-order Butterworth high-pass filter.
|
|
114
|
+
*
|
|
115
|
+
* Derivation from the analogue Butterworth prototype:
|
|
116
|
+
* H(s) = s^2 / (s^2 + sqrt(2)*s + 1)
|
|
117
|
+
*
|
|
118
|
+
* Bilinear transform with pre-warping:
|
|
119
|
+
* omega_c = 2 * pi * frequency / sampleRate
|
|
120
|
+
* K = tan(omega_c / 2)
|
|
121
|
+
* norm = 1 / (1 + sqrt(2)*K + K^2)
|
|
122
|
+
*
|
|
123
|
+
* b0 = norm
|
|
124
|
+
* b1 = -2 * norm
|
|
125
|
+
* b2 = norm
|
|
126
|
+
* a1 = 2 * (K^2 - 1) * norm
|
|
127
|
+
* a2 = (1 - sqrt(2)*K + K^2) * norm
|
|
128
|
+
*
|
|
129
|
+
* The returned state has zeroed delay lines, ready for immediate use.
|
|
130
|
+
*
|
|
131
|
+
* @param frequency - HPF cutoff frequency in Hz
|
|
132
|
+
* @param sampleRate - Audio sample rate in Hz
|
|
133
|
+
* @returns A BiquadFilterState with computed coefficients and zeroed state
|
|
134
|
+
*/
|
|
135
|
+
export declare function computeHPFCoefficients(frequency: number, sampleRate: number): BiquadFilterState;
|
|
136
|
+
export {};
|
|
137
|
+
//# sourceMappingURL=SidechainRouter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SidechainRouter.d.ts","sourceRoot":"","sources":["../../../src/audio/engine/SidechainRouter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE7C;;;;;;;;;;GAUG;AACH,qBAAa,eAAe;IACxB,OAAO,CAAC,QAAQ,CAA2C;IAE3D,iEAAiE;IACjE,OAAO,CAAC,iBAAiB,CAA2C;IAEpE,6EAA6E;IAC7E,OAAO,CAAC,aAAa,CAA+C;IAEpE,uDAAuD;IACvD,OAAO,CAAC,WAAW,CAAS;IAE5B,SAAgB,cAAc,eAAsB;IAEpD;;OAEG;gBACS,UAAU,GAAE,MAAc;IAMtC;;;OAGG;IACH,SAAS,CAAC,MAAM,EAAE,eAAe,GAAG,IAAI;IAqBxC;;OAEG;IACH,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAUpC;;OAEG;IACH,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS;IAIxD;;OAEG;IACH,mBAAmB,CAAC,OAAO,EAAE,OAAO,GAAG,eAAe,EAAE;IAUxD;;OAEG;IACH,mBAAmB,CAAC,OAAO,EAAE,OAAO,GAAG,eAAe,EAAE;IAYxD;;;;;;;;;;OAUG;IACH,eAAe,CAAC,OAAO,EAAE,OAAO,EAAE,SAAS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