{"id":129,"date":"2021-08-03T19:23:45","date_gmt":"2021-08-03T19:23:45","guid":{"rendered":"https:\/\/blogs.scummvm.org\/djsrv\/?p=129"},"modified":"2021-08-03T19:23:45","modified_gmt":"2021-08-03T19:23:45","slug":"puppetsound-and-paths","status":"publish","type":"post","link":"https:\/\/blogs.scummvm.org\/djsrv\/2021\/08\/03\/puppetsound-and-paths\/","title":{"rendered":"puppetSound and paths"},"content":{"rendered":"\n<p>Last week I continued debugging Meet MediaBand. As sheep said in his blog post, Director 2\/3 is nearing completion, and while Director 4 is a bit further from completion, it&#8217;s also getting there. Most of the important, low-hanging fruit in D2-4 is gone, and while that&#8217;s mostly a good thing, it means that the things left to do can be quite tedious.<\/p>\n\n\n\n<p>One example of this is the <code>puppetSound<\/code> command. We had already fully implemented it, but it turned out it was bugged in some subtle ways. Normally, sound is controlled by the score. Each frame has two sound channels, and putting a sound in that channel will, of course, cause that sound to play:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"474\" height=\"111\" src=\"https:\/\/blogs.scummvm.org\/djsrv\/wp-content\/uploads\/sites\/4\/2021\/08\/Screenshot-from-2021-08-03-13-39-37.png\" alt=\"\" class=\"wp-image-130\" srcset=\"https:\/\/blogs.scummvm.org\/djsrv\/wp-content\/uploads\/sites\/4\/2021\/08\/Screenshot-from-2021-08-03-13-39-37.png 474w, https:\/\/blogs.scummvm.org\/djsrv\/wp-content\/uploads\/sites\/4\/2021\/08\/Screenshot-from-2021-08-03-13-39-37-300x70.png 300w\" sizes=\"auto, (max-width: 474px) 100vw, 474px\" \/><\/figure>\n\n\n\n<p><code>puppetSound<\/code> allows sound to be controlled programmatically instead. For example, using the Director 4 version of the command, <code>puppetSound 2, 8<\/code> will play sound 8 in sound channel 2. From then on, sound channel 2 is a &#8220;puppet,&#8221; meaning it is controlled by Lingo until control is returned to the score with <code>puppetSound 2, 0<\/code>.<\/p>\n\n\n\n<p>Previously, we implemented &#8220;puppet&#8221; status universally\u2014either every sound channel was a puppet, or every sound channel was not a puppet. When a movie used a mix of puppet and non-puppet sound channels, the non-puppet sound channels would be incorrectly ignored. In addition, our previous <code>puppetSound<\/code> implementation played sounds immediately, while in the original, puppet sounds would not play until the movie went to a different frame or <code>updateStage<\/code> was called.<\/p>\n\n\n\n<p>These may seem like minor details, but in an interactive music video like Meet MediaBand, small sound bugs can make a big difference. So I had to fix them, which required quite a bit of reworking the engine&#8217;s sound code.<\/p>\n\n\n\n<p>Another feature which took quite a bit of work was handling &#8216;\/&#8217; in file names. Director was originally a Mac-centric product, and since classic Mac OS allowed &#8216;\/&#8217; to be used in file names, quite a few Director games did that. Nowadays, &#8216;\/&#8217; is commonly used as a directory separator, including in ScummVM, and it&#8217;s typically forbidden in file names. To solve this, I created a <code>Path<\/code> type which is used to pass paths to\/from common file functions, allowing arbitrary directory separators to be used. Once my <a href=\"https:\/\/github.com\/scummvm\/scummvm\/pull\/3234\">pull request<\/a> is reviewed and merged, it will let the engine use &#8216;:&#8217; as a directory separator, like the original Macintosh version of Director did.<\/p>\n\n\n\n<p>Besides these fixes, I implemented some rather uncommon features including the <code>closeXlib<\/code>, <code>framesToHMS<\/code>, and <code>HMSToFrames<\/code> commands. These don&#8217;t pop up often, but when they do, it&#8217;s better that they work. \ud83d\ude42<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Last week I continued debugging Meet MediaBand. As sheep said in his blog post, Director 2\/3 is nearing completion, and while Director 4 is a bit further from completion, it&#8217;s also getting there. Most of the important, low-hanging fruit in D2-4 is gone, and while that&#8217;s mostly a good thing, it means that the things [&hellip;]<\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-129","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/blogs.scummvm.org\/djsrv\/wp-json\/wp\/v2\/posts\/129","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.scummvm.org\/djsrv\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.scummvm.org\/djsrv\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.scummvm.org\/djsrv\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.scummvm.org\/djsrv\/wp-json\/wp\/v2\/comments?post=129"}],"version-history":[{"count":1,"href":"https:\/\/blogs.scummvm.org\/djsrv\/wp-json\/wp\/v2\/posts\/129\/revisions"}],"predecessor-version":[{"id":131,"href":"https:\/\/blogs.scummvm.org\/djsrv\/wp-json\/wp\/v2\/posts\/129\/revisions\/131"}],"wp:attachment":[{"href":"https:\/\/blogs.scummvm.org\/djsrv\/wp-json\/wp\/v2\/media?parent=129"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.scummvm.org\/djsrv\/wp-json\/wp\/v2\/categories?post=129"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.scummvm.org\/djsrv\/wp-json\/wp\/v2\/tags?post=129"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}