matlab GUI界面的播放器,用matlab环境控制播放、暂停、停止和回放源码程序 - GUI界面设计 - 谷速源码
下载频道> 资源分类> matlab源码> GUI界面设计> matlab GUI界面的播放器,用matlab环境控制播放、暂停、停止和回放源码程序

标题:matlab GUI界面的播放器,用matlab环境控制播放、暂停、停止和回放源码程序
分享到:

所属分类: GUI界面设计 资源类型:程序源码 文件大小: 1.46 MB 上传时间: 2019-06-16 21:54:05 下载次数: 57 资源积分:1分 提 供 者: zhangsan456 code
内容:
基于matlab GUI界面的播放器,用matlab环境控制播放、暂停、停止和回放源码程序
function varargout = testplay(varargin)
% TESTPLAY M-file for testplay.fig
%      TESTPLAY, by itself, creates a new TESTPLAY or raises the existing
%      singleton*.
%
%      H = TESTPLAY returns the handle to a new TESTPLAY or the handle to
%      the existing singleton*.
%
%      TESTPLAY('CALLBACK',h ,eventData,handles,...) calls the local
%      function named CALLBACK in TESTPLAY.M with the given input arguments.
%
%      TESTPLAY('Property','Value',...) creates a new TESTPLAY or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before testplay_OpeningFcn gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to testplay_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 testplay
 
% Last Modified by GUIDE v2.5 31-Jan-2010 17:36:17
 
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @testplay_OpeningFcn, ...
                   'gui_OutputFcn',  @testplay_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 testplay is made visible.
function testplay_OpeningFcn(h , eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% h    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 testplay (see VARARGIN)
 
% Choose default command line output for testplay
handles.output = h ;
 
handles.status=0;
handles.stat=0;
% Update handles structure
guidata(h , handles);
 
% UIWAIT makes testplay wait for user response (see UIRESUME)
% uiwait(handles.figure1);
 
 
% --- Outputs from this function are returned to the command line.
function varargout = testplay_OutputFcn(h , eventdata, handles) 
% varargout  cell array for returning output args (see VARARGOUT);
% h    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 pushbutton1.
function pushbutton1_Callback(h , eventdata, handles)
% h    handle to pushbutton1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
global file_name;
if(~ischar(file_name))
    errordlg('Please Open a .Wav File');
else
    if handles.status==0
        handles.status=1;
        [x,Fs]=wavread(file_name);
        handles.r=audiop (x,Fs);
        play(handles.r);
    else
        warndlg({'Warning: Play Is Already In Progress.';' To Begin A New Play You Must First Stop The Current Session.'})
    end
end
guidata(h ,handles);
 
% --- Executes on button press in pushbutton2.
function pushbutton2_Callback(h , eventdata, handles)
% h    handle to pushbutton2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
if handles.status==1
    handles.status=0;
    stop(handles.r);
else
    errordlg('Warning: To Stop, Play Must Be In Progress.')
end
guidata(h ,handles);
 
 
% --- Executes during creation, after setting all properties.
function axes1_CreateFcn(h , eventdata, handles)
% h    handle to axes1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called
 
% Hint: place code in OpeningFcn to populate axes1
axes(h )
imshow('flow.jpg');
 
 
% --- Executes on button press in pushbutton3.
function pushbutton3_Callback(h , eventdata, handles)
% h    handle to pushbutton3 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
global file_name;
file_name=uigetfile('*.wav','Select the Wave File');
 
% --- Executes on button press in pushbutton4.
function pushbutton4_Callback(h , eventdata, handles)
% h    handle to pushbutton4 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
if (handles.status==1)&&(handles.stat==0)
    pause(handles.r);
    handles.stat=1;
else if handles.stat==1
        errordlg('Play Is Already Paused')
    else
        errordlg('Warning: Play Must Be In Progress To Pause')
    end
end
guidata(h ,handles);
 
% --- Executes on button press in pushbutton5.
function pushbutton5_Callback(h , eventdata, handles)
% h    handle to pushbutton5 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
if (handles.status==1)&&(handles.stat==1)
    resume(handles.r);
    handles.stat=0;
else
    errordlg('Warning: Play Must Be Paused To Resume.')
end
guidata(h ,handles);
 
 
% --- Executes during creation, after setting all properties.
function figure1_CreateFcn(h , eventdata, handles)
% h    handle to figure1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called
 
 
% --- Executes when user attempts to close figure1.
function figure1_CloseRequestFcn(h , eventdata, handles)
% h    handle to figure1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
 
% Hint: delete(h ) closes the figure
clear global;
delete(h );

文件列表(点击上边下载按钮,如果是垃圾文件请在下面评价差评或者投诉):

code/
code/Bach2.wav
code/flow.jpg
code/screenshot.jpg
code/testplay.asv
code/testplay.fig
code/testplay.m

关键词: 播放器 暂停 停止 回放

Top_arrow
回到顶部
联系方式| 版权声明| 招聘信息| 广告服务| 银行汇款| 法律顾问| 兼职技术| 付款方式| 关于我们|
网站客服网站客服 程序员兼职招聘 程序员兼职招聘
沪ICP备19040327号-3
公安备案号:沪公网安备 31011802003874号
库纳格流体控制系统(上海)有限公司 版权所有
Copyright © 1999-2014, GUSUCODE.COM, All Rights Reserved