aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIOhannes m zmölnig <zmoelnig@users.sourceforge.net>2013-01-17 11:07:27 +0000
committerIOhannes m zmölnig <zmoelnig@users.sourceforge.net>2013-01-17 11:07:27 +0000
commit0077c941b9f516c2aee9233b8cbd36800f578260 (patch)
treebaa9556740c52053187284983a52988bae9b91fe /src
parentbe9221e8ec7f4fdf00e68dd8a1cc7276e6e4bfaf (diff)
added [longload] (to simulate long loading times
shan't that go to [iemguts]? svn path=/trunk/externals/zexy/; revision=16890
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am4
-rw-r--r--src/longload.c65
-rw-r--r--src/z_zexy.c11
-rw-r--r--src/z_zexy.h11
4 files changed, 80 insertions, 11 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index a89b3e7..50bdbc8 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -65,6 +65,7 @@ pkglib_LTLIBRARIES+= \
lister.la \
listfind.la \
liststorage.la \
+ longload.la \
lpt.la \
lp.la \
makesymbol.la \
@@ -165,6 +166,7 @@ lister_la_SOURCES = lister.c
l_la_SOURCES = lister.c
listfind_la_SOURCES = listfind.c
liststorage_la_SOURCES = liststorage.c
+longload_la_SOURCES = longload.c
if LPT
lpt_la_SOURCES = lpt.c
lp_la_SOURCES = lpt.c
@@ -231,7 +233,7 @@ zexy_la_SOURCES = zexy.c z_zexy.c \
blockmirror~.c blockshuffle~.c blockswap~.c \
date.c demultiplex~.c demultiplex.c dfreq~.c dirac~.c drip.c envrms~.c \
fifop.c freadln.c fwriteln.c glue.c index.c length.c lifop.c limiter~.c \
- list2int.c list2lists.c list2symbol.c lister.c listfind.c liststorage.c lpt.c \
+ list2int.c list2lists.c list2symbol.c lister.c listfind.c liststorage.c longload.c lpt.c \
makesymbol.c matchbox.c mavg.c minmax.c msgfile.c multiline~.c multiplex~.c \
multiplex.c multireceive.c niagara.c noish~.c noisi~.c operating_system.c pack~.c \
pack.c packel.c pdf~.c prime.c quantize~.c rawprint.c regex.c relay.c repack.c \
diff --git a/src/longload.c b/src/longload.c
new file mode 100644
index 0000000..f6844a2
--- /dev/null
+++ b/src/longload.c
@@ -0,0 +1,65 @@
+/*
+ * longload: takes a long time to load
+ *
+ * (c) 1999-2011 IOhannes m zmölnig, forum::für::umläute, institute of electronic music and acoustics (iem)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "zexy.h"
+
+
+/* ------------------------- longload ------------------------------- */
+#ifdef _WIN32
+# include <windows.h>
+#else
+# include <unistd.h>
+#endif
+
+
+static t_class *longload_class;
+
+typedef struct _longload
+{
+ t_object x_obj;
+} t_longload;
+
+int millisleep(unsigned int milli) {
+#ifdef _WIN32
+ Sleep(milli);
+#else
+ usleep(milli*1000);
+#endif
+}
+
+static void *longload_new(t_float f)
+{
+ t_longload *x = (t_longload *)pd_new(longload_class);
+ if(f>0.f)
+ millisleep(f);
+ else
+ millisleep(1000);
+ return (x);
+}
+
+void longload_setup(void)
+{
+ longload_class = class_new(gensym("longload"),
+ (t_newmethod)longload_new,
+ 0,
+ sizeof(t_longload),
+ CLASS_NOINLET,
+ A_DEFFLOAT, 0);
+ zexy_register("longload");
+}
diff --git a/src/z_zexy.c b/src/z_zexy.c
index 35e3ba6..4efc3d8 100644
--- a/src/z_zexy.c
+++ b/src/z_zexy.c
@@ -14,8 +14,8 @@ void z_zexy_setup(void)
setup_0x3e0x7e(); /* 0x3e0x7e */
setup_0x7c0x7c0x7e(); /* 0x7c0x7c0x7e */
a2l_setup(); /* a2l */
- absgn_tilde_setup(); /* absgn~ */
abs_tilde_setup(); /* abs~ */
+ absgn_tilde_setup(); /* absgn~ */
atof_setup(); /* atof */
atoi_setup(); /* atoi */
avg_tilde_setup(); /* avg~ */
@@ -23,8 +23,8 @@ void z_zexy_setup(void)
blockshuffle_tilde_setup(); /* blockshuffle~ */
blockswap_tilde_setup(); /* blockswap~ */
date_setup(); /* date */
- demultiplex_setup(); /* demultiplex */
demultiplex_tilde_setup(); /* demultiplex~ */
+ demultiplex_setup(); /* demultiplex */
dfreq_tilde_setup(); /* dfreq~ */
dirac_tilde_setup(); /* dirac~ */
drip_setup(); /* drip */
@@ -43,6 +43,7 @@ void z_zexy_setup(void)
lister_setup(); /* lister */
listfind_setup(); /* listfind */
liststorage_setup(); /* liststorage */
+ longload_setup(); /* longload */
lpt_setup(); /* lpt */
makesymbol_setup(); /* makesymbol */
matchbox_setup(); /* matchbox */
@@ -50,16 +51,16 @@ void z_zexy_setup(void)
minmax_setup(); /* minmax */
msgfile_setup(); /* msgfile */
multiline_tilde_setup(); /* multiline~ */
- multiplex_setup(); /* multiplex */
multiplex_tilde_setup(); /* multiplex~ */
+ multiplex_setup(); /* multiplex */
multireceive_setup(); /* multireceive */
niagara_setup(); /* niagara */
noish_tilde_setup(); /* noish~ */
noisi_tilde_setup(); /* noisi~ */
operating_system_setup(); /* operating_system */
+ pack_tilde_setup(); /* pack~ */
pack_setup(); /* pack */
packel_setup(); /* packel */
- pack_tilde_setup(); /* pack~ */
pdf_tilde_setup(); /* pdf~ */
prime_setup(); /* prime */
quantize_tilde_setup(); /* quantize~ */
@@ -86,8 +87,8 @@ void z_zexy_setup(void)
tabset_setup(); /* tabset */
tavg_tilde_setup(); /* tavg~ */
time_setup(); /* time */
- unpack_setup(); /* unpack */
unpack_tilde_setup(); /* unpack~ */
+ unpack_setup(); /* unpack */
urn_setup(); /* urn */
wrap_setup(); /* wrap */
z_tilde_setup(); /* z~ */
diff --git a/src/z_zexy.h b/src/z_zexy.h
index c35e767..2699361 100644
--- a/src/z_zexy.h
+++ b/src/z_zexy.h
@@ -12,8 +12,8 @@ void setup_0x3d0x3d0x7e(void); /* 0x3d0x3d0x7e */
void setup_0x3e0x7e(void); /* 0x3e0x7e */
void setup_0x7c0x7c0x7e(void); /* 0x7c0x7c0x7e */
void a2l_setup(void); /* a2l */
-void absgn_tilde_setup(void); /* absgn~ */
void abs_tilde_setup(void); /* abs~ */
+void absgn_tilde_setup(void); /* absgn~ */
void atof_setup(void); /* atof */
void atoi_setup(void); /* atoi */
void avg_tilde_setup(void); /* avg~ */
@@ -21,8 +21,8 @@ void blockmirror_tilde_setup(void); /* blockmirror~ */
void blockshuffle_tilde_setup(void); /* blockshuffle~ */
void blockswap_tilde_setup(void); /* blockswap~ */
void date_setup(void); /* date */
-void demultiplex_setup(void); /* demultiplex */
void demultiplex_tilde_setup(void); /* demultiplex~ */
+void demultiplex_setup(void); /* demultiplex */
void dfreq_tilde_setup(void); /* dfreq~ */
void dirac_tilde_setup(void); /* dirac~ */
void drip_setup(void); /* drip */
@@ -41,6 +41,7 @@ void list2symbol_setup(void); /* list2symbol */
void lister_setup(void); /* lister */
void listfind_setup(void); /* listfind */
void liststorage_setup(void); /* liststorage */
+void longload_setup(void); /* longload */
void lpt_setup(void); /* lpt */
void makesymbol_setup(void); /* makesymbol */
void matchbox_setup(void); /* matchbox */
@@ -48,16 +49,16 @@ void mavg_setup(void); /* mavg */
void minmax_setup(void); /* minmax */
void msgfile_setup(void); /* msgfile */
void multiline_tilde_setup(void); /* multiline~ */
-void multiplex_setup(void); /* multiplex */
void multiplex_tilde_setup(void); /* multiplex~ */
+void multiplex_setup(void); /* multiplex */
void multireceive_setup(void); /* multireceive */
void niagara_setup(void); /* niagara */
void noish_tilde_setup(void); /* noish~ */
void noisi_tilde_setup(void); /* noisi~ */
void operating_system_setup(void); /* operating_system */
+void pack_tilde_setup(void); /* pack~ */
void pack_setup(void); /* pack */
void packel_setup(void); /* packel */
-void pack_tilde_setup(void); /* pack~ */
void pdf_tilde_setup(void); /* pdf~ */
void prime_setup(void); /* prime */
void quantize_tilde_setup(void); /* quantize~ */
@@ -84,8 +85,8 @@ void tabread4_tilde_tilde_setup(void); /* tabread4~~ */
void tabset_setup(void); /* tabset */
void tavg_tilde_setup(void); /* tavg~ */
void time_setup(void); /* time */
-void unpack_setup(void); /* unpack */
void unpack_tilde_setup(void); /* unpack~ */
+void unpack_setup(void); /* unpack */
void urn_setup(void); /* urn */
void wrap_setup(void); /* wrap */
void z_tilde_setup(void); /* z~ */