Struct rrise::sound_engine::PostEvent
source · [−]pub struct PostEvent<'a> { /* private fields */ }Expand description
Helper to post events to the sound engine.
Use PostEvent::post to post your event to the sound engine.
The callback function can be used to be noticed when markers are reached or when the event is finished.
An array of Wave file sources can be provided to resolve External Sources triggered by the event.
Return The playing ID of the event launched, or AK_INVALID_PLAYING_ID if posting the event failed
Remarks
- If used, the array of external sources should contain the information for each external source triggered by the event. When triggering an Event with multiple external sources, you need to differentiate each source by using the cookie property in the External Source in the Wwise project and in AkExternalSourceInfo.
- If an event triggers the playback of more than one external source, they must be named uniquely in the project (therefore have a unique cookie) in order to tell them apart when filling the AkExternalSourceInfo structures.
See also
- render_audio
- [get_source_play_position]
Implementations
sourceimpl<'a> PostEvent<'a>
impl<'a> PostEvent<'a>
sourcepub fn new<T: Into<AkID<'a>>>(
game_obj_id: AkGameObjectID,
event_id: T
) -> PostEvent<'a>
pub fn new<T: Into<AkID<'a>>>(
game_obj_id: AkGameObjectID,
event_id: T
) -> PostEvent<'a>
Select an event by name or by ID, to play on a given game object.
sourcepub fn add_flags(&mut self, flags: AkCallbackType) -> &mut Self
pub fn add_flags(&mut self, flags: AkCallbackType) -> &mut Self
Add flags before posting. Bitmask: see AkCallbackType.
See also post_with_callback
sourcepub fn flags(&mut self, flags: AkCallbackType) -> &mut Self
pub fn flags(&mut self, flags: AkCallbackType) -> &mut Self
Set flags before posting. Bitmask: see AkCallbackType
See also post_with_callback
sourcepub fn playing_id(&mut self, id: AkPlayingID) -> &mut Self
pub fn playing_id(&mut self, id: AkPlayingID) -> &mut Self
Advanced users only. Specify the playing ID to target with the event. Will Cause active actions in this event to target an existing Playing ID. Let it be AK_INVALID_PLAYING_ID or do not specify any for normal playback.
sourcepub fn post(&self) -> Result<AkPlayingID, AkResult>
pub fn post(&self) -> Result<AkPlayingID, AkResult>
Posts the event to the sound engine.
sourcepub fn post_with_callback<F>(
&self,
callback: F
) -> Result<AkPlayingID, AkResult> where
F: FnMut(AkCallbackInfo) + 'static,
pub fn post_with_callback<F>(
&self,
callback: F
) -> Result<AkPlayingID, AkResult> where
F: FnMut(AkCallbackInfo) + 'static,
Posts the event to the sound engine, calling callback according to flags.
callback can be a function or a closure.
⚡ ATTENTION ⚡
callback will be called on the audio thread, not on the current thread where you called
this. This means your closure or function must access shared state in a thread-safe way.
This also means the closure or function must not be long to return, or audio might sutter as it prevents the audio thread from processing buffers.
Trait Implementations
impl<'a> Copy for PostEvent<'a>
Auto Trait Implementations
impl<'a> RefUnwindSafe for PostEvent<'a>
impl<'a> Send for PostEvent<'a>
impl<'a> Sync for PostEvent<'a>
impl<'a> Unpin for PostEvent<'a>
impl<'a> UnwindSafe for PostEvent<'a>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more