From 8b11ff540b36e612d9eff9a2ac9beda098341f0d Mon Sep 17 00:00:00 2001 From: Richard Knight Date: Fri, 30 Dec 2022 22:19:45 +0000 Subject: new opcode --- src/opcodes.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/opcodes.cpp b/src/opcodes.cpp index 2d7d8b8..fab6c7c 100644 --- a/src/opcodes.cpp +++ b/src/opcodes.cpp @@ -254,6 +254,19 @@ public: }; +struct mempssize : csnd::Plugin<1, 2> { + static constexpr char const *otypes = "i"; + static constexpr char const *itypes = "io"; + + int init() { + MemParser* mp = new MemParser(csound, (int)inargs[0], (inargs[1] > 0)); + + long length = mp->get_size(); + outargs[0] = FL(length); + return OK; + } +}; + // ifn mem2tab ipid, iskipzero=0 struct mem2tab : csnd::Plugin<1, 2> { static constexpr char const *otypes = "i"; @@ -579,6 +592,7 @@ void csnd::on_load(csnd::Csound *csound) { #ifdef USE_PROCMAPS csnd::plugin(csound, "memson", csnd::thread::ia); csnd::plugin(csound, "memps", csnd::thread::i); + csnd::plugin(csound, "mempssize", csnd::thread::i); csnd::plugin(csound, "mempsname", csnd::thread::i); csnd::plugin(csound, "mem2tab", csnd::thread::i); #endif -- cgit v1.2.3