summaryrefslogtreecommitdiff
path: root/snd-file.c
diff options
context:
space:
mode:
authorAlessio Treglia <quadrispro@ubuntu.com>2010-01-08 18:21:56 +0100
committerAlessio Treglia <quadrispro@ubuntu.com>2010-01-08 18:21:56 +0100
commitf369f1bdb2b9efc5b7ed3b74a0b4b51642086e18 (patch)
tree67d9e1386cd8c7b0fae976ca5c426dc43f54ed15 /snd-file.c
parent8b022ab680a3f5e374a44f2c05c1671cfb2bc799 (diff)
Imported Upstream version 11.2
Diffstat (limited to 'snd-file.c')
-rw-r--r--snd-file.c47
1 files changed, 27 insertions, 20 deletions
diff --git a/snd-file.c b/snd-file.c
index 0904aaf..09add61 100644
--- a/snd-file.c
+++ b/snd-file.c
@@ -7,6 +7,9 @@
#endif
+/* TODO: show listener from menu sometimes doesn't open the listener pane */
+
+
/* -------------------------------- basic file attributes -------------------------------- */
#if USE_STATVFS
@@ -17,7 +20,7 @@
#include <sys/param.h>
#endif
-#if (HAVE_SYS_MOUNT_H && MUS_MAC_OSX) || __bsdi__ || MUS_NETBSD
+#if (HAVE_SYS_MOUNT_H && HAVE_OSX) || __bsdi__ || HAVE_NETBSD
#include <sys/mount.h>
#endif
@@ -46,7 +49,7 @@ mus_long_t disk_kspace(const char *filename) {return(1234567);}
mus_long_t disk_kspace(const char *filename)
{
-#if MUS_SUN
+#if HAVE_SUN
statvfs_t buf; /* else dumb compiler complaint */
#else
struct statvfs buf;
@@ -1464,7 +1467,7 @@ snd_info *finish_opening_sound(snd_info *sp, bool selected)
XEN_VARIABLE_SET(snd_opened_sound, C_INT_TO_XEN_SOUND(sp->index));
#endif
- sp->write_date = file_write_date(sp->filename);
+ sp->write_date = file_write_date(sp->filename); /* redundant (see snd-xsnd.c) */
sp->need_update = false;
ss->active_sounds++;
reflect_file_change_in_title();
@@ -1507,6 +1510,7 @@ snd_info *snd_open_file(const char *filename, read_only_t read_only)
file_info *hdr;
snd_info *sp;
static char *mcf = NULL;
+
if (mcf) free(mcf);
mcf = mus_expand_filename(filename);
if (XEN_HOOKED(open_hook))
@@ -1531,6 +1535,7 @@ snd_info *snd_open_file(const char *filename, read_only_t read_only)
}
}
}
+
hdr = make_file_info(mcf, read_only, FILE_SELECTED);
if (!hdr)
{
@@ -1560,6 +1565,9 @@ void snd_close_file(snd_info *sp)
S_before_close_hook);
if (XEN_TRUE_P(res)) return;
+ if (peak_env_dir(ss))
+ map_over_sound_chans(sp, write_peak_env_info_file);
+
if (XEN_HOOKED(close_hook))
run_hook(close_hook,
XEN_LIST_1(C_INT_TO_XEN_SOUND(sp->index)),
@@ -1567,21 +1575,24 @@ void snd_close_file(snd_info *sp)
remember_filename(sp->filename, preloaded_files); /* for open dialog(s) previous files list in case dialog doesn't yet exist */
- check_for_event(); /* an experiment -- event queue seems to be glomming up when lots of fast open/close */
+ /* an experiment -- event queue seems to be glomming up when lots of fast open/close */
+ /* but squelch updates just in case a redisplay event is in the queue */
+
+ for (i = 0; i < sp->nchans; i++)
+ sp->chans[i]->squelch_update = true;
+ check_for_event();
sp->file_watcher = fam_unmonitor_file(sp->filename, sp->file_watcher);
/* exit does not go through this function to clean up temps -- see snd_exit_cleanly in snd-main.c */
if (selection_creation_in_progress()) finish_selection_creation();
+
if (ss->deferred_regions > 0)
for (i = 0; i < sp->nchans; i++)
if (sp->chans[i])
sequester_deferred_regions(sp->chans[i], -1);
sp->inuse = SOUND_IDLE;
- for (i = 0; i < sp->nchans; i++)
- sp->chans[i]->squelch_update = true;
-
if (sp->playing)
stop_playing_sound(sp, PLAY_CLOSE);
@@ -1993,6 +2004,12 @@ snd_info *snd_update(snd_info *sp)
app_y = widget_height(MAIN_SHELL(ss));
ur_filename = sp->filename;
+ if (peak_env_dir(ss))
+ for_each_sound_chan(sp, delete_peak_env_info_file);
+
+ if (with_inset_graph(ss))
+ for_each_sound_chan(sp, clear_inset_graph);
+
if (XEN_HOOKED(update_hook))
{
/* #t => return without updating (not recommended!!), proc of 1 arg will be evaluated after update is complete */
@@ -2107,12 +2124,6 @@ snd_info *snd_update(snd_info *sp)
restore_axes_data(nsp, sa, mus_sound_duration(filename), false);
sound_restore_marks(nsp, ms);
-#if 0
- /* I don't think this is needed -- marks do get redisplayed, and the rest is handled in restore_axes_data */
- for (i = 0; i < nsp->nchans; i++)
- update_graph(nsp->chans[i]);
-#endif
-
for (i = 0; (i < nsp->nchans) && (i < sp_chans); i++)
CURSOR(nsp->chans[i]) = old_cursors[i];
@@ -4920,10 +4931,6 @@ static XEN g_set_sound_file_extensions(XEN lst)
static XEN g_file_write_date(XEN file)
{
- #if HAVE_GUILE
- #define write_date_equivalent "Equivalent to Guile's (stat:mtime (stat file))"
- #endif
-
#if HAVE_RUBY
#define write_date_equivalent "Equivalent to Ruby's File.mtime(file)"
#endif
@@ -4947,7 +4954,7 @@ current-time:\n(strftime \"%a %d-%b-%Y %H:%M %Z\" (localtime (" S_file_write_dat
time_t date;
XEN_ASSERT_TYPE(XEN_STRING_P(file), file, XEN_ONLY_ARG, S_file_write_date, "a string");
date = file_write_date(XEN_TO_C_STRING(file));
- return(xen_return_first(C_TO_XEN_INT(date), file));
+ return(C_TO_XEN_INT(date));
}
@@ -5108,7 +5115,7 @@ static XEN g_set_sound_loop_info(XEN snd, XEN vals)
if (err != IO_SAVE_HOOK_CANCELLATION)
snd_update(sp);
free(tmp_file);
- return(xen_return_first((err == IO_NO_ERROR) ? XEN_TRUE : C_TO_XEN_INT((int)err), snd, vals));
+ return((err == IO_NO_ERROR) ? XEN_TRUE : C_TO_XEN_INT((int)err));
}
}
@@ -5166,7 +5173,7 @@ static XEN g_sound_files_in_directory(XEN dirname)
}
free(name);
}
- return(xen_return_first(res, dirname));
+ return(res);
}