JUCE

Struct JUCE 

Source
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

Source

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
Hide additional 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§

Source§

impl Clone for JUCE

Source§

fn clone(&self) -> JUCE

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.