Skip to content

Commit

Permalink
Update XSynth and remove Send+Sync wrapper (#81)
Browse files Browse the repository at this point in the history
  • Loading branch information
MyBlackMIDIScore authored Nov 24, 2024
1 parent 33ecdec commit 749adc5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 32 deletions.
6 changes: 3 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ vulkano = { git = "https://github.com/vulkano-rs/vulkano.git", rev = "4a77d39" }
vulkano-shaders = { git = "https://github.com/vulkano-rs/vulkano.git", rev = "4a77d39" }
vulkano-win = { git = "https://github.com/vulkano-rs/vulkano.git", rev = "4a77d39" }
midi-toolkit-rs = "0.1.0"
xsynth-core = { git = "https://github.com/BlackMIDIDevs/xsynth", rev = "0d1d11d", features = ["serde"] }
xsynth-realtime = { git = "https://github.com/BlackMIDIDevs/xsynth", rev = "0d1d11d", features = ["serde"] }
xsynth-core = { git = "https://github.com/BlackMIDIDevs/xsynth", rev = "818dbd6", features = ["serde"] }
xsynth-realtime = { git = "https://github.com/BlackMIDIDevs/xsynth", rev = "818dbd6", features = ["serde"] }
kdmapi-rs = { package = "kdmapi", git = "https://github.com/MyBlackMIDIScore/kdmapi-rs.git", rev = "e1db353" }
serde = "1.0.210"
serde_derive = "1.0.210"
Expand Down
30 changes: 3 additions & 27 deletions src/audio_playback/xsynth.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
use std::{
ops::{Deref, DerefMut},
sync::Arc,
thread,
};
use std::{sync::Arc, thread};

use crate::{
gui::window::{LoadingType, WasabiError},
Expand All @@ -20,36 +16,16 @@ use xsynth_realtime::{

use super::*;

#[repr(transparent)]
struct FuckYouImSend<T>(T);

unsafe impl<T> Sync for FuckYouImSend<T> {}
unsafe impl<T> Send for FuckYouImSend<T> {}

impl<T> Deref for FuckYouImSend<T> {
type Target = T;

fn deref(&self) -> &Self::Target {
&self.0
}
}

impl<T> DerefMut for FuckYouImSend<T> {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.0
}
}

pub struct XSynthPlayer {
sender: RealtimeEventSender,
stats: RealtimeSynthStatsReader,
stream_params: AudioStreamParams,
synth: FuckYouImSend<RealtimeSynth>,
synth: RealtimeSynth,
}

impl XSynthPlayer {
pub fn new(config: XSynthRealtimeConfig) -> Self {
let synth = FuckYouImSend(RealtimeSynth::open_with_default_output(config));
let synth = RealtimeSynth::open_with_default_output(config);
let sender = synth.get_sender_ref().clone();
let stream_params = synth.stream_params();
let stats = synth.get_stats();
Expand Down

0 comments on commit 749adc5

Please sign in to comment.