MCPcopy Create free account
hub / github.com/Monogatari/Monogatari / getAudioBufferPersistent

Function getAudioBufferPersistent

src/engine/assets.ts:295–312  ·  view source on GitHub ↗
(engine: VisualNovelEngine, key: string)

Source from the content-addressed store, hash-verified

293}
294
295export async function getAudioBufferPersistent(engine: VisualNovelEngine, key: string): Promise<AudioBuffer | undefined> {
296 const space = await audioBufferSpace(engine);
297
298 if (!space) {
299 return undefined; // IndexedDB not available
300 }
301
302 try {
303 const data = await space.get(key) as { channels: Float32Array[]; sampleRate: number; length: number; numberOfChannels: number } | undefined;
304
305 if (data && data.channels && engine.audioContext) {
306 return deserializeAudioBuffer(data, engine.audioContext);
307 }
308 } catch (error) {
309 console.warn('Failed to retrieve audio buffer from IndexedDB:', error);
310 }
311 return undefined;
312}
313
314export async function removeAudioBufferPersistent(engine: VisualNovelEngine, key: string): Promise<void> {
315 const space = await audioBufferSpace(engine);

Callers

nothing calls this directly

Calls 3

audioBufferSpaceFunction · 0.85
deserializeAudioBufferFunction · 0.85
getMethod · 0.65

Tested by

no test coverage detected