Skip to content

Commit 402b99c

Browse files
authored
Merge pull request #10 from kindohm/fix-boot-code
update boot code to work with Tidal 1.0.11
2 parents 3d88f60 + 1a57dd0 commit 402b99c

File tree

2 files changed

+79
-67
lines changed

2 files changed

+79
-67
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "vscode-tidalcycles",
33
"displayName": "TidalCycles for VSCode",
44
"description": "TidalCycles support in VSCode",
5-
"version": "1.0.1",
5+
"version": "1.0.2",
66
"publisher": "tidalcycles",
77
"icon": "images/icon128.png",
88
"repository": "https://github.com/tidalcycles/vscode-tidalcycles",

src/tidal.ts

Lines changed: 78 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
import { ILogger } from "./logging";
2-
import { IGhci } from "./ghci";
1+
import { ILogger } from './logging';
2+
import { IGhci } from './ghci';
33
import * as vscode from 'vscode';
44

5-
65
/**
76
* Provides an interface to send instructions to the current Tidal instance.
87
*/
@@ -12,11 +11,16 @@ export interface ITidal {
1211

1312
export class Tidal implements ITidal {
1413
tidalBooted: boolean = false;
15-
lineEnding = vscode.workspace.getConfiguration('files', null).get('eol', '\n');
14+
lineEnding = vscode.workspace
15+
.getConfiguration('files', null)
16+
.get('eol', '\n');
1617

17-
constructor(private logger: ILogger, private ghci: IGhci,
18-
private bootTidalPath: string | null, private useBootFileInCurrentDirectory: boolean) {
19-
}
18+
constructor(
19+
private logger: ILogger,
20+
private ghci: IGhci,
21+
private bootTidalPath: string | null,
22+
private useBootFileInCurrentDirectory: boolean
23+
) {}
2024

2125
private async bootTidal(): Promise<boolean> {
2226
if (this.tidalBooted) {
@@ -34,10 +38,14 @@ export class Tidal implements ITidal {
3438
const folders = vscode.workspace.workspaceFolders;
3539

3640
if (folders !== undefined && folders.length > 0) {
37-
uri = vscode.Uri.parse(`file://${folders[0].uri.path}/BootTidal.hs`);
41+
uri = vscode.Uri.parse(
42+
`file://${folders[0].uri.path}/BootTidal.hs`
43+
);
3844
} else {
39-
this.logger.warning('You must open a folder or workspace in order to use the Tidal \
40-
useBootFileInCurrentDirectory setting.');
45+
this.logger.warning(
46+
'You must open a folder or workspace in order to use the Tidal \
47+
useBootFileInCurrentDirectory setting.'
48+
);
4149
}
4250
} else if (bootTidalPath) {
4351
uri = vscode.Uri.file(`${bootTidalPath}`);
@@ -61,7 +69,7 @@ export class Tidal implements ITidal {
6169
}
6270

6371
public async sendTidalExpression(expression: string) {
64-
if (!await this.bootTidal()) {
72+
if (!(await this.bootTidal())) {
6573
this.logger.error('Could not boot Tidal');
6674
return;
6775
}
@@ -74,69 +82,73 @@ export class Tidal implements ITidal {
7482
this.ghci.writeLn(':}');
7583
}
7684

77-
private async getBootCommandsFromFile(uri: vscode.Uri): Promise<string[] | null> {
78-
85+
private async getBootCommandsFromFile(
86+
uri: vscode.Uri
87+
): Promise<string[] | null> {
7988
this.logger.log(`Using Tidal boot file on disk at ${uri.fsPath}`);
8089

8190
let doc: vscode.TextDocument;
8291
try {
83-
doc = await vscode.workspace.openTextDocument(uri);
92+
doc = await vscode.workspace.openTextDocument(uri);
8493
return doc.getText().split(/[\r\n]+/);
8594
} catch (e) {
8695
this.logger.error(`Failed to load boot commands from ${uri.fsPath}`);
8796
return null;
8897
}
8998
}
9099

91-
bootCommands: string[] =
92-
[
93-
':set -XOverloadedStrings',
94-
':set prompt ""',
95-
':set prompt-cont ""',
96-
'import Sound.Tidal.Context',
97-
'tidal <- startTidal (superdirtTarget {oLatency = 0.1, oAddress = "127.0.0.1", oPort = 57120}) (defaultConfig {cFrameTimespan = 1/20})',
98-
'let p = streamReplace tidal',
99-
'let hush = streamHush tidal',
100-
'let list = streamList tidal',
101-
'let mute = streamMute tidal',
102-
'let unmute = streamUnmute tidal',
103-
'let solo = streamSolo tidal',
104-
'let unsolo = streamUnsolo tidal',
105-
'let once = streamOnce tidal False',
106-
'let asap = streamOnce tidal True',
107-
'let nudgeAll = streamNudgeAll tidal',
108-
'let setcps = asap . cps',
109-
'let xfade i = transition tidal (Sound.Tidal.Transition.xfadeIn 4) i',
110-
'let xfadeIn i t = transition tidal (Sound.Tidal.Transition.xfadeIn t) i',
111-
'let histpan i t = transition tidal (Sound.Tidal.Transition.histpan t) i',
112-
'let wait i t = transition tidal (Sound.Tidal.Transition.wait t) i',
113-
'let waitT i f t = transition tidal (Sound.Tidal.Transition.waitT f t) i',
114-
'let jump i = transition tidal (Sound.Tidal.Transition.jump) i',
115-
'let jumpIn i t = transition tidal (Sound.Tidal.Transition.jumpIn t) i',
116-
'let jumpIn\' i t = transition tidal (Sound.Tidal.Transition.jumpIn\' t) i',
117-
'let jumpMod i t = transition tidal (Sound.Tidal.Transition.jumpMod t) i',
118-
'let mortal i lifespan release = transition tidal (Sound.Tidal.Transition.mortal lifespan release) i',
119-
'let interpolate i = transition tidal (Sound.Tidal.Transition.interpolate) i',
120-
'let interpolateIn i t = transition tidal (Sound.Tidal.Transition.interpolateIn t) i',
121-
'let clutch i = transition tidal (Sound.Tidal.Transition.clutch) i',
122-
'let clutchIn i t = transition tidal (Sound.Tidal.Transition.clutchIn t) i',
123-
'let anticipate i = transition tidal (Sound.Tidal.Transition.anticipate) i',
124-
'let anticipateIn i t = transition tidal (Sound.Tidal.Transition.anticipateIn t) i',
125-
'let d1 = p 1',
126-
'let d2 = p 2',
127-
'let d3 = p 3',
128-
'let d4 = p 4',
129-
'let d5 = p 5',
130-
'let d6 = p 6',
131-
'let d7 = p 7',
132-
'let d8 = p 8',
133-
'let d9 = p 9',
134-
'let d10 = p 10',
135-
'let d11 = p 11',
136-
'let d12 = p 12',
137-
'let d13 = p 13',
138-
'let d14 = p 14',
139-
'let d15 = p 15',
140-
'let d16 = p 16',
141-
':set prompt "tidal> "' ];
142-
}
100+
bootCommands: string[] = [
101+
':set -XOverloadedStrings',
102+
':set prompt ""',
103+
':set prompt-cont ""',
104+
'import Sound.Tidal.Context',
105+
'tidal <- startTidal (superdirtTarget {oLatency = 0.1, oAddress = "127.0.0.1", oPort = 57120}) (defaultConfig {cFrameTimespan = 1/20})',
106+
'let p = streamReplace tidal',
107+
'let hush = streamHush tidal',
108+
'let list = streamList tidal',
109+
'let mute = streamMute tidal',
110+
'let unmute = streamUnmute tidal',
111+
'let solo = streamSolo tidal',
112+
'let unsolo = streamUnsolo tidal',
113+
'let once = streamOnce tidal',
114+
'let asap = once',
115+
'let nudgeAll = streamNudgeAll tidal',
116+
'let all = streamAll tidal',
117+
'let resetCycles = streamResetCycles tidal',
118+
'let setcps = asap . cps',
119+
'let xfade i = transition tidal True (Sound.Tidal.Transition.xfadeIn 4) i',
120+
'let xfadeIn i t = transition tidal True (Sound.Tidal.Transition.xfadeIn t) i',
121+
'let histpan i t = transition tidal True (Sound.Tidal.Transition.histpan t) i',
122+
'let wait i t = transition tidal True (Sound.Tidal.Transition.wait t) i',
123+
'let waitT i f t = transition tidal True (Sound.Tidal.Transition.waitT f t) i',
124+
'let jump i = transition tidal True (Sound.Tidal.Transition.jump) i',
125+
'let jumpIn i t = transition tidal True (Sound.Tidal.Transition.jumpIn t) i',
126+
"let jumpIn' i t = transition tidal True (Sound.Tidal.Transition.jumpIn' t) i",
127+
'let jumpMod i t = transition tidal True (Sound.Tidal.Transition.jumpMod t) i',
128+
'let mortal i lifespan release = transition tidal True (Sound.Tidal.Transition.mortal lifespan release) i',
129+
'let interpolate i = transition tidal True (Sound.Tidal.Transition.interpolate) i',
130+
'let interpolateIn i t = transition tidal True (Sound.Tidal.Transition.interpolateIn t) i',
131+
'let clutch i = transition tidal True (Sound.Tidal.Transition.clutch) i',
132+
'let clutchIn i t = transition tidal True (Sound.Tidal.Transition.clutchIn t) i',
133+
'let anticipate i = transition tidal True (Sound.Tidal.Transition.anticipate) i',
134+
'let anticipateIn i t = transition tidal True (Sound.Tidal.Transition.anticipateIn t) i',
135+
'let forId i t = transition tidal False (Sound.Tidal.Transition.mortalOverlay t) i',
136+
'let d1 = p 1',
137+
'let d2 = p 2',
138+
'let d3 = p 3',
139+
'let d4 = p 4',
140+
'let d5 = p 5',
141+
'let d6 = p 6',
142+
'let d7 = p 7',
143+
'let d8 = p 8',
144+
'let d9 = p 9',
145+
'let d10 = p 10',
146+
'let d11 = p 11',
147+
'let d12 = p 12',
148+
'let d13 = p 13',
149+
'let d14 = p 14',
150+
'let d15 = p 15',
151+
'let d16 = p 16',
152+
':set prompt "tidal> "'
153+
];
154+
}

0 commit comments

Comments
 (0)