Example #1
0
    public VstBuffer2(int blockSize, int channels, IPCBuffer <T> buf)
    {
        if (blockSize < 1)
        {
            throw new ArgumentOutOfRangeException(nameof(blockSize), blockSize, "1以上にしてください");
        }

        if (channels < 1)
        {
            throw new ArgumentOutOfRangeException(nameof(channels), channels, "1以上にしてください");
        }

        if (buf == default)
        {
            throw new ArgumentNullException(nameof(buf));
        }

        Buffer    = new(new IntPtr[channels]);
        Log       = new();
        BlockSize = blockSize;
        for (var i = 0; i < channels; i++)
        {
            Buffer.Target[i] = buf.Allocate(blockSize);
        }
    }
Example #2
0
    public H264InputBuffer(int picWidth, int picHeight)
    {
        SSourcePictureBuffer = new(new SSourcePicture());
        Log = new();

        var frameSize = picWidth * picHeight * 3 / 2;

        _dataBuffer = new(new byte[frameSize]);

        var target = SSourcePictureBuffer.Target;

        target.iColorFormat = EVideoFormatType.videoFormatI420;
        target.iStride0     = picWidth;
        target.iStride1     = picWidth >> 1;
        target.iStride2     = picWidth >> 1;
        target.iStride3     = 0;
        target.pData0       = _dataBuffer.AddrOfPinnedObject;
        target.pData1       = target.pData0 + (picWidth * picHeight);
        target.pData2       = target.pData1 + (picWidth * picHeight >> 2);
        target.pData3       = IntPtr.Zero;
        target.iPicWidth    = picWidth;
        target.iPicHeight   = picHeight;
    }
 public PcmBuffer(int blockSize, int channels)
 {
     Buffer = new(new T[blockSize * channels]);
     Log    = new();
 }