pub fn upload_ir_profile(
file_service: State<'_, FileService>,
file_name: String,
file_bytes: Vec<u8>,
) -> Result<String, String>Expand description
Uploads a custom IR WAV file to the user’s custom IR directory.
The upload pipeline:
- The frontend reads the user-selected file into a
Uint8Arrayand sends the raw bytes together with the original filename. - This command delegates to
FileService::save_custom_ir_profile, which sanitizes the name, validates the WAV data, and writes the file to disk. - On success, the sanitized filename is returned so the frontend can immediately add the new entry to the IR list without re-fetching.
§Errors
Returns Err when the file fails validation (wrong extension, no impulse,
duplicate of a default profile) or cannot be written to disk.