MCPcopy Create free account
hub / github.com/RustAudio/rust-jack / ProcessHandler

Interface ProcessHandler

src/client/callbacks.rs:79–123  ·  view source on GitHub ↗

Specifies real-time processing.

Source from the content-addressed store, hash-verified

77
78/// Specifies real-time processing.
79pub trait ProcessHandler: Send {
80 /// Indicates whether or not this process handler represents a
81 /// slow-sync client
82 const SLOW_SYNC: bool = false;
83
84 /// Called whenever there is work to be done.
85 ///
86 /// It needs to be suitable for real-time execution. That means that it
87 /// cannot call functions
88 /// that might block for a long time. This includes all I/O functions
89 /// (disk, TTY, network),
90 /// malloc, free, printf, pthread_mutex_lock, sleep, wait, poll, select,
91 /// pthread_join,
92 /// pthread_cond_wait, etc, etc.
93 ///
94 /// Should return `Control::Continue` on success, and
95 /// `Control::Quit` on error.
96 fn process(&mut self, _: &Client, _process_scope: &ProcessScope) -> Control;
97
98 /// Called whenever the size of the buffer that will be passed to `process`
99 /// is about to change, and once before the first call to `process`.
100 ///
101 /// It is called on the same thread as `process`, but as an exception, does
102 /// not need to be suitable for real-time execution, so it is allowed to
103 /// allocate new buffers to accomodate the buffer size for example.
104 fn buffer_size(&mut self, _: &Client, _size: Frames) -> Control {
105 Control::Continue
106 }
107
108 /// For slow-sync clients, called periodically when the transport position
109 /// is changed. The transport will not start rolling until all clients
110 /// indicate they are ready, or a timeout occurs.
111 ///
112 /// It should return `false` until the handler is ready process audio.
113 ///
114 /// Ignored unless Self::SLOW_SYNC == true.
115 fn sync(
116 &mut self,
117 _: &Client,
118 _state: crate::TransportState,
119 _pos: &crate::TransportPosition,
120 ) -> bool {
121 true
122 }
123}
124
125unsafe extern "C" fn thread_init_callback<N, P>(data: *mut libc::c_void)
126where

Callers 2

buffer_sizeFunction · 0.45
syncFunction · 0.80

Implementers 2

handler_impls.rssrc/client/handler_impls.rs
closure.rssrc/contrib/closure.rs

Calls

no outgoing calls

Tested by

no test coverage detected