Browse files

debugging

  • Loading branch information...
1 parent c69d4c8 commit 7f8400fda43919ea9c27f9d94dfb112b0490c470 @sapht committed Jan 16, 2012
Showing with 70 additions and 25 deletions.
  1. +2 −2 guiscripts/_common.applescript
  2. +16 −16 guiscripts/_reasonbatch.applescript
  3. +1 −1 guiscripts/render.applescript
  4. +1 −0 src/album.c
  5. +45 −6 src/song.c
  6. +5 −0 src/song.h
View
4 guiscripts/_common.applescript
@@ -29,11 +29,11 @@ to get_dirname(file_alias) -- NOTE: will mess up if you give it a path with trai
set fpath_chunks to my split(file_alias, "/")
set n to number of fpath_chunks
set i to 0
- log fpath_chunks
+ --log fpath_chunks
repeat
if (i is greater than 0) then
set p to item (i + 1) of fpath_chunks
- log p
+ --log p
if i is equal to (n - 1) then
exit repeat
end if
View
32 guiscripts/_reasonbatch.applescript
@@ -5,14 +5,14 @@ to close_split_windows()
set reloop to false
repeat with win in every window
set wintitle to (title of win)
- log wintitle
+ --log wintitle
if (wintitle) contains " (Rack)" then
- log "ya gotta do it again (rack)"
+ --log "ya gotta do it again (rack)"
set reloop to true
set n to number of every window
- click button 1 of win
- --keystroke "w" using {command down}
+ click button 1 of win
+ --keystroke "w" using {command down}
repeat -- repeat in order to make sure the window is actually closed
set n2 to number of every window
@@ -23,7 +23,7 @@ to close_split_windows()
end if
if (wintitle) contains " (Mixer)" then
- log "ya gotta do it again (mixer)"
+ --log "ya gotta do it again (mixer)"
set reloop to true
set n to number of every window
@@ -51,7 +51,7 @@ to close_split_windows()
end close_split_windows
to resolve_bad_format()
- log "Bad format"
+ --log "Bad format"
tell application "System Events" to key code 52
tell application "System Events"
tell process "Reason"
@@ -65,7 +65,7 @@ to resolve_bad_format()
end resolve_bad_format
to resolve_missing_sounds()
- log "Missing sounds"
+ --log "Missing sounds"
tell application "System Events" to key code 53
tell application "System Events"
tell process "Reason"
@@ -79,7 +79,7 @@ to resolve_missing_sounds()
end resolve_missing_sounds
to resolve_please_insert_disk()
- log "Missing refill"
+ --log "Missing refill"
(* Perform hacks to press escape multiple times *)
tell application "System Events"
tell process "Reason"
@@ -103,7 +103,7 @@ to process_file(current_file_alias, new_name)
end tell
tell application process "Reason"
repeat
- my clog("Inside repeat...")
+ --my clog("Inside repeat...")
set did_process to false
repeat with current_win in every window -- the reason for this loop is to circumvent "Open Song" (and possibly other, unknown) tickers
set loop_continue to false
@@ -116,13 +116,13 @@ to process_file(current_file_alias, new_name)
if loop_continue is false then -- if the try block failed we will not go here. the try block should only fail during tiny frames of 0 window count
-- BAD FORMAT
- my clog("confused???")
+ --my clog("confused???")
if number of all_ui is 4 then
- log "well..."
+ --log "well..."
if name of item 4 in all_ui is "File has bad format" then
my resolve_bad_format()
- log "well well..."
- my clog("bad format: " & current_file_alias)
+ --log "well well..."
+ --my clog("bad format: " & current_file_alias)
set did_process to true
return "broken"
exit repeat
@@ -133,7 +133,7 @@ to process_file(current_file_alias, new_name)
if current_title is "Missing Sounds" then
select current_win
my resolve_missing_sounds()
- my clog("missing sounds: " & current_file_alias)
+ --my clog("missing sounds: " & current_file_alias)
set did_process to true
return "missing_sounds"
exit repeat
@@ -143,14 +143,14 @@ to process_file(current_file_alias, new_name)
if current_title is "Please Insert Disk" then
select current_win
my resolve_please_insert_disk()
- my clog("missing refill: " & current_file_alias)
+ --my clog("missing refill: " & current_file_alias)
set did_process to true
return "missing_refill"
exit repeat
end if
-- MAIN APPLICATION WINDOW
- my clog((number of all_ui) as string)
+ --my clog((number of all_ui) as string)
if (number of all_ui) is in {21, 22, 23} then -- looks like this number changed in reason6
my close_split_windows()
my saphtune_main(current_file_alias, new_name)
View
2 guiscripts/render.applescript
@@ -56,7 +56,7 @@ to saphtune_main(file_alias, new_name)
end repeat
- my clog("Successfully exported: " & file_alias)
+ my clog("exported:" & file_alias)
return "success"
end tell
end tell
View
1 src/album.c
@@ -48,6 +48,7 @@ album_list_make_m3u(struct album_list *album_list)
+
struct song_list *
album_list_find_exclusions(
struct album_list *album_list,
View
51 src/song.c
@@ -26,17 +26,56 @@ song_create(char *root, char *name)
r->slug = name;
git_load_status(&r->git);
r->path = r->git.path;
- r->render_path = malloc(256 * sizeof(char));
-
- sprintf(r->render_path, "%s/%s.wav",
- r->path,
- r->slug);
-
+ r->project_path = malloc(256 * sizeof(char));
+ r->render_path = malloc(256 * sizeof(char));
+ sprintf(r->render_path, "%s/%s.wav", r->path, r->slug);
+ r->render_path_len = strlen(render_path);
+ sprintf(r->project_path, "%s/%s.reason", r->path, r->slug);
+ r->project_path_len = strlen(render_path);
r->render_stat = song_render_analyze(r->render_path);
return r;
}
+void
+song_list_render(struct song_list *song_list, char *render_script_path)
+{
+ struct song *song;
+ struct {
+ char **command;
+ int command_num;
+ } queue;
+ queue.command_num = 0;
+ queue.command = malloc(sizeof(void*) * song_list->len);
+
+ for(int j=0; j<song_list->len; j++) {
+ song = song_list->e[i];
+
+ queue.command[queue.command_num] = malloc((
+ strlen("osascript xx xx")
+ + strlen(render_script_path)
+ + strlen(song->slug)
+ + 1) * sizeof(char));
+
+ queue.command[queue.command_num] = sprintf(
+ "osascript %s \"%s\" \"%s.wav\"",
+ render_script_path,
+ song->project_path,
+ song->slug
+ );
+
+ queue.command_num++;
+ }
+
+ FILE *pipe;
+ for(int i=0; i<queue.command_num; i++) {
+ if(!(fpipe = popen(queue.command[i], "r"))) {
+ perror("Problem with le pipe");
+ exit(1);
+ }
+ }
+}
+
struct song_render_stat
song_render_analyze(char *render_path)
{
View
5 src/song.h
@@ -18,6 +18,10 @@ struct song {
struct song_render_stat render_stat;
char *render_path;
+ int render_path_len;
+
+ char *project_path;
+ int project_path_len;
};
struct song_list {
@@ -30,4 +34,5 @@ int song_qsort(struct song **a, struct song **b);
int songs_load_dir(char *dir, struct song_list *song_list);
struct song * song_create(char *root, char *name);
int song_repos_not_cloned(char *git_dir, struct song_list *song_list, char **not_cloned);
+void song_list_render(struct song_list *song_list, char *render_script_path);
#endif

0 comments on commit 7f8400f

Please sign in to comment.