aboutsummaryrefslogtreecommitdiff
path: root/getpatchname/src
diff options
context:
space:
mode:
authorJamie Bullock <postlude@users.sourceforge.net>2006-07-12 14:36:34 +0000
committerJamie Bullock <postlude@users.sourceforge.net>2006-07-12 14:36:34 +0000
commit76c97192a191929dfabeefa168a4b838a3b1f07f (patch)
tree72d6f39b5d981b4bf7a4f852f9991e7886e525fb /getpatchname/src
parent4de225a88232e3dafdc8d907b58bc5d06cdb7c38 (diff)
This commit was generated by cvs2svn to compensate for changes in r5366,
which included commits to RCS files with non-trunk default branches. svn path=/trunk/externals/postlude/; revision=5367
Diffstat (limited to 'getpatchname/src')
-rw-r--r--getpatchname/src/getpatchname.c54
1 files changed, 54 insertions, 0 deletions
diff --git a/getpatchname/src/getpatchname.c b/getpatchname/src/getpatchname.c
new file mode 100644
index 0000000..c9116a8
--- /dev/null
+++ b/getpatchname/src/getpatchname.c
@@ -0,0 +1,54 @@
+
+/* getpatchname - Returns the filename of the current patch
+ *
+ * Copyright (C) 2006 Jamie Bullock
+ *
+ * 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, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "m_pd.h"
+#include "g_canvas.h"
+
+static t_class *getpatchname_class;
+
+typedef struct _getpatchname {
+ t_object x_obj;
+ t_symbol *patch_name;
+ t_outlet *outlet;
+} t_getpatchname;
+
+void getpatchname_bang(t_getpatchname *x)
+{
+/* At some point we need to be to get the new patch name if it changes, couldn't make this work though */
+ outlet_symbol(x->outlet, x->patch_name);
+}
+
+void *getpatchname_new(void)
+{
+ t_getpatchname *x = (t_getpatchname *)pd_new(getpatchname_class);
+ x->patch_name = canvas_getcurrent()->gl_name;
+ x->outlet = outlet_new(&x->x_obj, &s_symbol);
+ return (void *)x;
+}
+
+void getpatchname_setup(void) {
+ getpatchname_class = class_new(gensym("getpatchname"),
+ (t_newmethod)getpatchname_new,
+ 0, sizeof(t_getpatchname),
+ CLASS_DEFAULT, 0);
+ class_addbang(getpatchname_class, getpatchname_bang);
+}
+
+