fidl_fuchsia_media_audio__common/
fidl_fuchsia_media_audio__common.rs

1// WARNING: This file is machine generated by fidlgen.
2
3#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
8use futures::future::{self, MaybeDone, TryFutureExt};
9use zx_status;
10
11pub const MAX_EFFECT_NAME_LENGTH: u32 = 128;
12
13/// Maximum permitted gain value.
14pub const MAX_GAIN_DB: f32 = 24.0;
15
16/// The volume value representing the maximum loudness.
17pub const MAX_VOLUME: f32 = 1.0;
18
19/// The volume value representing silence.
20pub const MIN_VOLUME: f32 = 0.0;
21
22/// Gain value producing silence. Gain values less than this value are permitted,
23/// but produce the same effect as this value.
24pub const MUTED_GAIN_DB: f32 = -160.0;
25
26/// Enumerates gain control ramp types.
27#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
28#[repr(u16)]
29pub enum RampType {
30    /// Amplitude scale changes at a fixed rate across the ramp duration.
31    ScaleLinear = 1,
32}
33
34impl RampType {
35    #[inline]
36    pub fn from_primitive(prim: u16) -> Option<Self> {
37        match prim {
38            1 => Some(Self::ScaleLinear),
39            _ => None,
40        }
41    }
42
43    #[inline]
44    pub const fn into_primitive(self) -> u16 {
45        self as u16
46    }
47}
48
49#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
50#[repr(u32)]
51pub enum UpdateEffectError {
52    InvalidConfig = 1,
53    NotFound = 2,
54}
55
56impl UpdateEffectError {
57    #[inline]
58    pub fn from_primitive(prim: u32) -> Option<Self> {
59        match prim {
60            1 => Some(Self::InvalidConfig),
61            2 => Some(Self::NotFound),
62            _ => None,
63        }
64    }
65
66    #[inline]
67    pub const fn into_primitive(self) -> u32 {
68        self as u32
69    }
70}
71
72#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
73pub struct EffectsControllerUpdateEffectRequest {
74    pub effect_name: String,
75    pub config: String,
76}
77
78impl fidl::Persistable for EffectsControllerUpdateEffectRequest {}
79
80#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
81pub struct GainControlOnGainMuteChangedRequest {
82    pub gain_db: f32,
83    pub muted: bool,
84}
85
86impl fidl::Persistable for GainControlOnGainMuteChangedRequest {}
87
88#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
89pub struct GainControlSetGainRequest {
90    pub gain_db: f32,
91}
92
93impl fidl::Persistable for GainControlSetGainRequest {}
94
95#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
96pub struct GainControlSetGainWithRampRequest {
97    pub gain_db: f32,
98    pub duration: i64,
99    pub ramp_type: RampType,
100}
101
102impl fidl::Persistable for GainControlSetGainWithRampRequest {}
103
104#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
105pub struct GainControlSetMuteRequest {
106    pub muted: bool,
107}
108
109impl fidl::Persistable for GainControlSetMuteRequest {}
110
111#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
112pub struct VolumeControlOnVolumeMuteChangedRequest {
113    pub new_volume: f32,
114    pub new_muted: bool,
115}
116
117impl fidl::Persistable for VolumeControlOnVolumeMuteChangedRequest {}
118
119#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
120pub struct VolumeControlSetMuteRequest {
121    pub mute: bool,
122}
123
124impl fidl::Persistable for VolumeControlSetMuteRequest {}
125
126#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
127pub struct VolumeControlSetVolumeRequest {
128    pub volume: f32,
129}
130
131impl fidl::Persistable for VolumeControlSetVolumeRequest {}
132
133pub mod effects_controller_ordinals {
134    pub const UPDATE_EFFECT: u64 = 0x4e39e4b5e6279125;
135}
136
137pub mod gain_control_ordinals {
138    pub const SET_GAIN: u64 = 0x2fc070871d033f64;
139    pub const SET_GAIN_WITH_RAMP: u64 = 0x3a175b2d6979e8ea;
140    pub const SET_MUTE: u64 = 0x5415723c1e31448;
141    pub const ON_GAIN_MUTE_CHANGED: u64 = 0x66d528cad4e0d753;
142}
143
144pub mod volume_control_ordinals {
145    pub const SET_VOLUME: u64 = 0x6ff4231809a697da;
146    pub const SET_MUTE: u64 = 0x50c10c28bba46425;
147    pub const ON_VOLUME_MUTE_CHANGED: u64 = 0x9cea352bd86c171;
148}
149
150mod internal {
151    use super::*;
152    unsafe impl fidl::encoding::TypeMarker for RampType {
153        type Owned = Self;
154
155        #[inline(always)]
156        fn inline_align(_context: fidl::encoding::Context) -> usize {
157            std::mem::align_of::<u16>()
158        }
159
160        #[inline(always)]
161        fn inline_size(_context: fidl::encoding::Context) -> usize {
162            std::mem::size_of::<u16>()
163        }
164
165        #[inline(always)]
166        fn encode_is_copy() -> bool {
167            true
168        }
169
170        #[inline(always)]
171        fn decode_is_copy() -> bool {
172            false
173        }
174    }
175
176    impl fidl::encoding::ValueTypeMarker for RampType {
177        type Borrowed<'a> = Self;
178        #[inline(always)]
179        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
180            *value
181        }
182    }
183
184    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for RampType {
185        #[inline]
186        unsafe fn encode(
187            self,
188            encoder: &mut fidl::encoding::Encoder<'_, D>,
189            offset: usize,
190            _depth: fidl::encoding::Depth,
191        ) -> fidl::Result<()> {
192            encoder.debug_check_bounds::<Self>(offset);
193            encoder.write_num(self.into_primitive(), offset);
194            Ok(())
195        }
196    }
197
198    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for RampType {
199        #[inline(always)]
200        fn new_empty() -> Self {
201            Self::ScaleLinear
202        }
203
204        #[inline]
205        unsafe fn decode(
206            &mut self,
207            decoder: &mut fidl::encoding::Decoder<'_, D>,
208            offset: usize,
209            _depth: fidl::encoding::Depth,
210        ) -> fidl::Result<()> {
211            decoder.debug_check_bounds::<Self>(offset);
212            let prim = decoder.read_num::<u16>(offset);
213
214            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
215            Ok(())
216        }
217    }
218    unsafe impl fidl::encoding::TypeMarker for UpdateEffectError {
219        type Owned = Self;
220
221        #[inline(always)]
222        fn inline_align(_context: fidl::encoding::Context) -> usize {
223            std::mem::align_of::<u32>()
224        }
225
226        #[inline(always)]
227        fn inline_size(_context: fidl::encoding::Context) -> usize {
228            std::mem::size_of::<u32>()
229        }
230
231        #[inline(always)]
232        fn encode_is_copy() -> bool {
233            true
234        }
235
236        #[inline(always)]
237        fn decode_is_copy() -> bool {
238            false
239        }
240    }
241
242    impl fidl::encoding::ValueTypeMarker for UpdateEffectError {
243        type Borrowed<'a> = Self;
244        #[inline(always)]
245        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
246            *value
247        }
248    }
249
250    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
251        for UpdateEffectError
252    {
253        #[inline]
254        unsafe fn encode(
255            self,
256            encoder: &mut fidl::encoding::Encoder<'_, D>,
257            offset: usize,
258            _depth: fidl::encoding::Depth,
259        ) -> fidl::Result<()> {
260            encoder.debug_check_bounds::<Self>(offset);
261            encoder.write_num(self.into_primitive(), offset);
262            Ok(())
263        }
264    }
265
266    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for UpdateEffectError {
267        #[inline(always)]
268        fn new_empty() -> Self {
269            Self::InvalidConfig
270        }
271
272        #[inline]
273        unsafe fn decode(
274            &mut self,
275            decoder: &mut fidl::encoding::Decoder<'_, D>,
276            offset: usize,
277            _depth: fidl::encoding::Depth,
278        ) -> fidl::Result<()> {
279            decoder.debug_check_bounds::<Self>(offset);
280            let prim = decoder.read_num::<u32>(offset);
281
282            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
283            Ok(())
284        }
285    }
286
287    impl fidl::encoding::ValueTypeMarker for EffectsControllerUpdateEffectRequest {
288        type Borrowed<'a> = &'a Self;
289        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
290            value
291        }
292    }
293
294    unsafe impl fidl::encoding::TypeMarker for EffectsControllerUpdateEffectRequest {
295        type Owned = Self;
296
297        #[inline(always)]
298        fn inline_align(_context: fidl::encoding::Context) -> usize {
299            8
300        }
301
302        #[inline(always)]
303        fn inline_size(_context: fidl::encoding::Context) -> usize {
304            32
305        }
306    }
307
308    unsafe impl<D: fidl::encoding::ResourceDialect>
309        fidl::encoding::Encode<EffectsControllerUpdateEffectRequest, D>
310        for &EffectsControllerUpdateEffectRequest
311    {
312        #[inline]
313        unsafe fn encode(
314            self,
315            encoder: &mut fidl::encoding::Encoder<'_, D>,
316            offset: usize,
317            _depth: fidl::encoding::Depth,
318        ) -> fidl::Result<()> {
319            encoder.debug_check_bounds::<EffectsControllerUpdateEffectRequest>(offset);
320            // Delegate to tuple encoding.
321            fidl::encoding::Encode::<EffectsControllerUpdateEffectRequest, D>::encode(
322                (
323                    <fidl::encoding::BoundedString<128> as fidl::encoding::ValueTypeMarker>::borrow(
324                        &self.effect_name,
325                    ),
326                    <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
327                        &self.config,
328                    ),
329                ),
330                encoder,
331                offset,
332                _depth,
333            )
334        }
335    }
336    unsafe impl<
337            D: fidl::encoding::ResourceDialect,
338            T0: fidl::encoding::Encode<fidl::encoding::BoundedString<128>, D>,
339            T1: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
340        > fidl::encoding::Encode<EffectsControllerUpdateEffectRequest, D> for (T0, T1)
341    {
342        #[inline]
343        unsafe fn encode(
344            self,
345            encoder: &mut fidl::encoding::Encoder<'_, D>,
346            offset: usize,
347            depth: fidl::encoding::Depth,
348        ) -> fidl::Result<()> {
349            encoder.debug_check_bounds::<EffectsControllerUpdateEffectRequest>(offset);
350            // Zero out padding regions. There's no need to apply masks
351            // because the unmasked parts will be overwritten by fields.
352            // Write the fields.
353            self.0.encode(encoder, offset + 0, depth)?;
354            self.1.encode(encoder, offset + 16, depth)?;
355            Ok(())
356        }
357    }
358
359    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
360        for EffectsControllerUpdateEffectRequest
361    {
362        #[inline(always)]
363        fn new_empty() -> Self {
364            Self {
365                effect_name: fidl::new_empty!(fidl::encoding::BoundedString<128>, D),
366                config: fidl::new_empty!(fidl::encoding::UnboundedString, D),
367            }
368        }
369
370        #[inline]
371        unsafe fn decode(
372            &mut self,
373            decoder: &mut fidl::encoding::Decoder<'_, D>,
374            offset: usize,
375            _depth: fidl::encoding::Depth,
376        ) -> fidl::Result<()> {
377            decoder.debug_check_bounds::<Self>(offset);
378            // Verify that padding bytes are zero.
379            fidl::decode!(
380                fidl::encoding::BoundedString<128>,
381                D,
382                &mut self.effect_name,
383                decoder,
384                offset + 0,
385                _depth
386            )?;
387            fidl::decode!(
388                fidl::encoding::UnboundedString,
389                D,
390                &mut self.config,
391                decoder,
392                offset + 16,
393                _depth
394            )?;
395            Ok(())
396        }
397    }
398
399    impl fidl::encoding::ValueTypeMarker for GainControlOnGainMuteChangedRequest {
400        type Borrowed<'a> = &'a Self;
401        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
402            value
403        }
404    }
405
406    unsafe impl fidl::encoding::TypeMarker for GainControlOnGainMuteChangedRequest {
407        type Owned = Self;
408
409        #[inline(always)]
410        fn inline_align(_context: fidl::encoding::Context) -> usize {
411            4
412        }
413
414        #[inline(always)]
415        fn inline_size(_context: fidl::encoding::Context) -> usize {
416            8
417        }
418    }
419
420    unsafe impl<D: fidl::encoding::ResourceDialect>
421        fidl::encoding::Encode<GainControlOnGainMuteChangedRequest, D>
422        for &GainControlOnGainMuteChangedRequest
423    {
424        #[inline]
425        unsafe fn encode(
426            self,
427            encoder: &mut fidl::encoding::Encoder<'_, D>,
428            offset: usize,
429            _depth: fidl::encoding::Depth,
430        ) -> fidl::Result<()> {
431            encoder.debug_check_bounds::<GainControlOnGainMuteChangedRequest>(offset);
432            // Delegate to tuple encoding.
433            fidl::encoding::Encode::<GainControlOnGainMuteChangedRequest, D>::encode(
434                (
435                    <f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.gain_db),
436                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.muted),
437                ),
438                encoder,
439                offset,
440                _depth,
441            )
442        }
443    }
444    unsafe impl<
445            D: fidl::encoding::ResourceDialect,
446            T0: fidl::encoding::Encode<f32, D>,
447            T1: fidl::encoding::Encode<bool, D>,
448        > fidl::encoding::Encode<GainControlOnGainMuteChangedRequest, D> for (T0, T1)
449    {
450        #[inline]
451        unsafe fn encode(
452            self,
453            encoder: &mut fidl::encoding::Encoder<'_, D>,
454            offset: usize,
455            depth: fidl::encoding::Depth,
456        ) -> fidl::Result<()> {
457            encoder.debug_check_bounds::<GainControlOnGainMuteChangedRequest>(offset);
458            // Zero out padding regions. There's no need to apply masks
459            // because the unmasked parts will be overwritten by fields.
460            unsafe {
461                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(4);
462                (ptr as *mut u32).write_unaligned(0);
463            }
464            // Write the fields.
465            self.0.encode(encoder, offset + 0, depth)?;
466            self.1.encode(encoder, offset + 4, depth)?;
467            Ok(())
468        }
469    }
470
471    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
472        for GainControlOnGainMuteChangedRequest
473    {
474        #[inline(always)]
475        fn new_empty() -> Self {
476            Self { gain_db: fidl::new_empty!(f32, D), muted: fidl::new_empty!(bool, D) }
477        }
478
479        #[inline]
480        unsafe fn decode(
481            &mut self,
482            decoder: &mut fidl::encoding::Decoder<'_, D>,
483            offset: usize,
484            _depth: fidl::encoding::Depth,
485        ) -> fidl::Result<()> {
486            decoder.debug_check_bounds::<Self>(offset);
487            // Verify that padding bytes are zero.
488            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(4) };
489            let padval = unsafe { (ptr as *const u32).read_unaligned() };
490            let mask = 0xffffff00u32;
491            let maskedval = padval & mask;
492            if maskedval != 0 {
493                return Err(fidl::Error::NonZeroPadding {
494                    padding_start: offset + 4 + ((mask as u64).trailing_zeros() / 8) as usize,
495                });
496            }
497            fidl::decode!(f32, D, &mut self.gain_db, decoder, offset + 0, _depth)?;
498            fidl::decode!(bool, D, &mut self.muted, decoder, offset + 4, _depth)?;
499            Ok(())
500        }
501    }
502
503    impl fidl::encoding::ValueTypeMarker for GainControlSetGainRequest {
504        type Borrowed<'a> = &'a Self;
505        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
506            value
507        }
508    }
509
510    unsafe impl fidl::encoding::TypeMarker for GainControlSetGainRequest {
511        type Owned = Self;
512
513        #[inline(always)]
514        fn inline_align(_context: fidl::encoding::Context) -> usize {
515            4
516        }
517
518        #[inline(always)]
519        fn inline_size(_context: fidl::encoding::Context) -> usize {
520            4
521        }
522    }
523
524    unsafe impl<D: fidl::encoding::ResourceDialect>
525        fidl::encoding::Encode<GainControlSetGainRequest, D> for &GainControlSetGainRequest
526    {
527        #[inline]
528        unsafe fn encode(
529            self,
530            encoder: &mut fidl::encoding::Encoder<'_, D>,
531            offset: usize,
532            _depth: fidl::encoding::Depth,
533        ) -> fidl::Result<()> {
534            encoder.debug_check_bounds::<GainControlSetGainRequest>(offset);
535            // Delegate to tuple encoding.
536            fidl::encoding::Encode::<GainControlSetGainRequest, D>::encode(
537                (<f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.gain_db),),
538                encoder,
539                offset,
540                _depth,
541            )
542        }
543    }
544    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<f32, D>>
545        fidl::encoding::Encode<GainControlSetGainRequest, D> for (T0,)
546    {
547        #[inline]
548        unsafe fn encode(
549            self,
550            encoder: &mut fidl::encoding::Encoder<'_, D>,
551            offset: usize,
552            depth: fidl::encoding::Depth,
553        ) -> fidl::Result<()> {
554            encoder.debug_check_bounds::<GainControlSetGainRequest>(offset);
555            // Zero out padding regions. There's no need to apply masks
556            // because the unmasked parts will be overwritten by fields.
557            // Write the fields.
558            self.0.encode(encoder, offset + 0, depth)?;
559            Ok(())
560        }
561    }
562
563    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
564        for GainControlSetGainRequest
565    {
566        #[inline(always)]
567        fn new_empty() -> Self {
568            Self { gain_db: fidl::new_empty!(f32, D) }
569        }
570
571        #[inline]
572        unsafe fn decode(
573            &mut self,
574            decoder: &mut fidl::encoding::Decoder<'_, D>,
575            offset: usize,
576            _depth: fidl::encoding::Depth,
577        ) -> fidl::Result<()> {
578            decoder.debug_check_bounds::<Self>(offset);
579            // Verify that padding bytes are zero.
580            fidl::decode!(f32, D, &mut self.gain_db, decoder, offset + 0, _depth)?;
581            Ok(())
582        }
583    }
584
585    impl fidl::encoding::ValueTypeMarker for GainControlSetGainWithRampRequest {
586        type Borrowed<'a> = &'a Self;
587        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
588            value
589        }
590    }
591
592    unsafe impl fidl::encoding::TypeMarker for GainControlSetGainWithRampRequest {
593        type Owned = Self;
594
595        #[inline(always)]
596        fn inline_align(_context: fidl::encoding::Context) -> usize {
597            8
598        }
599
600        #[inline(always)]
601        fn inline_size(_context: fidl::encoding::Context) -> usize {
602            24
603        }
604    }
605
606    unsafe impl<D: fidl::encoding::ResourceDialect>
607        fidl::encoding::Encode<GainControlSetGainWithRampRequest, D>
608        for &GainControlSetGainWithRampRequest
609    {
610        #[inline]
611        unsafe fn encode(
612            self,
613            encoder: &mut fidl::encoding::Encoder<'_, D>,
614            offset: usize,
615            _depth: fidl::encoding::Depth,
616        ) -> fidl::Result<()> {
617            encoder.debug_check_bounds::<GainControlSetGainWithRampRequest>(offset);
618            // Delegate to tuple encoding.
619            fidl::encoding::Encode::<GainControlSetGainWithRampRequest, D>::encode(
620                (
621                    <f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.gain_db),
622                    <i64 as fidl::encoding::ValueTypeMarker>::borrow(&self.duration),
623                    <RampType as fidl::encoding::ValueTypeMarker>::borrow(&self.ramp_type),
624                ),
625                encoder,
626                offset,
627                _depth,
628            )
629        }
630    }
631    unsafe impl<
632            D: fidl::encoding::ResourceDialect,
633            T0: fidl::encoding::Encode<f32, D>,
634            T1: fidl::encoding::Encode<i64, D>,
635            T2: fidl::encoding::Encode<RampType, D>,
636        > fidl::encoding::Encode<GainControlSetGainWithRampRequest, D> for (T0, T1, T2)
637    {
638        #[inline]
639        unsafe fn encode(
640            self,
641            encoder: &mut fidl::encoding::Encoder<'_, D>,
642            offset: usize,
643            depth: fidl::encoding::Depth,
644        ) -> fidl::Result<()> {
645            encoder.debug_check_bounds::<GainControlSetGainWithRampRequest>(offset);
646            // Zero out padding regions. There's no need to apply masks
647            // because the unmasked parts will be overwritten by fields.
648            unsafe {
649                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
650                (ptr as *mut u64).write_unaligned(0);
651            }
652            unsafe {
653                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
654                (ptr as *mut u64).write_unaligned(0);
655            }
656            // Write the fields.
657            self.0.encode(encoder, offset + 0, depth)?;
658            self.1.encode(encoder, offset + 8, depth)?;
659            self.2.encode(encoder, offset + 16, depth)?;
660            Ok(())
661        }
662    }
663
664    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
665        for GainControlSetGainWithRampRequest
666    {
667        #[inline(always)]
668        fn new_empty() -> Self {
669            Self {
670                gain_db: fidl::new_empty!(f32, D),
671                duration: fidl::new_empty!(i64, D),
672                ramp_type: fidl::new_empty!(RampType, D),
673            }
674        }
675
676        #[inline]
677        unsafe fn decode(
678            &mut self,
679            decoder: &mut fidl::encoding::Decoder<'_, D>,
680            offset: usize,
681            _depth: fidl::encoding::Depth,
682        ) -> fidl::Result<()> {
683            decoder.debug_check_bounds::<Self>(offset);
684            // Verify that padding bytes are zero.
685            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
686            let padval = unsafe { (ptr as *const u64).read_unaligned() };
687            let mask = 0xffffffff00000000u64;
688            let maskedval = padval & mask;
689            if maskedval != 0 {
690                return Err(fidl::Error::NonZeroPadding {
691                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
692                });
693            }
694            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
695            let padval = unsafe { (ptr as *const u64).read_unaligned() };
696            let mask = 0xffffffffffff0000u64;
697            let maskedval = padval & mask;
698            if maskedval != 0 {
699                return Err(fidl::Error::NonZeroPadding {
700                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
701                });
702            }
703            fidl::decode!(f32, D, &mut self.gain_db, decoder, offset + 0, _depth)?;
704            fidl::decode!(i64, D, &mut self.duration, decoder, offset + 8, _depth)?;
705            fidl::decode!(RampType, D, &mut self.ramp_type, decoder, offset + 16, _depth)?;
706            Ok(())
707        }
708    }
709
710    impl fidl::encoding::ValueTypeMarker for GainControlSetMuteRequest {
711        type Borrowed<'a> = &'a Self;
712        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
713            value
714        }
715    }
716
717    unsafe impl fidl::encoding::TypeMarker for GainControlSetMuteRequest {
718        type Owned = Self;
719
720        #[inline(always)]
721        fn inline_align(_context: fidl::encoding::Context) -> usize {
722            1
723        }
724
725        #[inline(always)]
726        fn inline_size(_context: fidl::encoding::Context) -> usize {
727            1
728        }
729    }
730
731    unsafe impl<D: fidl::encoding::ResourceDialect>
732        fidl::encoding::Encode<GainControlSetMuteRequest, D> for &GainControlSetMuteRequest
733    {
734        #[inline]
735        unsafe fn encode(
736            self,
737            encoder: &mut fidl::encoding::Encoder<'_, D>,
738            offset: usize,
739            _depth: fidl::encoding::Depth,
740        ) -> fidl::Result<()> {
741            encoder.debug_check_bounds::<GainControlSetMuteRequest>(offset);
742            // Delegate to tuple encoding.
743            fidl::encoding::Encode::<GainControlSetMuteRequest, D>::encode(
744                (<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.muted),),
745                encoder,
746                offset,
747                _depth,
748            )
749        }
750    }
751    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
752        fidl::encoding::Encode<GainControlSetMuteRequest, D> for (T0,)
753    {
754        #[inline]
755        unsafe fn encode(
756            self,
757            encoder: &mut fidl::encoding::Encoder<'_, D>,
758            offset: usize,
759            depth: fidl::encoding::Depth,
760        ) -> fidl::Result<()> {
761            encoder.debug_check_bounds::<GainControlSetMuteRequest>(offset);
762            // Zero out padding regions. There's no need to apply masks
763            // because the unmasked parts will be overwritten by fields.
764            // Write the fields.
765            self.0.encode(encoder, offset + 0, depth)?;
766            Ok(())
767        }
768    }
769
770    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
771        for GainControlSetMuteRequest
772    {
773        #[inline(always)]
774        fn new_empty() -> Self {
775            Self { muted: fidl::new_empty!(bool, D) }
776        }
777
778        #[inline]
779        unsafe fn decode(
780            &mut self,
781            decoder: &mut fidl::encoding::Decoder<'_, D>,
782            offset: usize,
783            _depth: fidl::encoding::Depth,
784        ) -> fidl::Result<()> {
785            decoder.debug_check_bounds::<Self>(offset);
786            // Verify that padding bytes are zero.
787            fidl::decode!(bool, D, &mut self.muted, decoder, offset + 0, _depth)?;
788            Ok(())
789        }
790    }
791
792    impl fidl::encoding::ValueTypeMarker for VolumeControlOnVolumeMuteChangedRequest {
793        type Borrowed<'a> = &'a Self;
794        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
795            value
796        }
797    }
798
799    unsafe impl fidl::encoding::TypeMarker for VolumeControlOnVolumeMuteChangedRequest {
800        type Owned = Self;
801
802        #[inline(always)]
803        fn inline_align(_context: fidl::encoding::Context) -> usize {
804            4
805        }
806
807        #[inline(always)]
808        fn inline_size(_context: fidl::encoding::Context) -> usize {
809            8
810        }
811    }
812
813    unsafe impl<D: fidl::encoding::ResourceDialect>
814        fidl::encoding::Encode<VolumeControlOnVolumeMuteChangedRequest, D>
815        for &VolumeControlOnVolumeMuteChangedRequest
816    {
817        #[inline]
818        unsafe fn encode(
819            self,
820            encoder: &mut fidl::encoding::Encoder<'_, D>,
821            offset: usize,
822            _depth: fidl::encoding::Depth,
823        ) -> fidl::Result<()> {
824            encoder.debug_check_bounds::<VolumeControlOnVolumeMuteChangedRequest>(offset);
825            // Delegate to tuple encoding.
826            fidl::encoding::Encode::<VolumeControlOnVolumeMuteChangedRequest, D>::encode(
827                (
828                    <f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.new_volume),
829                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.new_muted),
830                ),
831                encoder,
832                offset,
833                _depth,
834            )
835        }
836    }
837    unsafe impl<
838            D: fidl::encoding::ResourceDialect,
839            T0: fidl::encoding::Encode<f32, D>,
840            T1: fidl::encoding::Encode<bool, D>,
841        > fidl::encoding::Encode<VolumeControlOnVolumeMuteChangedRequest, D> for (T0, T1)
842    {
843        #[inline]
844        unsafe fn encode(
845            self,
846            encoder: &mut fidl::encoding::Encoder<'_, D>,
847            offset: usize,
848            depth: fidl::encoding::Depth,
849        ) -> fidl::Result<()> {
850            encoder.debug_check_bounds::<VolumeControlOnVolumeMuteChangedRequest>(offset);
851            // Zero out padding regions. There's no need to apply masks
852            // because the unmasked parts will be overwritten by fields.
853            unsafe {
854                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(4);
855                (ptr as *mut u32).write_unaligned(0);
856            }
857            // Write the fields.
858            self.0.encode(encoder, offset + 0, depth)?;
859            self.1.encode(encoder, offset + 4, depth)?;
860            Ok(())
861        }
862    }
863
864    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
865        for VolumeControlOnVolumeMuteChangedRequest
866    {
867        #[inline(always)]
868        fn new_empty() -> Self {
869            Self { new_volume: fidl::new_empty!(f32, D), new_muted: fidl::new_empty!(bool, D) }
870        }
871
872        #[inline]
873        unsafe fn decode(
874            &mut self,
875            decoder: &mut fidl::encoding::Decoder<'_, D>,
876            offset: usize,
877            _depth: fidl::encoding::Depth,
878        ) -> fidl::Result<()> {
879            decoder.debug_check_bounds::<Self>(offset);
880            // Verify that padding bytes are zero.
881            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(4) };
882            let padval = unsafe { (ptr as *const u32).read_unaligned() };
883            let mask = 0xffffff00u32;
884            let maskedval = padval & mask;
885            if maskedval != 0 {
886                return Err(fidl::Error::NonZeroPadding {
887                    padding_start: offset + 4 + ((mask as u64).trailing_zeros() / 8) as usize,
888                });
889            }
890            fidl::decode!(f32, D, &mut self.new_volume, decoder, offset + 0, _depth)?;
891            fidl::decode!(bool, D, &mut self.new_muted, decoder, offset + 4, _depth)?;
892            Ok(())
893        }
894    }
895
896    impl fidl::encoding::ValueTypeMarker for VolumeControlSetMuteRequest {
897        type Borrowed<'a> = &'a Self;
898        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
899            value
900        }
901    }
902
903    unsafe impl fidl::encoding::TypeMarker for VolumeControlSetMuteRequest {
904        type Owned = Self;
905
906        #[inline(always)]
907        fn inline_align(_context: fidl::encoding::Context) -> usize {
908            1
909        }
910
911        #[inline(always)]
912        fn inline_size(_context: fidl::encoding::Context) -> usize {
913            1
914        }
915    }
916
917    unsafe impl<D: fidl::encoding::ResourceDialect>
918        fidl::encoding::Encode<VolumeControlSetMuteRequest, D> for &VolumeControlSetMuteRequest
919    {
920        #[inline]
921        unsafe fn encode(
922            self,
923            encoder: &mut fidl::encoding::Encoder<'_, D>,
924            offset: usize,
925            _depth: fidl::encoding::Depth,
926        ) -> fidl::Result<()> {
927            encoder.debug_check_bounds::<VolumeControlSetMuteRequest>(offset);
928            // Delegate to tuple encoding.
929            fidl::encoding::Encode::<VolumeControlSetMuteRequest, D>::encode(
930                (<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.mute),),
931                encoder,
932                offset,
933                _depth,
934            )
935        }
936    }
937    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
938        fidl::encoding::Encode<VolumeControlSetMuteRequest, D> for (T0,)
939    {
940        #[inline]
941        unsafe fn encode(
942            self,
943            encoder: &mut fidl::encoding::Encoder<'_, D>,
944            offset: usize,
945            depth: fidl::encoding::Depth,
946        ) -> fidl::Result<()> {
947            encoder.debug_check_bounds::<VolumeControlSetMuteRequest>(offset);
948            // Zero out padding regions. There's no need to apply masks
949            // because the unmasked parts will be overwritten by fields.
950            // Write the fields.
951            self.0.encode(encoder, offset + 0, depth)?;
952            Ok(())
953        }
954    }
955
956    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
957        for VolumeControlSetMuteRequest
958    {
959        #[inline(always)]
960        fn new_empty() -> Self {
961            Self { mute: fidl::new_empty!(bool, D) }
962        }
963
964        #[inline]
965        unsafe fn decode(
966            &mut self,
967            decoder: &mut fidl::encoding::Decoder<'_, D>,
968            offset: usize,
969            _depth: fidl::encoding::Depth,
970        ) -> fidl::Result<()> {
971            decoder.debug_check_bounds::<Self>(offset);
972            // Verify that padding bytes are zero.
973            fidl::decode!(bool, D, &mut self.mute, decoder, offset + 0, _depth)?;
974            Ok(())
975        }
976    }
977
978    impl fidl::encoding::ValueTypeMarker for VolumeControlSetVolumeRequest {
979        type Borrowed<'a> = &'a Self;
980        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
981            value
982        }
983    }
984
985    unsafe impl fidl::encoding::TypeMarker for VolumeControlSetVolumeRequest {
986        type Owned = Self;
987
988        #[inline(always)]
989        fn inline_align(_context: fidl::encoding::Context) -> usize {
990            4
991        }
992
993        #[inline(always)]
994        fn inline_size(_context: fidl::encoding::Context) -> usize {
995            4
996        }
997    }
998
999    unsafe impl<D: fidl::encoding::ResourceDialect>
1000        fidl::encoding::Encode<VolumeControlSetVolumeRequest, D>
1001        for &VolumeControlSetVolumeRequest
1002    {
1003        #[inline]
1004        unsafe fn encode(
1005            self,
1006            encoder: &mut fidl::encoding::Encoder<'_, D>,
1007            offset: usize,
1008            _depth: fidl::encoding::Depth,
1009        ) -> fidl::Result<()> {
1010            encoder.debug_check_bounds::<VolumeControlSetVolumeRequest>(offset);
1011            // Delegate to tuple encoding.
1012            fidl::encoding::Encode::<VolumeControlSetVolumeRequest, D>::encode(
1013                (<f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.volume),),
1014                encoder,
1015                offset,
1016                _depth,
1017            )
1018        }
1019    }
1020    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<f32, D>>
1021        fidl::encoding::Encode<VolumeControlSetVolumeRequest, D> for (T0,)
1022    {
1023        #[inline]
1024        unsafe fn encode(
1025            self,
1026            encoder: &mut fidl::encoding::Encoder<'_, D>,
1027            offset: usize,
1028            depth: fidl::encoding::Depth,
1029        ) -> fidl::Result<()> {
1030            encoder.debug_check_bounds::<VolumeControlSetVolumeRequest>(offset);
1031            // Zero out padding regions. There's no need to apply masks
1032            // because the unmasked parts will be overwritten by fields.
1033            // Write the fields.
1034            self.0.encode(encoder, offset + 0, depth)?;
1035            Ok(())
1036        }
1037    }
1038
1039    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1040        for VolumeControlSetVolumeRequest
1041    {
1042        #[inline(always)]
1043        fn new_empty() -> Self {
1044            Self { volume: fidl::new_empty!(f32, D) }
1045        }
1046
1047        #[inline]
1048        unsafe fn decode(
1049            &mut self,
1050            decoder: &mut fidl::encoding::Decoder<'_, D>,
1051            offset: usize,
1052            _depth: fidl::encoding::Depth,
1053        ) -> fidl::Result<()> {
1054            decoder.debug_check_bounds::<Self>(offset);
1055            // Verify that padding bytes are zero.
1056            fidl::decode!(f32, D, &mut self.volume, decoder, offset + 0, _depth)?;
1057            Ok(())
1058        }
1059    }
1060}