Yuichi Yamamoto Posted August 19, 2016 Share Posted August 19, 2016 Hi, I'm really in love with Opusmodus and first of all, thank you so much for your great app! Well, though I already enjoy the whole functions and stuff that already exist in the basic Opusmodus, I'm starting to crave for something more advanced: one of such is multi-thread programming. (or is it already supported?) So I looked up through the internet and found the "bordeaux-threads" library(https://common-lisp.net/project/bordeaux-threads/), and I did (ql:quickload "bordeaux-threads") and it loads successfully. At least it prompts just like when I load any other no-problem libraries like Drakma. However, although I DID load the library when I try to use some of the functions from them, it says "undefined function ~" thing. So the loading thing did not go well, I guess. => So here, I changed my plan. There was an article in which someone was wrapping the bordeaux-threads in a "defpackage" and then after an "in-package" use the funcitons of them. And actually this works fine in my computer. But I discovered that inside the package that only contains bordeaux-threads, I cannot use the Opusmodus functions. So I included "Opusmodus" in the package as well. Case closed, I thought. But though now I get most of the Opusmodus-functions working well, there were still some functions and symbols that weren't acknowledged such as "display-musicxml" and "'atonal" (inside a def-score). I'm guessing this is due to the packaging that I probably did not do correctly? For you information, here is the code. –––––––––––––––––––––––––––––––––––––– (require :bordeaux-threads) (defpackage :threads-test-pkg (:use :cl :bordeaux-threads :opusmodus )) (in-package :threads-test-pkg) (progn (format t "# start thread test~%") (let* ((test-counter #'(lambda (thread-identifier-num count interval) (let ((*standard-output* #.*standard-output*)) (format t "## start-thread: ~s~%" thread-identifier-num) (dotimes (i count) (sleep interval) (format t "### thread ~s --- ~s~%" thread-identifier-num i)) (format t "## end-thread: ~s~%" thread-identifier-num)))) (test-thread-alive-p #'(lambda (thread) (let ((*standard-output* #.*standard-output*)) (format t "~a: ~a~%" (thread-name thread) (thread-alive-p thread))))) ;; Make Threads and Start (thd1 (make-thread #'(lambda () (funcall test-counter 1 5 3)) :name "thread 1")) (thd2 (make-thread #'(lambda () (funcall test-counter 2 5 2)) :name "thread 2")) (thd3 (make-thread #'(lambda () (funcall test-counter 3 5 1)) :name "thread 3"))) ;; Check the threads (funcall test-thread-alive-p thd1) (funcall test-thread-alive-p thd2) (funcall test-thread-alive-p thd3) ;; Wait for the threads to end (join-thread thd1) (join-thread thd2) (join-thread thd3) ;; Threads Status (funcall test-thread-alive-p thd1) (funcall test-thread-alive-p thd2) (funcall test-thread-alive-p thd3)) (format t "# end thread test~%")) ;;Things that works (gen-integer 10) (display-midi 'hoge) ;;Things that do not work (display-musicxml 'hoge) 'atonal ;this symbol was somehow not undefined –––––––––––––––––––––––––––––––––––––– I might be doing something way too unnecessary, but please forgive me for all the ignorance. All I want to do is just to get multi-thread capability along with Opusmodus, in order to achieve some real-time programming. Thank you, Yuichi Yogo Quote Link to comment Share on other sites More sharing options...
g000001 Posted August 20, 2016 Share Posted August 20, 2016 > there were still some functions and symbols that weren't acknowledged such as "display-musicxml" and "'atonal" (inside a def-score) I am not a Opusmodus user (Just a Common Lisper) but IMHO, I think there is Common Lisp PACKAGE and SYMBOL related things like a described below link. http://www.gigamonkeys.com/book/programming-in-the-large-packages-and-symbols.html If "display-musicxml" and "atonal" symbols are not exported, You may IMPORT them, like (defpackage :threads-test-pkg (:use :cl :bordeaux-threads :opusmodus) (:import-from ??? :display-musicxml :atonal)) If "display-musicxml" and "atonal" symbols are exported, You may USE-PACKAGE, like (defpackage :threads-test-pkg (:use :cl :bordeaux-threads :opusmodus ???)) ;; How to find the ??? package => (find-all-symbols (string '#:display-musicxml)) -- g000001 https://github.com/g000001 Quote Link to comment Share on other sites More sharing options...
opmo Posted August 21, 2016 Share Posted August 21, 2016 The DISPLAY-MUSICXML is now in the package :-) g000001 1 Quote Link to comment Share on other sites More sharing options...
Yuichi Yamamoto Posted August 23, 2016 Author Share Posted August 23, 2016 g000001, Thank you so much for your precise information! I was reading through a lot of references about the lisp package thing, but actually what I really wanted to know was how to figure out which package a symbol / function belongs to; so "find-all-symbols" was exactly what I needed. I really appreciate it. Though when I referenced the 'display-musicXML' and 'atonal (symbol), these both belonged to the Opusmodus package itself, but thank you very much to the developers, after updating the app, it all fixed peacefully! g000001 1 Quote Link to comment Share on other sites More sharing options...
Yuichi Yamamoto Posted August 24, 2016 Author Share Posted August 24, 2016 Sorry to bring this topic back, but it seems that those symbols for the tone names (such as 'c4, 'ds5 etc.) don't get loaded correctly when I include the Opusmodus package? Is it only me? P.S. It happend when I tried to evaluate "vector-to-pitch" or "ambitus" with the arguments of '(c4 c6) and it did not recognize the symbols. Quote Link to comment Share on other sites More sharing options...
opmo Posted August 25, 2016 Share Posted August 25, 2016 Maybe you should try to add the library to OM package and not the other way round. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.