pub struct JUCE { /* private fields */ }Expand description
A handle to the JUCE runtime. Required for certain JUCE classes.
Once all references to this object are dropped, the JUCE runtime will be shut down.
Implementations§
Source§impl JUCE
impl JUCE
Sourcepub fn initialise() -> Self
pub fn initialise() -> Self
Initialises the JUCE runtime.
§Panics
This function will panic if the JUCE runtime is already initialised.
Examples found in repository?
examples/audio_callback.rs (line 80)
79fn main() -> Result<()> {
80 let juce = JUCE::initialise();
81 let mut device_manager = AudioDeviceManager::new(&juce);
82 device_manager.initialise(0, 2)?;
83
84 let handle = device_manager.add_audio_callback(AudioCallback::default());
85
86 sleep(Duration::from_secs(2));
87
88 device_manager.remove_audio_callback(handle);
89
90 Ok(())
91}More examples
examples/devices.rs (line 7)
6fn main() -> Result<()> {
7 let juce = JUCE::initialise();
8 let mut audio_device_manager = AudioDeviceManager::new(&juce);
9 audio_device_manager.initialise(2, 2)?;
10
11 let device_type = audio_device_manager.current_device_type().unwrap();
12
13 println!("Inputs:");
14 for input in device_type.input_devices() {
15 println!(" {}", input);
16 }
17
18 println!("Outputs:");
19 for output in device_type.output_devices() {
20 println!(" {}", output);
21 }
22
23 Ok(())
24}examples/test_tone.rs (line 10)
9fn main() -> Result<()> {
10 let juce = JUCE::initialise();
11 let mut audio_device_manager = AudioDeviceManager::new(&juce);
12 audio_device_manager.initialise(0, 2)?;
13
14 {
15 let mut device = audio_device_manager.current_device().unwrap();
16
17 println!("Name: {}", device.name());
18 println!("Type: {}", device.type_name());
19 println!("Sample rate: {}", device.sample_rate());
20 println!("Buffer size: {}", device.buffer_size());
21 println!(
22 "Available sample rates: {:?}",
23 device.available_sample_rates()
24 );
25 println!(
26 "Available buffer sizes: {:?}",
27 device.available_buffer_sizes()
28 );
29 }
30
31 audio_device_manager.play_test_sound();
32 sleep(Duration::from_secs(1));
33
34 Ok(())
35}Trait Implementations§
Auto Trait Implementations§
impl Freeze for JUCE
impl RefUnwindSafe for JUCE
impl !Send for JUCE
impl !Sync for JUCE
impl Unpin for JUCE
impl UnwindSafe for JUCE
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more