예제 #1
0
        private static int WriteDsfFile(ref AudioData ad, string path)
        {
            int rv;
            var dsf = new WWDsfWriter();

            rv = dsf.EncodeInit(ad.meta);
            if (rv < 0) {
                return rv;
            }

            rv = dsf.EncodeSetPicture(ad.picture);
            if (rv < 0) {
                dsf.EncodeEnd();
                return rv;
            }

            for (int ch = 0; ch < ad.meta.channels; ++ch) {
                long lrv = dsf.EncodeAddPcm(ch, ad.pcm[ch].data);
                if (lrv < 0) {
                    dsf.EncodeEnd();
                    return (int)lrv;
                }
            }

            rv = dsf.EncodeRun(path);
            if (rv < 0) {
                dsf.EncodeEnd();
                return rv;
            }

            dsf.EncodeEnd();
            return 0;
        }