Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 1c9780d1 authored by hhakim's avatar hhakim
Browse files

Bind matlab wrapper to Faust::Transform::save_mat_file().

Complete 2aac8ad7.
parent 99cb43d3
No related branches found
No related tags found
No related merge requests found
......@@ -385,6 +385,17 @@ classdef Faust
end
function save_core(F, filename)
%% save_core Saves a Faust into a matfile.
%
% save_core(F,filename) saves the Faust F into the .mat file specified by filename.
% N.B.: this function is identitical to save() but relies on Faust core library to operate.
if(F.isReal)
mexFaustReal('save_core', F.matrix.objectHandle, filename)
else
mexFaustCplx('save_core', F.matrix.objectHandle, filename)
end
end
function submatrix=subsref(F,S)
%% SUBSREF Subscripted reference (overloaded Matlab built-in function).
......
......@@ -72,6 +72,22 @@
typedef @FAUST_SCALAR@ SCALAR;
void save_core(Faust::Transform<SCALAR,Cpu>* core_ptr, int nargs, const mxArray *args[])
{
char filepath[512];
// args[0] must be the filepath
if(nargs != 1){
mexErrMsgTxt("The number of arguments for the save_core function is not valid.");
return;
}
if(mxGetString(args[0], filepath, sizeof(filepath)) && strlen(filepath) > 0){
mexErrMsgTxt("The filepath for saving is too long (max. is 511 characters).");
return;
}
// printf("save_core: filepath = %s, nargs = %d\n", filepath, nargs);
core_ptr->save_mat_file(filepath);
}
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
{
#ifdef FAUST_VERBOSE
......@@ -431,8 +447,8 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
return;
}
if(!strcmp("save_core", cmd))
return save_core(convertMat2Ptr<Faust::Transform<SCALAR,Cpu> >(prhs[1]), nrhs-2, &prhs[nrhs>=3?2:0]);
// // Call the various class methods
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment