arduino-audio-tools
Classes | Namespaces | Macros | Typedefs | Variables
AudioSPDIF.h File Reference

S/PDIF output. More...

#include "AudioConfig.h"
#include "AudioTools/AudioLogger.h"
#include "AudioTools/AudioStreams.h"
#include "AudioI2S/I2SConfig.h"
#include "AudioI2S/I2SStream.h"

Go to the source code of this file.

Classes

struct  SPDIFConfig
 SPDIF configuration. More...
 
class  SPDIFOutput
 Output as 16 bit stereo SPDIF on the I2S data output pin. More...
 

Namespaces

 audio_tools
 Generic Implementation of sound input and output for desktop environments using portaudio.
 

Macros

#define BMC_B   0x33173333
 
#define BMC_BITS_FACTOR   (BMC_BITS_PER_SAMPLE / I2S_BITS_PER_SAMPLE)
 
#define BMC_BITS_PER_SAMPLE   64
 
#define BMC_M   0x331d3333
 
#define BMC_MW_DIF   (BMC_M ^ BMC_W)
 
#define BMC_W   0x331b3333
 
#define DMA_BUF_COUNT   2
 
#define DMA_BUF_LEN
 
#define I2S_BITS_PER_SAMPLE   (32)
 
#define I2S_BUG_MAGIC   (26 * 1000 * 1000)
 
#define I2S_CHANNELS   2
 
#define I2S_NUM   ((i2s_port_t)0)
 
#define SPDIF_BLOCK_SAMPLES   192
 
#define SPDIF_BLOCK_SIZE    (SPDIF_BLOCK_SAMPLES * (BMC_BITS_PER_SAMPLE / 8) * I2S_CHANNELS)
 
#define SPDIF_BUF_ARRAY_SIZE   (SPDIF_BUF_SIZE / sizeof(uint32_t))
 
#define SPDIF_BUF_DIV   2
 
#define SPDIF_BUF_SIZE   (SPDIF_BLOCK_SIZE / SPDIF_BUF_DIV)
 
#define SPDIF_DATA_PIN   23
 
#define SYNC_FLIP   ((BMC_B ^ BMC_M) >> (SYNC_OFFSET * 8))
 
#define SYNC_OFFSET   2
 

Typedefs

using SPDIFStream = SPDIFOutput
 

Variables

static const int16_t * bmc_tab = (int16_t *)bmc_tab_uint
 
static const uint16_t bmc_tab_uint [256]
 
static uint32_t spdif_buf [(((192 *(64/8) *2)/2)/sizeof(uint32_t))]
 
static uint32_t * spdif_ptr = nullptr
 

Detailed Description

S/PDIF output.

Author
amedes / Phil Schatzmann

This example code is in the Public Domain (or CC0 licensed, at your option.) Unless required by applicable law or agreed to in writing, this software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

Date
2022-01-30

Macro Definition Documentation

◆ DMA_BUF_LEN

#define DMA_BUF_LEN
Value:
(SPDIF_BLOCK_SAMPLES * BMC_BITS_PER_SAMPLE / I2S_BITS_PER_SAMPLE / \
SPDIF_BUF_DIV)