kopia lustrzana https://github.com/backface/turtlestitch
accept lists and lists of lists as inputs to all sound playing primitives
rodzic
5427a7a396
commit
38727fa467
|
@ -18,6 +18,7 @@
|
|||
* new sound + music stereo "panning" feature + blocks
|
||||
* new sound attribute getter reporter
|
||||
* new "play sound at sample rate" command
|
||||
* accept lists and lists of lists as inputs to all sound playing primitives
|
||||
* new "play frequency" commands in the Sounds category
|
||||
* added "neg" selector to monadic function reporter in "Operators" category
|
||||
* added "log2" selector to monadic function reporter in "Operators" category
|
||||
|
@ -65,6 +66,7 @@
|
|||
* Blocks, Objects, Threads: new "play sound at sample rate" command primitive
|
||||
* Objects: added relabelling information for the new "play sound at sample rate" block
|
||||
* Objects, Threads: accept a number as input for a sound - interpret as index
|
||||
* Objects, Threads: accept lists and lists of lists as inputs to all sound playing primitives
|
||||
|
||||
### 2019-04-05
|
||||
* Objects: eliminated "clicks" when playing music notes
|
||||
|
|
|
@ -3321,7 +3321,7 @@ SpriteMorph.prototype.addSound = function (audio, name) {
|
|||
this.sounds.add(new Sound(audio, name));
|
||||
};
|
||||
|
||||
SpriteMorph.prototype.playSound = function (name) {
|
||||
SpriteMorph.prototype.doPlaySound = function (name) {
|
||||
var stage = this.parentThatIsA(StageMorph),
|
||||
sound = name instanceof Sound ? name
|
||||
: (typeof name === 'number' ? this.sounds.at(name)
|
||||
|
|
|
@ -2221,10 +2221,17 @@ Process.prototype.blockReceiver = function () {
|
|||
|
||||
// Process sound primitives (interpolated)
|
||||
|
||||
Process.prototype.playSound = function (name) {
|
||||
if (name instanceof List) {
|
||||
return this.doPlaySoundAtRate(name, 44100);
|
||||
}
|
||||
return this.blockReceiver().doPlaySound(name);
|
||||
};
|
||||
|
||||
Process.prototype.doPlaySoundUntilDone = function (name) {
|
||||
var sprite = this.blockReceiver();
|
||||
if (this.context.activeAudio === null) {
|
||||
this.context.activeAudio = sprite.playSound(name);
|
||||
this.context.activeAudio = this.playSound(name);
|
||||
}
|
||||
if (name === null || this.context.activeAudio.ended
|
||||
|| this.context.activeAudio.terminated) {
|
||||
|
@ -2312,9 +2319,12 @@ Process.prototype.doPlaySoundAtRate = function (name, rate) {
|
|||
} else {
|
||||
gain.connect(ctx.destination);
|
||||
}
|
||||
source.start();
|
||||
source.pause = source.stop;
|
||||
source.ended = false;
|
||||
source.onended = function () {this.ended = true; }
|
||||
source.start();
|
||||
rcvr.parentThatIsA(StageMorph).activeSounds.push(source);
|
||||
return source;
|
||||
};
|
||||
|
||||
Process.prototype.reportGetSoundAttribute = function (choice, soundName) {
|
||||
|
|
Ładowanie…
Reference in New Issue