From: Sim on
Hi,

I have created two pushbuttons for playing soundA and soundB. The listener plays the two sounds and then responds how similar these sounds are with a slider. Once the slider is set to the desirable value then the listener presses a respond button.

I would like the pushbutton respond to be visible only when the user has pressed the two pushbuttons which play soundA and soundB at least one.

Any guidance appreciated.

S.
From: Walter Roberson on
Sim wrote:

> I have created two pushbuttons for playing soundA and soundB. The
> listener plays the two sounds and then responds how similar these sounds
> are with a slider. Once the slider is set to the desirable value then
> the listener presses a respond button.
>
> I would like the pushbutton respond to be visible only when the user has
> pressed the two pushbuttons which play soundA and soundB at least one.
> Any guidance appreciated.

set(Respond_Pushbutton_handle, 'Visible', 'off')

and in the callbacks for playing the sounds, set() the handle to Visible
on .
From: Simos on
Yes, that is correct. The problem though is that I have two callbacks playsoundA and playsoundB. Each one of them has the following form:

set(H_TEST(1),'Enable','off');
set(H_TEST(2),'Enable','off');
%set(H_TEST(3),'Visible','on');
set(H_TEST(10),'Enable','off');
set(H_TEST(23),'Enable','off');
playrec('play', soundA, [RepSys]);
pause(size(soundA)/48e3);
set(H_TEST(1),'Enable','on');
set(H_TEST(2),'Enable','on');
%set(H_TEST(3),'Visible','off');
set(H_TEST(23),'Enable','on');
set(H_TEST(10),'Enable','on');
set(H_TEST(10),'Visible','on')

In the last line I set the respond button visible (H_TEST(10)) but the problem is that the respond button is visible when you listen one of the two sounds and not both of them at least once.

I would like to solve this without using switch and inserting playsoundA and playsoundB in one function with two cases as this cause problems with playrec and global variables.

Do you think this is achievable?

S.



Walter Roberson <roberson(a)hushmail.com> wrote in message <FJ7Pn.33759$TL5.26012(a)newsfe24.iad>...
> Sim wrote:
>
> > I have created two pushbuttons for playing soundA and soundB. The
> > listener plays the two sounds and then responds how similar these sounds
> > are with a slider. Once the slider is set to the desirable value then
> > the listener presses a respond button.
> >
> > I would like the pushbutton respond to be visible only when the user has
> > pressed the two pushbuttons which play soundA and soundB at least one.
> > Any guidance appreciated.
>
> set(Respond_Pushbutton_handle, 'Visible', 'off')
>
> and in the callbacks for playing the sounds, set() the handle to Visible
> on .
From: Walter Roberson on
Simos wrote:
> Yes, that is correct. The problem though is that I have two callbacks
> playsoundA and playsoundB. Each one of them has the following form:
>
> set(H_TEST(1),'Enable','off');
> set(H_TEST(2),'Enable','off');
> %set(H_TEST(3),'Visible','on');
> set(H_TEST(10),'Enable','off');
> set(H_TEST(23),'Enable','off');
> playrec('play', soundA, [RepSys]);
> pause(size(soundA)/48e3);
> set(H_TEST(1),'Enable','on');
> set(H_TEST(2),'Enable','on');
> %set(H_TEST(3),'Visible','off');
> set(H_TEST(23),'Enable','on');
> set(H_TEST(10),'Enable','on');
> set(H_TEST(10),'Visible','on')
>
> In the last line I set the respond button visible (H_TEST(10)) but the
> problem is that the respond button is visible when you listen one of the
> two sounds and not both of them at least once.
>
> I would like to solve this without using switch and inserting playsoundA
> and playsoundB in one function with two cases as this cause problems
> with playrec and global variables.

There are different ways of handling that. One of them would be:

set([Play_A_button_handle, Play_B_button_handle], 'UserData', []);

Then in the callback for those two, use

set(src, 'UserData', 1);
if ~isempty(get(Play_A_button_handle,'UserData')) &&
~isempty(get(Play_B_button_handle,'UserData'))
set(H_TEST(10),'Visible','on')
end

I don't know what the H_TEST() at index 1, 2, or 23 are about, so I
can't offer any advice on them.
From: Simos on
Hi,

Thank you, in this way I can incorporate that in other handles as well and have much more control..

Thank you
S.

Walter Roberson <roberson(a)hushmail.com> wrote in message <dD8Pn.52874$h57.48162(a)newsfe22.iad>...
> Simos wrote:
> > Yes, that is correct. The problem though is that I have two callbacks
> > playsoundA and playsoundB. Each one of them has the following form:
> >
> > set(H_TEST(1),'Enable','off');
> > set(H_TEST(2),'Enable','off');
> > %set(H_TEST(3),'Visible','on');
> > set(H_TEST(10),'Enable','off');
> > set(H_TEST(23),'Enable','off');
> > playrec('play', soundA, [RepSys]);
> > pause(size(soundA)/48e3);
> > set(H_TEST(1),'Enable','on');
> > set(H_TEST(2),'Enable','on');
> > %set(H_TEST(3),'Visible','off');
> > set(H_TEST(23),'Enable','on');
> > set(H_TEST(10),'Enable','on');
> > set(H_TEST(10),'Visible','on')
> >
> > In the last line I set the respond button visible (H_TEST(10)) but the
> > problem is that the respond button is visible when you listen one of the
> > two sounds and not both of them at least once.
> >
> > I would like to solve this without using switch and inserting playsoundA
> > and playsoundB in one function with two cases as this cause problems
> > with playrec and global variables.
>
> There are different ways of handling that. One of them would be:
>
> set([Play_A_button_handle, Play_B_button_handle], 'UserData', []);
>
> Then in the callback for those two, use
>
> set(src, 'UserData', 1);
> if ~isempty(get(Play_A_button_handle,'UserData')) &&
> ~isempty(get(Play_B_button_handle,'UserData'))
> set(H_TEST(10),'Visible','on')
> end
>
> I don't know what the H_TEST() at index 1, 2, or 23 are about, so I
> can't offer any advice on them.