-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
changed SoundPlayer to ISoundPlayer, other TS cleanup, see #160
- Loading branch information
Showing
12 changed files
with
75 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,15 @@ | ||
// Copyright 2022, University of Colorado Boulder | ||
|
||
/** | ||
* SoundPlayer is a "definition" type, initially based off of PaintDef.js, that defines a type that is used in the tambo | ||
* sound library but is not actually a base class. This is similar to the idea of an "interface" in Java. A | ||
* SoundPlayer type is a sound generator that has just the most basic methods for playing a sound. | ||
* ISoundPlayer defines a simple interface that can be used to support polymorphism when defining options and other | ||
* API interfaces that include sound generation. | ||
* | ||
* @author John Blanco (PhET Interactive Simulations) | ||
*/ | ||
|
||
type SoundPlayer = { | ||
interface ISoundPlayer { | ||
play: () => void; | ||
stop: () => void; | ||
}; | ||
} | ||
|
||
export default SoundPlayer; | ||
export default ISoundPlayer; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// Copyright 2020-2022, University of Colorado Boulder | ||
|
||
/** | ||
* The nullSoundPlayer is a singleton that implements the ISoundPlayer interface but produces no sound. It is most | ||
* often used to turn off sound generation in an interactive component that produces sound by default. | ||
* | ||
* @author John Blanco (PhET Interactive Simulations) | ||
*/ | ||
|
||
import tambo from '../tambo.js'; | ||
import ISoundPlayer from '../ISoundPlayer.js'; | ||
|
||
class NullSoundPlayer implements ISoundPlayer { | ||
|
||
constructor() {} | ||
|
||
public play() {} | ||
|
||
public stop() {} | ||
} | ||
|
||
// Create the singleton instance. | ||
const nullSoundPlayer = new NullSoundPlayer(); | ||
|
||
tambo.register( 'nullSoundPlayer', nullSoundPlayer ); | ||
|
||
export default nullSoundPlayer; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters