mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-03 11:52:19 +00:00
removed rodio and deps
This commit is contained in:
parent
63f84ac750
commit
091e043168
11 changed files with 8 additions and 405 deletions
|
@ -14,7 +14,6 @@ normal = ["confy"]
|
|||
|
||||
[features]
|
||||
default = []
|
||||
with_sound = ["rodio"]
|
||||
|
||||
[dependencies]
|
||||
roc_ast = { path = "../ast" }
|
||||
|
@ -57,7 +56,6 @@ confy = { git = 'https://github.com/rust-cli/confy', features = [
|
|||
], default-features = false }
|
||||
serde = { version = "1.0.144", features = ["derive"] }
|
||||
nonempty = "0.8.0"
|
||||
rodio = { version = "0.15.0", optional = true } # to play sounds
|
||||
threadpool = "1.8.1"
|
||||
|
||||
fs_extra.workspace = true
|
||||
|
|
|
@ -8,7 +8,5 @@ mod mvc;
|
|||
mod render_ast;
|
||||
mod render_debug;
|
||||
mod resources;
|
||||
#[cfg(feature = "with_sound")]
|
||||
mod sound;
|
||||
mod theme;
|
||||
mod util;
|
||||
|
|
|
@ -21,8 +21,6 @@ use crate::editor::mvc::string_update::start_new_string;
|
|||
use crate::editor::mvc::string_update::update_small_string;
|
||||
use crate::editor::mvc::string_update::update_string;
|
||||
use crate::editor::mvc::tld_value_update::{start_new_tld_value, update_tld_val_name};
|
||||
#[cfg(feature = "with_sound")]
|
||||
use crate::editor::sound::play_sound;
|
||||
use crate::ui::text::caret_w_select::CaretWSelect;
|
||||
use crate::ui::text::lines::MoveCaretFun;
|
||||
use crate::ui::text::selection::validate_raw_sel;
|
||||
|
@ -546,12 +544,6 @@ impl<'a> EdModel<'a> {
|
|||
self.show_debug_view = !self.show_debug_view;
|
||||
self.dirty = true;
|
||||
}
|
||||
F12 => {
|
||||
#[cfg(feature = "with_sound")]
|
||||
_sound_thread_pool.execute(move || {
|
||||
play_sound("./editor/src/editor/resources/sounds/bell_sound.mp3");
|
||||
});
|
||||
}
|
||||
_ => (),
|
||||
}
|
||||
|
||||
|
|
|
@ -1,45 +0,0 @@
|
|||
use rodio::{Decoder, OutputStream, Sink};
|
||||
use std::fs::File;
|
||||
use std::io::BufReader;
|
||||
|
||||
pub(crate) fn play_sound(sound_path_str: &str) {
|
||||
let out_stream_res = OutputStream::try_default();
|
||||
|
||||
match out_stream_res {
|
||||
Ok((_, out_stream_handle)) => match Sink::try_new(&out_stream_handle) {
|
||||
Ok(sink) => match File::open(sound_path_str) {
|
||||
Ok(file) => {
|
||||
let reader = BufReader::new(file);
|
||||
|
||||
match Decoder::new(reader) {
|
||||
Ok(decoder) => {
|
||||
sink.append(decoder);
|
||||
sink.sleep_until_end();
|
||||
}
|
||||
Err(e) => {
|
||||
println!("Failed to create Decoder from BufReader from sound file at {}. Error message: {:?}", sound_path_str, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
Err(e) => {
|
||||
println!(
|
||||
"Failed to open sound file at {}. Error message: {}",
|
||||
sound_path_str, e
|
||||
);
|
||||
}
|
||||
},
|
||||
Err(e) => {
|
||||
println!(
|
||||
"Failed to create Sink to play sound. Error message: {:?}",
|
||||
e
|
||||
);
|
||||
}
|
||||
},
|
||||
Err(e) => {
|
||||
println!(
|
||||
"Failed to create OutputStream to play sound. Error message: {:?}",
|
||||
e
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue