Closed sonoro1234 closed 8 years ago
Instruments using sound files where noisy. Now fixed with LITTLE_ENDIAN checking Everything works, only left to know where to install rawwavefiles in sc3 distribution
I don't use STK I'm afraid, so I can't test. I agree that the standard wrappings are buggy. Can anyone try out this proposal?
@sonoro1234 this proposal changes the API, so it's not clear who it would "hurt" to make this change. Any comment on that?
I think the same instruments are wrapped. Yes, the api changes a little but it would be the "price" for something to work. 372 lines of new code where easier for me that chasing bugs in 1589 lines.
@sonoro1234 if I understand right, the old and new ugens can both coexist, so there's NO reason not to do a pull request. The sc3-plugins repository is deliberately not as closely guarded as the main sc repository. Please could you do a PR? That way, if anyone decides to do a new release (!) they can be included for testing right away
@danstowell Still dont know what should be done with sample files needed by Stk. Where should they be placed at installation?
I don't know. This has been dealt with before in some of Nick Collins' ugens - see the extra Qitch files here - however I don't see any special install commands going along with those.
Yes, I see that everyting in sc folder is copied
# install help and sc specific files that are found in 'PLUGIN_NAME/sc' folder
foreach (DIR ${PLUGIN_DIRS};${PLUGIN_DIRS_EXTRA})
install(DIRECTORY "${DIR}/sc/" DESTINATION "${INSTALL_DESTINATION_DISTRO}/${DIR}"
PATTERN "*")
endforeach(DIR)
But I cant find how to reference that location on sclang
example:
LFSaw.filenameSymbol
(Note that if the synth is on a different machine than the lang, this might not give the needed answer. But you probably have to live with that.)
Platform.userExtensionDir would be better? Does it work in all systems?
Platform.userExtensionDir ++"/SC3Plugins/StkInst/rawwaves"
is this ok for all platforms?
@danstowell also: I would like to set rawwaves path with
{StkGlobals.ar(1,1,Platform.userExtensionDir ++"/SC3Plugins/StkInst/rawwaves")}.play;
But this Synth sould be auto free after StkGlobals_Ctor (where it sets the rawwavepath for the library) Any example on how to do that?
Yes Platform.userExtensionDir
might be a good way, BUT you can't guarantee that the user has placed the file where you expect it! Maybe they put it in a subfolder called weird_new_plugins
In order to set the rawwavepath, look at SuperCollider's rarely-used /u_cmd
message. Nick Collins used it in his FeatureSave
class (in SCMIRugens). You might like to use the same design pattern as he did. (Look at the FeatureSave helpfile example for a start.)
It's easy for a synth to free itself. Look at the source code to the FreeSelf
ugen (in TriggerUGens.cpp).
Have found
unit->mDone = true;
DoneAction(2, unit);
Can this be used on Ctor?
Is this the same as?
NodeEnd(&unit->mParent->mNode);
Yes - look at Unit_DoneAction() in SC_Node.cpp to see the connection - but you don't need to use DoneAction because you don't need the indirection, nor the option to perform other doneactions. simply do NodeEnd
It seems that StkInst is not ready. I am getting an SIGSEV at scsynth quit:
Program received signal SIGSEGV, Segmentation fault.
0x672586b1 in World_Free (inWorld=0x1c2cbc0, inPtr=0x27a22a0)
at C:\SupercolliderRepos\scfork\supercollider\server\scsynth\SC_World.cpp:807
807 inWorld->hw->mAllocPool->Free(inPtr);
(gdb) thread apply all bt
Thread 1 (Thread 3284.0xb38):
#0 0x672586b1 in World_Free (inWorld=0x1c2cbc0, inPtr=0x27a22a0)
at C:\SupercolliderRepos\scfork\supercollider\server\scsynth\SC_World.cpp:807
#1 0x6d581bab in operator delete (ptr=0x27a22a0) at C:\SupercolliderRepos\Mios\StkInst\StkInst.cpp:42
#2 0x6d5f8ee4 in deallocate (this=0x6d6fd234 <stk::Stk::alertList_>, __p=<optimized out>)
at c:/mingw32-4.8.2-posix-dwarf/i686-w64-mingw32/include/c++/ext/new_allocator.h:110
#3 _M_deallocate (this=0x6d6fd234 <stk::Stk::alertList_>, __n=<optimized out>, __p=<optimized out>)
at c:/mingw32-4.8.2-posix-dwarf/i686-w64-mingw32/include/c++/bits/stl_vector.h:174
#4 ~_Vector_base (this=0x6d6fd234 <stk::Stk::alertList_>, __in_chrg=<optimized out>)
at c:/mingw32-4.8.2-posix-dwarf/i686-w64-mingw32/include/c++/bits/stl_vector.h:160
#5 ~vector (this=0x6d6fd234 <stk::Stk::alertList_>, __in_chrg=<optimized out>)
at c:/mingw32-4.8.2-posix-dwarf/i686-w64-mingw32/include/c++/bits/stl_vector.h:416
#6 __tcf_2 () at C:\SupercolliderRepos\Mios\StkInst\stk\src\Stk.cpp:68
#7 0x6d5811a4 in _CRT_INIT@12 () from C:\SupercolliderRepos\Mios\ugens\StkInst.scx
#8 0x6d58139d in __DllMainCRTStartup () from C:\SupercolliderRepos\Mios\ugens\StkInst.scx
#9 0x6d581443 in DllMainCRTStartup@12 () from C:\SupercolliderRepos\Mios\ugens\StkInst.scx
#10 0x77871288 in ntdll!RtlQueryInformationActivationContext () from C:\Windows\system32\ntdll.dll
#11 0x6d580000 in ?? ()
#12 0x7786b16c in ntdll!RtlExitUserProcess () from C:\Windows\system32\ntdll.dll
#13 0x7786b0ee in ntdll!RtlExitUserProcess () from C:\Windows\system32\ntdll.dll
#14 0x761744d1 in KERNEL32!ExitProcess () from C:\Windows\system32\kernel32.dll
#15 0x00000000 in ?? ()
It seems realted to Stk using stl_vector and my redefinition of operator delete as
void operator delete(void* ptr) noexcept
{
RTFree(gWorld, ptr);
}
Perhaps a stl custom allocator should be used. It is a bit too much complicated for me. Perhaps @timblechmann has any clues on that?
@danstowell Solved the SIGSEV issue in my repo https://github.com/sonoro1234/StkInst
trying to incorporate in sc3-plugins breaks StkUGens compilation because there is only a CMake file for all plugins and include_directories from both projects get mixed. Solutions : rework all CMAKE building of plugins!! or discard StkUGens!! Any thoughts?
solved in PR #47
Hello,
Stk is a library devoted to physical modeling
https://ccrma.stanford.edu/software/stk/index.html
As StkUgens are quite buggy I did another stk wraping for myself: Is is based on StkInstrumnt so that with only one UGen (StkInst) it is possible to talk to all stk instruments and specific parameter are accesed by number.
for example stk::Bowed has https://ccrma.stanford.edu/software/stk/classstk_1_1Bowed.html
( SynthDef(\helpStkbowed,{arg out=0,freq=220,gate=1,amp=1,bowpressure = 64, bowposition = 17, vibfreq=50, vibgain=1, loudness=128; var sig,env; env = EnvGen.kr(Env.asr(0,1,0.1),gate,doneAction:2); sig = StkInst.ar(Stk.at("Bowed"),freq, gate, amp, 0.5,[2,bowpressure,4,bowposition,11,vibfreq,1,vibgain,128,loudness])*env; Out.ar(out, sig.dup); }).add; )
It can be found on: https://github.com/sonoro1234/StkInst
Works for me but I would like somebody to use it before doing a pull request for sc3-plugins Also need some advise about copying audio stk files (where, how...)
Best victor bombi