Members
audioFiles
Array containing [name, data] pairs corresponding to all loaded audio files
dialogShouldReopen
This is a hack for reopening the dialog on adding new parameters.
The methods AddParameter() and RemoveParameter() toggle dialogShouldReopen.
We can then check dialogShouldReopen on closing our dialog to determine whether we should reshow the dialog.
instrumentMap
The instrument map contains all the instruments keyed by name.
paramList
An array to store the list of parameters for the in progress instrument
pianoRollVCellDefault
The default number of cells for a pianoroll widget.
sliderVCellDefault
The default number of vertical divisions for slider type widgets
trackLaneObject
The TrackLane object of the program.
This widget corresponds to the canvas in the playlist editor of the program.
trackMap
The track map contains all tracks keyed by name
Methods
AddCanvas(canvasDiv, prefix, name)
Add canvas to either the instrument editor or track editor.
Parameters:
| Name | Type | Description |
|---|---|---|
canvasDiv |
string | The canvas div to modify (differs based on whether this is an instrument or track). |
prefix |
string | Prefix used to specify whether the new canvas is an instrument or track. |
name |
string | The name of the instrument/track to be added. |
AddParameter()
Add a a parameter to the new instrument modal dialog.
CheckDialogReopen()
Check if the track dialog modal needs reopened. If so reshow it.
CleanName(name)
Delete whitespace from the input name string
Parameters:
| Name | Type | Description |
|---|---|---|
name |
string | The string containing the name we want to clean. |
DecrementPlaylistBlockSize()
decrease the blocksize for the playlist editor.
DeleteInstrumentSelection()
Delete the currently selected instrument.
DeleteSelectOptionHelper(select, value)
Deletes value from select tag.
Parameters:
| Name | Type | Description |
|---|---|---|
select |
string | Id of select tag to delete from. |
value |
string | The value to be deleted. |
DeleteTrackSelection()
Delete the currently selected track.
EnterHandler()
Hack to catch enter button presses on form inputs for adding canvases.
HideAllCanvases(divId)
Hides all canvases attached to the specified div.
Parameters:
| Name | Type | Description |
|---|---|---|
divId |
string | The div to hide attached canvases of. |
IncrementPlaylistBlockSize()
Increase the blocksize for the playlist editor.
InstrumentCanvasHelper(canvasDiv, name)
Helper to build all instrument canvases.
Parameters:
| Name | Type | Description |
|---|---|---|
canvasDiv |
string | The div containing instrument canvases. |
name |
string | The name of the instrument to be added. |
NextParameter()
Display next parameter for the currently selected instrument.
OpenTab(tabName, btnID)
Opens the corresponding tab.
Parameters:
| Name | Type | Description |
|---|---|---|
tabName |
string | The name of the tab to be opened. |
btnID |
string | The button clicked to open the tab. |
PatternSelect()
Handles selection in playlist editor tab.
PrevParameter()
Display previous parameter for the currently selected instrument.
RemoveParameter()
Remove a a parameter to the new instrument modal dialog.
ResetParameter()
Reset display of currently selected instrument to show only the 0th parameters widget and hide all others.
ResetPlaylist()
Reset the playlist object.
SelectDropDown(divId, value)
Updates display when drop down is changed.
This is mainly used for switching tracks/instruments in the track and instrument
editor tabs.
Parameters:
| Name | Type | Description |
|---|---|---|
divId |
string | The div containing the canvases to select from. |
value |
string | The canvas to be selected. |
TrackCanvasHelper(canvasDiv, name)
Helper to build all track canvases.
Parameters:
| Name | Type | Description |
|---|---|---|
canvasDiv |
string | The div containing track canvases. |
name |
string | The name of the track to be added. |
buildInstrument(text)
Given instrument state in a string create/load the instrument into the project.
See saveInstrument() code to better understand the instrument text format.
Parameters:
| Name | Type | Description |
|---|---|---|
text |
string | An instrument in text form. |
buildTrack(text, filename)
Given track state in a string create/load the track into the project.
See saveTrack() code to better understand the instrument text format.
Parameters:
| Name | Type | Description |
|---|---|---|
text |
string | A track in text form. |
filename |
string | Name of the file the track is being loaded from. |
configureNode()
Configures the currently selected node based on the node dialog in the instrument editor.
getAudioFiles()
Returns the array of audio files that View keeps track of.
getOrchestraFooter() → {string}
Returns a string containing code intended to be emitted at the end of the orchestra code.
Returns:
Returns string containing the desired code.
- Type
- string
getOrchestraHeader() → {string}
Returns a string containing code intended to be emitted at the start of the orchestra code.
Returns:
Returns string containing the desired code.
- Type
- string
getScoreFooter() → {string}
Returns a string containing code intended to be emitted at the end of the score code.
Returns:
Returns string containing the desired code.
- Type
- string
getScoreHeader() → {string}
Returns a string containing code intended to be emitted at the start of the score code.
Returns:
Returns string containing the desired code.
- Type
- string
loadAudioFile()
Prompt user for an audio file and load the audio file into memory/csound.
NOTE: This code requires the csound engine already be initialized to run due to
csound needing to be initialized in order for us to load samples into it.
loadInstrument()
Prompt user for .synth file and create/load the instrument from the selected file.
loadProject()
Prompt user for a zip file containing a project and load the project from the file.
NOTE: This code requires the csound engine already be initialized to run due to
csound needing to be initialized in order for us to load samples into memory correctly.
loadTrack()
Prompt user for .track file and create/load the track from the selected file.
playPattern()
Render and play back the currently selected pattern.
playTrack()
Render and play back the entire project so far.
renderCSD(displayModal) → {string}
Render a CSD corresponding the whole project so far.
Parameters:
| Name | Type | Description |
|---|---|---|
displayModal |
boolean | true/false to display a modal on the page containing the rendered code. |
Returns:
Returns string containing the text of the generated code.
- Type
- string
renderInstrument()
Render the currently selected instrument to text and display in a pop up modal.
renderOrchestra(displayModal) → {string}
Render the orchestra.
Parameters:
| Name | Type | Description |
|---|---|---|
displayModal |
boolean | true/false to display a modal on the page containing the orchestra code. |
Returns:
Returns string containing the text of the generated code.
- Type
- string
renderPatternCSD(displayModal) → {string}
Render a CSD corresponding the currently selected pattern.
Parameters:
| Name | Type | Description |
|---|---|---|
displayModal |
boolean | true/false to display a modal on the page containing the rendered code. |
Returns:
Returns string containing the text of the generated code.
- Type
- string
renderScore(displayModal) → {string}
Render the entire score.
Parameters:
| Name | Type | Description |
|---|---|---|
displayModal |
boolean | If true displays a modal containing generated code. |
Returns:
Returns string containing the text of the generated code.
- Type
- string
renderTrack(offset, displayModal) → {string}
Render the currently selected track.
Parameters:
| Name | Type | Description |
|---|---|---|
offset |
number | A time to offset generated times of track by. |
displayModal |
boolean | If true displays a modal containing generated code. |
Returns:
Returns string containing the text of the generated code.
- Type
- string
renderTrackByName(bpm, name, offset) → {string}
Render a track by name.
Parameters:
| Name | Type | Description |
|---|---|---|
bpm |
number | Bpm to use for rendering track. |
name |
string | The name of the track to render. |
offset |
number | Time to offset note events by. |
Returns:
Returns string containing the text of the generated code.
- Type
- string
saveInstrument()
Generate and download a .synth file containing the currently selected instrument.
saveProject()
Create a zip file containing the full state of the current project and download it
to the user computer.
saveTrack()
Generate and download a .track file containing the currently selected track.
stopPlayBack()
Stops playback if csound backend is playing audio.