hi I need abit of help with my coding

can sumone tel me how i can remove the listen/speak checkboxs and replace it with just the button up/down funcation I tryed the following code it sends the data when button is is helddown but once I relesse it still keep streaming can anyone help???

Old check box code!

[code]
procedure Tc_form_main.a_cln_startExecute(Sender: TObject);
begin
a_cln_start.enabled := false;
//
ipClient.host := c_edit_host.text;
//
if (c_rb_speak.checked) then begin
// speak
ipClient.proto := tunavclProtoType(choice(0 = c_comboBox_speakProto.ItemIndex, ord(unapt_UDP), ord(unapt_TCP)));
ipClient.port := c_edit_speakPort.text;
ipClient.consumer := nil; // no need to playback
//
if (not waveIn.open()) then begin
waveIn.close();
//
raise exception.create('Unable to open waveIn device, error text: '#13#10 + waveIn.waveErrorAsString);
end;
end
else begin
// listen
ipClient.proto := tunavclProtoType(choice(0 = c_comboBox_listenProto.ItemIndex, ord(unapt_UDP), ord(unapt_TCP)));
ipClient.port := c_edit_listenPort.text;
ipClient.consumer := codecOut; // restore playback chain
ipClient.open();
end;
end;
[/code]

HERE IS MY CODE FOR BUTTON DOWN AND UP!

[code]
procedure TMainForm1.Button1MouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
ButtonDown := True;
if (ButtonDown) then begin
// speak
ipClient.host := 'localhost';
ipClient.port := '17860';
ipClient.consumer := nil; // no need to playback
if (not waveIn.open()) then begin
waveIn.close();
//
raise exception.create('Unable to open waveIn device, error text: '#13#10 + waveIn.waveErrorAsString);
end;
end
else begin
ButtonUp := True;
// listen
ipClient.host := 'localhost';
ipClient.port := '17861';
ipClient.consumer := codecOut; // restore playback chain
ipClient.open();
end;
end;

procedure TMainForm1.Button1MouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
ButtonUp := True;
if (ButtonUp) then begin
// listen
ipClient.host := 'localhost';
ipClient.port := '17861';
ipClient.consumer := codecOut; // restore playback chain
ipClient.open();
end;
end;
[/code]

hope sumone can help cheers
Slewis
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories