Browse Source

added mute_PCM() - sets or unsets VALID in VUCP (and adjusts PARITY)

dds
Frank 9 years ago
parent
commit
f20b191ae8
1 changed files with 19 additions and 7 deletions
  1. +19
    -7
      output_spdif.cpp

+ 19
- 7
output_spdif.cpp View File

* THE SOFTWARE. * THE SOFTWARE.
*/ */


// 2015/08/23: (FB) added mute_PCM() - sets or unsets VALID in VUCP (and adjusts PARITY)
#include "output_spdif.h" #include "output_spdif.h"


#define PREAMBLE_B (0xE8) //11101000
#define PREAMBLE_M (0xE2) //11100010
#define PREAMBLE_W (0xE4) //11100100

#define VUCP_VALID ((0xCC) << 24)
#define VUCP_INVALID ((0xD4) << 24)// To mute PCM, set VUCP = invalid.

audio_block_t * AudioOutputSPDIF::block_left_1st = NULL; audio_block_t * AudioOutputSPDIF::block_left_1st = NULL;
audio_block_t * AudioOutputSPDIF::block_right_1st = NULL; audio_block_t * AudioOutputSPDIF::block_right_1st = NULL;
audio_block_t * AudioOutputSPDIF::block_left_2nd = NULL; audio_block_t * AudioOutputSPDIF::block_left_2nd = NULL;
uint16_t AudioOutputSPDIF::block_left_offset = 0; uint16_t AudioOutputSPDIF::block_left_offset = 0;
uint16_t AudioOutputSPDIF::block_right_offset = 0; uint16_t AudioOutputSPDIF::block_right_offset = 0;
bool AudioOutputSPDIF::update_responsibility = false; bool AudioOutputSPDIF::update_responsibility = false;
uint32_t AudioOutputSPDIF::vucp = VUCP_VALID;


DMAMEM static uint32_t SPDIF_tx_buffer[AUDIO_BLOCK_SAMPLES * 4]; //2 KB DMAMEM static uint32_t SPDIF_tx_buffer[AUDIO_BLOCK_SAMPLES * 4]; //2 KB


0x32aa, 0xb2aa, 0xd2aa, 0x52aa, 0xcaaa, 0x4aaa, 0x2aaa, 0xaaaa 0x32aa, 0xb2aa, 0xd2aa, 0x52aa, 0xcaaa, 0x4aaa, 0x2aaa, 0xaaaa
}; };


#define PREAMBLE_B (0xE8) //11101000
#define PREAMBLE_M (0xE2) //11100010
#define PREAMBLE_W (0xE4) //11100100


void AudioOutputSPDIF::begin(void) void AudioOutputSPDIF::begin(void)
{ {
dma.begin(true); // Allocate the DMA channel first dma.begin(true); // Allocate the DMA channel first


block_left_1st = NULL; block_left_1st = NULL;


if (++frame > 191) { if (++frame > 191) {
// VUCP-Bits ("Valid, Subcode, Channelstatus, Parity) = 0 (0xcc) | Preamble (depends on Framno.) | Auxillary // VUCP-Bits ("Valid, Subcode, Channelstatus, Parity) = 0 (0xcc) | Preamble (depends on Framno.) | Auxillary
*(dest+0) = 0xcc000000 | (PREAMBLE_B << 16 ) | aux; //special preamble for one of 192 frames
*(dest+0) = vucp | (PREAMBLE_B << 16 ) | aux; //special preamble for one of 192 frames
frame = 0; frame = 0;
} else { } else {
*(dest+0) = 0xcc000000 | (PREAMBLE_M << 16 ) | aux;
*(dest+0) = vucp | (PREAMBLE_M << 16 ) | aux;
} }
dest += 4; dest += 4;


*(dest+1) = ( ((uint32_t)lo << 16) | hi ); *(dest+1) = ( ((uint32_t)lo << 16) | hi );


aux = (0xB333 ^ (((uint32_t)((int16_t)lo)) >> 17)); aux = (0xB333 ^ (((uint32_t)((int16_t)lo)) >> 17));
*(dest+0) = 0xcc000000 | (PREAMBLE_W << 16 ) | aux;
*(dest+0) = vucp | (PREAMBLE_W << 16 ) | aux;


dest += 4; dest += 4;
} while (dest < end); } while (dest < end);


} }


void AudioOutputSPDIF::mute_PCM(const bool mute)
{
vucp = mute?VUCP_INVALID:VUCP_VALID;
}

void AudioOutputSPDIF::update(void) void AudioOutputSPDIF::update(void)
{ {



Loading…
Cancel
Save