@opendaw/studio-core 0.0.41 → 0.0.42

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.
Files changed (155) hide show
  1. package/dist/EngineWorklet.d.ts.map +1 -1
  2. package/dist/EngineWorklet.js +18 -1
  3. package/dist/FilePickerAcceptTypes.d.ts +1 -0
  4. package/dist/FilePickerAcceptTypes.d.ts.map +1 -1
  5. package/dist/FilePickerAcceptTypes.js +6 -0
  6. package/dist/InstrumentBox.d.ts +2 -2
  7. package/dist/InstrumentBox.d.ts.map +1 -1
  8. package/dist/InstrumentFactories.d.ts +13 -4
  9. package/dist/InstrumentFactories.d.ts.map +1 -1
  10. package/dist/InstrumentFactories.js +38 -18
  11. package/dist/InstrumentFactory.d.ts +3 -2
  12. package/dist/InstrumentFactory.d.ts.map +1 -1
  13. package/dist/InstrumentOptions.d.ts +2 -1
  14. package/dist/InstrumentOptions.d.ts.map +1 -1
  15. package/dist/OpenDAWHeaders.d.ts +3 -0
  16. package/dist/OpenDAWHeaders.d.ts.map +1 -0
  17. package/dist/OpenDAWHeaders.js +8 -0
  18. package/dist/RecordingWorklet.js +1 -1
  19. package/dist/Storage.d.ts +14 -0
  20. package/dist/Storage.d.ts.map +1 -0
  21. package/dist/Storage.js +32 -0
  22. package/dist/capture/index.d.ts +6 -0
  23. package/dist/capture/index.d.ts.map +1 -0
  24. package/dist/capture/index.js +5 -0
  25. package/dist/cloud/CloudAuthManager.d.ts.map +1 -0
  26. package/dist/{clouds → cloud}/CloudBackup.d.ts +1 -1
  27. package/dist/cloud/CloudBackup.d.ts.map +1 -0
  28. package/dist/{clouds → cloud}/CloudBackup.js +6 -4
  29. package/dist/cloud/CloudBackupProjects.d.ts.map +1 -0
  30. package/dist/cloud/CloudBackupSamples.d.ts.map +1 -0
  31. package/dist/{clouds → cloud}/CloudBackupSamples.js +5 -6
  32. package/dist/cloud/CloudBackupSoundfont.d.ts +13 -0
  33. package/dist/cloud/CloudBackupSoundfont.d.ts.map +1 -0
  34. package/dist/cloud/CloudBackupSoundfont.js +120 -0
  35. package/dist/cloud/CloudHandler.d.ts.map +1 -0
  36. package/dist/cloud/CloudService.d.ts.map +1 -0
  37. package/dist/cloud/DropboxHandler.d.ts.map +1 -0
  38. package/dist/cloud/GoogleDriveHandler.d.ts.map +1 -0
  39. package/dist/cloud/index.d.ts +4 -0
  40. package/dist/cloud/index.d.ts.map +1 -0
  41. package/dist/cloud/index.js +3 -0
  42. package/dist/dawproject/DawProjectExporter.test.js +2 -1
  43. package/dist/dawproject/DawProjectService.d.ts +11 -0
  44. package/dist/dawproject/DawProjectService.d.ts.map +1 -0
  45. package/dist/dawproject/DawProjectService.js +63 -0
  46. package/dist/dawproject/index.d.ts +5 -0
  47. package/dist/dawproject/index.d.ts.map +1 -0
  48. package/dist/dawproject/index.js +4 -0
  49. package/dist/index.d.ts +11 -32
  50. package/dist/index.d.ts.map +1 -1
  51. package/dist/index.js +11 -32
  52. package/dist/midi/index.d.ts +3 -0
  53. package/dist/midi/index.d.ts.map +1 -0
  54. package/dist/midi/index.js +2 -0
  55. package/dist/processors.js +3 -3
  56. package/dist/processors.js.map +4 -4
  57. package/dist/project/Project.d.ts +2 -1
  58. package/dist/project/Project.d.ts.map +1 -1
  59. package/dist/project/Project.js +1 -0
  60. package/dist/project/ProjectApi.d.ts +1 -1
  61. package/dist/project/ProjectApi.d.ts.map +1 -1
  62. package/dist/project/ProjectApi.js +3 -2
  63. package/dist/project/ProjectBundle.d.ts.map +1 -1
  64. package/dist/project/ProjectBundle.js +67 -18
  65. package/dist/project/ProjectEnv.d.ts +2 -1
  66. package/dist/project/ProjectEnv.d.ts.map +1 -1
  67. package/dist/project/ProjectStorage.d.ts +3 -2
  68. package/dist/project/ProjectStorage.d.ts.map +1 -1
  69. package/dist/project/ProjectStorage.js +2 -3
  70. package/dist/project/index.d.ts +10 -0
  71. package/dist/project/index.d.ts.map +1 -0
  72. package/dist/project/index.js +9 -0
  73. package/dist/samples/DefaultSampleLoader.js +2 -2
  74. package/dist/samples/OpenSampleAPI.d.ts.map +1 -1
  75. package/dist/samples/OpenSampleAPI.js +4 -11
  76. package/dist/samples/SampleService.d.ts +18 -0
  77. package/dist/samples/SampleService.d.ts.map +1 -0
  78. package/dist/samples/SampleService.js +82 -0
  79. package/dist/samples/SampleStorage.d.ts +11 -10
  80. package/dist/samples/SampleStorage.d.ts.map +1 -1
  81. package/dist/samples/SampleStorage.js +32 -39
  82. package/dist/samples/index.d.ts +1 -1
  83. package/dist/samples/index.d.ts.map +1 -1
  84. package/dist/samples/index.js +1 -1
  85. package/dist/soundfont/DefaultSoundfontLoader.d.ts +15 -0
  86. package/dist/soundfont/DefaultSoundfontLoader.d.ts.map +1 -0
  87. package/dist/soundfont/DefaultSoundfontLoader.js +69 -0
  88. package/dist/soundfont/DefaultSoundfontLoaderManager.d.ts +11 -0
  89. package/dist/soundfont/DefaultSoundfontLoaderManager.d.ts.map +1 -0
  90. package/dist/soundfont/DefaultSoundfontLoaderManager.js +17 -0
  91. package/dist/soundfont/OpenSoundfontAPI.d.ts +13 -0
  92. package/dist/soundfont/OpenSoundfontAPI.d.ts.map +1 -0
  93. package/dist/soundfont/OpenSoundfontAPI.js +63 -0
  94. package/dist/soundfont/SoundfontProvider.d.ts +6 -0
  95. package/dist/soundfont/SoundfontProvider.d.ts.map +1 -0
  96. package/dist/soundfont/SoundfontService.d.ts +20 -0
  97. package/dist/soundfont/SoundfontService.d.ts.map +1 -0
  98. package/dist/soundfont/SoundfontService.js +98 -0
  99. package/dist/soundfont/SoundfontStorage.d.ts +21 -0
  100. package/dist/soundfont/SoundfontStorage.d.ts.map +1 -0
  101. package/dist/soundfont/SoundfontStorage.js +40 -0
  102. package/dist/soundfont/index.d.ts +7 -0
  103. package/dist/soundfont/index.d.ts.map +1 -0
  104. package/dist/soundfont/index.js +6 -0
  105. package/dist/sync-log/index.d.ts +4 -0
  106. package/dist/sync-log/index.d.ts.map +1 -0
  107. package/dist/sync-log/index.js +3 -0
  108. package/dist/ui/index.d.ts +2 -0
  109. package/dist/ui/index.d.ts.map +1 -0
  110. package/dist/ui/index.js +1 -0
  111. package/dist/utils/index.d.ts +2 -0
  112. package/dist/utils/index.d.ts.map +1 -0
  113. package/dist/utils/index.js +1 -0
  114. package/dist/workers-main.js +2 -2
  115. package/dist/workers-main.js.map +3 -3
  116. package/dist/ysync/YMapper.d.ts.map +1 -0
  117. package/dist/{yjs → ysync}/YService.d.ts +1 -2
  118. package/dist/ysync/YService.d.ts.map +1 -0
  119. package/dist/{yjs → ysync}/YService.js +1 -1
  120. package/dist/ysync/YSync.d.ts.map +1 -0
  121. package/dist/{yjs → ysync}/YSync.js +1 -1
  122. package/dist/ysync/index.d.ts +4 -0
  123. package/dist/ysync/index.d.ts.map +1 -0
  124. package/dist/ysync/index.js +3 -0
  125. package/package.json +15 -17
  126. package/dist/clouds/CloudAuthManager.d.ts.map +0 -1
  127. package/dist/clouds/CloudBackup.d.ts.map +0 -1
  128. package/dist/clouds/CloudBackupProjects.d.ts.map +0 -1
  129. package/dist/clouds/CloudBackupSamples.d.ts.map +0 -1
  130. package/dist/clouds/CloudHandler.d.ts.map +0 -1
  131. package/dist/clouds/CloudService.d.ts.map +0 -1
  132. package/dist/clouds/DropboxHandler.d.ts.map +0 -1
  133. package/dist/clouds/GoogleDriveHandler.d.ts.map +0 -1
  134. package/dist/samples/SampleImporter.d.ts +0 -11
  135. package/dist/samples/SampleImporter.d.ts.map +0 -1
  136. package/dist/yjs/YMapper.d.ts.map +0 -1
  137. package/dist/yjs/YService.d.ts.map +0 -1
  138. package/dist/yjs/YSync.d.ts.map +0 -1
  139. /package/dist/{clouds → cloud}/CloudAuthManager.d.ts +0 -0
  140. /package/dist/{clouds → cloud}/CloudAuthManager.js +0 -0
  141. /package/dist/{clouds → cloud}/CloudBackupProjects.d.ts +0 -0
  142. /package/dist/{clouds → cloud}/CloudBackupProjects.js +0 -0
  143. /package/dist/{clouds → cloud}/CloudBackupSamples.d.ts +0 -0
  144. /package/dist/{clouds → cloud}/CloudHandler.d.ts +0 -0
  145. /package/dist/{clouds → cloud}/CloudHandler.js +0 -0
  146. /package/dist/{clouds → cloud}/CloudService.d.ts +0 -0
  147. /package/dist/{clouds → cloud}/CloudService.js +0 -0
  148. /package/dist/{clouds → cloud}/DropboxHandler.d.ts +0 -0
  149. /package/dist/{clouds → cloud}/DropboxHandler.js +0 -0
  150. /package/dist/{clouds → cloud}/GoogleDriveHandler.d.ts +0 -0
  151. /package/dist/{clouds → cloud}/GoogleDriveHandler.js +0 -0
  152. /package/dist/{samples/SampleImporter.js → soundfont/SoundfontProvider.js} +0 -0
  153. /package/dist/{yjs → ysync}/YMapper.d.ts +0 -0
  154. /package/dist/{yjs → ysync}/YMapper.js +0 -0
  155. /package/dist/{yjs → ysync}/YSync.d.ts +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"EngineWorklet.d.ts","sourceRoot":"","sources":["../src/EngineWorklet.ts"],"names":[],"mappings":"AAAA,OAAO,EAGH,GAAG,EACH,sBAAsB,EAEtB,QAAQ,EACR,eAAe,EACf,QAAQ,EAER,YAAY,EAGZ,IAAI,EACP,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAC,IAAI,EAAC,MAAM,kBAAkB,CAAA;AAIrC,OAAO,EAEH,gBAAgB,EAOhB,wBAAwB,EACxB,UAAU,EACV,gBAAgB,EACnB,MAAM,0BAA0B,CAAA;AAEjC,OAAO,EAAC,OAAO,EAAC,MAAM,mBAAmB,CAAA;AACzC,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAA;AAE/B,qBAAa,aAAc,SAAQ,gBAAiB,YAAW,MAAM;;IACjE,MAAM,CAAC,EAAE,EAAE,GAAG,CAAQ;IAEtB,QAAQ,CAAC,EAAE,SAAqB;gBAqBpB,OAAO,EAAE,gBAAgB,EACzB,OAAO,EAAE,OAAO,EAChB,mBAAmB,CAAC,EAAE,wBAAwB,EAC9C,OAAO,CAAC,EAAE,gBAAgB;IAsGtC,IAAI,IAAI,IAAI;IACZ,IAAI,CAAC,KAAK,GAAE,OAAe,GAAG,IAAI;IAClC,WAAW,CAAC,QAAQ,EAAE,IAAI,GAAG,IAAI;IACjC,cAAc,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;IACtC,aAAa,IAAI,IAAI;IACrB,KAAK,IAAI,IAAI;IAEb,IAAI,SAAS,IAAI,eAAe,CAAC,OAAO,CAAC,CAAyB;IAClE,IAAI,WAAW,IAAI,eAAe,CAAC,OAAO,CAAC,CAA2B;IACtE,IAAI,YAAY,IAAI,eAAe,CAAC,OAAO,CAAC,CAA4B;IACxE,IAAI,iBAAiB,IAAI,eAAe,CAAC,GAAG,CAAC,CAAiC;IAC9E,IAAI,qBAAqB,IAAI,eAAe,CAAC,MAAM,CAAC,CAAqC;IACzF,IAAI,QAAQ,IAAI,eAAe,CAAC,IAAI,CAAC,CAAwB;IAC7D,IAAI,iBAAiB,IAAI,sBAAsB,CAAC,MAAM,CAAC,CAAiC;IACxF,IAAI,wBAAwB,IAAI,sBAAsB,CAAC,OAAO,CAAC,CAAwC;IACvG,IAAI,gBAAgB,IAAI,sBAAsB,CAAC,OAAO,CAAC,CAAgC;IACvF,IAAI,WAAW,IAAI,eAAe,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC,CAA2B;IAC1F,IAAI,OAAO,IAAI,OAAO,CAAuB;IAE7C,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IACxB,oBAAoB,IAAI,OAAO,CAAC,OAAO,CAAC;IACxC,UAAU,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI;IACpC,cAAc,CAAC,QAAQ,EAAE,QAAQ,CAAC,UAAU,CAAC,GAAG,YAAY;IAC5D,gBAAgB,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,GAAG,IAAI;IACxC,gBAAgB,CAAC,OAAO,EAAE,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,IAAI;IAI1D,gBAAgB,CAAC,QAAQ,EAAE,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,IAAI;IAG3D,yBAAyB,CAAC,QAAQ,EAAE,QAAQ,CAAC,gBAAgB,CAAC,GAAG,YAAY;IAQ7E,SAAS,IAAI,IAAI;CAIpB"}
1
+ {"version":3,"file":"EngineWorklet.d.ts","sourceRoot":"","sources":["../src/EngineWorklet.ts"],"names":[],"mappings":"AAAA,OAAO,EAGH,GAAG,EACH,sBAAsB,EAEtB,QAAQ,EACR,eAAe,EACf,QAAQ,EAER,YAAY,EAGZ,IAAI,EACP,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAC,IAAI,EAAC,MAAM,kBAAkB,CAAA;AAIrC,OAAO,EAEH,gBAAgB,EAOhB,wBAAwB,EACxB,UAAU,EACV,gBAAgB,EACnB,MAAM,0BAA0B,CAAA;AAEjC,OAAO,EAAC,OAAO,EAAC,MAAM,mBAAmB,CAAA;AACzC,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAA;AAG/B,qBAAa,aAAc,SAAQ,gBAAiB,YAAW,MAAM;;IACjE,MAAM,CAAC,EAAE,EAAE,GAAG,CAAQ;IAEtB,QAAQ,CAAC,EAAE,SAAqB;gBAqBpB,OAAO,EAAE,gBAAgB,EACzB,OAAO,EAAE,OAAO,EAChB,mBAAmB,CAAC,EAAE,wBAAwB,EAC9C,OAAO,CAAC,EAAE,gBAAgB;IAsHtC,IAAI,IAAI,IAAI;IACZ,IAAI,CAAC,KAAK,GAAE,OAAe,GAAG,IAAI;IAClC,WAAW,CAAC,QAAQ,EAAE,IAAI,GAAG,IAAI;IACjC,cAAc,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;IACtC,aAAa,IAAI,IAAI;IACrB,KAAK,IAAI,IAAI;IAEb,IAAI,SAAS,IAAI,eAAe,CAAC,OAAO,CAAC,CAAyB;IAClE,IAAI,WAAW,IAAI,eAAe,CAAC,OAAO,CAAC,CAA2B;IACtE,IAAI,YAAY,IAAI,eAAe,CAAC,OAAO,CAAC,CAA4B;IACxE,IAAI,iBAAiB,IAAI,eAAe,CAAC,GAAG,CAAC,CAAiC;IAC9E,IAAI,qBAAqB,IAAI,eAAe,CAAC,MAAM,CAAC,CAAqC;IACzF,IAAI,QAAQ,IAAI,eAAe,CAAC,IAAI,CAAC,CAAwB;IAC7D,IAAI,iBAAiB,IAAI,sBAAsB,CAAC,MAAM,CAAC,CAAiC;IACxF,IAAI,wBAAwB,IAAI,sBAAsB,CAAC,OAAO,CAAC,CAAwC;IACvG,IAAI,gBAAgB,IAAI,sBAAsB,CAAC,OAAO,CAAC,CAAgC;IACvF,IAAI,WAAW,IAAI,eAAe,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC,CAA2B;IAC1F,IAAI,OAAO,IAAI,OAAO,CAAuB;IAE7C,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IACxB,oBAAoB,IAAI,OAAO,CAAC,OAAO,CAAC;IACxC,UAAU,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI;IACpC,cAAc,CAAC,QAAQ,EAAE,QAAQ,CAAC,UAAU,CAAC,GAAG,YAAY;IAC5D,gBAAgB,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,GAAG,IAAI;IACxC,gBAAgB,CAAC,OAAO,EAAE,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,IAAI;IAI1D,gBAAgB,CAAC,QAAQ,EAAE,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,IAAI;IAG3D,yBAAyB,CAAC,QAAQ,EAAE,QAAQ,CAAC,gBAAgB,CAAC,GAAG,YAAY;IAQ7E,SAAS,IAAI,IAAI;CAIpB"}
@@ -86,12 +86,29 @@ export class EngineWorklet extends AudioWorkletNode {
86
86
  fetchAudio: (uuid) => {
87
87
  return new Promise((resolve, reject) => {
88
88
  const handler = project.sampleManager.getOrCreate(uuid);
89
- handler.subscribe(state => {
89
+ const subscription = handler.subscribe(state => {
90
90
  if (state.type === "error") {
91
91
  reject(state.reason);
92
+ subscription.terminate();
92
93
  }
93
94
  else if (state.type === "loaded") {
94
95
  resolve(handler.data.unwrap());
96
+ subscription.terminate();
97
+ }
98
+ });
99
+ });
100
+ },
101
+ fetchSoundfont: (uuid) => {
102
+ return new Promise((resolve, reject) => {
103
+ const handler = project.soundfontManager.getOrCreate(uuid);
104
+ const subscription = handler.subscribe(state => {
105
+ if (state.type === "error") {
106
+ reject(state.reason);
107
+ subscription.terminate();
108
+ }
109
+ else if (state.type === "loaded") {
110
+ resolve(handler.soundfont.unwrap());
111
+ subscription.terminate();
95
112
  }
96
113
  });
97
114
  });
@@ -1,5 +1,6 @@
1
1
  export declare namespace FilePickerAcceptTypes {
2
2
  const WavFiles: FilePickerOptions;
3
+ const SoundfontFiles: FilePickerOptions;
3
4
  const ProjectSyncLog: FilePickerOptions;
4
5
  const ProjectFileType: FilePickerAcceptType;
5
6
  const ProjectBundleFileType: FilePickerAcceptType;
@@ -1 +1 @@
1
- {"version":3,"file":"FilePickerAcceptTypes.d.ts","sourceRoot":"","sources":["../src/FilePickerAcceptTypes.ts"],"names":[],"mappings":"AAAA,yBAAiB,qBAAqB,CAAC;IAC5B,MAAM,QAAQ,EAAE,iBAKtB,CAAA;IACM,MAAM,cAAc,EAAE,iBAK5B,CAAA;IAEM,MAAM,eAAe,EAAE,oBAG7B,CAAA;IAEM,MAAM,qBAAqB,EAAE,oBAGnC,CAAA;IAEM,MAAM,kBAAkB,EAAE,oBAGhC,CAAA;IACM,MAAM,YAAY,EAAE,oBAG1B,CAAA;CAEJ"}
1
+ {"version":3,"file":"FilePickerAcceptTypes.d.ts","sourceRoot":"","sources":["../src/FilePickerAcceptTypes.ts"],"names":[],"mappings":"AAAA,yBAAiB,qBAAqB,CAAC;IAC5B,MAAM,QAAQ,EAAE,iBAKtB,CAAA;IACM,MAAM,cAAc,EAAE,iBAK5B,CAAA;IACM,MAAM,cAAc,EAAE,iBAK5B,CAAA;IAEM,MAAM,eAAe,EAAE,oBAG7B,CAAA;IAEM,MAAM,qBAAqB,EAAE,oBAGnC,CAAA;IAEM,MAAM,kBAAkB,EAAE,oBAGhC,CAAA;IACM,MAAM,YAAY,EAAE,oBAG1B,CAAA;CAEJ"}
@@ -6,6 +6,12 @@ export var FilePickerAcceptTypes;
6
6
  accept: { "audio/wav": [".wav"] }
7
7
  }]
8
8
  };
9
+ FilePickerAcceptTypes.SoundfontFiles = {
10
+ types: [{
11
+ description: "soundfont-file",
12
+ accept: { "audio/x-soundfont": [".sf2"] }
13
+ }]
14
+ };
9
15
  FilePickerAcceptTypes.ProjectSyncLog = {
10
16
  types: [{
11
17
  description: "openDAW sync-log-file",
@@ -1,3 +1,3 @@
1
- import { NanoDeviceBox, PlayfieldDeviceBox, TapeDeviceBox, VaporisateurDeviceBox } from "@opendaw/studio-boxes";
2
- export type InstrumentBox = TapeDeviceBox | VaporisateurDeviceBox | NanoDeviceBox | PlayfieldDeviceBox;
1
+ import { NanoDeviceBox, PlayfieldDeviceBox, SoundfontDeviceBox, TapeDeviceBox, VaporisateurDeviceBox } from "@opendaw/studio-boxes";
2
+ export type InstrumentBox = TapeDeviceBox | VaporisateurDeviceBox | NanoDeviceBox | PlayfieldDeviceBox | SoundfontDeviceBox;
3
3
  //# sourceMappingURL=InstrumentBox.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"InstrumentBox.d.ts","sourceRoot":"","sources":["../src/InstrumentBox.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAE,kBAAkB,EAAE,aAAa,EAAE,qBAAqB,EAAC,MAAM,uBAAuB,CAAA;AAE7G,MAAM,MAAM,aAAa,GAAG,aAAa,GAAG,qBAAqB,GAAG,aAAa,GAAG,kBAAkB,CAAA"}
1
+ {"version":3,"file":"InstrumentBox.d.ts","sourceRoot":"","sources":["../src/InstrumentBox.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,aAAa,EACb,kBAAkB,EAClB,kBAAkB,EAClB,aAAa,EACb,qBAAqB,EACxB,MAAM,uBAAuB,CAAA;AAE9B,MAAM,MAAM,aAAa,GACrB,aAAa,GACX,qBAAqB,GACrB,aAAa,GACb,kBAAkB,GAClB,kBAAkB,CAAA"}
@@ -1,14 +1,23 @@
1
+ import { UUID } from "@opendaw/lib-std";
1
2
  import { InstrumentFactory } from "./InstrumentFactory";
2
3
  export declare namespace InstrumentFactories {
3
4
  const Tape: InstrumentFactory;
4
5
  const Nano: InstrumentFactory;
5
6
  const Playfield: InstrumentFactory;
6
7
  const Vaporisateur: InstrumentFactory;
8
+ const Soundfont: InstrumentFactory<{
9
+ uuid: UUID.String;
10
+ name: string;
11
+ }>;
7
12
  const Named: {
8
- Vaporisateur: InstrumentFactory;
9
- Playfield: InstrumentFactory;
10
- Nano: InstrumentFactory;
11
- Tape: InstrumentFactory;
13
+ Vaporisateur: InstrumentFactory<never>;
14
+ Playfield: InstrumentFactory<never>;
15
+ Nano: InstrumentFactory<never>;
16
+ Tape: InstrumentFactory<never>;
17
+ Soundfont: InstrumentFactory<{
18
+ uuid: UUID.String;
19
+ name: string;
20
+ }>;
12
21
  };
13
22
  type Keys = keyof typeof Named;
14
23
  }
@@ -1 +1 @@
1
- {"version":3,"file":"InstrumentFactories.d.ts","sourceRoot":"","sources":["../src/InstrumentFactories.ts"],"names":[],"mappings":"AAaA,OAAO,EAAC,iBAAiB,EAAC,MAAM,qBAAqB,CAAA;AAGrD,yBAAiB,mBAAmB,CAAC;IAC1B,MAAM,IAAI,EAAE,iBAelB,CAAA;IAEM,MAAM,IAAI,EAAE,iBAoBlB,CAAA;IAEM,MAAM,SAAS,EAAE,iBAkCvB,CAAA;IAEM,MAAM,YAAY,EAAE,iBAiB1B,CAAA;IAEM,MAAM,KAAK;;;;;KAAwC,CAAA;IAC1D,KAAY,IAAI,GAAG,MAAM,OAAO,KAAK,CAAA;CAQxC"}
1
+ {"version":3,"file":"InstrumentFactories.d.ts","sourceRoot":"","sources":["../src/InstrumentFactories.ts"],"names":[],"mappings":"AAWA,OAAO,EAAC,IAAI,EAAC,MAAM,kBAAkB,CAAA;AAKrC,OAAO,EAAC,iBAAiB,EAAC,MAAM,qBAAqB,CAAA;AAGrD,yBAAiB,mBAAmB,CAAC;IAC1B,MAAM,IAAI,EAAE,iBAmBlB,CAAA;IAEM,MAAM,IAAI,EAAE,iBAwBlB,CAAA;IAEM,MAAM,SAAS,EAAE,iBAsCvB,CAAA;IAEM,MAAM,YAAY,EAAE,iBAqB1B,CAAA;IAEM,MAAM,SAAS,EAAE,iBAAiB,CAAC;QAAE,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAqB5E,CAAA;IAEM,MAAM,KAAK;;;;;;kBAvBgC,IAAI,CAAC,MAAM;kBAAQ,MAAM;;KAuBN,CAAA;IACrE,KAAY,IAAI,GAAG,MAAM,OAAO,KAAK,CAAA;CAYxC"}
@@ -1,4 +1,4 @@
1
- import { AudioFileBox, NanoDeviceBox, PlayfieldDeviceBox, PlayfieldSampleBox, TapeDeviceBox, VaporisateurDeviceBox } from "@opendaw/studio-boxes";
1
+ import { AudioFileBox, NanoDeviceBox, PlayfieldDeviceBox, PlayfieldSampleBox, SoundfontDeviceBox, SoundfontFileBox, TapeDeviceBox, VaporisateurDeviceBox } from "@opendaw/studio-boxes";
2
2
  import { UUID } from "@opendaw/lib-std";
3
3
  import { Waveform } from "@opendaw/lib-dsp";
4
4
  import { IconSymbol, TrackType } from "@opendaw/studio-adapters";
@@ -9,7 +9,7 @@ export var InstrumentFactories;
9
9
  defaultIcon: IconSymbol.Tape,
10
10
  description: "Plays audio regions & clips",
11
11
  trackType: TrackType.Audio,
12
- create: (boxGraph, host, name, icon) => TapeDeviceBox.create(boxGraph, UUID.generate(), box => {
12
+ create: (boxGraph, host, name, icon, _attachment) => TapeDeviceBox.create(boxGraph, UUID.generate(), box => {
13
13
  box.label.setValue(name);
14
14
  box.icon.setValue(IconSymbol.toName(icon));
15
15
  box.flutter.setValue(0.2);
@@ -24,7 +24,7 @@ export var InstrumentFactories;
24
24
  defaultIcon: IconSymbol.NanoWave,
25
25
  description: "Simple sampler",
26
26
  trackType: TrackType.Notes,
27
- create: (boxGraph, host, name, icon) => {
27
+ create: (boxGraph, host, name, icon, _attachment) => {
28
28
  const fileUUID = UUID.parse("c1678daa-4a47-4cba-b88f-4f4e384663c3");
29
29
  const fileDuration = 5.340;
30
30
  const audioFileBox = boxGraph.findBox(fileUUID)
@@ -45,24 +45,24 @@ export var InstrumentFactories;
45
45
  defaultIcon: IconSymbol.Playfield,
46
46
  description: "Drum computer",
47
47
  trackType: TrackType.Notes,
48
- create: (boxGraph, host, name, icon) => {
48
+ create: (boxGraph, host, name, icon, _attachment) => {
49
49
  const deviceBox = PlayfieldDeviceBox.create(boxGraph, UUID.generate(), box => {
50
50
  box.label.setValue(name);
51
51
  box.icon.setValue(IconSymbol.toName(icon));
52
52
  box.host.refer(host);
53
53
  });
54
54
  const files = [
55
- useFile(boxGraph, UUID.parse("8bb2c6e8-9a6d-4d32-b7ec-1263594ef367"), "909 Bassdrum", 0.509),
56
- useFile(boxGraph, UUID.parse("0017fa18-a5eb-4d9d-b6f2-e2ddd30a3010"), "909 Snare", 0.235),
57
- useFile(boxGraph, UUID.parse("28d14cb9-1dc6-4193-9dd7-4e881f25f520"), "909 Low Tom", 0.509),
58
- useFile(boxGraph, UUID.parse("21f92306-d6e7-446c-a34b-b79620acfefc"), "909 Mid Tom", 0.385),
59
- useFile(boxGraph, UUID.parse("ad503883-8a72-46ab-a05b-a84149953e17"), "909 High Tom", 0.511),
60
- useFile(boxGraph, UUID.parse("cfee850b-7658-4d08-9e3b-79d196188504"), "909 Rimshot", 0.150),
61
- useFile(boxGraph, UUID.parse("32a6f36f-06eb-4b84-bb57-5f51103eb9e6"), "909 Clap", 0.507),
62
- useFile(boxGraph, UUID.parse("e0ac4b39-23fb-4a56-841d-c9e0ff440cab"), "909 Closed Hat", 0.154),
63
- useFile(boxGraph, UUID.parse("51c5eea4-391c-4743-896a-859692ec1105"), "909 Open Hat", 0.502),
64
- useFile(boxGraph, UUID.parse("42a56ff6-89b6-4f2e-8a66-5a41d316f4cb"), "909 Crash", 1.055),
65
- useFile(boxGraph, UUID.parse("87cde966-b799-4efc-a994-069e703478d3"), "909 Ride", 1.720)
55
+ useAudioFile(boxGraph, UUID.parse("8bb2c6e8-9a6d-4d32-b7ec-1263594ef367"), "909 Bassdrum", 0.509),
56
+ useAudioFile(boxGraph, UUID.parse("0017fa18-a5eb-4d9d-b6f2-e2ddd30a3010"), "909 Snare", 0.235),
57
+ useAudioFile(boxGraph, UUID.parse("28d14cb9-1dc6-4193-9dd7-4e881f25f520"), "909 Low Tom", 0.509),
58
+ useAudioFile(boxGraph, UUID.parse("21f92306-d6e7-446c-a34b-b79620acfefc"), "909 Mid Tom", 0.385),
59
+ useAudioFile(boxGraph, UUID.parse("ad503883-8a72-46ab-a05b-a84149953e17"), "909 High Tom", 0.511),
60
+ useAudioFile(boxGraph, UUID.parse("cfee850b-7658-4d08-9e3b-79d196188504"), "909 Rimshot", 0.150),
61
+ useAudioFile(boxGraph, UUID.parse("32a6f36f-06eb-4b84-bb57-5f51103eb9e6"), "909 Clap", 0.507),
62
+ useAudioFile(boxGraph, UUID.parse("e0ac4b39-23fb-4a56-841d-c9e0ff440cab"), "909 Closed Hat", 0.154),
63
+ useAudioFile(boxGraph, UUID.parse("51c5eea4-391c-4743-896a-859692ec1105"), "909 Open Hat", 0.502),
64
+ useAudioFile(boxGraph, UUID.parse("42a56ff6-89b6-4f2e-8a66-5a41d316f4cb"), "909 Crash", 1.055),
65
+ useAudioFile(boxGraph, UUID.parse("87cde966-b799-4efc-a994-069e703478d3"), "909 Ride", 1.720)
66
66
  ];
67
67
  const samples = files.map((file, index) => PlayfieldSampleBox.create(boxGraph, UUID.generate(), box => {
68
68
  box.device.refer(deviceBox.samples);
@@ -79,7 +79,7 @@ export var InstrumentFactories;
79
79
  defaultIcon: IconSymbol.Piano,
80
80
  description: "Classic subtractive synthesizer",
81
81
  trackType: TrackType.Notes,
82
- create: (boxGraph, host, name, icon) => VaporisateurDeviceBox.create(boxGraph, UUID.generate(), box => {
82
+ create: (boxGraph, host, name, icon, _attachment) => VaporisateurDeviceBox.create(boxGraph, UUID.generate(), box => {
83
83
  box.label.setValue(name);
84
84
  box.icon.setValue(IconSymbol.toName(icon));
85
85
  box.tune.setInitValue(0.0);
@@ -91,10 +91,30 @@ export var InstrumentFactories;
91
91
  box.host.refer(host);
92
92
  })
93
93
  };
94
- InstrumentFactories.Named = { Vaporisateur: InstrumentFactories.Vaporisateur, Playfield: InstrumentFactories.Playfield, Nano: InstrumentFactories.Nano, Tape: InstrumentFactories.Tape };
95
- const useFile = (boxGraph, fileUUID, name, duration) => boxGraph.findBox(fileUUID)
94
+ InstrumentFactories.Soundfont = {
95
+ defaultName: "Soundfont",
96
+ defaultIcon: IconSymbol.Book,
97
+ description: "Soundfont Player",
98
+ trackType: TrackType.Notes,
99
+ create: (boxGraph, host, name, icon, attachment) => {
100
+ attachment ??= { uuid: "d9f51577-2096-4671-9067-27ca2e12b329", name: "Upright Piano KW" };
101
+ const soundFontUUIDAsString = attachment.uuid;
102
+ const soundfontUUID = UUID.parse(soundFontUUIDAsString);
103
+ const soundfontBox = useSoundfontFile(boxGraph, soundfontUUID, attachment.name);
104
+ return SoundfontDeviceBox.create(boxGraph, UUID.generate(), box => {
105
+ box.label.setValue(name);
106
+ box.icon.setValue(IconSymbol.toName(icon));
107
+ box.host.refer(host);
108
+ box.file.refer(soundfontBox);
109
+ });
110
+ }
111
+ };
112
+ InstrumentFactories.Named = { Vaporisateur: InstrumentFactories.Vaporisateur, Playfield: InstrumentFactories.Playfield, Nano: InstrumentFactories.Nano, Tape: InstrumentFactories.Tape, Soundfont: InstrumentFactories.Soundfont };
113
+ const useAudioFile = (boxGraph, fileUUID, name, duration) => boxGraph.findBox(fileUUID)
96
114
  .unwrapOrElse(() => AudioFileBox.create(boxGraph, fileUUID, box => {
97
115
  box.fileName.setValue(name);
98
116
  box.endInSeconds.setValue(duration);
99
117
  }));
118
+ const useSoundfontFile = (boxGraph, fileUUID, name) => boxGraph.findBox(fileUUID)
119
+ .unwrapOrElse(() => SoundfontFileBox.create(boxGraph, fileUUID, box => box.fileName.setValue(name)));
100
120
  })(InstrumentFactories || (InstrumentFactories = {}));
@@ -1,12 +1,13 @@
1
1
  import { IconSymbol, TrackType } from "@opendaw/studio-adapters";
2
2
  import { BoxGraph, Field } from "@opendaw/lib-box";
3
+ import { BoxIO } from "@opendaw/studio-boxes";
3
4
  import { InstrumentBox } from "./InstrumentBox";
4
5
  import { Pointers } from "@opendaw/studio-enums";
5
- export interface InstrumentFactory {
6
+ export interface InstrumentFactory<T = never> {
6
7
  defaultName: string;
7
8
  defaultIcon: IconSymbol;
8
9
  description: string;
9
10
  trackType: TrackType;
10
- create: (boxGraph: BoxGraph, host: Field<Pointers.InstrumentHost | Pointers.AudioOutput>, name: string, icon: IconSymbol) => InstrumentBox;
11
+ create: (boxGraph: BoxGraph<BoxIO.TypeMap>, host: Field<Pointers.InstrumentHost | Pointers.AudioOutput>, name: string, icon: IconSymbol, attachment?: T) => InstrumentBox;
11
12
  }
12
13
  //# sourceMappingURL=InstrumentFactory.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"InstrumentFactory.d.ts","sourceRoot":"","sources":["../src/InstrumentFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,SAAS,EAAC,MAAM,0BAA0B,CAAA;AAC9D,OAAO,EAAC,QAAQ,EAAE,KAAK,EAAC,MAAM,kBAAkB,CAAA;AAEhD,OAAO,EAAC,aAAa,EAAC,MAAM,iBAAiB,CAAA;AAC7C,OAAO,EAAC,QAAQ,EAAC,MAAM,uBAAuB,CAAA;AAE9C,MAAM,WAAW,iBAAiB;IAC9B,WAAW,EAAE,MAAM,CAAA;IACnB,WAAW,EAAE,UAAU,CAAA;IACvB,WAAW,EAAE,MAAM,CAAA;IACnB,SAAS,EAAE,SAAS,CAAA;IACpB,MAAM,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,KAAK,CAAC,QAAQ,CAAC,cAAc,GAAG,QAAQ,CAAC,WAAW,CAAC,EAC3D,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,UAAU,KAAK,aAAa,CAAA;CAC9C"}
1
+ {"version":3,"file":"InstrumentFactory.d.ts","sourceRoot":"","sources":["../src/InstrumentFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,SAAS,EAAC,MAAM,0BAA0B,CAAA;AAC9D,OAAO,EAAC,QAAQ,EAAE,KAAK,EAAC,MAAM,kBAAkB,CAAA;AAChD,OAAO,EAAC,KAAK,EAAC,MAAM,uBAAuB,CAAA;AAC3C,OAAO,EAAC,aAAa,EAAC,MAAM,iBAAiB,CAAA;AAC7C,OAAO,EAAC,QAAQ,EAAC,MAAM,uBAAuB,CAAA;AAE9C,MAAM,WAAW,iBAAiB,CAAC,CAAC,GAAG,KAAK;IACxC,WAAW,EAAE,MAAM,CAAA;IACnB,WAAW,EAAE,UAAU,CAAA;IACvB,WAAW,EAAE,MAAM,CAAA;IACnB,SAAS,EAAE,SAAS,CAAA;IACpB,MAAM,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,EACjC,IAAI,EAAE,KAAK,CAAC,QAAQ,CAAC,cAAc,GAAG,QAAQ,CAAC,WAAW,CAAC,EAC3D,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,UAAU,EAChB,UAAU,CAAC,EAAE,CAAC,KAAK,aAAa,CAAA;CAC5C"}
@@ -1,8 +1,9 @@
1
1
  import { IconSymbol } from "@opendaw/studio-adapters";
2
2
  import { int } from "@opendaw/lib-std";
3
- export type InstrumentOptions = {
3
+ export type InstrumentOptions<T = never> = {
4
4
  name?: string;
5
5
  icon?: IconSymbol;
6
6
  index?: int;
7
+ attachment?: T;
7
8
  };
8
9
  //# sourceMappingURL=InstrumentOptions.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"InstrumentOptions.d.ts","sourceRoot":"","sources":["../src/InstrumentOptions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,0BAA0B,CAAA;AACnD,OAAO,EAAC,GAAG,EAAC,MAAM,kBAAkB,CAAA;AAEpC,MAAM,MAAM,iBAAiB,GAAG;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,UAAU,CAAC;IAAC,KAAK,CAAC,EAAE,GAAG,CAAA;CAAE,CAAA"}
1
+ {"version":3,"file":"InstrumentOptions.d.ts","sourceRoot":"","sources":["../src/InstrumentOptions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,0BAA0B,CAAA;AACnD,OAAO,EAAC,GAAG,EAAC,MAAM,kBAAkB,CAAA;AAEpC,MAAM,MAAM,iBAAiB,CAAC,CAAC,GAAG,KAAK,IAAI;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,UAAU,CAAC;IAAC,KAAK,CAAC,EAAE,GAAG,CAAC;IAAC,UAAU,CAAC,EAAE,CAAC,CAAA;CAAE,CAAA"}
@@ -0,0 +1,3 @@
1
+ export declare const base64Credentials: string;
2
+ export declare const OpenDAWHeaders: RequestInit;
3
+ //# sourceMappingURL=OpenDAWHeaders.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OpenDAWHeaders.d.ts","sourceRoot":"","sources":["../src/OpenDAWHeaders.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,iBAAiB,QAAkC,CAAA;AAChE,eAAO,MAAM,cAAc,EAAE,WAI5B,CAAA"}
@@ -0,0 +1,8 @@
1
+ const username = "openDAW";
2
+ const password = "prototype";
3
+ export const base64Credentials = btoa(`${username}:${password}`);
4
+ export const OpenDAWHeaders = {
5
+ method: "GET",
6
+ headers: { "Authorization": `Basic ${base64Credentials}` },
7
+ credentials: "include"
8
+ };
@@ -95,7 +95,7 @@ export class RecordingWorklet extends AudioWorkletNode {
95
95
  peaks: peaks,
96
96
  meta
97
97
  };
98
- await SampleStorage.saveSample(sample);
98
+ await SampleStorage.get().save(sample);
99
99
  this.#setState({ type: "loaded" });
100
100
  this.terminate();
101
101
  return sample;
@@ -0,0 +1,14 @@
1
+ import { UUID } from "@opendaw/lib-std";
2
+ export declare abstract class Storage<ITEM extends {
3
+ uuid: UUID.String;
4
+ } & META, META, NEW, PARTS> {
5
+ readonly folder: string;
6
+ protected constructor(folder: string);
7
+ abstract save(item: NEW): Promise<void>;
8
+ abstract load(uuid: UUID.Bytes): Promise<PARTS>;
9
+ deleteItem(uuid: UUID.Bytes): Promise<void>;
10
+ loadTrashedIds(): Promise<Array<UUID.String>>;
11
+ saveTrashedIds(ids: ReadonlyArray<UUID.String>): Promise<void>;
12
+ list(): Promise<ReadonlyArray<ITEM>>;
13
+ }
14
+ //# sourceMappingURL=Storage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Storage.d.ts","sourceRoot":"","sources":["../src/Storage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAC,MAAM,kBAAkB,CAAA;AAIrC,8BAAsB,OAAO,CAAC,IAAI,SAAS;IAAE,IAAI,EAAE,IAAI,CAAC,MAAM,CAAA;CAAE,GAAG,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK;IAC/D,QAAQ,CAAC,MAAM,EAAE,MAAM;IAA7C,SAAS,aAAsB,MAAM,EAAE,MAAM;IAE7C,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;IACvC,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;IAEzC,UAAU,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC;IAQ3C,cAAc,IAAI,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAK7C,cAAc,CAAC,GAAG,EAAE,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAK9D,IAAI,IAAI,OAAO,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;CAQ7C"}
@@ -0,0 +1,32 @@
1
+ import { UUID } from "@opendaw/lib-std";
2
+ import { Workers } from "./Workers";
3
+ import { Promises } from "@opendaw/lib-runtime";
4
+ export class Storage {
5
+ folder;
6
+ constructor(folder) {
7
+ this.folder = folder;
8
+ }
9
+ async deleteItem(uuid) {
10
+ const path = `${this.folder}/${UUID.toString(uuid)}`;
11
+ const uuids = await this.loadTrashedIds();
12
+ uuids.push(UUID.toString(uuid));
13
+ await this.saveTrashedIds(uuids);
14
+ await Workers.Opfs.delete(path);
15
+ }
16
+ async loadTrashedIds() {
17
+ const { status, value } = await Promises.tryCatch(Workers.Opfs.read(`${this.folder}/trash.json`));
18
+ return status === "rejected" ? [] : JSON.parse(new TextDecoder().decode(value));
19
+ }
20
+ async saveTrashedIds(ids) {
21
+ const trash = new TextEncoder().encode(JSON.stringify(ids));
22
+ await Workers.Opfs.write(`${this.folder}/trash.json`, trash);
23
+ }
24
+ async list() {
25
+ return Workers.Opfs.list(this.folder)
26
+ .then(files => Promise.all(files.filter(file => file.kind === "directory")
27
+ .map(async ({ name }) => {
28
+ const array = await Workers.Opfs.read(`${this.folder}/${name}/meta.json`);
29
+ return { uuid: name, ...JSON.parse(new TextDecoder().decode(array)) };
30
+ })), () => []);
31
+ }
32
+ }
@@ -0,0 +1,6 @@
1
+ export * from "./Capture";
2
+ export * from "./CaptureAudio";
3
+ export * from "./CaptureMidi";
4
+ export * from "./CaptureDevices";
5
+ export * from "./Recording";
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/capture/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AACzB,cAAc,gBAAgB,CAAA;AAC9B,cAAc,eAAe,CAAA;AAC7B,cAAc,kBAAkB,CAAA;AAChC,cAAc,aAAa,CAAA"}
@@ -0,0 +1,5 @@
1
+ export * from "./Capture";
2
+ export * from "./CaptureAudio";
3
+ export * from "./CaptureMidi";
4
+ export * from "./CaptureDevices";
5
+ export * from "./Recording";
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CloudAuthManager.d.ts","sourceRoot":"","sources":["../../src/cloud/CloudAuthManager.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAA;AAC3C,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAA;AAI3C,qBAAa,gBAAgB;;IACzB,MAAM,CAAC,MAAM,IAAI,gBAAgB;IAqBjC,QAAQ,CAAC,EAAE,SAAyB;IAIpC,OAAO;IAED,UAAU,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC;CAuLjE"}
@@ -1,6 +1,6 @@
1
+ import { CloudService } from "./CloudService";
1
2
  import { CloudHandler } from "./CloudHandler";
2
3
  import { CloudAuthManager } from "./CloudAuthManager";
3
- import { CloudService } from "./CloudService";
4
4
  export declare namespace CloudBackup {
5
5
  const backup: (cloudAuthManager: CloudAuthManager, service: CloudService) => Promise<void>;
6
6
  const backupWithHandler: (cloudHandler: CloudHandler, service: CloudService) => Promise<undefined>;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CloudBackup.d.ts","sourceRoot":"","sources":["../../src/cloud/CloudBackup.ts"],"names":[],"mappings":"AAYA,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAA;AAC3C,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAA;AAC3C,OAAO,EAAC,gBAAgB,EAAC,MAAM,oBAAoB,CAAA;AAMnD,yBAAiB,WAAW,CAAC;IAClB,MAAM,MAAM,GAAU,kBAAkB,gBAAgB,EAAE,SAAS,YAAY,kBA+BrF,CAAA;IAEM,MAAM,iBAAiB,GAAU,cAAc,YAAY,EAAE,SAAS,YAAY,uBAiDxF,CAAA;CACJ"}
@@ -1,9 +1,10 @@
1
1
  import { DefaultObservableValue, Errors, isInstanceOf, Progress, RuntimeNotifier, RuntimeSignal, TimeSpan } from "@opendaw/lib-std";
2
+ import { Browser } from "@opendaw/lib-dom";
3
+ import { Promises } from "@opendaw/lib-runtime";
2
4
  import { CloudBackupSamples } from "./CloudBackupSamples";
3
5
  import { CloudBackupProjects } from "./CloudBackupProjects";
4
- import { ProjectSignals } from "../project/ProjectSignals";
5
- import { Promises } from "@opendaw/lib-runtime";
6
- import { Browser } from "@opendaw/lib-dom";
6
+ import { CloudBackupSoundfonts } from "./CloudBackupSoundfont";
7
+ import { ProjectSignals } from "../project";
7
8
  export var CloudBackup;
8
9
  (function (CloudBackup) {
9
10
  CloudBackup.backup = async (cloudAuthManager, service) => {
@@ -47,7 +48,7 @@ export var CloudBackup;
47
48
  const progressValue = new DefaultObservableValue(0.0);
48
49
  const notification = RuntimeNotifier.progress({ headline: `Backup with ${service}`, progress: progressValue });
49
50
  const log = (text) => notification.message = text;
50
- const [progressSamples, progressProjects] = Progress.split(progress => progressValue.setValue(progress), 2);
51
+ const [progressSamples, progressProjects, progressSoundfonts] = Progress.split(progress => progressValue.setValue(progress), 3);
51
52
  const lockPath = "lock.json";
52
53
  let canReleaseLock = false;
53
54
  try {
@@ -83,6 +84,7 @@ export var CloudBackup;
83
84
  await cloudHandler.upload(lockPath, new TextEncoder().encode(JSON.stringify(json)).buffer);
84
85
  await CloudBackupSamples.start(cloudHandler, progressSamples, log);
85
86
  await CloudBackupProjects.start(cloudHandler, progressProjects, log);
87
+ await CloudBackupSoundfonts.start(cloudHandler, progressSoundfonts, log);
86
88
  }
87
89
  finally {
88
90
  if (canReleaseLock) {
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CloudBackupProjects.d.ts","sourceRoot":"","sources":["../../src/cloud/CloudBackupProjects.ts"],"names":[],"mappings":"AAAA,OAAO,EAOH,SAAS,EACT,QAAQ,EAKX,MAAM,kBAAkB,CAAA;AAIzB,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAA;AAY3C,qBAAa,mBAAmB;;IAC5B,MAAM,CAAC,QAAQ,CAAC,UAAU,cAAa;IACvC,MAAM,CAAC,QAAQ,CAAC,iBAAiB,SAAkC;WAEtD,KAAK,CAAC,YAAY,EAAE,YAAY,EAC1B,QAAQ,EAAE,QAAQ,CAAC,OAAO,EAC1B,GAAG,EAAE,SAAS,CAAC,MAAM,CAAC;IAmBzC,OAAO;CAyJV"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CloudBackupSamples.d.ts","sourceRoot":"","sources":["../../src/cloud/CloudBackupSamples.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,SAAS,EAAE,QAAQ,EAAmB,IAAI,EAAC,MAAM,kBAAkB,CAAA;AAGlG,OAAO,EAAY,MAAM,EAAC,MAAM,0BAA0B,CAAA;AAE1D,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAA;AAM3C,qBAAa,kBAAkB;;IAC3B,MAAM,CAAC,QAAQ,CAAC,UAAU,aAAY;IACtC,MAAM,CAAC,QAAQ,CAAC,iBAAiB,SAAkC;IACnE,MAAM,CAAC,QAAQ,CAAC,eAAe,GAAI,aAAW,MAAM,EAAE,aAAW,MAAM,aAAY;IAEnF,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,GAAG,MAAM;WAE5B,KAAK,CAAC,YAAY,EAAE,YAAY,EAC1B,QAAQ,EAAE,QAAQ,CAAC,OAAO,EAC1B,GAAG,EAAE,SAAS,CAAC,MAAM,CAAC;IAgBzC,OAAO;CA2HV"}
@@ -1,8 +1,7 @@
1
1
  import { Arrays, Errors, panic, Progress, RuntimeNotifier, UUID } from "@opendaw/lib-std";
2
2
  import { network, Promises } from "@opendaw/lib-runtime";
3
3
  import { SamplePeaks } from "@opendaw/lib-fusion";
4
- import { OpenSampleAPI } from "../samples/OpenSampleAPI";
5
- import { SampleStorage } from "../samples/SampleStorage";
4
+ import { OpenSampleAPI, SampleStorage } from "../samples";
6
5
  import { Workers } from "../Workers";
7
6
  import { WavFile } from "../WavFile";
8
7
  export class CloudBackupSamples {
@@ -14,7 +13,7 @@ export class CloudBackupSamples {
14
13
  log("Collecting all sample domains...");
15
14
  const [stock, local, cloud] = await Promise.all([
16
15
  OpenSampleAPI.get().all(),
17
- SampleStorage.listSamples(),
16
+ SampleStorage.get().list(),
18
17
  cloudHandler.download(CloudBackupSamples.RemoteCatalogPath)
19
18
  .then(json => JSON.parse(new TextDecoder().decode(json)))
20
19
  .catch(reason => reason instanceof Errors.FileNotFound ? Arrays.empty() : panic(reason))
@@ -30,7 +29,7 @@ export class CloudBackupSamples {
30
29
  this.#log = log;
31
30
  }
32
31
  async #start(progress) {
33
- const trashed = await SampleStorage.loadTrashedIds();
32
+ const trashed = await SampleStorage.get().loadTrashedIds();
34
33
  const [uploadProgress, trashProgress, downloadProgress] = Progress.splitWithWeights(progress, [0.45, 0.10, 0.45]);
35
34
  await this.#upload(uploadProgress);
36
35
  await this.#trash(trashed, trashProgress);
@@ -48,7 +47,7 @@ export class CloudBackupSamples {
48
47
  const uploadedSamples = await Promises.sequentialAll(unsyncedSamples.map((sample, index, { length }) => async () => {
49
48
  progress((index + 1) / length);
50
49
  this.#log(`Uploading sample '${sample.name}'`);
51
- const arrayBuffer = await SampleStorage.loadSample(UUID.parse(sample.uuid))
50
+ const arrayBuffer = await SampleStorage.get().load(UUID.parse(sample.uuid))
52
51
  .then(([{ frames: channels, numberOfChannels, numberOfFrames: numFrames, sampleRate }]) => WavFile.encodeFloats({ channels, numberOfChannels, numFrames, sampleRate }));
53
52
  const path = CloudBackupSamples.pathFor(sample.uuid);
54
53
  await Promises.approvedRetry(() => this.#cloudHandler.upload(path, arrayBuffer), error => ({
@@ -114,7 +113,7 @@ export class CloudBackupSamples {
114
113
  };
115
114
  const shifts = SamplePeaks.findBestFit(audioData.numberOfFrames);
116
115
  const peaks = await Workers.Peak.generateAsync(Progress.Empty, shifts, audioData.frames, audioData.numberOfFrames, audioData.numberOfChannels);
117
- await SampleStorage.saveSample({
116
+ await SampleStorage.get().save({
118
117
  uuid: UUID.parse(sample.uuid),
119
118
  audio: audioData,
120
119
  peaks: peaks,
@@ -0,0 +1,13 @@
1
+ import { Procedure, Progress, UUID } from "@opendaw/lib-std";
2
+ import { Soundfont } from "@opendaw/studio-adapters";
3
+ import { CloudHandler } from "./CloudHandler";
4
+ export declare class CloudBackupSoundfonts {
5
+ #private;
6
+ static readonly RemotePath = "soundfonts";
7
+ static readonly RemoteCatalogPath: string;
8
+ static readonly areSoundfontsEqual: ({ uuid: a }: Soundfont, { uuid: b }: Soundfont) => boolean;
9
+ static pathFor(uuid: UUID.String): string;
10
+ static start(cloudHandler: CloudHandler, progress: Progress.Handler, log: Procedure<string>): Promise<void>;
11
+ private constructor();
12
+ }
13
+ //# sourceMappingURL=CloudBackupSoundfont.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CloudBackupSoundfont.d.ts","sourceRoot":"","sources":["../../src/cloud/CloudBackupSoundfont.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,SAAS,EAAE,QAAQ,EAAmB,IAAI,EAAC,MAAM,kBAAkB,CAAA;AAElG,OAAO,EAAC,SAAS,EAAC,MAAM,0BAA0B,CAAA;AAClD,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAA;AAK3C,qBAAa,qBAAqB;;IAC9B,MAAM,CAAC,QAAQ,CAAC,UAAU,gBAAe;IACzC,MAAM,CAAC,QAAQ,CAAC,iBAAiB,SAAkC;IACnE,MAAM,CAAC,QAAQ,CAAC,kBAAkB,GAAI,aAAW,SAAS,EAAE,aAAW,SAAS,aAAY;IAE5F,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,GAAG,MAAM;WAE5B,KAAK,CAAC,YAAY,EAAE,YAAY,EAC1B,QAAQ,EAAE,QAAQ,CAAC,OAAO,EAC1B,GAAG,EAAE,SAAS,CAAC,MAAM,CAAC;IAgBzC,OAAO;CA2GV"}
@@ -0,0 +1,120 @@
1
+ import { Arrays, Errors, panic, Progress, RuntimeNotifier, UUID } from "@opendaw/lib-std";
2
+ import { network, Promises } from "@opendaw/lib-runtime";
3
+ import { OpenSoundfontAPI, SoundfontStorage } from "../soundfont";
4
+ export class CloudBackupSoundfonts {
5
+ static RemotePath = "soundfonts";
6
+ static RemoteCatalogPath = `${this.RemotePath}/index.json`;
7
+ static areSoundfontsEqual = ({ uuid: a }, { uuid: b }) => a === b;
8
+ static pathFor(uuid) { return `${this.RemotePath}/${uuid}.wav`; }
9
+ static async start(cloudHandler, progress, log) {
10
+ log("Collecting all soundfont domains...");
11
+ const [stock, local, cloud] = await Promise.all([
12
+ OpenSoundfontAPI.get().all(),
13
+ SoundfontStorage.get().list(),
14
+ cloudHandler.download(CloudBackupSoundfonts.RemoteCatalogPath)
15
+ .then(json => JSON.parse(new TextDecoder().decode(json)))
16
+ .catch(reason => reason instanceof Errors.FileNotFound ? Arrays.empty() : panic(reason))
17
+ ]);
18
+ return new CloudBackupSoundfonts(cloudHandler, { stock, local, cloud }, log).#start(progress);
19
+ }
20
+ #cloudHandler;
21
+ #soundfontDomains;
22
+ #log;
23
+ constructor(cloudHandler, soundfontDomains, log) {
24
+ this.#cloudHandler = cloudHandler;
25
+ this.#soundfontDomains = soundfontDomains;
26
+ this.#log = log;
27
+ }
28
+ async #start(progress) {
29
+ const trashed = await SoundfontStorage.get().loadTrashedIds();
30
+ const [uploadProgress, trashProgress, downloadProgress] = Progress.splitWithWeights(progress, [0.45, 0.10, 0.45]);
31
+ await this.#upload(uploadProgress);
32
+ await this.#trash(trashed, trashProgress);
33
+ await this.#download(trashed, downloadProgress);
34
+ }
35
+ async #upload(progress) {
36
+ const { stock, local, cloud } = this.#soundfontDomains;
37
+ const maybeUnsyncedSoundfonts = Arrays.subtract(local, stock, CloudBackupSoundfonts.areSoundfontsEqual);
38
+ const unsyncedSoundfonts = Arrays.subtract(maybeUnsyncedSoundfonts, cloud, CloudBackupSoundfonts.areSoundfontsEqual);
39
+ if (unsyncedSoundfonts.length === 0) {
40
+ this.#log("No unsynced soundfonts found.");
41
+ progress(1.0);
42
+ return;
43
+ }
44
+ const uploadedSoundfonts = await Promises.sequentialAll(unsyncedSoundfonts.map((soundfont, index, { length }) => async () => {
45
+ progress((index + 1) / length);
46
+ this.#log(`Uploading soundfont '${soundfont.name}'`);
47
+ const arrayBuffer = await SoundfontStorage.get().load(UUID.parse(soundfont.uuid))
48
+ .then(([file, _meta]) => file);
49
+ const path = CloudBackupSoundfonts.pathFor(soundfont.uuid);
50
+ await Promises.approvedRetry(() => this.#cloudHandler.upload(path, arrayBuffer), error => ({
51
+ headline: "Upload failed",
52
+ message: `Failed to upload soundfont '${soundfont.name}'. '${error}'`,
53
+ approveText: "Retry",
54
+ cancelText: "Cancel"
55
+ }));
56
+ return soundfont;
57
+ }));
58
+ const catalog = Arrays.merge(cloud, uploadedSoundfonts, CloudBackupSoundfonts.areSoundfontsEqual);
59
+ await this.#uploadCatalog(catalog);
60
+ progress(1.0);
61
+ }
62
+ async #trash(trashed, progress) {
63
+ const { cloud } = this.#soundfontDomains;
64
+ const obsolete = Arrays.intersect(cloud, trashed, (soundfont, uuid) => soundfont.uuid === uuid);
65
+ if (obsolete.length === 0) {
66
+ progress(1.0);
67
+ return;
68
+ }
69
+ const approved = await RuntimeNotifier.approve({
70
+ headline: "Delete Soundfonts?",
71
+ message: `Found ${obsolete.length} locally deleted soundfonts. Delete from cloud as well?`,
72
+ approveText: "Yes",
73
+ cancelText: "No"
74
+ });
75
+ if (!approved) {
76
+ progress(1.0);
77
+ return;
78
+ }
79
+ const result = await Promises.sequentialAll(obsolete.map((soundfont, index, { length }) => async () => {
80
+ progress((index + 1) / length);
81
+ this.#log(`Deleting '${soundfont.name}'`);
82
+ await this.#cloudHandler.delete(CloudBackupSoundfonts.pathFor(soundfont.uuid));
83
+ return soundfont;
84
+ }));
85
+ const catalog = cloud.slice();
86
+ result.forEach((soundfont) => Arrays.removeIf(catalog, ({ uuid }) => soundfont.uuid === uuid));
87
+ await this.#uploadCatalog(catalog);
88
+ progress(1.0);
89
+ }
90
+ async #download(trashed, progress) {
91
+ const { cloud, local } = this.#soundfontDomains;
92
+ const missingLocally = Arrays.subtract(cloud, local, CloudBackupSoundfonts.areSoundfontsEqual);
93
+ const download = Arrays.subtract(missingLocally, trashed, (soundfont, uuid) => soundfont.uuid === uuid);
94
+ if (download.length === 0) {
95
+ this.#log("No soundfonts to download.");
96
+ progress(1.0);
97
+ return;
98
+ }
99
+ await Promises.sequentialAll(download.map((soundfont, index, { length }) => async () => {
100
+ progress((index + 1) / length);
101
+ this.#log(`Downloading soundfont '${soundfont.name}'`);
102
+ const path = CloudBackupSoundfonts.pathFor(soundfont.uuid);
103
+ const buffer = await Promises.guardedRetry(() => this.#cloudHandler.download(path), network.DefaultRetry);
104
+ await SoundfontStorage.get().save({
105
+ uuid: UUID.parse(soundfont.uuid),
106
+ file: buffer,
107
+ meta: soundfont
108
+ });
109
+ return soundfont;
110
+ }));
111
+ this.#log("Download soundfonts complete.");
112
+ progress(1.0);
113
+ }
114
+ async #uploadCatalog(catalog) {
115
+ this.#log("Uploading soundfonts catalog...");
116
+ const jsonString = JSON.stringify(catalog, null, 2);
117
+ const buffer = new TextEncoder().encode(jsonString).buffer;
118
+ return this.#cloudHandler.upload(CloudBackupSoundfonts.RemoteCatalogPath, buffer);
119
+ }
120
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CloudHandler.d.ts","sourceRoot":"","sources":["../../src/cloud/CloudHandler.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IACzB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACtD,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;IACtC,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAAA;IAC5C,IAAI,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAA;IACtC,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACnC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;CACzB"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CloudService.d.ts","sourceRoot":"","sources":["../../src/cloud/CloudService.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,aAAa,CAAA"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DropboxHandler.d.ts","sourceRoot":"","sources":["../../src/cloud/DropboxHandler.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAA;AAE3C,qBAAa,cAAe,YAAW,YAAY;;gBAKnC,WAAW,EAAE,MAAM;IAEzB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAMtB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAaxD,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAe5C,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAWtC,IAAI,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAO3C,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAgC5C"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GoogleDriveHandler.d.ts","sourceRoot":"","sources":["../../src/cloud/GoogleDriveHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAA;AAmB3C,qBAAa,kBAAmB,YAAW,YAAY;;gBAKvC,WAAW,EAAE,MAAM;IAEzB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IActB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IA8BtD,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAe5C,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAKtC,IAAI,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IA4BtC,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAmK5C"}