Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,34 @@ jobs:
- name: Install cargo-audit
run: cargo install cargo-audit

- name: Cache apt packages
if: contains(matrix.os, 'ubuntu')
uses: actions/cache@v4
with:
path: ~/apt-cache
key: ${{ runner.os }}-apt-${{ hashFiles('.github/workflows/rust.yml') }}
restore-keys: |
${{ runner.os }}-apt-

- name: Restore apt cache
if: contains(matrix.os, 'ubuntu')
run: |
sudo mkdir -p /var/cache/apt/archives
sudo cp -r ~/apt-cache/. /var/cache/apt/archives/ 2>/dev/null || true

- name: Install system packages
if: contains(matrix.os, 'ubuntu')
run: |
sudo apt-get update
sudo apt-get update
sudo apt-get install -y libx11-dev

- name: Save apt cache
if: contains(matrix.os, 'ubuntu')
run: |
mkdir -p ~/apt-cache
cp /var/cache/apt/archives/*.deb ~/apt-cache/ 2>/dev/null || true

- name: Check formatting
run: cargo fmt --check

Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "maolan-plugin-host"
version = "0.1.2"
version = "0.1.3"
edition = "2024"
description = "Out-of-process audio plugin hosting library"
authors = ["Maolan Team"]
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

Out-of-process plugin host for the [Maolan DAW](https://maolan.github.io).

This crate provides the reusable plugin-host library. Applications can build
their own host process around it and communicate with the audio engine over
shared memory and lightweight event channels. The Maolan DAW's host executable
is built from `maolan/src/bin/maolan-plugin-host.rs`.
This crate provides the reusable plugin-host library and a thin
`maolan-plugin-host` executable around it. Applications can also build their
own host process and communicate with the audio engine over shared memory and
lightweight event channels.

## Supported formats

Expand Down
12 changes: 8 additions & 4 deletions src/au/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -767,8 +767,10 @@ mod tests {
#[test]
fn au_params_scratch_roundtrip() {
let params = sample_params();
let mut shm = vec![0u8; LAYOUT_SIZE];
let ptr = shm.as_mut_ptr();
let mut shm = std::iter::repeat_with(ShmHeader::default)
.take(LAYOUT_SIZE.div_ceil(std::mem::size_of::<ShmHeader>()))
.collect::<Vec<_>>();
let ptr = shm.as_mut_ptr().cast::<u8>();
unsafe {
init_shm_layout(ptr, LAYOUT_SIZE);
write_au_params_to_scratch(ptr, &params).expect("write");
Expand All @@ -780,8 +782,10 @@ mod tests {
#[test]
fn au_state_roundtrip() {
let state = vec![0xAA; 1000];
let mut shm = vec![0u8; LAYOUT_SIZE];
let ptr = shm.as_mut_ptr();
let mut shm = std::iter::repeat_with(ShmHeader::default)
.take(LAYOUT_SIZE.div_ceil(std::mem::size_of::<ShmHeader>()))
.collect::<Vec<_>>();
let ptr = shm.as_mut_ptr().cast::<u8>();
unsafe {
init_shm_layout(ptr, LAYOUT_SIZE);
let scratch = scratch_ptr(ptr);
Expand Down
4 changes: 2 additions & 2 deletions src/au/v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -344,9 +344,9 @@ extern "C" fn input_render_callback(
// descriptors contiguously after the count, so index past the
// declared `[AudioBuffer; 1]` via raw pointer arithmetic.
let buffers = list.buffers.as_mut_ptr();
for i in 0..n {
for (i, input) in input_ref.ptrs.iter().copied().enumerate().take(n) {
let buf = &mut *buffers.add(i);
buf.data = input_ref.ptrs[i].cast();
buf.data = input.cast();
buf.number_channels = 1;
buf.data_byte_size = frames * 4;
}
Expand Down
2 changes: 1 addition & 1 deletion src/gui_x11.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ pub mod x11 {
}
/// # Safety
/// No-op stub; all arguments are ignored.
pub unsafe fn create_simple_window(
pub unsafe extern "C" fn create_simple_window(
_display: *mut Display,
_parent: Window,
_x: c_int,
Expand Down
5 changes: 5 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
use maolan_plugin_host::cli::run;

fn main() {
run();
}
12 changes: 8 additions & 4 deletions src/vst3/interfaces.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1575,10 +1575,14 @@ fn extract_string128(s: &String128) -> String {
#[cfg(test)]
mod tests {
use super::*;
#[cfg(not(miri))]
use std::fs::{self, File};
#[cfg(not(miri))]
use std::path::PathBuf;
#[cfg(not(miri))]
use std::time::{SystemTime, UNIX_EPOCH};

#[cfg(not(miri))]
fn unique_temp_dir(name: &str) -> PathBuf {
let nanos = SystemTime::now()
.duration_since(UNIX_EPOCH)
Expand Down Expand Up @@ -1615,7 +1619,7 @@ mod tests {
assert_eq!(extract_cstring(&bytes), "XYZ");
}

#[cfg(unix)]
#[cfg(all(unix, not(miri)))]
#[test]
fn get_module_path_returns_unix_shared_object_path() {
let bundle_path = unique_temp_dir("vst3-module").join("Example.vst3");
Expand All @@ -1634,7 +1638,7 @@ mod tests {
let _ = fs::remove_dir_all(bundle_path.parent().expect("bundle parent"));
}

#[cfg(unix)]
#[cfg(all(unix, not(miri)))]
#[test]
fn get_module_path_errors_when_unix_module_is_missing() {
let bundle_path = unique_temp_dir("missing-vst3").join("Missing.vst3");
Expand All @@ -1647,7 +1651,7 @@ mod tests {
let _ = fs::remove_dir_all(bundle_path.parent().expect("bundle parent"));
}

#[cfg(target_os = "windows")]
#[cfg(all(target_os = "windows", not(miri)))]
#[test]
fn get_module_path_returns_windows_vst3_binary_path() {
let bundle_path = unique_temp_dir("vst3-module").join("Example.vst3");
Expand All @@ -1666,7 +1670,7 @@ mod tests {
let _ = fs::remove_dir_all(bundle_path.parent().expect("bundle parent"));
}

#[cfg(target_os = "windows")]
#[cfg(all(target_os = "windows", not(miri)))]
#[test]
fn get_module_path_errors_when_windows_module_is_missing() {
let bundle_path = unique_temp_dir("missing-vst3").join("Missing.vst3");
Expand Down
2 changes: 1 addition & 1 deletion src/vst3_lv2_host.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ mod x11_ffi {
}
/// # Safety
/// No-op stub; all arguments are ignored.
pub unsafe fn create_simple_window(
pub unsafe extern "C" fn create_simple_window(
_display: *mut Display,
_parent: Window,
_x: c_int,
Expand Down
2 changes: 1 addition & 1 deletion tests/au_gui_smoke.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![cfg(target_os = "macos")]
#![cfg(all(target_os = "macos", not(miri)))]
use maolan_plugin_protocol::protocol::*;
use maolan_plugin_protocol::shm::ShmMapping;
use std::sync::atomic::Ordering;
Expand Down
2 changes: 1 addition & 1 deletion tests/au_host_smoke.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
//! audio blocks, a DAW-side parameter set, and a state save/restore
//! roundtrip over the real shared-memory protocol.

#![cfg(target_os = "macos")]
#![cfg(all(target_os = "macos", not(miri)))]

use maolan_plugin_protocol::protocol::*;
use maolan_plugin_protocol::ringbuf::RingBuffer;
Expand Down
2 changes: 1 addition & 1 deletion tests/au_v3_smoke.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
//! against one and pumps an audio block over SHM. This machine may have no
//! AUv3 extensions installed; the test skips with a message in that case.

#![cfg(target_os = "macos")]
#![cfg(all(target_os = "macos", not(miri)))]

use maolan_plugin_host::au::v3::V3Unit;
use maolan_plugin_host::au::{AuComponentDesc, AuInitConfig, AuTransport, AuUnit};
Expand Down
Loading