Add boilerplate files and licenses
This commit is contained in:
80
src/types/global.d.ts
vendored
Normal file
80
src/types/global.d.ts
vendored
Normal file
@@ -0,0 +1,80 @@
|
||||
/// <reference types="vite-plugin-pwa/client" />
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
gtag: GtagFunction;
|
||||
}
|
||||
}
|
||||
|
||||
type GtagFunction = {
|
||||
(
|
||||
command: 'config',
|
||||
targetId: string,
|
||||
config?: {
|
||||
[key: string]: any;
|
||||
anonymize_ip?: boolean;
|
||||
allow_ad_features?: boolean;
|
||||
allow_google_signals?: boolean;
|
||||
cookie_domain?: string;
|
||||
cookie_expires?: number;
|
||||
cookie_flags?: string;
|
||||
cookie_name?: string;
|
||||
cookie_prefix?: string;
|
||||
cookie_update?: boolean;
|
||||
page_title?: string;
|
||||
page_location?: string;
|
||||
send_page_view?: boolean;
|
||||
user_id?: string;
|
||||
},
|
||||
): void;
|
||||
|
||||
(command: 'set', targetId: string | 'user_properties', config: Record<string, any>): void;
|
||||
|
||||
(
|
||||
command: 'event',
|
||||
action: string,
|
||||
parameters?: {
|
||||
[key: string]: any;
|
||||
event_category?: string;
|
||||
event_label?: string;
|
||||
value?: number;
|
||||
custom_map?: Record<string, string>;
|
||||
items?: Array<{
|
||||
item_id?: string;
|
||||
item_name?: string;
|
||||
affiliation?: string;
|
||||
coupon?: string;
|
||||
currency?: string;
|
||||
discount?: number;
|
||||
index?: number;
|
||||
item_brand?: string;
|
||||
item_category?: string;
|
||||
item_category2?: string;
|
||||
item_category3?: string;
|
||||
item_category4?: string;
|
||||
item_category5?: string;
|
||||
item_list_id?: string;
|
||||
item_list_name?: string;
|
||||
item_variant?: string;
|
||||
location_id?: string;
|
||||
price?: number;
|
||||
quantity?: number;
|
||||
}>;
|
||||
transaction_id?: string;
|
||||
affiliation?: string;
|
||||
currency?: string;
|
||||
tax?: number;
|
||||
shipping?: number;
|
||||
checkout_step?: number;
|
||||
checkout_option?: string;
|
||||
method?: string;
|
||||
search_term?: string;
|
||||
content_type?: string;
|
||||
content_id?: string;
|
||||
},
|
||||
): void;
|
||||
|
||||
(command: 'get', targetId: string, fieldName: string, callback: (value: any) => void): void;
|
||||
};
|
||||
|
||||
export {};
|
||||
180
src/types/types.ts
Normal file
180
src/types/types.ts
Normal file
@@ -0,0 +1,180 @@
|
||||
import { TEFileNode, TESoundMetadata } from '../lib/midi/types';
|
||||
import { TarFile } from '../lib/untar';
|
||||
|
||||
export type Group = 'a' | 'b' | 'c' | 'd';
|
||||
export type PadNumber = `${number}`;
|
||||
export type PadCode = `${Group}${PadNumber}`;
|
||||
|
||||
export type Sound = {
|
||||
id: number;
|
||||
fileNode: TEFileNode;
|
||||
meta: TESoundMetadata;
|
||||
};
|
||||
|
||||
export enum EffectType {
|
||||
Off = 0,
|
||||
Delay = 1,
|
||||
Reverb = 2,
|
||||
Distortion = 3,
|
||||
Chorus = 4,
|
||||
Filter = 5,
|
||||
Compressor = 6,
|
||||
}
|
||||
|
||||
export enum FaderParam {
|
||||
LVL = 0,
|
||||
PTC = 1,
|
||||
TIM = 2,
|
||||
LPF = 3,
|
||||
HPF = 4,
|
||||
FX = 5,
|
||||
ATK = 6,
|
||||
REL = 7,
|
||||
PAN = 8,
|
||||
TUNE = 9,
|
||||
VEL = 10,
|
||||
MOD = 11,
|
||||
}
|
||||
|
||||
export type GroupFaderParam = {
|
||||
[group: string]: {
|
||||
[K in FaderParam]: number;
|
||||
};
|
||||
};
|
||||
|
||||
export type ProjectSettings = {
|
||||
bpm: number;
|
||||
scale: number;
|
||||
rootNote: number;
|
||||
groupFaderParams: GroupFaderParam;
|
||||
faderAssignment: Record<string, FaderParam>;
|
||||
rawData: Uint8Array;
|
||||
};
|
||||
|
||||
export type TimeSignature = {
|
||||
numerator: number;
|
||||
denominator: number;
|
||||
};
|
||||
|
||||
export type ScenesSettings = {
|
||||
timeSignature: TimeSignature;
|
||||
};
|
||||
|
||||
export type Effects = {
|
||||
rawData: Uint8Array;
|
||||
effectType: EffectType;
|
||||
param1: number;
|
||||
param2: number;
|
||||
};
|
||||
|
||||
export type Pattern = {
|
||||
pad: PadCode;
|
||||
group: Group;
|
||||
notes: Note[];
|
||||
bars: number;
|
||||
};
|
||||
|
||||
export type Scene = {
|
||||
name: string;
|
||||
patterns: Pattern[];
|
||||
};
|
||||
|
||||
export type Note = {
|
||||
note: number;
|
||||
position: number;
|
||||
duration: number;
|
||||
velocity: number;
|
||||
};
|
||||
|
||||
export type Pad = {
|
||||
pad: number;
|
||||
name: string;
|
||||
group: Group;
|
||||
file: TarFile | null;
|
||||
rawData: Uint8Array | null;
|
||||
soundId: number;
|
||||
volume: number;
|
||||
attack: number;
|
||||
release: number;
|
||||
trimLeft: number;
|
||||
trimRight: number;
|
||||
soundLength: number;
|
||||
playMode: 'oneshot' | 'key' | 'legato';
|
||||
pan: number;
|
||||
pitch: number;
|
||||
rootNote: number;
|
||||
timeStretch: 'off' | 'bpm' | 'bars' | 'rev';
|
||||
timeStretchBpm: number;
|
||||
timeStretchBars: number;
|
||||
inChokeGroup: boolean;
|
||||
midiChannel: number;
|
||||
};
|
||||
|
||||
export type ProjectRawData = {
|
||||
pads: Record<string, Pad[]>;
|
||||
scenes: Scene[];
|
||||
settings: ProjectSettings;
|
||||
effects: Effects;
|
||||
sounds: Sound[];
|
||||
projectFile: File;
|
||||
scenesSettings: ScenesSettings;
|
||||
};
|
||||
|
||||
export type ExportResultFile = {
|
||||
name: string;
|
||||
url: string;
|
||||
type: 'project' | 'archive';
|
||||
size: number;
|
||||
};
|
||||
|
||||
export type ExportResult = {
|
||||
files: ExportResultFile[];
|
||||
sampleReport?: SampleReport;
|
||||
};
|
||||
|
||||
export type ExportFormatId = 'ableton' | 'dawproject' | 'midi' | 'reaper';
|
||||
|
||||
export type ExportStatus = {
|
||||
status: string;
|
||||
progress: number;
|
||||
sampleReport?: SampleReport;
|
||||
};
|
||||
|
||||
export type SampleReport = {
|
||||
downloaded: string[];
|
||||
missing: { name: string; error: string }[];
|
||||
};
|
||||
|
||||
export type ExportFormat = {
|
||||
name: string;
|
||||
value: ExportFormatId;
|
||||
exportFn?: (
|
||||
projectId: string,
|
||||
data: ProjectRawData,
|
||||
sounds: Sound[],
|
||||
progressCallback: ({ progress, status }: ExportStatus) => void,
|
||||
exporterParams: ExporterParams,
|
||||
) => Promise<ExportResult>;
|
||||
};
|
||||
|
||||
export type ExporterParams = {
|
||||
projectName?: string; // custom project name for exported files
|
||||
includeArchivedSamples?: boolean;
|
||||
exportAllPadsWithSamples?: boolean; // export all pads with assigned samples even if not used
|
||||
clips?: boolean; // build clips not arrangements
|
||||
noSampler?: boolean; // don't use sampler/simpler at all
|
||||
groupTracks?: boolean; // group tracks by group name
|
||||
drumRackGroupA?: boolean; // merge tracks for group A
|
||||
drumRackGroupB?: boolean; // merge tracks for group B
|
||||
drumRackGroupC?: boolean; // merge tracks for group C
|
||||
drumRackGroupD?: boolean; // merge tracks for group D
|
||||
sendEffects?: boolean; // send effects to return tracks
|
||||
allScenes?: boolean; // export all scenes
|
||||
selectedScenes?: string[]; // export only selected scenes (when allScenes is false)
|
||||
customSceneNames?: Record<string, string>;
|
||||
};
|
||||
|
||||
export type SoundInfo = {
|
||||
soundId: number;
|
||||
soundMeta: TESoundMetadata;
|
||||
};
|
||||
12
src/types/vite-env.d.ts
vendored
Normal file
12
src/types/vite-env.d.ts
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
/// <reference types="vite/client" />
|
||||
|
||||
declare module '*.svg?react' {
|
||||
import { JSX } from 'preact';
|
||||
const SVG: (props: JSX.SVGProps<SVGSVGElement>) => JSX.Element;
|
||||
export default SVG;
|
||||
}
|
||||
|
||||
declare module '*.svg' {
|
||||
const content: string;
|
||||
export default content;
|
||||
}
|
||||
Reference in New Issue
Block a user