alsaseq/auto/event.rs
1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from
3// from gir-files (https://github.com/gtk-rs/gir-files)
4// DO NOT EDIT
5
6use crate::{
7 ffi, Addr, EventDataConnect, EventDataCtl, EventDataNote, EventDataQueue, EventDataResult,
8 EventLengthMode, EventPriorityMode, EventTimeMode, EventTstampMode, EventType,
9};
10use glib::translate::*;
11
12glib::wrapper! {
13 /// A boxed structure for sequencer event.
14 ///
15 /// A [`Event`][crate::Event] expresses any type of event in ALSA Sequencer. The event consists of some
16 /// product-type propertiess and two variant-type properties.
17 ///
18 /// The instance should be released by call of `boxed_free()` since it can point to the
19 /// other allocated object for blob data, therefore it's preferable to use `boxed_copy()`
20 /// to duplicate the instance so that the blob data is going to be duplicated as well.
21 ///
22 /// This is the list of product-type properties:
23 ///
24 /// - the type of event
25 /// - the mode of time stamp
26 /// - the mode of time
27 /// - the mode of length
28 /// - the mode of priority
29 /// - the numeric value of tag associated to the event
30 /// - the numeric identifier of queue to schedule the event
31 /// - destination address
32 /// - source address
33 ///
34 /// One of variant-type property is for time stamp.
35 ///
36 /// - tick count as time stamp of event
37 /// - real time as time stamp of event
38 ///
39 /// Another variant-type property is for data of event.
40 ///
41 /// - note
42 /// - control
43 /// - 12 bytes
44 /// - 3 quadlets
45 /// - blob as variable length of bytes
46 /// - pointer in VMA of user process
47 /// - queue control
48 /// - tick count as arbitrary time stamp
49 /// - real time as arbitrary time stamp
50 /// - arbitrary address
51 /// - connection between source and destination addresses
52 /// - result
53 ///
54 /// The type of time stamp is associated to the mode of time stamp, while the type of data is
55 /// associated to the type of event loosely. Each of the variant type property has single storage
56 /// internally, thus an event can includes the sole variant.
57 ///
58 /// The object wraps `struct snd_seq_event` in UAPI of Linux sound subsystem.
59 #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
60 pub struct Event(Boxed<ffi::ALSASeqEvent>);
61
62 match fn {
63 copy => |ptr| glib::gobject_ffi::g_boxed_copy(ffi::alsaseq_event_get_type(), ptr as *mut _) as *mut ffi::ALSASeqEvent,
64 free => |ptr| glib::gobject_ffi::g_boxed_free(ffi::alsaseq_event_get_type(), ptr as *mut _),
65 type_ => || ffi::alsaseq_event_get_type(),
66 }
67}
68
69impl Event {
70 /// Allocate and return an instance of [`Event`][crate::Event].
71 /// ## `event_type`
72 /// A [`EventType`][crate::EventType].
73 ///
74 /// # Returns
75 ///
76 /// An instance of [`Event`][crate::Event].
77 #[doc(alias = "alsaseq_event_new")]
78 pub fn new(event_type: EventType) -> Event {
79 unsafe { from_glib_full(ffi::alsaseq_event_new(event_type.into_glib())) }
80 }
81
82 /// Calculate the number of cells in client pool to be consumed when the event is delivered.
83 /// The comparison to properties of [`ClientPool`][crate::ClientPool] is useful when scheduling the event.
84 ///
85 /// # Returns
86 ///
87 ///
88 /// ## `cells`
89 /// The number of consumed cells in client pool.
90 #[doc(alias = "alsaseq_event_calculate_pool_consumption")]
91 pub fn calculate_pool_consumption(&self) -> u32 {
92 unsafe {
93 let mut cells = std::mem::MaybeUninit::uninit();
94 ffi::alsaseq_event_calculate_pool_consumption(
95 self.to_glib_none().0,
96 cells.as_mut_ptr(),
97 );
98 cells.assume_init()
99 }
100 }
101
102 /// Get the type of event.
103 ///
104 /// # Returns
105 ///
106 ///
107 /// ## `event_type`
108 /// A [`EventType`][crate::EventType].
109 #[doc(alias = "alsaseq_event_get_event_type")]
110 #[doc(alias = "get_event_type")]
111 pub fn event_type(&self) -> EventType {
112 unsafe {
113 let mut event_type = std::mem::MaybeUninit::uninit();
114 ffi::alsaseq_event_get_event_type(self.to_glib_none().0, event_type.as_mut_ptr());
115 from_glib(event_type.assume_init())
116 }
117 }
118
119 /// Get the mode of data length for the event.
120 ///
121 /// # Returns
122 ///
123 ///
124 /// ## `length_mode`
125 /// A [`EventLengthMode`][crate::EventLengthMode] for the mode of data length.
126 #[doc(alias = "alsaseq_event_get_length_mode")]
127 #[doc(alias = "get_length_mode")]
128 pub fn length_mode(&self) -> EventLengthMode {
129 unsafe {
130 let mut length_mode = std::mem::MaybeUninit::uninit();
131 ffi::alsaseq_event_get_length_mode(self.to_glib_none().0, length_mode.as_mut_ptr());
132 from_glib(length_mode.assume_init())
133 }
134 }
135
136 /// Get the mode of priority for the event.
137 ///
138 /// # Returns
139 ///
140 ///
141 /// ## `priority_mode`
142 /// A [`EventPriorityMode`][crate::EventPriorityMode] The mode of priority.
143 #[doc(alias = "alsaseq_event_get_priority_mode")]
144 #[doc(alias = "get_priority_mode")]
145 pub fn priority_mode(&self) -> EventPriorityMode {
146 unsafe {
147 let mut priority_mode = std::mem::MaybeUninit::uninit();
148 ffi::alsaseq_event_get_priority_mode(self.to_glib_none().0, priority_mode.as_mut_ptr());
149 from_glib(priority_mode.assume_init())
150 }
151 }
152
153 /// Get the numeric identifier of queue to schedule the event.
154 ///
155 /// # Returns
156 ///
157 ///
158 /// ## `queue_id`
159 /// The numeric identifier of queue.
160 #[doc(alias = "alsaseq_event_get_queue_id")]
161 #[doc(alias = "get_queue_id")]
162 pub fn queue_id(&self) -> u8 {
163 unsafe {
164 let mut queue_id = std::mem::MaybeUninit::uninit();
165 ffi::alsaseq_event_get_queue_id(self.to_glib_none().0, queue_id.as_mut_ptr());
166 queue_id.assume_init()
167 }
168 }
169
170 /// Get the numeric value of tag associated to the event.
171 ///
172 /// # Returns
173 ///
174 ///
175 /// ## `tag`
176 /// The numeric value of tag.
177 #[doc(alias = "alsaseq_event_get_tag")]
178 #[doc(alias = "get_tag")]
179 pub fn tag(&self) -> i8 {
180 unsafe {
181 let mut tag = std::mem::MaybeUninit::uninit();
182 ffi::alsaseq_event_get_tag(self.to_glib_none().0, tag.as_mut_ptr());
183 tag.assume_init()
184 }
185 }
186
187 /// Get the mode of time for the event.
188 ///
189 /// # Returns
190 ///
191 ///
192 /// ## `time_mode`
193 /// A [`EventTimeMode`][crate::EventTimeMode] for the mode of time.
194 #[doc(alias = "alsaseq_event_get_time_mode")]
195 #[doc(alias = "get_time_mode")]
196 pub fn time_mode(&self) -> EventTimeMode {
197 unsafe {
198 let mut time_mode = std::mem::MaybeUninit::uninit();
199 ffi::alsaseq_event_get_time_mode(self.to_glib_none().0, time_mode.as_mut_ptr());
200 from_glib(time_mode.assume_init())
201 }
202 }
203
204 /// Get the mode of time stamp for the event.
205 ///
206 /// # Returns
207 ///
208 ///
209 /// ## `tstamp_mode`
210 /// A [`EventTstampMode`][crate::EventTstampMode] for the mode of time stamp.
211 #[doc(alias = "alsaseq_event_get_tstamp_mode")]
212 #[doc(alias = "get_tstamp_mode")]
213 pub fn tstamp_mode(&self) -> EventTstampMode {
214 unsafe {
215 let mut tstamp_mode = std::mem::MaybeUninit::uninit();
216 ffi::alsaseq_event_get_tstamp_mode(self.to_glib_none().0, tstamp_mode.as_mut_ptr());
217 from_glib(tstamp_mode.assume_init())
218 }
219 }
220
221 /// Get the address data of event, available when [`event_type()`][Self::event_type()] results in one of:
222 ///
223 /// - [`EventType`][crate::EventType].CLIENT_START
224 /// - [`EventType`][crate::EventType].CLIENT_EXIT
225 /// - [`EventType`][crate::EventType].CLIENT_CHANGE
226 /// - [`EventType`][crate::EventType].PORT_START
227 /// - [`EventType`][crate::EventType].PORT_EXIT
228 /// - [`EventType`][crate::EventType].PORT_CHANGE
229 /// - [`EventType`][crate::EventType].USR0
230 /// - [`EventType`][crate::EventType].USR1
231 /// - [`EventType`][crate::EventType].USR2
232 /// - [`EventType`][crate::EventType].USR3
233 /// - [`EventType`][crate::EventType].USR4
234 /// - [`EventType`][crate::EventType].USR5
235 /// - [`EventType`][crate::EventType].USR6
236 /// - [`EventType`][crate::EventType].USR7
237 /// - [`EventType`][crate::EventType].USR8
238 /// - [`EventType`][crate::EventType].USR9
239 /// ## `data`
240 /// The address data of event.
241 ///
242 /// # Returns
243 ///
244 /// [`true`] when the overall operation finishes successfully, else [`false`].
245 #[doc(alias = "alsaseq_event_set_addr_data")]
246 pub fn set_addr_data(&mut self, data: &Addr) -> Result<(), glib::Error> {
247 unsafe {
248 let mut error = std::ptr::null_mut();
249 let is_ok = ffi::alsaseq_event_set_addr_data(
250 self.to_glib_none_mut().0,
251 data.to_glib_none().0,
252 &mut error,
253 );
254 debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
255 if error.is_null() {
256 Ok(())
257 } else {
258 Err(from_glib_full(error))
259 }
260 }
261 }
262
263 /// Copy the quadlet data to the event, available when [`event_type()`][Self::event_type()] results in one of:
264 ///
265 /// - [`EventType`][crate::EventType].SYSEX
266 /// - [`EventType`][crate::EventType].BOUNCE
267 /// - [`EventType`][crate::EventType].USR_VAR0
268 /// - [`EventType`][crate::EventType].USR_VAR1
269 /// - [`EventType`][crate::EventType].USR_VAR2
270 /// - [`EventType`][crate::EventType].USR_VAR3
271 /// - [`EventType`][crate::EventType].USR_VAR4
272 /// ## `data`
273 /// The pointer to blob data for the event.
274 ///
275 /// # Returns
276 ///
277 /// [`true`] when the overall operation finishes successfully, else [`false`].
278 #[doc(alias = "alsaseq_event_set_blob_data")]
279 pub fn set_blob_data(&mut self, data: &[u8]) -> Result<(), glib::Error> {
280 let length = data.len() as _;
281 unsafe {
282 let mut error = std::ptr::null_mut();
283 let is_ok = ffi::alsaseq_event_set_blob_data(
284 self.to_glib_none_mut().0,
285 data.to_glib_none().0,
286 length,
287 &mut error,
288 );
289 debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
290 if error.is_null() {
291 Ok(())
292 } else {
293 Err(from_glib_full(error))
294 }
295 }
296 }
297
298 /// Copy the connect data to the event, available when [`event_type()`][Self::event_type()] results in one of:
299 ///
300 /// - [`EventType`][crate::EventType].PORT_SUBSCRIBED
301 /// - [`EventType`][crate::EventType].PORT_UNSUBSCRIBED
302 /// - [`EventType`][crate::EventType].USR0
303 /// - [`EventType`][crate::EventType].USR1
304 /// - [`EventType`][crate::EventType].USR2
305 /// - [`EventType`][crate::EventType].USR3
306 /// - [`EventType`][crate::EventType].USR4
307 /// - [`EventType`][crate::EventType].USR5
308 /// - [`EventType`][crate::EventType].USR6
309 /// - [`EventType`][crate::EventType].USR7
310 /// - [`EventType`][crate::EventType].USR8
311 /// - [`EventType`][crate::EventType].USR9
312 /// ## `data`
313 /// The connect data of event.
314 ///
315 /// # Returns
316 ///
317 /// [`true`] when the overall operation finishes successfully, else [`false`].
318 #[doc(alias = "alsaseq_event_set_connect_data")]
319 pub fn set_connect_data(&mut self, data: &EventDataConnect) -> Result<(), glib::Error> {
320 unsafe {
321 let mut error = std::ptr::null_mut();
322 let is_ok = ffi::alsaseq_event_set_connect_data(
323 self.to_glib_none_mut().0,
324 data.to_glib_none().0,
325 &mut error,
326 );
327 debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
328 if error.is_null() {
329 Ok(())
330 } else {
331 Err(from_glib_full(error))
332 }
333 }
334 }
335
336 /// Copy the control data, available when [`event_type()`][Self::event_type()] results in one of:
337 ///
338 /// - [`EventType`][crate::EventType].CONTROLLER
339 /// - [`EventType`][crate::EventType].PGMCHANGE
340 /// - [`EventType`][crate::EventType].CHANPRESS
341 /// - [`EventType`][crate::EventType].PITCHBEND
342 /// - [`EventType`][crate::EventType].CONTROL14
343 /// - [`EventType`][crate::EventType].NONREGPARAM
344 /// - [`EventType`][crate::EventType].REGPARAM
345 /// - [`EventType`][crate::EventType].SONGPOS
346 /// - [`EventType`][crate::EventType].SONGSEL
347 /// - [`EventType`][crate::EventType].QFRAME
348 /// - [`EventType`][crate::EventType].TIMESIGN
349 /// - [`EventType`][crate::EventType].KEYSIGN
350 /// - [`EventType`][crate::EventType].USR0
351 /// - [`EventType`][crate::EventType].USR1
352 /// - [`EventType`][crate::EventType].USR2
353 /// - [`EventType`][crate::EventType].USR3
354 /// - [`EventType`][crate::EventType].USR4
355 /// - [`EventType`][crate::EventType].USR5
356 /// - [`EventType`][crate::EventType].USR6
357 /// - [`EventType`][crate::EventType].USR7
358 /// - [`EventType`][crate::EventType].USR8
359 /// - [`EventType`][crate::EventType].USR9
360 /// ## `data`
361 /// The control data of event.
362 ///
363 /// # Returns
364 ///
365 /// [`true`] when the overall operation finishes successfully, else [`false`].
366 #[doc(alias = "alsaseq_event_set_ctl_data")]
367 pub fn set_ctl_data(&mut self, data: &EventDataCtl) -> Result<(), glib::Error> {
368 unsafe {
369 let mut error = std::ptr::null_mut();
370 let is_ok = ffi::alsaseq_event_set_ctl_data(
371 self.to_glib_none_mut().0,
372 data.to_glib_none().0,
373 &mut error,
374 );
375 debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
376 if error.is_null() {
377 Ok(())
378 } else {
379 Err(from_glib_full(error))
380 }
381 }
382 }
383
384 /// Copy the address as destination of event.
385 /// ## `addr`
386 /// A [`Addr`][crate::Addr] for event destination.
387 #[doc(alias = "alsaseq_event_set_destination")]
388 pub fn set_destination(&mut self, addr: &Addr) {
389 unsafe {
390 ffi::alsaseq_event_set_destination(self.to_glib_none_mut().0, addr.to_glib_none().0);
391 }
392 }
393
394 /// Copy the note data, available when [`event_type()`][Self::event_type()] results in one of:
395 ///
396 /// - [`EventType`][crate::EventType].NOTE
397 /// - [`EventType`][crate::EventType].NOTEON
398 /// - [`EventType`][crate::EventType].NOTEOFF
399 /// - [`EventType`][crate::EventType].KEYPRESS
400 /// - [`EventType`][crate::EventType].USR0
401 /// - [`EventType`][crate::EventType].USR1
402 /// - [`EventType`][crate::EventType].USR2
403 /// - [`EventType`][crate::EventType].USR3
404 /// - [`EventType`][crate::EventType].USR4
405 /// - [`EventType`][crate::EventType].USR5
406 /// - [`EventType`][crate::EventType].USR6
407 /// - [`EventType`][crate::EventType].USR7
408 /// - [`EventType`][crate::EventType].USR8
409 /// - [`EventType`][crate::EventType].USR9
410 /// ## `data`
411 /// The note data of event.
412 ///
413 /// # Returns
414 ///
415 /// [`true`] when the overall operation finishes successfully, else [`false`].
416 #[doc(alias = "alsaseq_event_set_note_data")]
417 pub fn set_note_data(&mut self, data: &EventDataNote) -> Result<(), glib::Error> {
418 unsafe {
419 let mut error = std::ptr::null_mut();
420 let is_ok = ffi::alsaseq_event_set_note_data(
421 self.to_glib_none_mut().0,
422 data.to_glib_none().0,
423 &mut error,
424 );
425 debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
426 if error.is_null() {
427 Ok(())
428 } else {
429 Err(from_glib_full(error))
430 }
431 }
432 }
433
434 /// Set the mode of priority for the event.
435 /// ## `priority_mode`
436 /// A [`EventPriorityMode`][crate::EventPriorityMode] for the mode of priority.
437 #[doc(alias = "alsaseq_event_set_priority_mode")]
438 pub fn set_priority_mode(&mut self, priority_mode: EventPriorityMode) {
439 unsafe {
440 ffi::alsaseq_event_set_priority_mode(
441 self.to_glib_none_mut().0,
442 priority_mode.into_glib(),
443 );
444 }
445 }
446
447 /// Copy the queue data to the event, available when [`event_type()`][Self::event_type()] results in one of:
448 ///
449 /// - [`EventType`][crate::EventType].START
450 /// - [`EventType`][crate::EventType].CONTINUE
451 /// - [`EventType`][crate::EventType].STOP
452 /// - [`EventType`][crate::EventType].SETPOS_TICK
453 /// - [`EventType`][crate::EventType].SETPOS_TIME
454 /// - [`EventType`][crate::EventType].TEMPO
455 /// - [`EventType`][crate::EventType].CLOCK
456 /// - [`EventType`][crate::EventType].TICK
457 /// - [`EventType`][crate::EventType].QUEUE_SKEW
458 /// - [`EventType`][crate::EventType].USR0
459 /// - [`EventType`][crate::EventType].USR1
460 /// - [`EventType`][crate::EventType].USR2
461 /// - [`EventType`][crate::EventType].USR3
462 /// - [`EventType`][crate::EventType].USR4
463 /// - [`EventType`][crate::EventType].USR5
464 /// - [`EventType`][crate::EventType].USR6
465 /// - [`EventType`][crate::EventType].USR7
466 /// - [`EventType`][crate::EventType].USR8
467 /// - [`EventType`][crate::EventType].USR9
468 /// ## `data`
469 /// The queue data of event.
470 ///
471 /// # Returns
472 ///
473 /// [`true`] when the overall operation finishes successfully, else [`false`].
474 #[doc(alias = "alsaseq_event_set_queue_data")]
475 pub fn set_queue_data(&mut self, data: &EventDataQueue) -> Result<(), glib::Error> {
476 unsafe {
477 let mut error = std::ptr::null_mut();
478 let is_ok = ffi::alsaseq_event_set_queue_data(
479 self.to_glib_none_mut().0,
480 data.to_glib_none().0,
481 &mut error,
482 );
483 debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
484 if error.is_null() {
485 Ok(())
486 } else {
487 Err(from_glib_full(error))
488 }
489 }
490 }
491
492 /// Set the numeric identifier of queue to schedule the event.
493 /// ## `queue_id`
494 /// The numeric identifier of queue.
495 #[doc(alias = "alsaseq_event_set_queue_id")]
496 pub fn set_queue_id(&mut self, queue_id: u8) {
497 unsafe {
498 ffi::alsaseq_event_set_queue_id(self.to_glib_none_mut().0, queue_id);
499 }
500 }
501
502 /// Copy the result data to the event, available when [`event_type()`][Self::event_type()] results in one of:
503 ///
504 /// - [`EventType`][crate::EventType].SYSTEM
505 /// - [`EventType`][crate::EventType].RESULT
506 /// - [`EventType`][crate::EventType].USR0
507 /// - [`EventType`][crate::EventType].USR1
508 /// - [`EventType`][crate::EventType].USR2
509 /// - [`EventType`][crate::EventType].USR3
510 /// - [`EventType`][crate::EventType].USR4
511 /// - [`EventType`][crate::EventType].USR5
512 /// - [`EventType`][crate::EventType].USR6
513 /// - [`EventType`][crate::EventType].USR7
514 /// - [`EventType`][crate::EventType].USR8
515 /// - [`EventType`][crate::EventType].USR9
516 /// ## `data`
517 /// The result data of event.
518 ///
519 /// # Returns
520 ///
521 /// [`true`] when the overall operation finishes successfully, else [`false`].
522 #[doc(alias = "alsaseq_event_set_result_data")]
523 pub fn set_result_data(&mut self, data: &EventDataResult) -> Result<(), glib::Error> {
524 unsafe {
525 let mut error = std::ptr::null_mut();
526 let is_ok = ffi::alsaseq_event_set_result_data(
527 self.to_glib_none_mut().0,
528 data.to_glib_none().0,
529 &mut error,
530 );
531 debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
532 if error.is_null() {
533 Ok(())
534 } else {
535 Err(from_glib_full(error))
536 }
537 }
538 }
539
540 /// Copy the address as source of event.
541 /// ## `addr`
542 /// A [`Addr`][crate::Addr] for source address.
543 #[doc(alias = "alsaseq_event_set_source")]
544 pub fn set_source(&mut self, addr: &Addr) {
545 unsafe {
546 ffi::alsaseq_event_set_source(self.to_glib_none_mut().0, addr.to_glib_none().0);
547 }
548 }
549
550 /// Set the numeric value of tag associated to the event.
551 /// ## `tag`
552 /// The numeric value of tag.
553 #[doc(alias = "alsaseq_event_set_tag")]
554 pub fn set_tag(&mut self, tag: i8) {
555 unsafe {
556 ffi::alsaseq_event_set_tag(self.to_glib_none_mut().0, tag);
557 }
558 }
559
560 /// Copy the real time to the event and set [`EventTstampMode`][crate::EventTstampMode].TICK.
561 /// ## `tick_time`
562 /// The tick time of event.
563 ///
564 /// # Returns
565 ///
566 /// [`true`] when the overall operation finishes successfully, else [`false`].
567 #[doc(alias = "alsaseq_event_set_tick_time")]
568 pub fn set_tick_time(&mut self, tick_time: u32) -> Result<(), glib::Error> {
569 unsafe {
570 let mut error = std::ptr::null_mut();
571 let is_ok =
572 ffi::alsaseq_event_set_tick_time(self.to_glib_none_mut().0, tick_time, &mut error);
573 debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
574 if error.is_null() {
575 Ok(())
576 } else {
577 Err(from_glib_full(error))
578 }
579 }
580 }
581
582 /// Copy the tick time data to the event, available when [`tstamp_mode()`][Self::tstamp_mode()] is
583 /// [`EventTstampMode`][crate::EventTstampMode].TICK and [`event_type()`][Self::event_type()] results in one of:
584 ///
585 /// - [`EventType`][crate::EventType].USR0
586 /// - [`EventType`][crate::EventType].USR1
587 /// - [`EventType`][crate::EventType].USR2
588 /// - [`EventType`][crate::EventType].USR3
589 /// - [`EventType`][crate::EventType].USR4
590 /// - [`EventType`][crate::EventType].USR5
591 /// - [`EventType`][crate::EventType].USR6
592 /// - [`EventType`][crate::EventType].USR7
593 /// - [`EventType`][crate::EventType].USR8
594 /// - [`EventType`][crate::EventType].USR9
595 /// ## `tick_time`
596 /// The tick time data of event.
597 ///
598 /// # Returns
599 ///
600 /// [`true`] when the overall operation finishes successfully, else [`false`].
601 #[doc(alias = "alsaseq_event_set_tick_time_data")]
602 pub fn set_tick_time_data(&mut self, tick_time: u32) -> Result<(), glib::Error> {
603 unsafe {
604 let mut error = std::ptr::null_mut();
605 let is_ok = ffi::alsaseq_event_set_tick_time_data(
606 self.to_glib_none_mut().0,
607 tick_time,
608 &mut error,
609 );
610 debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
611 if error.is_null() {
612 Ok(())
613 } else {
614 Err(from_glib_full(error))
615 }
616 }
617 }
618
619 /// Set the mode of time for the event.
620 /// ## `time_mode`
621 /// A [`EventTimeMode`][crate::EventTimeMode] for the mode of time.
622 #[doc(alias = "alsaseq_event_set_time_mode")]
623 pub fn set_time_mode(&mut self, time_mode: EventTimeMode) {
624 unsafe {
625 ffi::alsaseq_event_set_time_mode(self.to_glib_none_mut().0, time_mode.into_glib());
626 }
627 }
628}
629
630unsafe impl Send for Event {}