1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
|
/* autogenerated from "macros/Sources/READAU_f.sci" */
function READAU_f() {
READAU_f.prototype.define = function READAU_f() {
frmt = "uc ";
fname = "test.au";
lunit = 0;
this.N = 20;
M = 1;
tmask = [];
this.swap = 0;
offset = 1;
outmask = 1;
ievt = 0;
nout = size(outmask,"*");
this.model = scicos_model();
this.model.sim = list(new ScilabString(["readau"]), new ScilabDouble([2]));
this.model.out = new ScilabDouble([nout]);
this.model.evtin = new ScilabDouble([1]);
this.model.dstate = [[1],[1],[lunit],[zeros(this.N*M,1)]];
this.model.ipar = [[length(fname)],[this._str2code[frmt-1]],[ievt],[this.N],[M],[this.swap],[offset],[this._str2code[fname-1]],[tmask],[outmask]];
this.model.blocktype = new ScilabString(["d"]);
this.model.dep_ut = [false,false];
exprs = [[fname],[string(this.N)],[string(this.swap)]];
gr_i = [];
this.x = standard_define([5,2],this.model,exprs,gr_i);
return new BasicBlock(this.x);
}
READAU_f.prototype.details = function READAU_f() {
return this.x;
}
READAU_f.prototype.get = function READAU_f() {
var options = {
fname1:["Input File Name",this.fname1],
N:["Buffer size",this.N],
swap:["Swap Mode (0:No, 1:Yes)",this.swap],
}
return options;
}
READAU_f.prototype.set = function READAU_f() {
this.fname1 = parseFloat(arguments[0]["fname1"])
this.N = parseFloat(arguments[0]["N"])
this.swap = parseFloat(arguments[0]["swap"])
this.x = arg1;
graphics = arg1.graphics;
exprs = graphics.exprs;
this.model = arg1.model;
out = this.model.out;
dstate = this.model.dstate;
ipar = this.model.ipar;
imask = 9+ipar[1-1];
tmask = ipar[imask-1];
lunit = dstate[3-1];
fname = exprs[1-1];
while (true) {
[ok,this.fname1,this.N,this.swap,exprs] = scicos_getvalue([[msprintf("Set %s block parameters","READAU_f")],[" "],["(Read Audio File)"],[" "],["Read is done on a binary \'.au\' file"]],["Input File Name","Buffer size","Swap Mode (0:No, 1:Yes)"],list("str",1,"vec",1,"vec",1),exprs);
tmask1 = [];
outmask = 1;
frmt1 = "uc";
M = 1;
offset = 1;
if (!ok) {
break;
}
this.fname1 = stripblanks(this.fname1);
frmt1 = stripblanks(frmt1);
if (this.alreadyran&&this.fname1!=fname) {
block_parameter_error("Simulation running !!! You cannot modify Input file name","End current simulation first.");
} else if (this.fname1=="") {
block_parameter_error(msprintf("Wrong value for \'%s\' parameter.","Input File Name"),"You must provide a filename.");
} else if (this.N<1) {
block_parameter_error(msprintf("Wrong value for \'%s\' parameter: %d.","Buffer size",this.N),msprintf("Must be greater than %d.",1));
} else if (this.alreadyran&&(this.N!=ipar[6-1])) {
block_parameter_error(msprintf("You cannot modify \'%s\' when running.","Buffer Size"),"End current simulation first.");
} else if (this.swap!=0&&this.swap!=1) {
block_parameter_error(msprintf("Wrong value for \'%s\' parameter: %d.","Swap Mode",this.swap),msprintf("Must be in the interval %s.","[0, 1]"));
} else {
[this.model,graphics,ok] = check_io(this.model,graphics,[],1,1,[]);
frmt1 = part(frmt1,1,3);
if (ok) {
ipar = [[length(this.fname1)],[this._str2code[frmt1-1]],[0],[this.N],[M],[this.swap],[offset,this._str2code[this.fname1-1]],[tmask1,outmask.slice()]];
if (prod(size(dstate))!=(this.N*M)+3) {
dstate = [[-1],[-1],[lunit],[zeros(this.N*M,1)]];
}
this.model.dstate = dstate;
this.model.ipar = ipar;
graphics.exprs = exprs;
this.x.graphics = graphics;
this.x.model = this.model;
break;
}
}
}
return new BasicBlock(this.x);
}
}
|