it is not working because previously u posted a different code, without TBOFF an TBON. see modifications (in red, comments in blue)
: Still did not work here my full client and server commands maybe you can see were I am going worng????
:
:
: Client TALK BUTTON COMMANDS
: ---------------------------
:
: // BUTTON ON HOLD DOWN!
:
: procedure TForm1.XiButton2MouseDown(Sender: TObject; Button: TMouseButton;
: Shift: TShiftState; X, Y: Integer);
: begin
: waveIn.close();
: SendData('SPNSENDON',LoginName); // Sends command to server to enable voice allso sends username!
: ClientSocket1.Socket.SendText('TBOFF'); // sends command to server to disable all other clients talk button
: ClientSocket1.Socket.SendText('PRESSSPEAK'); // sends command to let server know user is talking
: end;
:
:
:
: // BUTTON ON UP!
:
: procedure TForm1.XiButton2MouseUp(Sender: TObject; Button: TMouseButton;
: Shift: TShiftState; X, Y: Integer);
: begin
: waveIn.close();
: ClientSocket1.Socket.SendText('TBON'); // sends command to server to enable all other clients talk button
: ClientSocket1.Socket.SendText('SPNSENDOFF'); // Sends command to server to disenable voice
: ClientSocket1.Socket.SendText('PRESSLISTEN'); // sends command to let server know user no longer is talking
: end;
:
:
:
: CLIENT TCLIENTSOCKET INFO!
: --------------------------
:
: if egg = 'LISTEN' then
: begin
: c_rb_listen.Checked := True; // disables talk mode and enables listen mode
: end;
:
: if egg = 'SPEAK' then
: begin
: c_rb_speak.Checked := True; // enables talk mode
: end;
:
: if GetByTab(egg,0) = 'SPEAKNAME' then
: begin
: i := 0;
remove this line:
: XiButton2.Enabled := GetByTab(egg,i) = LoginName;
: Label3.Caption := GetByTab(egg,i)+' Is on microphone ..'; // adds username that is talking
:
: repeat
: inc(i);
:
: if GetByTab(egg,0) <> '' then
remove this line:
: XiButton2.Enabled := GetByTab(egg,1) = LoginName;
didn't get ur idea of looping i. anyway this seems fishy as server always sends 1 username, not like 10 or so (because u disable other's buttons and disable them to speak - also the server code doesnt handle multiple users speaking at once
: Label3.Caption := GetByTab(egg,i)+' Is on microphone ..'; // adds username that is talking
: until
: GetByTab(egg,i) = '';
: end;
:
: if egg = 'NONAME' then
: begin
: ClientSocket1.Socket.SendText('SETBAR'); // sends to server to reset all other clients progressbars(volume)
: Label3.Caption := 'Microphone FREE!';
: end;
the problem is that you are not handling button on-off messages sent by the server
if egg = 'TBUTTONOFF' then XiButton2.Enabled := False;
if egg = 'TBUTTONON' then XiButton2.Enabled := True;
:
:
:
: SERVER COMMANDS!
:
: if command = 'PRESSSPEAK' then // Sends out command to enable talk mode
: begin
: SendData(socket,'SPEAK');
: end;
:
: if command = 'PRESSLISTEN' then
: begin
: SendData(socket,'LISTEN'); // Sends out command to enable listen mode
: end;
:
: if command = 'TBON' then
: begin
: Broadcast(Socket,'TBUTTONON'); // Disables talk button on all clients
: end;
:
: if command = 'TBOFF' then
: begin
: Broadcast(Socket,'TBUTTONOFF'); // Enables talk button on all clients
: end;
:
: if command = 'SPNSENDON' then
: begin
: username := GetByTab(egg,1);
: Broadcast(Socket,'SPEAKNAME'+chr(9)+username); // Sends the user name of the person talking to all clients
: end;
:
: if command = 'SPNSENDOFF' then
: begin
: Broadcast(Socket,'NONAME'); // Removes the username when person stops talking
: end;
:
: if command = 'SETBAR' then
: begin
: Broadcast(Socket,'SETBARS'); // Resets all clients volume bars
: end;
:
:
: hope it helps you find the error!
: Slewis
:
:
NetGert[/italic]