from ctypes import Structure, c_uint32


class AudioConfigStructure(Structure):
    _fields_ = [
        ('auto_ch_sts', c_uint32, 1),
        ('use_raw_data', c_uint32, 1),
        ('non_lpcm', c_uint32, 1),
        ('loop', c_uint32, 1),
        ('auto_info_frame', c_uint32, 1),
        ('', c_uint32, 3),
        ('n_selector', c_uint32, 4),
        ('cts_selector', c_uint32, 4),
        ('', c_uint32, 16),
    ]

    def value(self) -> int:
        return self.auto_ch_sts | self.use_raw_data << 1 | self.non_lpcm << 2 | self.loop << 3 | \
               self.auto_info_frame << 4 | self.n_selector << 8 | self.cts_selector << 12
