Skip to content

Commit dbf5459

Browse files
committed
Type winamp-eqf
1 parent f2fd00b commit dbf5459

File tree

19 files changed

+661
-98
lines changed

19 files changed

+661
-98
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ jobs:
5555
# Set CI environment variable for optimized builds
5656
export CI=true
5757
pnpm --filter ani-cursor build
58+
pnpm --filter winamp-eqf build
5859
pnpm --filter webamp build
5960
env:
6061
NODE_ENV: production
@@ -88,6 +89,7 @@ jobs:
8889
# Set CI environment variable for optimized builds
8990
export CI=true
9091
pnpm --filter ani-cursor build
92+
pnpm --filter winamp-eqf build
9193
pnpm --filter webamp build-library
9294
env:
9395
NODE_ENV: production

docs/typescript-checking.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ This document describes the TypeScript checking convention established for the W
66

77
Each TypeScript-enabled package in the monorepo now has a consistent `type-check` script that performs type checking without emitting files.
88

9-
**Progress: 4 out of 5 packages now passing! 🎉**
9+
**Progress: 5 out of 6 packages now passing! 🎉**
1010

1111
### Package Status
1212

@@ -16,6 +16,7 @@ Each TypeScript-enabled package in the monorepo now has a consistent `type-check
1616
- **ani-cursor**: Clean TypeScript compilation
1717
- **skin-database**: Clean TypeScript compilation (fixed JSZip types, Jest types, and Buffer compatibility issues)
1818
- **webamp-docs**: Clean TypeScript compilation
19+
- **winamp-eqf**: Clean TypeScript compilation (ES module with full type definitions)
1920

2021
#### ❌ Failing Packages (Need fixes)
2122

@@ -44,7 +45,7 @@ The root package.json contains a centralized script that runs type checking for
4445
```json
4546
{
4647
"scripts": {
47-
"type-check": "pnpm --filter webamp type-check && pnpm --filter ani-cursor type-check && pnpm --filter skin-database type-check && pnpm --filter webamp-docs type-check"
48+
"type-check": "pnpm --filter webamp type-check && pnpm --filter ani-cursor type-check && pnpm --filter skin-database type-check && pnpm --filter webamp-docs type-check && pnpm --filter winamp-eqf type-check"
4849
}
4950
}
5051
```

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"scripts": {
1212
"test": "jest",
1313
"lint": "eslint . --ext ts,tsx,js,jsx --rulesdir=packages/webamp-modern/tools/eslint-rules",
14-
"type-check": "pnpm --filter webamp type-check && pnpm --filter ani-cursor type-check && pnpm --filter skin-database type-check && pnpm --filter webamp-docs type-check",
14+
"type-check": "pnpm --filter webamp type-check && pnpm --filter ani-cursor type-check && pnpm --filter skin-database type-check && pnpm --filter webamp-docs type-check && pnpm --filter winamp-eqf type-check",
1515
"deploy": "sh deploy.sh",
1616
"format": "prettier --write '**/*.{js,ts,tsx}'"
1717
},

packages/webamp/config/jest.unit.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,12 @@ module.exports = {
1010
"\\.css$": "<rootDir>/js/__mocks__/styleMock.js",
1111
"\\.wsz$": "<rootDir>/js/__mocks__/fileMock.js",
1212
"\\.mp3$": "<rootDir>/js/__mocks__/fileMock.js",
13+
"^winamp-eqf$": "<rootDir>/../winamp-eqf/built/index.js",
1314
},
1415
transform: {
1516
"^.+\\.(t|j)sx?$": ["@swc/jest"],
1617
},
18+
extensionsToTreatAsEsm: [".ts", ".tsx"],
1719
testPathIgnorePatterns: ["/node_modules/"],
1820
testEnvironment: "jsdom",
1921
};

packages/webamp/js/selectors.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,20 @@ import { SerializedStateV1 } from "./serializedStates/v1Types";
4545
export const getSliders = (state: AppState) => state.equalizer.sliders;
4646

4747
export const getEqfData = createSelector(getSliders, (sliders) => {
48-
const preset: { [key: string]: number | string } = {
48+
const preset = {
4949
name: "Entry1",
5050
preamp: Utils.denormalizeEqBand(sliders.preamp),
51+
hz60: Utils.denormalizeEqBand(sliders[60]),
52+
hz170: Utils.denormalizeEqBand(sliders[170]),
53+
hz310: Utils.denormalizeEqBand(sliders[310]),
54+
hz600: Utils.denormalizeEqBand(sliders[600]),
55+
hz1000: Utils.denormalizeEqBand(sliders[1000]),
56+
hz3000: Utils.denormalizeEqBand(sliders[3000]),
57+
hz6000: Utils.denormalizeEqBand(sliders[6000]),
58+
hz12000: Utils.denormalizeEqBand(sliders[12000]),
59+
hz14000: Utils.denormalizeEqBand(sliders[14000]),
60+
hz16000: Utils.denormalizeEqBand(sliders[16000]),
5161
};
52-
BANDS.forEach((band) => {
53-
preset[`hz${band}`] = Utils.denormalizeEqBand(sliders[band]);
54-
});
5562
const eqfData = {
5663
presets: [preset],
5764
type: "Winamp EQ library file v1.1",

packages/webamp/js/winamp-eqf.d.ts

Lines changed: 0 additions & 4 deletions
This file was deleted.

packages/webamp/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,6 @@
155155
"reselect": "^3.0.1",
156156
"strtok3": "^10.3.1",
157157
"tinyqueue": "^1.2.3",
158-
"winamp-eqf": "^1.0.0"
158+
"winamp-eqf": "workspace:*"
159159
}
160160
}

packages/webamp/scripts/parsePresetFiles.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1-
const fs = require("fs");
2-
const path = require("path");
3-
const { parser } = require("winamp-eqf");
1+
import fs from "fs";
2+
import path from "path";
3+
import { parser } from "winamp-eqf";
4+
import { fileURLToPath } from "url";
5+
6+
const __filename = fileURLToPath(import.meta.url);
7+
const __dirname = path.dirname(__filename);
48

59
const presetsPath = path.join(__dirname, "../presets/winamp.q1");
610
const content = fs.readFileSync(presetsPath);

packages/winamp-eqf/.gitignore

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Build output
2+
built/
3+
4+
# Node modules
5+
node_modules/
6+
7+
# npm/pnpm
8+
npm-debug.log*
9+
yarn-debug.log*
10+
yarn-error.log*
11+
package-lock.json
12+
13+
# TypeScript
14+
*.tsbuildinfo
15+
16+
# OS generated files
17+
.DS_Store
18+
.DS_Store?
19+
._*
20+
.Spotlight-V100
21+
.Trashes
22+
ehthumbs.db
23+
Thumbs.db

packages/winamp-eqf/README.md

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,31 @@
11
# Winamp Equalizer Preset Parser
22

3-
Winamp allows you to save your equalizser settings to `.eqf` file. This package allows you to parse these files.
3+
Winamp allows you to save your equalizer settings to `.eqf` file. This package allows you to parse these files.
44

55
## Installation
66

7-
npm install --save winamp-eqf
7+
```bash
8+
npm install --save winamp-eqf
9+
```
10+
11+
## Usage
812

9-
## Ussage
13+
```typescript
14+
import { parser, creator, EqfData, CreateEqfData } from 'winamp-eqf';
1015

11-
import {parser, creator} from 'winamp-eqf';
16+
// ... Get your .eqf or .q1 file as an ArrayBuffer
17+
const eqf: EqfData = parser(eqfArrayBuffer);
1218

13-
// ... Get your .eqf or .q1 file as an ArrayBuffer
14-
const eqf = parser(eqfArrayBuffer);
19+
const eqfArrayBuffer: ArrayBuffer = creator(eqf);
20+
```
1521

16-
const eqfArrayBuffer = creator(eqf);
22+
This package is an ES module and requires Node.js 14+ or a modern bundler that supports ES modules.
1723

1824
## API
1925

20-
### `parser(ArrayBuffer)`
26+
This package is written in TypeScript and provides full type definitions.
27+
28+
### `parser(ArrayBuffer): EqfData`
2129

2230
#### Return value
2331

@@ -44,7 +52,7 @@ Winamp allows you to save your equalizser settings to `.eqf` file. This package
4452
}
4553
```
4654

47-
### `creator(eqfObject)`
55+
### `creator(eqfObject: CreateEqfData): ArrayBuffer`
4856

4957
#### Return Value: `ArrayBuffer`
5058

0 commit comments

Comments
 (0)