sdrplay-fm-radio/formats.py

17 lines
445 B
Python

import numpy as np
from SoapySDR import *
from dataclasses import dataclass
@dataclass
class FormatSpec:
name: str
soapy: int
numpy: np.dtype
packing: str
FORMATS = {
'CU8': FormatSpec('CU8', SOAPY_SDR_CU8, np.uint8, '=%dB'),
'CS8': FormatSpec('CS8', SOAPY_SDR_CS8, np.int8, '=%db'),
'CS16': FormatSpec('CS16', SOAPY_SDR_CS16, np.int16, '=%dh'),
'CF32': FormatSpec('CF32', SOAPY_SDR_CF32, np.float32, '=%df'),
}