Exemple #1
0
        public void Init(
            string fileName,
            MmlDatum[] srcBuf,
            Action <ChipDatum> opl4Write,
            double sampleRate,
            MoonDriverDotNETOption addtionalPMDDotNETOption, string[] addtionalPMDOption,
            Func <string, Stream> appendFileReaderCallback
            )
        {
            if (srcBuf == null || srcBuf.Length < 1)
            {
                return;
            }

            Driver.srcBuf = srcBuf;

            WriteOPL4 = opl4Write;

            //work = new PW();
            GetTags();
            //addtionalPMDDotNETOption.PPCHeader = CheckPPC(appendFileReaderCallback);

            //work.SetOption(addtionalPMDDotNETOption, addtionalPMDOption);
            //work.timer = new OPNATimer(44100, 7987200);

            string pcmFn = Path.Combine(Path.GetDirectoryName(fileName), Path.GetFileNameWithoutExtension(fileName) + ".pcm");

            byte[] pcmData = null;
            using (Stream s = appendFileReaderCallback(pcmFn))
            {
                pcmData = Common.Common.ReadAllBytes(s);
            }

            //

            md = new MoonDriver();
            if (pcmData != null)
            {
                md.ExtendFile = new Tuple <string, byte[]>(pcmFn, pcmData);
            }
            md.init(srcBuf, WriteRegister, sampleRate);

            //if (!string.IsNullOrEmpty(pmd.pw.ppz1File) || !string.IsNullOrEmpty(pmd.pw.ppz2File)) pmd.pcmload.ppz_load(pmd.pw.ppz1File, pmd.pw.ppz2File);
        }
Exemple #2
0
        public void Init(string fileName
                         , Action <ChipDatum> chipWriteRegister
                         , Action <long, int> chipWaitSend
                         , MmlDatum[] srcBuf
                         , object additionalOption)
        {
            if (srcBuf == null || srcBuf.Length < 1)
            {
                return;
            }

            Driver.srcBuf = srcBuf;
            WriteOPL4     = chipWriteRegister;
            object[] addOp = (object[])additionalOption;
            Func <string, Stream> appendFileReaderCallback = (Func <string, Stream>)addOp[1];
            double sampleRate = (double)addOp[2];

            GetTags();

            string pcmFn = Path.Combine(Path.GetDirectoryName(fileName), Path.GetFileNameWithoutExtension(fileName) + ".pcm");

            byte[] pcmData = null;
            using (Stream s = appendFileReaderCallback(pcmFn))
            {
                pcmData = Common.Common.ReadAllBytes(s);
            }

            //

            md = new MoonDriver();
            if (pcmData != null)
            {
                md.ExtendFile = new Tuple <string, byte[]>(pcmFn, pcmData);
            }
            md.init(srcBuf, WriteRegister, sampleRate);
        }