Subchannel interpretation code (nw)

This commit is contained in:
Matt Nadareski
2021-11-29 16:32:36 -08:00
parent 7b0615a792
commit 34d985d481
7 changed files with 255 additions and 2 deletions

View File

@@ -0,0 +1,25 @@
using System;
namespace RedBookPlayer.Models.Hardware.Karaoke
{
/// <see cref="https://jbum.com/cdg_revealed.html"/>
internal class LoadCLUT
{
// AND with 0x3F3F to clear P and Q channel
public short[] ColorSpec { get; private set; } = new short[8];
/// <summary>
/// Interpret subchannel packet data as Load Color Lookup Table
/// </summary>
public LoadCLUT(byte[] bytes)
{
if(bytes == null || bytes.Length != 16)
return;
for(int i = 0; i < 8; i++)
{
this.ColorSpec[i] = (short)(BitConverter.ToInt16(bytes, 2 * i) & 0x3F3F);
}
}
}
}