@opendaw/studio-core 0.0.91 → 0.0.92

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,10 @@
1
+ import { Optional } from "@opendaw/lib-std";
1
2
  export declare class AudioDevices {
2
3
  #private;
3
4
  static requestPermission(): Promise<undefined>;
4
5
  static requestStream(constraints: MediaTrackConstraints): Promise<MediaStream>;
5
6
  static updateInputList(): Promise<undefined>;
6
7
  static get inputs(): ReadonlyArray<MediaDeviceInfo>;
8
+ static get defaultInput(): Optional<MediaDeviceInfo>;
7
9
  }
8
10
  //# sourceMappingURL=AudioDevices.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"AudioDevices.d.ts","sourceRoot":"","sources":["../src/AudioDevices.ts"],"names":[],"mappings":"AAIA,qBAAa,YAAY;;WACR,iBAAiB;WAQjB,aAAa,CAAC,WAAW,EAAE,qBAAqB,GAAG,OAAO,CAAC,WAAW,CAAC;WAcvE,eAAe;IAY5B,MAAM,KAAK,MAAM,IAAI,aAAa,CAAC,eAAe,CAAC,CAAsB;CAC5E"}
1
+ {"version":3,"file":"AudioDevices.d.ts","sourceRoot":"","sources":["../src/AudioDevices.ts"],"names":[],"mappings":"AACA,OAAO,EAAiB,QAAQ,EAAC,MAAM,kBAAkB,CAAA;AAGzD,qBAAa,YAAY;;WACR,iBAAiB;WAQjB,aAAa,CAAC,WAAW,EAAE,qBAAqB,GAAG,OAAO,CAAC,WAAW,CAAC;WAcvE,eAAe;IAY5B,MAAM,KAAK,MAAM,IAAI,aAAa,CAAC,eAAe,CAAC,CAAsB;IAEzE,MAAM,KAAK,YAAY,IAAI,QAAQ,CAAC,eAAe,CAAC,CAEnD;CACJ"}
@@ -32,4 +32,7 @@ export class AudioDevices {
32
32
  }
33
33
  static #inputs = Arrays.empty();
34
34
  static get inputs() { return this.#inputs; }
35
+ static get defaultInput() {
36
+ return this.#inputs.find(device => device.deviceId === "default") ?? this.#inputs.at(0);
37
+ }
35
38
  }
@@ -90,10 +90,10 @@ export class CaptureAudio extends Capture {
90
90
  }
91
91
  }
92
92
  this.#stopStream();
93
- const deviceId = this.deviceId.getValue().unwrapOrElse("default");
93
+ const deviceId = this.deviceId.getValue().unwrapOrUndefined() ?? AudioDevices.defaultInput?.deviceId;
94
94
  const channelCount = this.#requestChannels.unwrapOrElse(1);
95
95
  return AudioDevices.requestStream({
96
- deviceId: { exact: deviceId },
96
+ deviceId: isDefined(deviceId) ? { exact: deviceId } : undefined,
97
97
  echoCancellation: false,
98
98
  noiseSuppression: false,
99
99
  autoGainControl: false,
@@ -103,8 +103,8 @@ export class CaptureAudio extends Capture {
103
103
  const track = tracks.at(0);
104
104
  const settings = track?.getSettings();
105
105
  const gotDeviceId = settings?.deviceId;
106
- console.debug(`new stream. device requested: ${deviceId}, got: ${gotDeviceId ?? "unknown"}. channelCount requested: ${channelCount}, got: ${settings?.channelCount}`);
107
- if (deviceId === "default" || deviceId === gotDeviceId) {
106
+ console.debug(`new stream. device requested: ${deviceId ?? "default"}, got: ${gotDeviceId ?? "unknown"}. channelCount requested: ${channelCount}, got: ${settings?.channelCount}`);
107
+ if (isUndefined(deviceId) || deviceId === gotDeviceId) {
108
108
  this.#stream.wrap(stream);
109
109
  }
110
110
  else {
@@ -1 +1 @@
1
- {"version":3,"file":"RecordAudio.d.ts","sourceRoot":"","sources":["../../src/capture/RecordAudio.ts"],"names":[],"mappings":"AAAA,OAAO,EAA6B,UAAU,EAAmB,MAAM,kBAAkB,CAAA;AAUzF,OAAO,EAAa,mBAAmB,EAAY,MAAM,0BAA0B,CAAA;AACnF,OAAO,EAAC,OAAO,EAAC,MAAM,YAAY,CAAA;AAClC,OAAO,EAAC,gBAAgB,EAAC,MAAM,qBAAqB,CAAA;AACpD,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAA;AAGjC,yBAAiB,WAAW,CAAC;IACzB,KAAK,kBAAkB,GAAG;QACtB,gBAAgB,EAAE,gBAAgB,CAAA;QAClC,WAAW,EAAE,WAAW,CAAA;QACxB,aAAa,EAAE,mBAAmB,CAAA;QAClC,YAAY,EAAE,YAAY,CAAA;QAC1B,OAAO,EAAE,OAAO,CAAA;QAChB,OAAO,EAAE,OAAO,CAAA;QAChB,MAAM,EAAE,MAAM,CAAA;QACd,aAAa,EAAE,MAAM,CAAA;KACxB,CAAA;IAQD,MAAM,CAAC,MAAM,KAAK,GACd,yGASG,kBAAkB,KACnB,UA2IL,CAAA;;CACJ"}
1
+ {"version":3,"file":"RecordAudio.d.ts","sourceRoot":"","sources":["../../src/capture/RecordAudio.ts"],"names":[],"mappings":"AAAA,OAAO,EAA6B,UAAU,EAAmB,MAAM,kBAAkB,CAAA;AAUzF,OAAO,EAAa,mBAAmB,EAAY,MAAM,0BAA0B,CAAA;AACnF,OAAO,EAAC,OAAO,EAAC,MAAM,YAAY,CAAA;AAClC,OAAO,EAAC,gBAAgB,EAAC,MAAM,qBAAqB,CAAA;AACpD,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAA;AAGjC,yBAAiB,WAAW,CAAC;IACzB,KAAK,kBAAkB,GAAG;QACtB,gBAAgB,EAAE,gBAAgB,CAAA;QAClC,WAAW,EAAE,WAAW,CAAA;QACxB,aAAa,EAAE,mBAAmB,CAAA;QAClC,YAAY,EAAE,YAAY,CAAA;QAC1B,OAAO,EAAE,OAAO,CAAA;QAChB,OAAO,EAAE,OAAO,CAAA;QAChB,MAAM,EAAE,MAAM,CAAA;QACd,aAAa,EAAE,MAAM,CAAA;KACxB,CAAA;IAQD,MAAM,CAAC,MAAM,KAAK,GACd,yGASG,kBAAkB,KACnB,UA6IL,CAAA;;CACJ"}
@@ -94,12 +94,14 @@ export var RecordAudio;
94
94
  const loopEnabled = loopArea.enabled.getValue();
95
95
  const loopFrom = loopArea.from.getValue();
96
96
  const loopTo = loopArea.to.getValue();
97
- const loopDurationPPQN = loopTo - loopFrom;
98
- const loopDurationSeconds = tempoMap.intervalToSeconds(loopFrom, loopTo);
99
- if (loopEnabled && currentTake.nonEmpty() && currentPosition < lastPosition) {
97
+ const allowTakes = project.engine.preferences.settings.recording.allowTakes;
98
+ if (loopEnabled && allowTakes && currentTake.nonEmpty() && currentPosition < lastPosition) {
100
99
  editing.modify(() => {
101
- currentTake.ifSome(take => finalizeTake(take, loopDurationPPQN));
102
- currentWaveformOffset += loopDurationSeconds;
100
+ currentTake.ifSome(take => {
101
+ const actualDurationPPQN = take.regionBox.duration.getValue();
102
+ finalizeTake(take, actualDurationPPQN);
103
+ currentWaveformOffset += tempoMap.intervalToSeconds(0, actualDurationPPQN);
104
+ });
103
105
  startNewTake(loopFrom);
104
106
  }, false);
105
107
  }
@@ -116,7 +118,7 @@ export var RecordAudio;
116
118
  editing.modify(() => {
117
119
  if (regionBox.isAttached()) {
118
120
  const { duration, loopDuration } = regionBox;
119
- const maxDuration = loopEnabled ? loopTo - regionBox.position.getValue() : Infinity;
121
+ const maxDuration = loopEnabled && allowTakes ? loopTo - regionBox.position.getValue() : Infinity;
120
122
  const distanceInPPQN = Math.min(maxDuration, Math.floor(currentPosition - regionBox.position.getValue()));
121
123
  duration.setValue(distanceInPPQN);
122
124
  loopDuration.setValue(distanceInPPQN);
@@ -1 +1 @@
1
- {"version":3,"file":"RecordMidi.d.ts","sourceRoot":"","sources":["../../src/capture/RecordMidi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,QAAQ,EAAuC,UAAU,EAAmB,MAAM,kBAAkB,CAAA;AAGvH,OAAO,EAAa,UAAU,EAAY,MAAM,0BAA0B,CAAA;AAC1E,OAAO,EAAC,OAAO,EAAC,MAAM,YAAY,CAAA;AAClC,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAA;AAGjC,yBAAiB,UAAU,CAAC;IACxB,KAAK,iBAAiB,GAAG;QACrB,QAAQ,EAAE,QAAQ,CAAC,UAAU,CAAC,CAAC;QAC/B,OAAO,EAAE,OAAO,CAAC;QACjB,OAAO,EAAE,OAAO,CAAA;KACnB,CAAA;IAgBD,MAAM,CAAC,MAAM,KAAK,GAAI,gCAA8B,iBAAiB,KAAG,UAmHvE,CAAA;;CACJ"}
1
+ {"version":3,"file":"RecordMidi.d.ts","sourceRoot":"","sources":["../../src/capture/RecordMidi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,QAAQ,EAAuC,UAAU,EAAmB,MAAM,kBAAkB,CAAA;AAGvH,OAAO,EAAa,UAAU,EAAY,MAAM,0BAA0B,CAAA;AAC1E,OAAO,EAAC,OAAO,EAAC,MAAM,YAAY,CAAA;AAClC,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAA;AAGjC,yBAAiB,UAAU,CAAC;IACxB,KAAK,iBAAiB,GAAG;QACrB,QAAQ,EAAE,QAAQ,CAAC,UAAU,CAAC,CAAC;QAC/B,OAAO,EAAE,OAAO,CAAC;QACjB,OAAO,EAAE,OAAO,CAAA;KACnB,CAAA;IAgBD,MAAM,CAAC,MAAM,KAAK,GAAI,gCAA8B,iBAAiB,KAAG,UAoHvE,CAAA;;CACJ"}
@@ -57,7 +57,8 @@ export var RecordMidi;
57
57
  const loopFrom = loopArea.from.getValue();
58
58
  const loopTo = loopArea.to.getValue();
59
59
  const loopDurationPPQN = loopTo - loopFrom;
60
- if (loopEnabled && currentTake.nonEmpty() && currentPosition < lastPosition) {
60
+ const allowTakes = project.engine.preferences.settings.recording.allowTakes;
61
+ if (loopEnabled && allowTakes && currentTake.nonEmpty() && currentPosition < lastPosition) {
61
62
  positionOffset += loopDurationPPQN;
62
63
  editing.modify(() => {
63
64
  currentTake.ifSome(take => finalizeTake(take, loopDurationPPQN));
@@ -75,7 +76,7 @@ export var RecordMidi;
75
76
  editing.modify(() => {
76
77
  if (regionBox.isAttached() && collection.isAttached()) {
77
78
  const { position: regionPosition, duration, loopDuration } = regionBox;
78
- const maxDuration = loopEnabled ? loopTo - regionPosition.getValue() : Infinity;
79
+ const maxDuration = loopEnabled && allowTakes ? loopTo - regionPosition.getValue() : Infinity;
79
80
  const newDuration = Math.min(maxDuration, quantizeCeil(writePosition, beats) - regionPosition.getValue());
80
81
  duration.setValue(newDuration);
81
82
  loopDuration.setValue(newDuration);