Skip to main content
← PSoXide SDK guides and examples · SDK f2fec1c301f1 · All Cargo features enabled; check feature gates before use.

Bank

Struct Bank 

Source
pub struct Bank { /* private fields */ }
Expand description

A sequential SPU RAM allocator: uploads cooked .psau samples one after another and hands back where each landed.

Start it at or above [psx_spu::SILENCE_BLOCK] plus one block. psx-spu keeps the first usable block of SPU RAM for the silence every finished one-shot parks on, and [psx_spu::Spu::upload_adpcm] rejects a bank laid over it rather than letting the collision be silent.

Implementations§

Source§

impl Bank

Source

pub const fn new(base: SpuAddr) -> Self

Start a bank at base.

Source

pub const fn next_addr(&self) -> SpuAddr

Where the next upload will land, and so the first address free after everything uploaded so far.

Source

pub fn upload_on(&mut self, spu: &mut Spu, psau: &[u8]) -> Sample

Upload one cooked .psau sample through spu.

§Panics

If psau is not a valid cooked sample, matching the rest of the SDK’s asset handling: a bad include_bytes! is a build mistake, not a runtime condition worth threading a Result through a sound effect for.

Source

pub fn upload(&mut self, psau: &[u8]) -> Sample

👎Deprecated:

use Bank::upload_on with the Spu driver

upload_on on a token the caller does not hold.

§Panics

As upload_on.

Auto Trait Implementations§

§

impl Freeze for Bank

§

impl RefUnwindSafe for Bank

§

impl Send for Bank

§

impl Sync for Bank

§

impl Unpin for Bank

§

impl UnsafeUnpin for Bank

§

impl UnwindSafe for Bank

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.