Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/delphi/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Delphi 使用tcp indy10的实时音频流_Delphi_Delphi 7_Audio Streaming - Fatal编程技术网

Delphi 使用tcp indy10的实时音频流

Delphi 使用tcp indy10的实时音频流,delphi,delphi-7,audio-streaming,Delphi,Delphi 7,Audio Streaming,从他们的例子(TLiveAudioRecorder) 如何使用TCP indy10发送音频流? 类似于Connection.IOHandler.Write(缓冲区,0,true)您可以: 使用RawToBytes() 使用TIdMemoryBufferStream将缓冲区包装在TStream中,并将其传递给TIdIOHandler.Write(TStream): //sender procedure TMainForm.LiveAudioRecorderData(Sender: TO

从他们的例子(TLiveAudioRecorder)

如何使用TCP indy10发送音频流? 类似于
Connection.IOHandler.Write(缓冲区,0,true)

您可以:

  • 使用
    RawToBytes()

  • 使用
    TIdMemoryBufferStream
    将缓冲区包装在
    TStream
    中,并将其传递给
    TIdIOHandler.Write(TStream)

  • //sender
        procedure TMainForm.LiveAudioRecorderData(Sender: TObject;
          const Buffer: Pointer; BufferSize: Cardinal; var FreeIt: Boolean);
        var
          I: Integer;
        begin
          FreeIt := True;
          for I := tcpServer.Socket.ActiveConnections - 1 downto 0 do
            with tcpServer.Socket.Connections[I] do
              if Data = Self then // the client is ready
                SendBuf(Buffer^, BufferSize);
    
        end;
    
    Connection.IOHandler.Write(RawToBytes(Buffer^, BufferSize));
    
    Strm := TIdMemoryBufferStream.Create(Buffer, BufferSize);
    Connection.IOHandler.Write(Strm);
    Strm.Free;