fmod/studio/system/
plugins.rs

1// Copyright (c) 2024 Lily Lyons
2//
3// This Source Code Form is subject to the terms of the Mozilla Public
4// License, v. 2.0. If a copy of the MPL was not distributed with this
5// file, You can obtain one at https://mozilla.org/MPL/2.0/.
6
7use fmod_sys::*;
8use lanyard::Utf8CStr;
9
10use crate::studio::System;
11
12impl System {
13    /// Registers a plugin DSP.
14    ///
15    /// Plugin DSPs used by an event must be registered using this function before loading the bank containing the event.
16    ///
17    /// # Safety
18    ///
19    /// This function provides no gaurdrails or safe API for registering a plugin.
20    /// It can call into non-rust external code.
21    /// Dsp descriptions are intended to be retrieved from a plugin's C API, so it's not feasible to provide a safe API for this function.
22    /// TODO
23    pub unsafe fn register_plugin(
24        &self,
25        dsp_description: *const FMOD_DSP_DESCRIPTION,
26    ) -> Result<()> {
27        unsafe { FMOD_Studio_System_RegisterPlugin(self.inner, dsp_description).to_result() }
28    }
29
30    /// Unregisters a plugin DSP.
31    ///
32    /// # Safety
33    ///
34    /// This function provides no gaurdrails or safe API for unregistering a plugin.
35    /// It can call into non-rust external code.
36    /// TODO
37    pub unsafe fn unregister_plugin(&self, name: &Utf8CStr) -> Result<()> {
38        unsafe { FMOD_Studio_System_UnregisterPlugin(self.inner, name.as_ptr()).to_result() }
39    }
40}