2 <link rel=
"stylesheet" href=
"style.css" type=
"text/css">
3 <meta content=
"text/html; charset=iso-8859-1" http-equiv=
"Content-Type">
4 <link rel=
"Start" href=
"index.html">
5 <link title=
"Index of types" rel=Appendix
href=
"index_types.html">
6 <link title=
"Index of exceptions" rel=Appendix
href=
"index_exceptions.html">
7 <link title=
"Index of values" rel=Appendix
href=
"index_values.html">
8 <link title=
"Index of modules" rel=Appendix
href=
"index_modules.html">
9 <link title=
"Types" rel=
"Chapter" href=
"Types.html">
10 <link title=
"Parser" rel=
"Chapter" href=
"Parser.html">
11 <link title=
"Lexer" rel=
"Chapter" href=
"Lexer.html">
12 <link title=
"Value" rel=
"Chapter" href=
"Value.html">
13 <link title=
"Signal" rel=
"Chapter" href=
"Signal.html">
14 <link title=
"Faustexp" rel=
"Chapter" href=
"Faustexp.html">
15 <link title=
"Interpreter" rel=
"Chapter" href=
"Interpreter.html">
16 <link title=
"Preprocess" rel=
"Chapter" href=
"Preprocess.html">
17 <link title=
"Main" rel=
"Chapter" href=
"Main.html"><title>Main.main
</title>
20 <code class=
"code"><span class=
"keyword">let
</span> main
()
=
<br>
22 <span class=
"comment">(*
ignore
system
alarm
clock
*)
</span><br>
23 <span class=
"keyword">let
</span> _
=
<span class=
"constructor">Sys
</span>.signal
<span class=
"constructor">Sys
</span>.sigalrm
<span class=
"constructor">Sys
</span>.
<span class=
"constructor">Signal_ignore
</span> <span class=
"keyword">in
</span><br>
25 <span class=
"comment">(*
set
garbage
collector
*)
</span><br>
26 <span class=
"keyword">let
</span> _
=
set_GC
()
<span class=
"keyword">in
</span><br>
28 <span class=
"comment">(*
read
input
wave
files
*)
</span><br>
29 <span class=
"keyword">let
</span> (input_rate_list,
input_float_array_list)
=
read_input_wave
<span class=
"constructor">Sys
</span>.argv
<span class=
"keyword">in
</span><br>
30 <br>
31 <span class=
"comment">(*
select
output
type
*)
</span><br>
32 <span class=
"keyword">let
</span> output_type
=
<span class=
"constructor">Sys
</span>.argv.(
1)
<span class=
"keyword">in
</span><br>
34 <span class=
"keyword">try
</span><br>
35 <span class=
"comment">(*
preprocess
*)
</span><br>
36 <span class=
"keyword">let
</span> dsp_file_route_string
=
(io_macro_to_string
<span class=
"constructor">Dsp_Route_string
</span>)
^
<span class=
"constructor">Sys
</span>.argv.(
2)
<span class=
"keyword">in
</span><br>
37 <span class=
"keyword">let
</span> exp_string
=
<span class=
"constructor">Preprocess
</span>.preprocess(dsp_file_route_string)
<span class=
"keyword">in
</span><br>
39 <span class=
"comment">(*
parsing
*)
</span><br>
40 <span class=
"keyword">let
</span> exp_faust
=
exp_of_string
exp_string
<span class=
"keyword">in
</span><br>
42 <span class=
"comment">(*
interpretation
*)
</span><br>
43 <span class=
"keyword">let
</span> (output_channel_list,
output_rate_list,
output_float_array_list)
=
<br>
44 interpreter
exp_faust
(input_rate_list,
input_float_array_list)
<span class=
"keyword">in
</span><br>
46 <span class=
"comment">(*
make
output
wave
files
*)
</span><br>
47 <span class=
"keyword">if
</span> output_type
=
<span class=
"string">"-wav"</span> <span class=
"keyword">then
</span><br>
48 write_output_wave
output_channel_list
output_rate_list
output_float_array_list
<br>
49 <span class=
"keyword">else
</span> <span class=
"keyword">if
</span> output_type
=
<span class=
"string">"-txt"</span> <span class=
"keyword">then
</span><br>
50 write_output_txt
output_channel_list
output_float_array_list
<br>
51 <span class=
"keyword">else
</span> raise
(
<span class=
"constructor">Invalid_argument
</span> (
<span class=
"string">"Unkown option: "</span> ^
output_type))
<br>
53 <span class=
"keyword">with
</span> <span class=
"constructor">NotYetDone
</span> <span class=
"keywordsign">-
></span><br>
54 print_endline(
<span class=
"string">"Operation not yet programed.."</span>)
</code></body></html>