Skip to content
This repository has been archived by the owner on Feb 7, 2019. It is now read-only.

Add the Sound library #53

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

Add the Sound library #53

wants to merge 7 commits into from

Conversation

sarajoiner
Copy link

Adds an initial implementation of the Sound library. Contains:

  • Full implementations for PlayClick(), PlayChime(), PlayChimes(), and PlayBellRing()
  • Full documentation for all other Sound APIs
  • Basic infrastructure hookup (with NYI errors) for all other Sound APIs
  • A few unit tests

Adds the basic structure for the Sound library, and populates it with the first couple (not yet implemented) methods.
Implemented Sound.PlayClick and manually verified that it works!
Adds the documentation for PlayClick.
Adds the strings for the rest of the Sound APIs, as copied from SmallBasic.Web\Content\js\json\generated-output.json
Copy better strings into Sound.Play and Sound.Play.FilePath, per the actual documentation headers in the original code.
Implement the structure of the rest of the Sound APIs, + actually implement the three easy ones (playing sound files like what was already implemented for Click)
Refactor the Sound library to make it more unit testable, and add some basic tests.
@sarajoiner
Copy link
Author

Notes:

  • Despite being implemented in exactly the same fashion, PlayClick and PlayBellRing work in my manual tests, and PlayChime and PlayChimes do not. I still have not been able to successfully debug why.
  • Going ahead and sending this out for PR because it seemed like a good interim point, in case re-implementing the rest of the APIs turns out to be significantly harder. 😊


public readonly methods: { readonly [name: string]: LibraryMethodInstance } = {
PlayClick: { execute: this.executePlayStockSound.bind(this, Sound.Click) },
PlayClickAndWait: { execute: () => { throw new Error("Not Implemented yet."); } },
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest not adding the NYI methods until they're actually functional. No need to show it in the UI and crash afterwards if they're not implemented yet.

@@ -0,0 +1,12 @@
import { ISoundLibraryPlugin } from "../../../compiler/runtime/libraries/sound";

export class SoundLibraryPlugin implements ISoundLibraryPlugin {
Copy link
Member

@OmarTawfik OmarTawfik Nov 2, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you document where did we get the sound files from?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The sound files come from the Desktop copy of the code -- do you know where that got it from? I don't recall seeing any comments.

Copy link
Member

@OmarTawfik OmarTawfik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left a few comments. Please let me know if you need a second pair of eyes on the sound files that are not playing.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants