-
-
Notifications
You must be signed in to change notification settings - Fork 32
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
Updating for 4.0 Update #46
Open
sysnet-ai
wants to merge
4
commits into
lpil:master
Choose a base branch
from
sysnet-ai:v40_update
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
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
ce801f0
Working with SonicPi >4.0 - Tested with vim-sonic-pi, only "logs" isn…
sysnet-ai 0b10e05
Cleaning up some debug messages and such
sysnet-ai b32f615
Fix typo on path
sysnet-ai ee51df3
Add a way to sync to sonic pi GUI as requested and some other improve…
sysnet-ai 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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
language: rust | ||
rust: | ||
- 1.20.0 | ||
- 1.56.0 | ||
- stable | ||
- beta | ||
- nightly | ||
|
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 |
---|---|---|
@@ -0,0 +1,41 @@ | ||
## Syncing sonic-pi-tool to a Runningi instance of Sonic PI GUI | ||
|
||
|
||
## Why is this needed? | ||
|
||
From version 4.0 and on, Sonic Pi's internal processes assing ports to communicate with one another dynamically (as opposed to using a pre-established one). | ||
Additionally, they added the concept of a token which is required for messages to be processed by the audio server. | ||
|
||
## How to sync? | ||
If you want to use sonic-pi-tool with a running instance of Sonic Pi, you need the port of the audio server, and the token to make sure your messages are treated as valid. | ||
|
||
|
||
### From Linux or Mac OS | ||
|
||
From terminal run the following command: | ||
```sh | ||
> ps x | grep spider | ||
``` | ||
|
||
This allows us to find the spider-server, which is the one that responds to the OSC commands sonic-pi-tool will send. | ||
You should see something like: | ||
```sh | ||
> ps x | grep spider | ||
52800 /Applications/Sonic Pi.app/Contents/Resources/app/server/native/ruby/bin/ruby | ||
--enable-frozen-string-literal -E utf-8 | ||
/Applications/Sonic Pi.app/Contents/Resources/app/server/ruby/bin/spider-server.rb | ||
-u 33926 33927 33928 33928 4560 33929 33933 1839294199 | ||
``` | ||
|
||
What we care about here are 2 numbers - The port of the server (the first number, right after the `-u` - `33926` in our example above) and the last number, which is the token (`1839294199` in the example above) | ||
|
||
With those two number we can call `sonic-pi-tool sync` and it will take care of setting up the configuration required: | ||
```sh | ||
> sonic-pi-tool sync 33926 1839294199 | ||
## Now sonic-pi-tool is sync'd with that instance of Sonic Pi GUI | ||
|
||
> sonic-pi-tool check | ||
# => Sonic Pi server listening on port 33926 | ||
``` | ||
|
||
## From Windows |
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 |
---|---|---|
|
@@ -152,10 +152,8 @@ pub fn start_server() { | |
|
||
// Write the ports of the different processes into a config file so other commands know | ||
// how to reach the right endpoints | ||
std::fs::create_dir_all(&config::SonicPiToolCfg::get_default_cfg_folder()).unwrap(); | ||
let cur_cfg = &config::SonicPiToolCfg::new(token, sonic_pi_port, daemon_port, gui_port); | ||
std::fs::write(&config::SonicPiToolCfg::get_default_cfg_file_path(), | ||
toml::to_string(cur_cfg).unwrap()).unwrap(); | ||
write_config_toml(&cur_cfg); | ||
|
||
loop { | ||
server::send_keep_live(); | ||
|
@@ -187,3 +185,17 @@ pub fn record(path: &str) { | |
} | ||
} | ||
} | ||
|
||
/// Sync with a Server that is already running (e.g. the Sonic Pi GUI) | ||
/// Will write the Config file so that other commands can correctly talk to that server. | ||
/// Refer to the README for more details on how to get the port and token | ||
pub fn sync(sonic_pi_port:&u16, token: &i32) { | ||
let cur_cfg = &config::SonicPiToolCfg::new(*token, *sonic_pi_port, 0, 0); | ||
write_config_toml(&cur_cfg); | ||
} | ||
|
||
fn write_config_toml(cfg: &config::SonicPiToolCfg) { | ||
std::fs::create_dir_all(&config::SonicPiToolCfg::get_default_cfg_folder()).unwrap(); | ||
std::fs::write(&config::SonicPiToolCfg::get_default_cfg_file_path(), | ||
toml::to_string(cfg).unwrap()).unwrap(); | ||
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. Could you run the formatter please? Thank you |
||
} |
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
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.
The user should be able to read this document and then know all need to know to be able to use the tool, so they'll need to know what numbers to use here.