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