use std::{cell::Cell, marker::PhantomData};
use maudio_sys::ffi as sys;
use crate::{Binding, MaResult};
pub mod backend;
pub struct Context {
inner: *mut sys::ma_context,
_not_sync: PhantomData<Cell<()>>,
}
#[non_exhaustive]
struct ContextConfig {}
impl Binding for Context {
type Raw = *mut sys::ma_context;
fn from_ptr(raw: Self::Raw) -> Self {
Self {
inner: raw,
_not_sync: PhantomData,
}
}
fn to_raw(&self) -> Self::Raw {
self.inner
}
}
impl Context {
fn new_internal() -> MaResult<Self> {
todo!()
}
}
pub(crate) mod context_ffi {
use maudio_sys::ffi as sys;
use crate::{MaResult, MaudioError};
pub fn ma_context_init(
backends: *const sys::ma_backend,
backend_count: u32,
config: *const sys::ma_context_config,
context: *mut sys::ma_context,
) -> MaResult<()> {
let res = unsafe { sys::ma_context_init(backends, backend_count, config, context) };
MaudioError::check(res)
}
}