astra integration module

This commit is contained in:
Boof2015
2026-03-29 18:55:36 -04:00
parent 6cd30cac39
commit 6f73802252
30 changed files with 2314 additions and 39 deletions
+38
View File
@@ -0,0 +1,38 @@
export const DEFAULT_ASTRA_BASE_URL = 'http://127.0.0.1:38401'
export type AstraPlaybackState = 'stopped' | 'playing' | 'paused' | 'loading'
export type AstraConnectionState = 'disabled' | 'connecting' | 'connected' | 'error'
export type AstraControlCommand = 'play' | 'pause' | 'next' | 'previous'
export interface AstraTrackSnapshot {
id: string
title: string
artist: string
album: string
isFavorite: boolean
artworkDataUrl: string | null
}
export interface AstraNowPlayingSnapshot {
playbackState: AstraPlaybackState
currentTime: number
duration: number
queueLength: number
outputDeviceLabel: string | null
visualizerLineColor: string
currentTrack: AstraTrackSnapshot | null
updatedAt: number
}
export interface AstraIntegrationConfig {
baseUrl: string
token: string
}
export interface AstraIntegrationState {
config: AstraIntegrationConfig
connectionState: AstraConnectionState
lastError: string | null
lastControlError: string | null
snapshot: AstraNowPlayingSnapshot | null
}
+2
View File
@@ -2,6 +2,7 @@ import type { CaptureBackendKind } from './capture'
import type { ScopeKind } from './scope'
import type { ScopeSettings } from './settings'
import type {
ResolvedAstraTheme,
ResolvedInterfaceTheme,
ResolvedLUFSMeterTheme,
ResolvedOscilloscopeTheme,
@@ -58,6 +59,7 @@ export type ScopePopoutResolvedScopeTheme =
| ResolvedVUMeterTheme
| ResolvedLUFSMeterTheme
| ResolvedWaveformTheme
| ResolvedAstraTheme
export interface ScopePopoutSnapshot<K extends ScopeKind = ScopeKind> {
kind: K
+27 -1
View File
@@ -1,4 +1,14 @@
export type ScopeKind = 'spectrum' | 'oscilloscope' | 'vectorscope' | 'spectrogram' | 'vumeter' | 'lufsmeter' | 'waveform'
export type ScopeKind =
| 'spectrum'
| 'oscilloscope'
| 'vectorscope'
| 'spectrogram'
| 'vumeter'
| 'lufsmeter'
| 'waveform'
| 'astra'
export type AudioScopeKind = Exclude<ScopeKind, 'astra'>
export const SCOPE_KINDS: ScopeKind[] = [
'spectrum',
@@ -8,8 +18,23 @@ export const SCOPE_KINDS: ScopeKind[] = [
'vumeter',
'lufsmeter',
'waveform',
'astra',
]
export const AUDIO_SCOPE_KINDS: AudioScopeKind[] = [
'spectrum',
'oscilloscope',
'vectorscope',
'spectrogram',
'vumeter',
'lufsmeter',
'waveform',
]
export function isAudioScopeKind(value: unknown): value is AudioScopeKind {
return typeof value === 'string' && AUDIO_SCOPE_KINDS.includes(value as AudioScopeKind)
}
export const SCOPE_LABELS: Record<ScopeKind, string> = {
spectrum: 'Spectrum',
oscilloscope: 'Oscilloscope',
@@ -18,4 +43,5 @@ export const SCOPE_LABELS: Record<ScopeKind, string> = {
vumeter: 'VU Meter',
lufsmeter: 'LUFS Meter',
waveform: 'Waveform',
astra: 'Astra',
}
+16
View File
@@ -48,6 +48,14 @@ export interface ScopeSettings {
gainDb: number
multiband: boolean
}
astra: {
showCoverArt: boolean
showTitle: boolean
showArtist: boolean
showProgress: boolean
showTime: boolean
showControls: boolean
}
}
export const DEFAULT_SCOPE_SETTINGS: ScopeSettings = {
@@ -58,4 +66,12 @@ export const DEFAULT_SCOPE_SETTINGS: ScopeSettings = {
vumeter: { mode: 'bar', orientation: 'horizontal' },
lufsmeter: { mode: 'bar' },
waveform: { mode: DEFAULT_WAVEFORM_MODE, scrollSpeed: 1, gainDb: 0, multiband: false },
astra: {
showCoverArt: true,
showTitle: true,
showArtist: true,
showProgress: true,
showTime: true,
showControls: true,
},
}
+20
View File
@@ -49,6 +49,7 @@ export interface PrismTheme {
vumeter: ThemeTokens
lufsmeter: ThemeTokens
waveform: ThemeTokens
astra: ThemeTokens
}
export interface PrismThemeLocalStateV1 {
@@ -182,6 +183,24 @@ export interface ResolvedWaveformTheme {
highBand: string
}
export interface ResolvedAstraTheme {
accent: string
text: string
subtext: string
background: string
surface: string
border: string
progressTrack: string
progressFill: string
buttonBg: string
buttonBgHover: string
buttonBgActive: string
buttonBorder: string
buttonText: string
statusOk: string
statusError: string
}
export interface PrismResolvedTheme {
id: string
name: string
@@ -196,4 +215,5 @@ export interface PrismResolvedTheme {
vumeter: ResolvedVUMeterTheme
lufsmeter: ResolvedLUFSMeterTheme
waveform: ResolvedWaveformTheme
astra: ResolvedAstraTheme
}