Nicolas Cellier uploaded a new version of Sound to project The Trunk:
http://source.squeak.org/trunk/Sound-nice.15.mcz ==================== Summary ==================== Name: Sound-nice.15 Author: nice Time: 17 April 2010, 2:20:04.094 am UUID: 382cadc9-f9bf-914f-9004-28241ec25994 Ancestors: Sound-nice.14 Fix the other missing #yourself after #add: Fix _ in class comments =============== Diff against Sound-nice.14 =============== Item was changed: AbstractSound subclass: #QueueSound instanceVariableNames: 'startTime sounds currentSound done' classVariableNames: '' poolDictionaries: '' category: 'Sound-Synthesis'! + !QueueSound commentStamp: 'nice 3/24/2010 07:38' prior: 0! - !QueueSound commentStamp: 'efc 1/2/2003 00:30' prior: 0! I am a queue for sound - give me a bunch of sounds to play and I will play them one at a time in the order that they are received. Example: "Here is a simple example which plays two sounds three times." | clink warble queue | + clink := SampledSound soundNamed: 'clink'. + warble := SampledSound soundNamed: 'warble'. + queue := QueueSound new. - clink _ SampledSound soundNamed: 'clink'. - warble _ SampledSound soundNamed: 'warble'. - queue _ QueueSound new. 3 timesRepeat:[ queue add: clink; add: warble ]. queue play. Structure: startTime Integer -- if present, start playing when startTime <= Time millisecondClockValue (schedule the sound to play later) sounds SharedQueue -- the synchronized list of sounds. currentSound AbstractSound -- the currently active sound done Boolean -- am I done playing ? Other: You may want to keep track of the queue's position so that you can feed it at an appropriate rate. To do this in an event driven way, modify or subclass nextSound to notify you when appropriate. You could also poll by checking currentSound, but this is not recommended for most applications. ! Item was changed: PianoKeyboardMorph subclass: #KeyboardMorphForInput instanceVariableNames: 'pianoRoll duration durationModifier articulation buildingChord insertMode prevSelection startOfNextNote' classVariableNames: '' poolDictionaries: '' category: 'Sound-Scores'! + !KeyboardMorphForInput commentStamp: 'nice 3/24/2010 07:37' prior: 0! - !KeyboardMorphForInput commentStamp: '<historical>' prior: 0! This class adds state and controls to the basic PianoKeyboardMorph so that notes of reliable duration can be keyed into a score without the need for a real keyboard. To try this out, execute... + | n score | n := 3. + score := (MIDIScore new tracks: ((1 to: n) collect: [:i | Array new]); - | n score | n _ 3. - score _ (MIDIScore new tracks: ((1 to: n) collect: [:i | Array new]); trackInfo: ((1 to: n) collect: [:i | 'Instrument' , i printString]); tempoMap: nil; ticksPerQuarterNote: 96). ScorePlayerMorph openOn: score title: 'empty score' Then open a pianoRoll and, from that, open a keyboard. The rule is that the keyboard will append after the current selection. If the current selection is muted or nil, then input will go to the end of the first non-muted track.! Item was changed: ----- Method: AbstractSound>>, (in category 'composition') ----- , aSound "Return the concatenation of the receiver and the argument sound." + ^(SequentialSound new) - ^ SequentialSound new add: self; + add: aSound; + yourself! - add: aSound - ! |
Free forum by Nabble | Edit this page |