static void Main(string[] args) { if (args.Length != 2) { Console.WriteLine("Usage: {0} <serial port> <path to .spc file>", Environment.GetCommandLineArgs()[0]); return; } byte[] spcData = File.ReadAllBytes(args[1]); // LoadSPCFile() requires 66048 bytes array at least if (spcData.Length < 66048) { Array.Resize(ref spcData, 66048); } Program.serialPort = new SerialPort(args[0], 115200, Parity.None, 8, StopBits.One); Program.serialPort.Open(); // Send reset command Program.serialPort.Write("I\n"); Thread.Sleep(50); var table = new TRANSMITSPCEXCALLBACK(); table.cbSize = (uint)Marshal.SizeOf(table); table.transmitType = 0x03; // TRANSMIT_TYPE_CALLBACK table.bScript700 = 0; table.pCallbackRead = Program.dRead; table.pCallbackWrite = Program.dWrite; // Send data to SHVC-SOUND Program.LoadSPCFile(spcData); Program.TransmitSPCEx(ref table); Console.WriteLine("Enjoy!"); }
public static extern uint TransmitSPCEx(ref TRANSMITSPCEXCALLBACK table);