A list,

Based on MATLAB GUI music alarm clock design

Ii. Source code

function varargout = wying(varargin)
% WYING M-file for wying.fig
%      WYING, by itself, creates a new WYING or raises the existing
%      singleton*.
%
%      H = WYING returns the handle to a new WYING or the handle to
%      the existing singleton*.
%
%      WYING('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in WYING.M with the given input arguments.
%
%      WYING('Property'.'Value',...). creates anew WYING or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before wying_OpeningFcn gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to wying_OpeningFcn via varargin.
%
%      *See GUI Options on GUIDE's Tools menu.  Choose "GUI allows only one % instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES

% Edit the above text to modify the response to help wying

% Last Modified by GUIDE v2. 5 02-Jun- 2021. 10:01:54

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @wying_OpeningFcn, ...
                   'gui_OutputFcn',  @wying_OutputFcn, ...
                   'gui_LayoutFcn', [],...'gui_Callback'[]);if nargin && ischar(varargin{1})
    gui_State.gui_Callback = str2func(varargin{1});
end

if nargout
    [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
    gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT


% --- Executes just before wying is made visible.
function wying_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% varargin   command line arguments to wying (see VARARGIN)% Set timerif ~isempty(timerfindall).stop(timerfindall);delete(timerfindall); End % sets radioButton here, is the property set at creation time invalid? %set(handles.radiobutton_music,'value',handles.clockSaveData(3));
set(handles.radiobutton_music,'Value',handles.clockSaveData(3)); % Settings icon * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename ='d:\ My documents \My Pictures\picture\ Pink documents.jpg ';
javaFrame=get(hObject,'javaFrame');
set(javaFrame,'FigureIcon',javax.swing.ImageIcon(filename)); % * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * % set com object media player temp=get(handles.uipanel_outerFrame,'Units');set(handles.uipanel_outerFrame,'Units'.'pixels');
position=get(handles.uipanel_outerFrame,'position'); % left X, left Y, width, height4)=position(2)- 20; position(2) =8; position(3)=position(3)+position(1)- 13;
handles.sound_player=actxcontrol('wmplayer.ocx.7',position,handles.figure_bkground);
handles.sound_player.settings.volume=100; The % volume0.100set(handles.uipanel_outerFrame,'Units',temp); %uipanellll_outerFrame revert to original unit handles. Timer =timer; This sentence should be putsetPreviously, otherwise handles had no timer fieldsset(handles.timer,'TimerFcn',{@timer_action,handles}); % timer start_timer(handles); % Start timer start_timer2(handles); % * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * %set(handles.pushbutton_browse,'visible'.'off'); % The default is to hide the browse box %set(handles.edit_musicFile,'visible'.'off');
%*************************************************************************
% Choose default command line output for wying
handles.output = hObject;

% Update handles structure
guidata(hObject, handles);

% UIWAIT makes wying wait for user response (see UIRESUME)
% uiwait(handles.figure_bkground);


% --- Outputs from this function are returned to the command line.
function varargout = wying_OutputFcn(hObject, eventdata, handles) 
% varargout  cell array for returning output args (see VARARGOUT);
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Get default command line output from handles structure
varargout{1} = handles.output;


% --- Executes on button press in pushbutton_browse.
function pushbutton_browse_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton_browse (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
%set(handles.activex1,'URL'.'d: My Documents my Music Music Assang.mp3 '); [filename,pathname]=uigetfile(... % call Windows open file window {'*.mp3; *.wav; *.asf; *.wma; *.wmv; *.rm; *.avi; . *.mpg; *.mp4; *.rmvb; *.mkv'.'Playable files'; },'Select the music to play'.'MultiSelect'.'off'); MusicSaveData =fullfile(pathname,filename); % writes the upper string to the edit_musicFile spacestringIn the domainset(handles.edit_musicFile,'String',handles.musicSaveData); musicSaveData=handles.musicSaveData; Use the musicSaveData variable % sava every time to provide recording function, is each time the alarm clock has the last recorded file name save('musicSaveData.txt'.'-ascii'.'musicSaveData'); % write a TXT file guidata(hObject,handles); % Update data for other functions due to added handles field % - Executes on selection change in popupmenu_hourfunction popupmenu_hour_Callback(hObject, eventdata, handles)
% hObject    handle to popupmenu_hour (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: contents = cellstr(get(hObject,'String')) returns popupmenu_hour contents as cell array
%        contents{get(hObject,'Value'Returns selected item from popupmenu_hour % handles. ClockSaveData ()1)=get(hObject,'Value');
clockSaveData=handles.clockSaveData;
save('clockSaveData.txt'.'-ascii'.'clockSaveData'); guidata(hObject,handles); % Update data % Start timer start_timer(handles) below; % --- Executes during object creation, after setting all properties.function popupmenu_hour_CreateFcn(hObject, eventdata, handles)
% hObject    handle to popupmenu_hour (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: popupmenu controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0.'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor'.'white'); End % loads the previous timerset(hObject,'Value',handles.clockSaveData(1)); % control object writes handles to handles in handles. Popupmenu_hour =hObject; guidata(hObject,handles); % --- Executes on selection change in popupmenu_minute.function popupmenu_minute_Callback(hObject, eventdata, handles)
% hObject    handle to popupmenu_minute (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: contents = cellstr(get(hObject,'String')) returns popupmenu_minute contents as cell array
%        contents{get(hObject,'Value')} returns selected item from popupmenu_minute
handles.clockSaveData(2)=get(hObject,'Value');
clockSaveData=handles.clockSaveData;
save('clockSaveData.txt'.'-ascii'.'clockSaveData'); guidata(hObject,handles); % Update data % Start timer start_timer(handles) below; % --- Executes during object creation, after setting all properties.function popupmenu_minute_CreateFcn(hObject, eventdata, handles)
% hObject    handle to popupmenu_minute (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: popupmenu controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0.'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor'.'white'); End % loads the previous timerset(hObject,'Value',handles.clockSaveData(2)); % control object writes handles to handles in handles. Popupmenu_minute =hObject; guidata(hObject,handles);function edit_musicFile_Callback(hObject, eventdata, handles)
% hObject    handle to edit_musicFile (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit_musicFile as text
%        str2double(get(hObject,'String')) returns contents of edit_musicFile as a double
handles.musicSaveData=get(hObject,'String'); % Get file name from edit box control (string) musicSaveData = handles. MusicSaveData; % Write the file name musicSaveData to the musicSaveData. TXT file and save it to the hard disk.'musicSaveData.txt'.'-ascii'.'musicSaveData'); guidata(hObject,handles); % Updates handles dataCopy the code

3. Operation results

Fourth, note

Version: 2014 a