1
0
Fork 0

Rename CPAL standalone backend to CpalMidir

To make it a bit more obvious what it ends up using for IO.
This commit is contained in:
Robbert van der Helm 2023-02-25 14:43:40 +01:00
parent d777b02d33
commit 045598aa09
3 changed files with 11 additions and 11 deletions

View file

@ -80,7 +80,7 @@ pub fn nih_export_standalone_with_args<P: Plugin, Args: IntoIterator<Item = Stri
#[cfg(target_os = "linux")] #[cfg(target_os = "linux")]
let result = result.or_else(|_| { let result = result.or_else(|_| {
match backend::Cpal::new::<P>(config.clone(), cpal::HostId::Alsa) { match backend::CpalMidir::new::<P>(config.clone(), cpal::HostId::Alsa) {
Ok(backend) => { Ok(backend) => {
nih_log!("Using the ALSA backend"); nih_log!("Using the ALSA backend");
Ok(run_wrapper::<P, _>(backend, config.clone())) Ok(run_wrapper::<P, _>(backend, config.clone()))
@ -96,7 +96,7 @@ pub fn nih_export_standalone_with_args<P: Plugin, Args: IntoIterator<Item = Stri
}); });
#[cfg(target_os = "macos")] #[cfg(target_os = "macos")]
let result = result.or_else(|_| { let result = result.or_else(|_| {
match backend::Cpal::new::<P>(config.clone(), cpal::HostId::CoreAudio) { match backend::CpalMidir::new::<P>(config.clone(), cpal::HostId::CoreAudio) {
Ok(backend) => { Ok(backend) => {
nih_log!("Using the CoreAudio backend"); nih_log!("Using the CoreAudio backend");
Ok(run_wrapper::<P, _>(backend, config.clone())) Ok(run_wrapper::<P, _>(backend, config.clone()))
@ -112,7 +112,7 @@ pub fn nih_export_standalone_with_args<P: Plugin, Args: IntoIterator<Item = Stri
}); });
#[cfg(target_os = "windows")] #[cfg(target_os = "windows")]
let result = result.or_else(|_| { let result = result.or_else(|_| {
match backend::Cpal::new::<P>(config.clone(), cpal::HostId::Wasapi) { match backend::CpalMidir::new::<P>(config.clone(), cpal::HostId::Wasapi) {
Ok(backend) => { Ok(backend) => {
nih_log!("Using the WASAPI backend"); nih_log!("Using the WASAPI backend");
Ok(run_wrapper::<P, _>(backend, config.clone())) Ok(run_wrapper::<P, _>(backend, config.clone()))
@ -141,7 +141,7 @@ pub fn nih_export_standalone_with_args<P: Plugin, Args: IntoIterator<Item = Stri
}, },
#[cfg(target_os = "linux")] #[cfg(target_os = "linux")]
config::BackendType::Alsa => { config::BackendType::Alsa => {
match backend::Cpal::new::<P>(config.clone(), cpal::HostId::Alsa) { match backend::CpalMidir::new::<P>(config.clone(), cpal::HostId::Alsa) {
Ok(backend) => run_wrapper::<P, _>(backend, config), Ok(backend) => run_wrapper::<P, _>(backend, config),
Err(err) => { Err(err) => {
nih_error!("Could not initialize the ALSA backend: {:#}", err); nih_error!("Could not initialize the ALSA backend: {:#}", err);
@ -151,7 +151,7 @@ pub fn nih_export_standalone_with_args<P: Plugin, Args: IntoIterator<Item = Stri
} }
#[cfg(target_os = "macos")] #[cfg(target_os = "macos")]
config::BackendType::CoreAudio => { config::BackendType::CoreAudio => {
match backend::Cpal::new::<P>(config.clone(), cpal::HostId::CoreAudio) { match backend::CpalMidir::new::<P>(config.clone(), cpal::HostId::CoreAudio) {
Ok(backend) => run_wrapper::<P, _>(backend, config), Ok(backend) => run_wrapper::<P, _>(backend, config),
Err(err) => { Err(err) => {
nih_error!("Could not initialize the CoreAudio backend: {:#}", err); nih_error!("Could not initialize the CoreAudio backend: {:#}", err);
@ -161,7 +161,7 @@ pub fn nih_export_standalone_with_args<P: Plugin, Args: IntoIterator<Item = Stri
} }
#[cfg(target_os = "windows")] #[cfg(target_os = "windows")]
config::BackendType::Wasapi => { config::BackendType::Wasapi => {
match backend::Cpal::new::<P>(config.clone(), cpal::HostId::Wasapi) { match backend::CpalMidir::new::<P>(config.clone(), cpal::HostId::Wasapi) {
Ok(backend) => run_wrapper::<P, _>(backend, config), Ok(backend) => run_wrapper::<P, _>(backend, config),
Err(err) => { Err(err) => {
nih_error!("Could not initialize the WASAPI backend: {:#}", err); nih_error!("Could not initialize the WASAPI backend: {:#}", err);

View file

@ -6,7 +6,7 @@ mod cpal;
mod dummy; mod dummy;
mod jack; mod jack;
pub use self::cpal::Cpal; pub use self::cpal::CpalMidir;
pub use self::dummy::Dummy; pub use self::dummy::Dummy;
pub use self::jack::Jack; pub use self::jack::Jack;
pub use crate::buffer::Buffer; pub use crate::buffer::Buffer;

View file

@ -17,7 +17,7 @@ use crate::midi::{MidiConfig, PluginNoteEvent};
use crate::plugin::Plugin; use crate::plugin::Plugin;
/// Uses CPAL for audio and midir for MIDI. /// Uses CPAL for audio and midir for MIDI.
pub struct Cpal { pub struct CpalMidir {
config: WrapperConfig, config: WrapperConfig,
audio_io_layout: AudioIOLayout, audio_io_layout: AudioIOLayout,
@ -29,7 +29,7 @@ pub struct Cpal {
// TODO: MIDI // TODO: MIDI
} }
impl<P: Plugin> Backend<P> for Cpal { impl<P: Plugin> Backend<P> for CpalMidir {
fn run( fn run(
&mut self, &mut self,
cb: impl FnMut( cb: impl FnMut(
@ -135,7 +135,7 @@ impl<P: Plugin> Backend<P> for Cpal {
} }
} }
impl Cpal { impl CpalMidir {
/// Initialize the backend with the specified host. Returns an error if this failed for whatever /// Initialize the backend with the specified host. Returns an error if this failed for whatever
/// reason. /// reason.
pub fn new<P: Plugin>(config: WrapperConfig, cpal_host_id: cpal::HostId) -> Result<Self> { pub fn new<P: Plugin>(config: WrapperConfig, cpal_host_id: cpal::HostId) -> Result<Self> {
@ -293,7 +293,7 @@ impl Cpal {
nih_warn!("Auxiliary outputs are not supported with this audio backend"); nih_warn!("Auxiliary outputs are not supported with this audio backend");
} }
Ok(Cpal { Ok(CpalMidir {
config, config,
audio_io_layout, audio_io_layout,