* simply replacing spaces with tabs in the example files

git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/branches/sfml2@1440 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
trass3r 2010-03-04 02:23:27 +00:00
parent 8390807b08
commit 4a19225764
9 changed files with 670 additions and 670 deletions

View file

@ -9,64 +9,64 @@ class NetworkRecorder : SoundRecorder
{
public:
// Constructor
this(SocketTCP Socket)
{
mySocket = Socket;
}
// Constructor
this(SocketTCP Socket)
{
mySocket = Socket;
}
~this()
{
delete mySocket;
}
~this()
{
delete mySocket;
}
protected:
override bool onStart()
{
return true;
}
override bool onStart()
{
return true;
}
override void onStop()
{
}
override bool onProcessSamples(short[] samples)
{
// Pack the audio samples into a network packet
Packet PacketOut = new Packet();
PacketOut.set(AudioData);
PacketOut.append((cast(byte*)samples.ptr)[0..samples.length * short.sizeof]);
// Send the audio packet to the server
return mySocket.send(PacketOut) == SocketStatus.DONE;
}
override void onStop()
{
}
override bool onProcessSamples(short[] samples)
{
// Pack the audio samples into a network packet
Packet PacketOut = new Packet();
PacketOut.set(AudioData);
PacketOut.append((cast(byte*)samples.ptr)[0..samples.length * short.sizeof]);
// Send the audio packet to the server
return mySocket.send(PacketOut) == SocketStatus.DONE;
}
SocketTCP mySocket; ///< Socket used to communicate with the server
SocketTCP mySocket; ///< Socket used to communicate with the server
}
void runClient(IPAddress adr, int port)
{
// Create a TCP socket for communicating with server
SocketTCP Socket = new SocketTCP();
// Create a TCP socket for communicating with server
SocketTCP Socket = new SocketTCP();
// Connect to the specified server
if (!Socket.connect(port, adr))
return;
// Connect to the specified server
if (!Socket.connect(port, adr))
return;
// Wait for user input...
Cout("Press enter to start recording audio").newline;
Cin.get();
// Wait for user input...
Cout("Press enter to start recording audio").newline;
Cin.get();
// Create a instance of our custom recorder
NetworkRecorder Recorder = new NetworkRecorder(Socket);
// Create a instance of our custom recorder
NetworkRecorder Recorder = new NetworkRecorder(Socket);
// Start capturing audio data
Recorder.start(44100);
Cout("Press enter to stop recording audio").newline;
Cin.get();
Recorder.stop();
// Start capturing audio data
Recorder.start(44100);
Cout("Press enter to stop recording audio").newline;
Cin.get();
Recorder.stop();
// Send a "end-of-stream" packet
Packet PacketOut = new Packet();
PacketOut.set(EndOfStream);
Socket.send(PacketOut);
// Send a "end-of-stream" packet
Packet PacketOut = new Packet();
PacketOut.set(EndOfStream);
Socket.send(PacketOut);
}