supernova: fix boost.thread move semantics
[supercollider.git] / Help / UGens / Info / CheckBadValues.html
bloba1f94639e43675fd4cb2cd9f0b581317a81249ad
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2 <html>
3 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5 <meta http-equiv="Content-Style-Type" content="text/css">
6 <title></title>
7 <meta name="Generator" content="Cocoa HTML Writer">
8 <meta name="CocoaVersion" content="824.42">
9 <style type="text/css">
10 p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 13.0px Helvetica}
11 p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 18.0px Helvetica; min-height: 22.0px}
12 p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica}
13 p.p4 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px}
14 p.p5 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; min-height: 12.0px}
15 p.p6 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #c40000}
16 p.p7 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco}
17 span.s1 {font: 18.0px Helvetica}
18 span.s2 {color: #000000}
19 span.s3 {color: #0010c4}
20 span.s4 {color: #c40000}
21 span.s5 {color: #007200}
22 span.Apple-tab-span {white-space:pre}
23 </style>
24 </head>
25 <body>
26 <p class="p1"><span class="s1"><b>CheckBadValues<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b></span><b>test for infinity, not-a-number, and denormals</b></p>
27 <p class="p2"><br></p>
28 <p class="p3"><b>CheckBadValues.ar(in, id, post)</b></p>
29 <p class="p3"><b>CheckBadValues.kr(in, id, post)</b></p>
30 <p class="p4"><br></p>
31 <p class="p3">This UGen tests for infinity, NaN (not a number), and denormals. If one of these is found, it posts a warning. Its output is as follows: 0 = a normal float, 1 = NaN, 2 = infinity, and 3 = a denormal.</p>
32 <p class="p3"><b>in</b> - the UGen whose output is to be tested</p>
33 <p class="p3"><b>id</b> - an id number to identify this UGen. The default is 0.</p>
34 <p class="p3"><b>post</b> - One of three post modes:</p>
35 <p class="p3"><span class="Apple-tab-span"> </span>0 = no posting;</p>
36 <p class="p3"><span class="Apple-tab-span"> </span>1 = post a line for every bad value;</p>
37 <p class="p3"><span class="Apple-tab-span"> </span>2 = post a line only when the floating-point classification changes (e.g., normal -&gt; NaN and vice versa)</p>
38 <p class="p4"><br></p>
39 <p class="p3">The default post mode is 2. Post mode 1 is retained for backward compatibility; be aware that it generates a large amount of output.</p>
40 <p class="p5"><br></p>
41 <p class="p5"><br></p>
42 <p class="p6"><span class="s2">{ </span><span class="s3">CheckBadValues</span><span class="s2">.kr(</span><span class="s3">SinOsc</span><span class="s2">.ar); 0}.play </span>// nothing wrong here</p>
43 <p class="p5"><br></p>
44 <p class="p7">{ <span class="s3">CheckBadValues</span>.kr(1 / 0, 1).poll; 0 }.play <span class="s4">// check infinity</span></p>
45 <p class="p5"><br></p>
46 <p class="p7">x = { <span class="s3">arg</span> test = -1; <span class="s3">CheckBadValues</span>.kr(test); 0 }.play <span class="s4">// check NaN</span></p>
47 <p class="p7">x.set(<span class="s5">\test</span>, -1.sqrt);</p>
48 <p class="p5"><br></p>
49 <p class="p6">// don't post, but do something with the output</p>
50 <p class="p7">(</p>
51 <p class="p7">x = { <span class="s3">arg</span> freq = 440;</p>
52 <p class="p7"><span class="Apple-tab-span"> </span><span class="s3">var</span> good;<span class="Apple-converted-space"> </span></p>
53 <p class="p7"><span class="Apple-tab-span"> </span>good = <span class="s3">BinaryOpUGen</span>(<span class="s5">'=='</span>, <span class="s3">CheckBadValues</span>.kr(freq, 0, 0), 0);</p>
54 <p class="p6"><span class="s2"><span class="Apple-tab-span"> </span></span><span class="s3">SinOsc</span><span class="s2">.ar(freq, 0, 0.1) * good </span>// silence the output if freq is bad</p>
55 <p class="p7">}.play;</p>
56 <p class="p7">)</p>
57 <p class="p7">x.set(<span class="s5">\freq</span>, -1.sqrt);</p>
58 <p class="p5"><br></p>
59 <p class="p6">// the UGen method checkBadValues passes through the input for quick testing</p>
60 <p class="p7">{ <span class="s3">SinOsc</span>.ar(440, 0, 0.1).checkBadValues }.play</p>
61 </body>
62 </html>