1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
h_fig= figure(15);
h_slid = uicontrol(h_fig,'style','slider','Position',[100 100 300 20]);
h_pause = uicontrol(h_fig,'style','pushbutton','Position',[200 200 50 50],'string','Pause','callback',@cllbk_pause);
h_play = uicontrol(h_fig,'style','pushbutton','Position',[300 200 50 50],'string','Play','callback',@cllbk_play);
music = 1;
play = 1;
setappdata(h_fig,'playpause',play)
temps = 0;
temps_total = 100;
while music == 1;
pause(0.1)
play = getappdata(h_fig,'playpause');
while play ==1
play = getappdata(h_fig,'playpause');
temps = temps+1;
pause(0.1)
set(h_slid,'Value',temps/temps_total);
if temps == temps_total
music = 0;
play = 0;
end
end
end |
Partager