-
-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Python rust backend #470
Open
SanderVocke
wants to merge
38
commits into
master
Choose a base branch
from
python_rust_backend
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Python rust backend #470
Changes from all commits
Commits
Show all changes
38 commits
Select commit
Hold shift + click to select a range
d121c30
wip
SanderVocke b97eaed
wip
SanderVocke f08073a
wip
SanderVocke 3123c20
wip
SanderVocke 392c39a
wip
SanderVocke 3dc4e03
wip
SanderVocke 6e13319
wip
SanderVocke 5354550
wip
SanderVocke 22660d8
wip
SanderVocke 3b27bc4
wip
SanderVocke 9576096
wip
SanderVocke 6fdca25
wip
SanderVocke ef16bec
wip
SanderVocke 5d7b671
refactor: Update BackendLoop to use shoop_py_backend methods instead …
SanderVocke f3a5d0a
wip
SanderVocke 6b99698
wip
SanderVocke 45a08cb
wip
SanderVocke 6ffe9bf
wip
SanderVocke f516356
wip
SanderVocke 6f75d29
wip
SanderVocke f4fe489
feat: Implement Rust methods for MidiChannel based on BackendLoopMidi…
SanderVocke e2db2d8
refactor: Simplify MidiChannel implementation by removing duplicate code
SanderVocke 16039ee
feat: Implement MidiEvent and MidiChannelState types in midi_channel.rs
SanderVocke 96a5c22
fix: Add missing newline at end of file in midi_channel.rs
SanderVocke fa61693
feat: Implement PyO3-exposed methods for BackendLoopMidiChannel in mi…
SanderVocke 850b51f
wip
SanderVocke f392285
refactor: Move MidiEvent struct to its own file for better organization
SanderVocke a522e3e
feat: Implement conversion from backend_bindings::MidiEvent to MidiEvent
SanderVocke 00c35ae
feat: Add registration function for MidiEvent in midi.rs and mod.rs
SanderVocke 3270410
refactor: Replace direct ffi calls in BackendLoopMidiChannel with Mid…
SanderVocke 6bb7772
wip
SanderVocke 463008d
wip
SanderVocke a217218
feat: Add methods for audio driver management and external port disco…
SanderVocke 8c87a92
feat: Implement types for Jack and Dummy audio driver settings
SanderVocke cc25169
feat: Create ExternalPortDescriptor struct to wrap shoop_external_por…
SanderVocke be3d111
wip
SanderVocke 07e7e09
feat: Add PyO3 wrappers for AudioDriver methods in Python backend
SanderVocke bedae5c
wip
SanderVocke File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,3 +18,4 @@ py-build-cmake.cross.toml | |
Cargo.lock | ||
target | ||
.aider* | ||
.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -630,6 +630,20 @@ void disconnect_audio_output (shoopdaloop_loop_audio_channel_t *channel, shoopda | |
}); | ||
} | ||
|
||
void disconnect_audio_port (shoopdaloop_loop_audio_channel_t *channel, shoopdaloop_audio_port_t* port) { | ||
return api_impl<void>("disconnect_audio_output", [&]() { | ||
auto _chan = internal_audio_channel(channel); | ||
if (!_chan) { return; } | ||
_chan->get_backend().queue_process_thread_command([=]() { | ||
auto _port = internal_audio_port(port); | ||
auto _channel = internal_audio_channel(channel); | ||
if (_port && _channel) { | ||
_channel->disconnect_port(_port, false); | ||
} | ||
}); | ||
}); | ||
} | ||
|
||
void disconnect_midi_output (shoopdaloop_loop_midi_channel_t *channel, shoopdaloop_midi_port_t* port) { | ||
return api_impl<void>("disconnect_midi_output", [&]() { | ||
auto _chan = internal_midi_channel(channel); | ||
|
@@ -644,6 +658,20 @@ void disconnect_midi_output (shoopdaloop_loop_midi_channel_t *channel, shoopdal | |
}); | ||
} | ||
|
||
void disconnect_midi_port (shoopdaloop_loop_midi_channel_t *channel, shoopdaloop_midi_port_t* port) { | ||
return api_impl<void>("disconnect_midi_output", [&]() { | ||
auto _chan = internal_midi_channel(channel); | ||
if (!_chan) { return; } | ||
_chan->get_backend().queue_process_thread_command([=]() { | ||
auto _port = internal_midi_port(port); | ||
auto _channel = internal_midi_channel(channel); | ||
if (_port && _channel) { | ||
_channel->disconnect_port(_port, false); | ||
} | ||
}); | ||
}); | ||
} | ||
|
||
void disconnect_audio_outputs (shoopdaloop_loop_audio_channel_t *channel) { | ||
return api_impl<void>("disconnect_audio_outputs", [&]() { | ||
auto _chan = internal_audio_channel(channel); | ||
|
@@ -1907,7 +1935,7 @@ void destroy_midi_channel(shoopdaloop_loop_midi_channel_t *d) { | |
|
||
void destroy_shoopdaloop_decoupled_midi_port(shoopdaloop_decoupled_midi_port_t *d) { | ||
return api_impl<void, log_level_debug_trace, log_level_warning>("destroy_shoopdaloop_decoupled_midi_port", [&]() { | ||
logging::log<"Backend.API", log_level_error>(std::nullopt, std::nullopt, "destroy_shoopdaloop_decoupled_midi_port"); | ||
logging::log<"Backend.API", log_level_debug>(std::nullopt, std::nullopt, "destroy_shoopdaloop_decoupled_midi_port"); | ||
throw std::runtime_error("unimplemented"); | ||
}); | ||
} | ||
|
@@ -2265,6 +2293,15 @@ void destroy_audio_driver_state(shoop_audio_driver_state_t *state) { | |
}); | ||
} | ||
|
||
void destroy_audio_driver(shoop_audio_driver_t *driver) { | ||
return api_impl<void, log_level_debug_trace>("destroy_audio_driver", [&]() { | ||
auto _driver = internal_audio_driver(driver); | ||
if (!_driver) { return; } | ||
_driver->close(); | ||
g_active_drivers.erase(_driver); | ||
Comment on lines
+2300
to
+2301
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. style: close() should be called after removing from g_active_drivers to prevent race conditions if close triggers callbacks |
||
}); | ||
} | ||
|
||
unsigned get_driver_active(shoop_audio_driver_t *driver) { | ||
return api_impl<unsigned>("get_driver_active", [&]() { | ||
auto _driver = internal_audio_driver(driver); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: potential memory leak - should delete the driver pointer after closing and removing from active drivers