1 #![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)]
2 //! # Csound
3 //! This crate contains safe Csound bindings for the csound's C API.
4 //! The supported csound's version is >= 6.12
5 //! ## What is Csound?
6 //! Csound is a sound and music computing system. If you want to known more visit:
7 //! - [Csound webside](https://csound.com/index.html)
8 //! - [Documentation](http://www.csounds.com/resources/documentation/)
9 //! - [Community](https://csound.com/community.html)
10 //! - [Audio examples](https://csound.com/community.html)
11 //! - [Floss](http://write.flossmanuals.net/csound/preface/)
12 //! # Hello World
13 //! A simple Hello world example which reproduces a simple sine wave signal. The call to the csound's perform() method will
14 //! block the application until the end of the score have been reached.
15 //! There are another alternatives for non blocking calls to perform csound's scores or csd files. see the examples in the project's source directory
16 //! or go to [*csound's examples repository*](https://github.com/csound/csoundAPI_examples/tree/master/rust) for more advanced examples and use cases.
17 //! ```text
18 //! extern crate csound;
19 //! use csound::*;
20 //!
21 //! static score: &str = "<CsoundSynthesizer>
22 //! <CsOptions>
23 //! -odac
24 //! </CsOptions>
25 //! <CsInstruments>
26 //!
27 //! sr = 44100
28 //! ksmps = 32
29 //! nchnls = 2
30 //! 0dbfs  = 1
31 //!
32 //! instr 1
33 //!
34 //! kamp = .6
35 //! kcps = 440
36 //! ifn  = p4
37 //!
38 //! asig oscil kamp, kcps, ifn
39 //!      outs asig,asig
40 //!
41 //! endin
42 //! </CsInstruments>
43 //! <CsScore>
44 //! f1 0 16384 10 1
45 //! i 1 0 2 1
46 //! e
47 //! </CsScore>
48 //! </CsoundSynthesizer>";
49 //!
50 //! fn main() {
51 //!     let mut cs = Csound::new();
52 //!
53 //!    /* a message callback*/
54 //!    let func = |_, message:&str| {
55 //!        print!("{}", message);
56 //!    };
57 //!    cs.message_string_callback(|_, msg: &str| {
58 //!         print!("{}", msg) );
59 //!    cs.compile_csd_text(csd).unwrap();
60 //!    cs.start().unwrap();
61 //!
62 //!    cs.perform();
63 //! }
64 //! ```
65 
66 pub use csound_sys::RTCLOCK;
67 
68 mod callbacks;
69 mod channels;
70 mod csound;
71 mod enums;
72 mod rtaudio;
73 pub use callbacks::FileInfo;
74 pub use channels::{ChannelHints, ChannelInfo, InputChannel, OutputChannel, PvsDataExt};
75 pub use csound::{BufferPtr, CircularBuffer, Csound, OpcodeListEntry, Table};
76 pub use enums::{
77     AudioChannel, ChannelData, ControlChannel, FileTypes, Language, MessageType, Status, StrChannel,
78 };
79 pub use rtaudio::{CsAudioDevice, CsMidiDevice, RtAudioParams};
80