Skip to content

Commit

Permalink
Modify consts and add default
Browse files Browse the repository at this point in the history
  • Loading branch information
MyBlackMIDIScore committed Aug 8, 2024
1 parent 84ab795 commit b0cdb05
Showing 1 changed file with 21 additions and 7 deletions.
28 changes: 21 additions & 7 deletions core/src/channel_group/config.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
use crate::{channel::ChannelInitOptions, AudioStreamParams};

/// Use multithreading for all actions inside the synthesizer (more info at `ParallelismOptions`)
/// with automatically determined thread counts.
pub const AUTO_MULTITHREADING: ParallelismOptions = ParallelismOptions {
channel: ThreadCount::Auto,
key: ThreadCount::Auto,
};

/// Defines the multithreading options for each task that supports it.
#[derive(Clone)]
pub enum ThreadCount {
Expand Down Expand Up @@ -48,6 +41,27 @@ pub struct ParallelismOptions {
pub key: ThreadCount,
}

impl ParallelismOptions {
const AUTO_PER_KEY: Self = ParallelismOptions {
channel: ThreadCount::None,
key: ThreadCount::Auto,
};

const AUTO_PER_CHANNEL: Self = ParallelismOptions {
channel: ThreadCount::Auto,
key: ThreadCount::None,
};
}

impl Default for ParallelismOptions {
fn default() -> Self {
ParallelismOptions {
channel: ThreadCount::Auto,
key: ThreadCount::Auto,
}
}
}

/// Options for initializing a new ChannelGroup.
#[derive(Clone)]
pub struct ChannelGroupConfig {
Expand Down

0 comments on commit b0cdb05

Please sign in to comment.