Skip to content

Commit 58a0d37

Browse files
committed
Play selected Audio SFX tiles and move Play button to SFX Shape - PR_26145_016-audio-sfx-play-selected-sound-and-move-play-button
1 parent 95b52a5 commit 58a0d37

4 files changed

Lines changed: 85 additions & 6 deletions

File tree

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Audio / SFX Playground V2 Tile Play And Button Move
2+
3+
PR: `PR_26145_016-audio-sfx-play-selected-sound-and-move-play-button`
4+
5+
## Targeted Static Validation
6+
7+
- `node --check tools/audio-sfx-playground-v2/js/AudioSfxPlaygroundV2App.js` - PASS
8+
- HTML external script/style guard for `tools/audio-sfx-playground-v2/index.html` - PASS
9+
- `git diff --check -- tools/audio-sfx-playground-v2/index.html tools/audio-sfx-playground-v2/styles/audioSfxLayoutDensity.css tools/audio-sfx-playground-v2/js/AudioSfxPlaygroundV2App.js` - PASS, with existing LF/CRLF working-copy warnings for edited HTML/CSS
10+
11+
## Focused Playwright Validation
12+
13+
Command: custom Playwright validation using the repo test server and installed Microsoft Edge at `C:/Program Files (x86)/Microsoft/Edge/Application/msedge.exe`.
14+
15+
Result: PASS
16+
17+
Validated:
18+
19+
- Audio / SFX Playground V2 launches with no console or page errors.
20+
- Clicking a created SFX tile selects that tile.
21+
- Tile selection still loads the selected sound settings into the editor.
22+
- Tile selection invokes the existing audio engine with the selected saved sound.
23+
- The Play button is inside `#sfxShapeContent`.
24+
- The old center-panel Play button placement is removed from `#soundDesignContent`.
25+
- The Play button is centered horizontally in the left SFX Shape panel.
26+
- The Play button is anchored to the bottom of the SFX Shape panel.
27+
28+
Measured focused validation highlights:
29+
30+
- Selected tile played: `First Selectable`, `440 Hz`, `square`.
31+
- `#soundDesignContent #toolPlayButton`: not present.
32+
- `#sfxShapeContent #toolPlayButton`: present.
33+
- Play button horizontal center delta: `0px`.
34+
- Play button bottom offset inside SFX Shape: `10px`.
35+
36+
## Playwright V8 Coverage
37+
38+
- `(100%) tools/audio-sfx-playground-v2/js/AudioSfxPlaygroundV2App.js - covered by focused add, select, tile playback, editor restore, and Play button placement validation`
39+
40+
Changed runtime JavaScript files were present in focused coverage.
41+
42+
## Required Workspace V2 Test
43+
44+
Command: `npm.cmd run test:workspace-v2`
45+
46+
Result: FAIL due environment browser install, not this PR's tool behavior.
47+
48+
Observed:
49+
50+
- 72 tests collected.
51+
- 1 test passed.
52+
- 71 tests failed before executing page assertions because Playwright could not launch its managed Chromium executable.
53+
- Error: `Executable doesn't exist at C:\Users\DavidQ\AppData\Local\ms-playwright\chromium-1217\chrome-win64\chrome.exe`
54+
- Playwright requested: `npx playwright install`
55+
56+
## Full Samples Smoke
57+
58+
Skipped. This PR only impacts Audio / SFX Playground V2 tile playback and Play button layout.
59+
60+
## Manual Validation Steps
61+
62+
1. Open `tools/audio-sfx-playground-v2/index.html` through the repo test server or Workspace V2 tile.
63+
2. Create at least two named SFX tiles.
64+
3. Click a non-active tile.
65+
4. Confirm the clicked tile becomes selected and its settings load into the editor.
66+
5. Confirm the clicked tile plays immediately.
67+
6. Confirm the Play button appears centered at the bottom of the SFX Shape left panel.
68+
7. Confirm no Play button appears in the Sound Design center panel.
69+
70+
Expected outcome: tile click selects, loads, and plays the saved sound with no console errors.

tools/audio-sfx-playground-v2/index.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,9 @@ <h2 class="tools-platform-frame__eyebrow">First-Class Tools Surface V2</h2>
9090
<ul id="styleExamples" class="audio-sfx__style-examples" aria-label="Example sound ideas"></ul>
9191
<p id="settingsHelper" class="tool-starter__hint audio-sfx__settings-helper" aria-live="polite"></p>
9292
<p id="sfxValidationMessage" class="tool-starter__hint">Ready to audition.</p>
93+
<div class="audio-sfx__shape-actions">
94+
<button id="toolPlayButton" type="button">Play</button>
95+
</div>
9396
</div>
9497
</section>
9598
</aside>
@@ -168,9 +171,6 @@ <h3 id="noiseControlsHeading">Noise Controls</h3>
168171
</label>
169172
</section>
170173
</div>
171-
<div class="audio-sfx__shape-actions">
172-
<button id="toolPlayButton" type="button">Play</button>
173-
</div>
174174
</div>
175175
</section>
176176
<section class="accordion-v2 tool-starter__accordion tool-starter__accordion--fill is-open" data-accordion-v2-open="true">

tools/audio-sfx-playground-v2/js/AudioSfxPlaygroundV2App.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,9 @@ export class AudioSfxPlaygroundV2App {
8989
onRename: () => this.renameCurrentSound()
9090
});
9191
this.tileList.mount({
92-
onSelect: (soundId) => this.selectSound(soundId)
92+
onSelect: (soundId) => {
93+
void this.selectSound(soundId);
94+
}
9395
});
9496
this.statusLog.mount();
9597
this.renderSoundList();
@@ -230,7 +232,7 @@ export class AudioSfxPlaygroundV2App {
230232
this.statusLog.write(`Renamed SFX to ${entry.sound.name}.`);
231233
}
232234

233-
selectSound(soundId) {
235+
async selectSound(soundId) {
234236
const entry = this.soundEntries.find((candidate) => candidate.id === soundId);
235237
if (!entry) {
236238
this.statusLog.error(`Unable to select missing SFX entry: ${soundId}.`);
@@ -241,6 +243,12 @@ export class AudioSfxPlaygroundV2App {
241243
this.renderSoundList();
242244
this.refreshPreview();
243245
this.statusLog.write(`Loaded ${entry.sound.name}.`);
246+
try {
247+
await this.audioEngine.play(entry.sound);
248+
this.statusLog.write(`Played ${entry.sound.name}.`);
249+
} catch (error) {
250+
this.statusLog.error(`Audio playback failed: ${error.message}`);
251+
}
244252
}
245253

246254
renderSoundList() {

tools/audio-sfx-playground-v2/styles/audioSfxLayoutDensity.css

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,8 +213,9 @@ body[data-tool-id="audio-sfx-playground-v2"] .audio-sfx__control-group h3 {
213213

214214
body[data-tool-id="audio-sfx-playground-v2"] .audio-sfx__shape-actions {
215215
display: flex;
216-
justify-content: flex-end;
216+
justify-content: center;
217217
border-top: 1px solid var(--tool-starter-line);
218+
margin-top: auto;
218219
padding-top: 6px;
219220
}
220221

0 commit comments

Comments
 (0)