draggables, ipc stuff
This commit is contained in:
18
electron-ui/src/ipc/audio/main.ts
Normal file
18
electron-ui/src/ipc/audio/main.ts
Normal file
@ -0,0 +1,18 @@
|
||||
import { ipcMain } from 'electron';
|
||||
import fs from 'fs';
|
||||
import AudioChannels from './channels';
|
||||
import { LoadAudioBufferArgs, LoadAudioBufferResult } from './types';
|
||||
|
||||
export default function registerAudioIpcHandlers() {
|
||||
ipcMain.handle(
|
||||
AudioChannels.LOAD_AUDIO_BUFFER,
|
||||
async (_, args: LoadAudioBufferArgs): Promise<LoadAudioBufferResult> => {
|
||||
try {
|
||||
const buffer = await fs.promises.readFile(args.filePath);
|
||||
return { buffer };
|
||||
} catch (err: any) {
|
||||
return { error: err.message };
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user