summaryrefslogtreecommitdiff
path: root/js/Sinks/WRITEAU_f.js
blob: 40833663102465040a98b8ccd6eb193714401c32 (plain)
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
/* autogenerated from "macros/Sinks/WRITEAU_f.sci" */
function WRITEAU_f() {
    WRITEAU_f.prototype.define = function WRITEAU_f() {
        in1 = 1;
        nin = sum(in1);
        frmt = "uc ";
        fname = "/dev/audio";
        swap = 0;
        lunit = 0;
        N = 2;
        model = scicos_model();
        model.sim = list("writeau",2);
        model.in1 = in1;
        model.evtin = 1;
        model.dstate = [[-1],[lunit],[zeros((nin+1)*N,1)]];
        model.ipar = [[length(fname)],[this._str2code[frmt-1]],[N],[swap],[this._str2code[fname-1]]];
        model.blocktype = "d";
        model.dep_ut = [true,false];
        exprs = [string(N),string(swap)];
        gr_i = [];
        this.x = standard_define([4,2],model,exprs,gr_i);
    }
    WRITEAU_f.prototype.details = function WRITEAU_f() {
        return this.x;
    }
    WRITEAU_f.prototype.get = function WRITEAU_f() {
    }
    WRITEAU_f.prototype.set = function WRITEAU_f() {
        this.x = arg1;
        graphics = arg1.graphics;
        exprs = graphics.exprs;
        model = arg1.model;
        ipar = model.ipar;
        dstate = model.dstate;
        lunit = dstate[2-1];
        while (true) {
            [ok,N,swap,exprs] = scicos_getvalue([[msprintf(gettext("Set %s block parameters"),"WRITEAU_f")],[" "],[gettext("Write \'.au\' sound file on audio device")]],[[gettext("Buffer Size")],[gettext("Swap Mode (0:No, 1:Yes)")]],list("vec",1,"vec",1),exprs);
            if (!ok) {
                break;
            }
            nin = 1;
            fname1 = "/dev/audio";
            frmt1 = "uc ";
            if (this.alreadyran&&(N!=ipar[5-1])) {
                block_parameter_error(msprintf(gettext("You cannot modify \'%s\' when running."),gettext("Buffer Size")),gettext("End current simulation first"));
                ok = false;
            } else if (N<1) {
                block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d."),gettext("Buffer Size"),N),gettext("Strictly positive integer expected."));
                ok = false;
            }
            if (swap!=0&&swap!=1) {
                block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d."),gettext("Swap Mode"),swap),msprintf(gettext("Must be in the interval %s."),"[0, 1]"));
                ok = false;
            }
            if (ok) {
                ipar = [[length(fname1)],[this._str2code[frmt1-1]],[N],[swap],[this._str2code[fname1-1]]];
                if (prod(size(dstate))!=(nin+1)*N+2) {
                    dstate = [[-1],[lunit],[zeros((nin+1)*N,1)]];
                }
                model.in1 = 1;
                model.dstate = dstate;
                model.ipar = ipar;
                graphics.exprs = exprs;
                this.x.graphics = graphics;
                this.x.model = model;
                break;
            }
        }
    }
}