@nice2dev/ui-audio 1.3.12 → 1.3.14
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/CHANGELOG.md +31 -0
- package/dist/index.cjs +31 -31
- package/dist/index.d.ts +3 -0
- package/dist/index.mjs +5635 -5524
- package/dist/karaoke/PitchMeter.d.ts +45 -0
- package/dist/ui-audio.css +1 -1
- package/dist/utils/pitchMath.d.ts +9 -0
- package/package.json +3 -3
- package/dist/__benchmarks__/audio-latency.bench.d.ts +0 -1
- package/dist/assets/scoringWorker-B1PkYu_m.js +0 -1
- package/dist/constants/index.d.ts +0 -5
- package/dist/constants/ui.d.ts +0 -2
- package/dist/editor/AudioClipBox.d.ts +0 -8
- package/dist/editor/AudioClipInfo.d.ts +0 -6
- package/dist/editor/AudioEditorPianoRoll.d.ts +0 -19
- package/dist/editor/AudioEditorPianoRollContainer.d.ts +0 -19
- package/dist/editor/AudioLayerDetails.d.ts +0 -9
- package/dist/editor/AudioLayerDetailsContainer.d.ts +0 -9
- package/dist/editor/AudioLayersNavContainer.d.ts +0 -8
- package/dist/editor/AudioMiniMap.d.ts +0 -10
- package/dist/editor/AudioMiniMapContainer.d.ts +0 -9
- package/dist/editor/AudioSourceDetails.d.ts +0 -11
- package/dist/editor/AudioTimelineContainer.d.ts +0 -17
- package/dist/editor/AudioTimelineNavContainer.d.ts +0 -13
- package/dist/editor/CCLaneSelector.d.ts +0 -13
- package/dist/editor/editorDisplayModes.d.ts +0 -36
- package/dist/editor/editorIO.d.ts +0 -10
- package/dist/editor/nav/AudioLayersNav.d.ts +0 -8
- package/dist/editor/nav/AudioProjectSectionNav.d.ts +0 -11
- package/dist/editor/nav/AudioTimelineNav.d.ts +0 -13
- package/dist/editor/nav/SaveLoadControls.d.ts +0 -8
- package/dist/editor/panels/AdvancedEditingPanel.d.ts +0 -29
- package/dist/editor/panels/DisplayModeSelector.d.ts +0 -8
- package/dist/editor/panels/LayerTrack.d.ts +0 -16
- package/dist/editor/panels/ProjectPanel.d.ts +0 -22
- package/dist/editor/panels/SectionPanel.d.ts +0 -10
- package/dist/editor/useEditorRecording.d.ts +0 -44
- package/dist/engine/NiceAudioWorklet.d.ts +0 -183
- package/dist/engine/NiceMultitrackExport.d.ts +0 -164
- package/dist/engine/audioKeyboard.d.ts +0 -27
- package/dist/engine/audioLayerDetails.d.ts +0 -12
- package/dist/engine/audioProject.d.ts +0 -9
- package/dist/engine/audioUtils.d.ts +0 -2
- package/dist/engine/generate-pitch-points.d.ts +0 -1
- package/dist/engine/pitch-worklet-processor.d.ts +0 -10
- package/dist/engine/pitch_client.d.ts +0 -15
- package/dist/models/game/modelsGame.d.ts +0 -11
- package/dist/models/index.d.ts +0 -15
- package/dist/models/modelsAiAudio.d.ts +0 -120
- package/dist/models/modelsAiVideo.d.ts +0 -74
- package/dist/models/modelsPlatforms.d.ts +0 -51
- package/dist/player/GenericPlayerStageVisualizer.d.ts +0 -31
- package/dist/player/GenericPlayerTrackList.d.ts +0 -9
- package/dist/player/nowPlayingAdapter.d.ts +0 -18
- package/dist/utils/articulationEngine.d.ts +0 -68
- package/dist/utils/chordScale.d.ts +0 -46
- package/dist/utils/clipLauncher.d.ts +0 -96
- package/dist/utils/envelopeFollower.d.ts +0 -45
- package/dist/utils/gameAudio.d.ts +0 -236
- package/dist/utils/index.d.ts +0 -39
- package/dist/utils/macroSystem.d.ts +0 -96
- package/dist/utils/padKaraokeSession.d.ts +0 -49
- package/dist/utils/songDataHelpers.d.ts +0 -58
|
@@ -1,236 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared Game Audio Manager — lightweight Web Audio API wrapper for
|
|
3
|
-
* loading and playing sound effects in mini-games.
|
|
4
|
-
*
|
|
5
|
-
* Designed to be shared across all games (underpaid, bunny-arena, etc.).
|
|
6
|
-
* Supports:
|
|
7
|
-
* - SFX pool with one-shot playback
|
|
8
|
-
* - Looping background music with crossfade
|
|
9
|
-
* - Master / SFX / Music volume (persisted to localStorage)
|
|
10
|
-
* - Spatial panning (left/right)
|
|
11
|
-
* - Procedural sounds (oscillator-based) for games without audio assets
|
|
12
|
-
*
|
|
13
|
-
* Usage:
|
|
14
|
-
* const audio = GameAudio.getInstance()
|
|
15
|
-
* audio.loadSfx('pickup', '/sounds/pickup.mp3')
|
|
16
|
-
* audio.playSfx('pickup')
|
|
17
|
-
* audio.playTone({ frequency: 440, duration: 0.1, type: 'sine' })
|
|
18
|
-
*/
|
|
19
|
-
export interface VolumeSettings {
|
|
20
|
-
master: number;
|
|
21
|
-
sfx: number;
|
|
22
|
-
music: number;
|
|
23
|
-
}
|
|
24
|
-
export interface ToneOptions {
|
|
25
|
-
/** Frequency in Hz */
|
|
26
|
-
frequency: number;
|
|
27
|
-
/** Duration in seconds */
|
|
28
|
-
duration: number;
|
|
29
|
-
/** Oscillator type */
|
|
30
|
-
type?: OscillatorType;
|
|
31
|
-
/** Volume 0..1 (relative to SFX volume) */
|
|
32
|
-
volume?: number;
|
|
33
|
-
/** Pan -1 (left) to 1 (right) */
|
|
34
|
-
pan?: number;
|
|
35
|
-
/** Frequency sweep target (portamento) */
|
|
36
|
-
frequencyEnd?: number;
|
|
37
|
-
/** Attack time in seconds */
|
|
38
|
-
attack?: number;
|
|
39
|
-
/** Decay time in seconds */
|
|
40
|
-
decay?: number;
|
|
41
|
-
}
|
|
42
|
-
export interface ProceduralSfxPreset {
|
|
43
|
-
tones: ToneOptions[];
|
|
44
|
-
}
|
|
45
|
-
export declare class GameAudio {
|
|
46
|
-
private ctx;
|
|
47
|
-
private masterGain;
|
|
48
|
-
private sfxGain;
|
|
49
|
-
private musicGain;
|
|
50
|
-
private volume;
|
|
51
|
-
private sfxBuffers;
|
|
52
|
-
private musicSource;
|
|
53
|
-
private musicId;
|
|
54
|
-
private constructor();
|
|
55
|
-
static getInstance(): GameAudio;
|
|
56
|
-
private ensureContext;
|
|
57
|
-
getVolume(): VolumeSettings;
|
|
58
|
-
setVolume(partial: Partial<VolumeSettings>): void;
|
|
59
|
-
private applyVolume;
|
|
60
|
-
private loadVolume;
|
|
61
|
-
private saveVolume;
|
|
62
|
-
loadSfx(id: string, url: string): Promise<void>;
|
|
63
|
-
/** Play a loaded SFX. Returns immediately (fire-and-forget). */
|
|
64
|
-
playSfx(id: string, options?: {
|
|
65
|
-
pan?: number;
|
|
66
|
-
volume?: number;
|
|
67
|
-
playbackRate?: number;
|
|
68
|
-
}): void;
|
|
69
|
-
/** Play a procedural tone (oscillator-based SFX). */
|
|
70
|
-
playTone(opts: ToneOptions): void;
|
|
71
|
-
/** Play a preset of multiple tones (chord, arpeggio, noise burst). */
|
|
72
|
-
playPreset(preset: ProceduralSfxPreset): void;
|
|
73
|
-
loadMusic(id: string, url: string): Promise<void>;
|
|
74
|
-
playMusic(id: string, loop?: boolean): void;
|
|
75
|
-
stopMusic(): void;
|
|
76
|
-
dispose(): void;
|
|
77
|
-
}
|
|
78
|
-
export declare const SFX_PRESETS: {
|
|
79
|
-
pickup: {
|
|
80
|
-
tones: {
|
|
81
|
-
frequency: number;
|
|
82
|
-
frequencyEnd: number;
|
|
83
|
-
duration: number;
|
|
84
|
-
type: OscillatorType;
|
|
85
|
-
volume: number;
|
|
86
|
-
}[];
|
|
87
|
-
};
|
|
88
|
-
drop: {
|
|
89
|
-
tones: {
|
|
90
|
-
frequency: number;
|
|
91
|
-
frequencyEnd: number;
|
|
92
|
-
duration: number;
|
|
93
|
-
type: OscillatorType;
|
|
94
|
-
volume: number;
|
|
95
|
-
}[];
|
|
96
|
-
};
|
|
97
|
-
chop: {
|
|
98
|
-
tones: {
|
|
99
|
-
frequency: number;
|
|
100
|
-
duration: number;
|
|
101
|
-
type: OscillatorType;
|
|
102
|
-
volume: number;
|
|
103
|
-
}[];
|
|
104
|
-
};
|
|
105
|
-
serve: {
|
|
106
|
-
tones: {
|
|
107
|
-
frequency: number;
|
|
108
|
-
duration: number;
|
|
109
|
-
type: OscillatorType;
|
|
110
|
-
volume: number;
|
|
111
|
-
}[];
|
|
112
|
-
};
|
|
113
|
-
combo: {
|
|
114
|
-
tones: {
|
|
115
|
-
frequency: number;
|
|
116
|
-
frequencyEnd: number;
|
|
117
|
-
duration: number;
|
|
118
|
-
type: OscillatorType;
|
|
119
|
-
volume: number;
|
|
120
|
-
}[];
|
|
121
|
-
};
|
|
122
|
-
error: {
|
|
123
|
-
tones: {
|
|
124
|
-
frequency: number;
|
|
125
|
-
frequencyEnd: number;
|
|
126
|
-
duration: number;
|
|
127
|
-
type: OscillatorType;
|
|
128
|
-
volume: number;
|
|
129
|
-
}[];
|
|
130
|
-
};
|
|
131
|
-
explosion: {
|
|
132
|
-
tones: {
|
|
133
|
-
frequency: number;
|
|
134
|
-
frequencyEnd: number;
|
|
135
|
-
duration: number;
|
|
136
|
-
type: OscillatorType;
|
|
137
|
-
volume: number;
|
|
138
|
-
}[];
|
|
139
|
-
};
|
|
140
|
-
cannon: {
|
|
141
|
-
tones: {
|
|
142
|
-
frequency: number;
|
|
143
|
-
frequencyEnd: number;
|
|
144
|
-
duration: number;
|
|
145
|
-
type: OscillatorType;
|
|
146
|
-
volume: number;
|
|
147
|
-
}[];
|
|
148
|
-
};
|
|
149
|
-
hit: {
|
|
150
|
-
tones: {
|
|
151
|
-
frequency: number;
|
|
152
|
-
frequencyEnd: number;
|
|
153
|
-
duration: number;
|
|
154
|
-
type: OscillatorType;
|
|
155
|
-
volume: number;
|
|
156
|
-
}[];
|
|
157
|
-
};
|
|
158
|
-
alarm: {
|
|
159
|
-
tones: {
|
|
160
|
-
frequency: number;
|
|
161
|
-
frequencyEnd: number;
|
|
162
|
-
duration: number;
|
|
163
|
-
type: OscillatorType;
|
|
164
|
-
volume: number;
|
|
165
|
-
attack: number;
|
|
166
|
-
decay: number;
|
|
167
|
-
}[];
|
|
168
|
-
};
|
|
169
|
-
coin: {
|
|
170
|
-
tones: {
|
|
171
|
-
frequency: number;
|
|
172
|
-
duration: number;
|
|
173
|
-
type: OscillatorType;
|
|
174
|
-
volume: number;
|
|
175
|
-
}[];
|
|
176
|
-
};
|
|
177
|
-
star: {
|
|
178
|
-
tones: {
|
|
179
|
-
frequency: number;
|
|
180
|
-
duration: number;
|
|
181
|
-
type: OscillatorType;
|
|
182
|
-
volume: number;
|
|
183
|
-
}[];
|
|
184
|
-
};
|
|
185
|
-
dash: {
|
|
186
|
-
tones: {
|
|
187
|
-
frequency: number;
|
|
188
|
-
frequencyEnd: number;
|
|
189
|
-
duration: number;
|
|
190
|
-
type: OscillatorType;
|
|
191
|
-
volume: number;
|
|
192
|
-
}[];
|
|
193
|
-
};
|
|
194
|
-
gameOver: {
|
|
195
|
-
tones: {
|
|
196
|
-
frequency: number;
|
|
197
|
-
frequencyEnd: number;
|
|
198
|
-
duration: number;
|
|
199
|
-
type: OscillatorType;
|
|
200
|
-
volume: number;
|
|
201
|
-
}[];
|
|
202
|
-
};
|
|
203
|
-
victory: {
|
|
204
|
-
tones: {
|
|
205
|
-
frequency: number;
|
|
206
|
-
duration: number;
|
|
207
|
-
type: OscillatorType;
|
|
208
|
-
volume: number;
|
|
209
|
-
}[];
|
|
210
|
-
};
|
|
211
|
-
tick: {
|
|
212
|
-
tones: {
|
|
213
|
-
frequency: number;
|
|
214
|
-
duration: number;
|
|
215
|
-
type: OscillatorType;
|
|
216
|
-
volume: number;
|
|
217
|
-
}[];
|
|
218
|
-
};
|
|
219
|
-
countdownTick: {
|
|
220
|
-
tones: {
|
|
221
|
-
frequency: number;
|
|
222
|
-
duration: number;
|
|
223
|
-
type: OscillatorType;
|
|
224
|
-
volume: number;
|
|
225
|
-
}[];
|
|
226
|
-
};
|
|
227
|
-
countdownFinal: {
|
|
228
|
-
tones: {
|
|
229
|
-
frequency: number;
|
|
230
|
-
duration: number;
|
|
231
|
-
type: OscillatorType;
|
|
232
|
-
volume: number;
|
|
233
|
-
}[];
|
|
234
|
-
};
|
|
235
|
-
};
|
|
236
|
-
export type SfxPresetId = keyof typeof SFX_PRESETS;
|
package/dist/utils/index.d.ts
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
export * from './audioEditorUtils';
|
|
2
|
-
export * from './audioFxUtils';
|
|
3
|
-
export { generateUltrastarText } from './audioPitchAlgorithms';
|
|
4
|
-
export * from './audioPitchAnalyzeFile';
|
|
5
|
-
export * from './audioTimelineUtils';
|
|
6
|
-
export * from './audioMidiUtils';
|
|
7
|
-
export * from './karaokeHelpers';
|
|
8
|
-
export * from './karaokeMetadata';
|
|
9
|
-
export * from './karaokeScoring';
|
|
10
|
-
export * from './arpeggiator';
|
|
11
|
-
export * from './articulationEngine';
|
|
12
|
-
export * from './envelopeFollower';
|
|
13
|
-
export * from './lfoEngine';
|
|
14
|
-
export * from './stepSequencer';
|
|
15
|
-
export * from './vocalEffectsEngine';
|
|
16
|
-
export * from './vocalPerformanceMetrics';
|
|
17
|
-
export * from './BaseStreamClient';
|
|
18
|
-
export * from './crepeStreaming';
|
|
19
|
-
export * from './librosaStreaming';
|
|
20
|
-
export * from './ccAutomation';
|
|
21
|
-
export * from './chordScale';
|
|
22
|
-
export * from './clipLauncher';
|
|
23
|
-
export * from './colorResolver';
|
|
24
|
-
export * from './drawTool';
|
|
25
|
-
export * from './grooveTemplates';
|
|
26
|
-
export * from './macroSystem';
|
|
27
|
-
export * from './undoRedoUtils';
|
|
28
|
-
export * from './musicPlayerUtils';
|
|
29
|
-
export * from './songDataHelpers';
|
|
30
|
-
export * from './padKaraokeSession';
|
|
31
|
-
export * from './pianoRollUtils';
|
|
32
|
-
export * from './gameAudio';
|
|
33
|
-
export * from './latencyEstimate';
|
|
34
|
-
export * from './shortcutManager';
|
|
35
|
-
export * from './audioDragDrop';
|
|
36
|
-
export * from './midiCCMapping';
|
|
37
|
-
export { logger } from './logger';
|
|
38
|
-
export type { ScopedLogger } from './logger';
|
|
39
|
-
export * from './sanitize';
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Macro system — macro controllers, parameter mapping, and modulation routing.
|
|
3
|
-
* Maps macro knobs → multiple target parameters with curves and ranges.
|
|
4
|
-
*/
|
|
5
|
-
export type ModulationCurve = 'linear' | 'exponential' | 'logarithmic' | 's-curve' | 'step' | 'inverse';
|
|
6
|
-
export interface MacroMapping {
|
|
7
|
-
id: string;
|
|
8
|
-
/** Target parameter identifier (e.g., 'filter.frequency', 'reverb.mix') */
|
|
9
|
-
targetParam: string;
|
|
10
|
-
/** Target component/effect identifier */
|
|
11
|
-
targetId: string;
|
|
12
|
-
/** Min output value */
|
|
13
|
-
minValue: number;
|
|
14
|
-
/** Max output value */
|
|
15
|
-
maxValue: number;
|
|
16
|
-
/** Curve type for value transformation */
|
|
17
|
-
curve: ModulationCurve;
|
|
18
|
-
/** Bipolar: if true, 0.5 macro = center, below inverts range */
|
|
19
|
-
bipolar: boolean;
|
|
20
|
-
/** Enabled flag */
|
|
21
|
-
enabled: boolean;
|
|
22
|
-
}
|
|
23
|
-
export interface MacroController {
|
|
24
|
-
id: string;
|
|
25
|
-
name: string;
|
|
26
|
-
/** Current value 0-1 */
|
|
27
|
-
value: number;
|
|
28
|
-
/** Default value */
|
|
29
|
-
defaultValue: number;
|
|
30
|
-
/** Color for UI */
|
|
31
|
-
color: string;
|
|
32
|
-
/** Mappings to target parameters */
|
|
33
|
-
mappings: MacroMapping[];
|
|
34
|
-
/** MIDI CC number for external control (null = unmapped) */
|
|
35
|
-
midiCC?: number;
|
|
36
|
-
/** Smoothing time in ms */
|
|
37
|
-
smoothingMs: number;
|
|
38
|
-
}
|
|
39
|
-
export interface LFOModulator {
|
|
40
|
-
id: string;
|
|
41
|
-
name: string;
|
|
42
|
-
/** LFO waveform */
|
|
43
|
-
waveform: 'sine' | 'triangle' | 'square' | 'sawtooth' | 'random';
|
|
44
|
-
/** Rate in Hz (free) or note division (synced) */
|
|
45
|
-
rate: number;
|
|
46
|
-
/** Sync to BPM */
|
|
47
|
-
synced: boolean;
|
|
48
|
-
/** Phase offset 0-1 */
|
|
49
|
-
phase: number;
|
|
50
|
-
/** Depth 0-1 */
|
|
51
|
-
depth: number;
|
|
52
|
-
/** Center value */
|
|
53
|
-
center: number;
|
|
54
|
-
/** Target mappings */
|
|
55
|
-
mappings: MacroMapping[];
|
|
56
|
-
/** Is running */
|
|
57
|
-
active: boolean;
|
|
58
|
-
}
|
|
59
|
-
export interface ModulationMatrix {
|
|
60
|
-
macros: MacroController[];
|
|
61
|
-
lfos: LFOModulator[];
|
|
62
|
-
}
|
|
63
|
-
/** Create an empty modulation matrix with N macro knobs */
|
|
64
|
-
export declare function createModulationMatrix(macroCount?: number, lfoCount?: number): ModulationMatrix;
|
|
65
|
-
/** Add a mapping to a macro */
|
|
66
|
-
export declare function addMacroMapping(matrix: ModulationMatrix, macroId: string, targetId: string, targetParam: string, minValue?: number, maxValue?: number, curve?: ModulationCurve): ModulationMatrix;
|
|
67
|
-
/** Remove a mapping from a macro */
|
|
68
|
-
export declare function removeMacroMapping(matrix: ModulationMatrix, macroId: string, mappingId: string): ModulationMatrix;
|
|
69
|
-
/** Set macro value and compute all mapped output values */
|
|
70
|
-
export declare function setMacroValue(matrix: ModulationMatrix, macroId: string, value: number): {
|
|
71
|
-
matrix: ModulationMatrix;
|
|
72
|
-
outputs: Array<{
|
|
73
|
-
targetId: string;
|
|
74
|
-
targetParam: string;
|
|
75
|
-
value: number;
|
|
76
|
-
}>;
|
|
77
|
-
};
|
|
78
|
-
/** Apply curve transformation to map macro value → output value */
|
|
79
|
-
export declare function applyCurve(input: number, mapping: MacroMapping): number;
|
|
80
|
-
/** Compute LFO value at a given time */
|
|
81
|
-
export declare function computeLFOValue(lfo: LFOModulator, timeSeconds: number): number;
|
|
82
|
-
/** Get all LFO outputs at a given time */
|
|
83
|
-
export declare function computeAllLFOOutputs(matrix: ModulationMatrix, timeSeconds: number): Array<{
|
|
84
|
-
targetId: string;
|
|
85
|
-
targetParam: string;
|
|
86
|
-
value: number;
|
|
87
|
-
}>;
|
|
88
|
-
/** Reset macro to its default value */
|
|
89
|
-
export declare function resetMacro(matrix: ModulationMatrix, macroId: string): ModulationMatrix;
|
|
90
|
-
/** Add mapping to an LFO */
|
|
91
|
-
export declare function addLFOMapping(matrix: ModulationMatrix, lfoId: string, targetId: string, targetParam: string, minValue?: number, maxValue?: number): ModulationMatrix;
|
|
92
|
-
/** Get available modulation curves */
|
|
93
|
-
export declare function getModulationCurves(): Array<{
|
|
94
|
-
curve: ModulationCurve;
|
|
95
|
-
label: string;
|
|
96
|
-
}>;
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Karaoke Pad Session — play karaoke by hitting notes with keyboard/pad instead of singing.
|
|
3
|
-
* Difficulty levels control how many keys are needed (more keys = harder).
|
|
4
|
-
*/
|
|
5
|
-
export type PadKaraokeDifficulty = 'easy' | 'normal' | 'hard' | 'expert';
|
|
6
|
-
export interface PadKaraokeConfig {
|
|
7
|
-
difficulty: PadKaraokeDifficulty;
|
|
8
|
-
/** Number of active keys for this difficulty */
|
|
9
|
-
keyCount: number;
|
|
10
|
-
/** Tolerance in semitones for "correct" hit */
|
|
11
|
-
semitoneTolerance: number;
|
|
12
|
-
/** Window in ms before the note to accept early hits */
|
|
13
|
-
preWindowMs: number;
|
|
14
|
-
/** Window in ms after the note to accept late hits */
|
|
15
|
-
postWindowMs: number;
|
|
16
|
-
}
|
|
17
|
-
export interface PadKaraokeNote {
|
|
18
|
-
id: number;
|
|
19
|
-
pitch: number;
|
|
20
|
-
startTime: number;
|
|
21
|
-
duration: number;
|
|
22
|
-
lyric?: string;
|
|
23
|
-
isGolden?: boolean;
|
|
24
|
-
}
|
|
25
|
-
export interface PadKaraokeHit {
|
|
26
|
-
noteId: number;
|
|
27
|
-
padIndex: number;
|
|
28
|
-
accuracy: 'perfect' | 'good' | 'ok' | 'miss';
|
|
29
|
-
timeDeltaMs: number;
|
|
30
|
-
score: number;
|
|
31
|
-
}
|
|
32
|
-
export interface PadKaraokeResult {
|
|
33
|
-
totalScore: number;
|
|
34
|
-
maxScore: number;
|
|
35
|
-
hits: PadKaraokeHit[];
|
|
36
|
-
combo: number;
|
|
37
|
-
maxCombo: number;
|
|
38
|
-
accuracy: number;
|
|
39
|
-
grade: 'S' | 'A' | 'B' | 'C' | 'D' | 'F';
|
|
40
|
-
}
|
|
41
|
-
export declare const DIFFICULTY_CONFIGS: Record<PadKaraokeDifficulty, PadKaraokeConfig>;
|
|
42
|
-
/** Map a MIDI note pitch to a pad index given difficulty key count */
|
|
43
|
-
export declare function pitchToPadIndex(pitch: number, keyCount: number, minPitch?: number, maxPitch?: number): number;
|
|
44
|
-
/** Check if a pad press matches an expected note */
|
|
45
|
-
export declare function evaluateHit(padIndex: number, pressTimeMs: number, expectedNote: PadKaraokeNote, config: PadKaraokeConfig, minPitch?: number, maxPitch?: number): PadKaraokeHit;
|
|
46
|
-
/** Calculate final results from all hits */
|
|
47
|
-
export declare function calculateResult(hits: PadKaraokeHit[], totalNotes: number): PadKaraokeResult;
|
|
48
|
-
/** Generate a key mapping label for UI display */
|
|
49
|
-
export declare function getPadKeyLabel(padIndex: number, keyCount: number): string;
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* songDataHelpers — Shared accessors for cover URL, year, and genre
|
|
3
|
-
* from KaraokeSong / KaraokeSongFile, consolidating linkedSong data.
|
|
4
|
-
*
|
|
5
|
-
* Handles TWO data shapes for linkedSong:
|
|
6
|
-
* A) DTO shape (from /get-filtered-songs): flat fields like albumCoverUrl, albumReleaseYear, artistName
|
|
7
|
-
* B) Raw entity shape (from /filter-songs): nested objects like album.coverUrl, album.releaseYear, primaryArtist.name
|
|
8
|
-
*
|
|
9
|
-
* Priority mirrors KaraokeSongBrowser.getSongCover():
|
|
10
|
-
* 1. linkedSong.albumCoverUrl / album.coverUrl (highest quality, from catalog)
|
|
11
|
-
* 2. linkedSong.externalCoverUrl (Spotify / external service)
|
|
12
|
-
* 3. song.externalCoverUrl (from import)
|
|
13
|
-
* 4. song.coverPath / coverImage (local / YouTube)
|
|
14
|
-
*/
|
|
15
|
-
/** DTO shape returned by /get-filtered-songs (LinkedSongInfoDto) */
|
|
16
|
-
interface LinkedSongDto {
|
|
17
|
-
albumCoverUrl?: string | null;
|
|
18
|
-
externalCoverUrl?: string | null;
|
|
19
|
-
albumReleaseYear?: number | null;
|
|
20
|
-
artistName?: string | null;
|
|
21
|
-
}
|
|
22
|
-
/** Raw entity shape returned by /filter-songs (Song with nav properties) */
|
|
23
|
-
interface LinkedSongRaw {
|
|
24
|
-
album?: {
|
|
25
|
-
coverUrl?: string | null;
|
|
26
|
-
releaseYear?: number | null;
|
|
27
|
-
} | null;
|
|
28
|
-
primaryArtist?: {
|
|
29
|
-
name?: string | null;
|
|
30
|
-
imageUrl?: string | null;
|
|
31
|
-
} | null;
|
|
32
|
-
externalCoverUrl?: string | null;
|
|
33
|
-
}
|
|
34
|
-
type LinkedSongAny = (LinkedSongDto & LinkedSongRaw) | null | undefined;
|
|
35
|
-
interface SongLike {
|
|
36
|
-
coverPath?: string;
|
|
37
|
-
coverImage?: string;
|
|
38
|
-
externalCoverUrl?: string | null;
|
|
39
|
-
genre?: string;
|
|
40
|
-
year?: number | string;
|
|
41
|
-
linkedSong?: LinkedSongAny;
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Resolve the best available cover URL for a song,
|
|
45
|
-
* including data from the linked Song entity.
|
|
46
|
-
*/
|
|
47
|
-
export declare function getSongCoverUrl(s: SongLike): string | undefined;
|
|
48
|
-
/**
|
|
49
|
-
* Resolve the best available year, falling back to linkedSong.albumReleaseYear.
|
|
50
|
-
*/
|
|
51
|
-
export declare function getSongYear(s: SongLike): number | undefined;
|
|
52
|
-
/**
|
|
53
|
-
* Resolve the best available genre.
|
|
54
|
-
* (LinkedSongInfoDto has no genre field, so this is just the direct value,
|
|
55
|
-
* but centralised here for future expansion.)
|
|
56
|
-
*/
|
|
57
|
-
export declare function getSongGenre(s: SongLike): string | undefined;
|
|
58
|
-
export {};
|