Add featured Dark House track with default landing ambient playback
Some checks failed
CI Docker Mining Proof / Linux agent hashrate proof (push) Has been cancelled
Some checks failed
CI Docker Mining Proof / Linux agent hashrate proof (push) Has been cancelled
Wire featured-dark-house-2025.mp3 as the default ambient source, enable BGM for first-time visitors, and attempt autoplay on Command Deck with gesture-unlock fallback. The ~57MB MP3 stays gitignored; copy instructions are in public/audio/.gitkeep.
This commit is contained in:
@@ -17,11 +17,16 @@ describe('ambientMusic prefs', () => {
|
||||
localStorage.clear();
|
||||
});
|
||||
|
||||
it('defaults music off and volume ~0.22', () => {
|
||||
expect(loadBgmEnabled()).toBe(false);
|
||||
it('defaults music on for first visit and volume ~0.22', () => {
|
||||
expect(loadBgmEnabled()).toBe(true);
|
||||
expect(loadBgmVolume()).toBeCloseTo(0.22);
|
||||
});
|
||||
|
||||
it('respects explicit opt-out', () => {
|
||||
localStorage.setItem(BGM_STORAGE_KEY, '0');
|
||||
expect(loadBgmEnabled()).toBe(false);
|
||||
});
|
||||
|
||||
it('persists enabled flag', () => {
|
||||
const p = new AmbientMusicPlayer();
|
||||
p.setEnabled(true);
|
||||
@@ -38,8 +43,8 @@ describe('ambientMusic prefs', () => {
|
||||
expect(localStorage.getItem(BGM_VOLUME_KEY)).toBe('0');
|
||||
});
|
||||
|
||||
it('points at public audio path', () => {
|
||||
expect(AMBIENT_MUSIC_SRC).toBe('/audio/ambient.mp3');
|
||||
it('points at featured public audio path', () => {
|
||||
expect(AMBIENT_MUSIC_SRC).toBe('/audio/featured-dark-house-2025.mp3');
|
||||
});
|
||||
|
||||
it('ducks effective volume 30% while modal registered', () => {
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
/**
|
||||
* Looping background music — drop your MP3 at public/audio/ambient.mp3
|
||||
* (MP3 preferred; OGG/WAV also work if you update AMBIENT_MUSIC_SRC).
|
||||
* Looping background music — featured track at public/audio/featured-dark-house-2025.mp3
|
||||
* (copy from repo music/; legacy ambient.mp3 still valid if you change AMBIENT_MUSIC_SRC).
|
||||
*/
|
||||
export const BGM_STORAGE_KEY = 'aetherforge-bgm';
|
||||
export const BGM_VOLUME_KEY = 'aetherforge-bgm-volume';
|
||||
/** Served from Vite public/ — place ambient.mp3 here before enabling in Settings. */
|
||||
export const AMBIENT_MUSIC_SRC = '/audio/ambient.mp3';
|
||||
/** Featured Command Deck landing track (gitignored when >15MB — copy locally from music/). */
|
||||
export const FEATURED_MUSIC_SRC = '/audio/featured-dark-house-2025.mp3';
|
||||
export const FEATURED_MUSIC_TITLE = 'Dark House 2025';
|
||||
/** Default looping source for the global ambient player. */
|
||||
export const AMBIENT_MUSIC_SRC = FEATURED_MUSIC_SRC;
|
||||
|
||||
/** Route → playback multiplier (0–1). User volume × intensity = effective output. */
|
||||
export const PAGE_AMBIENT_INTENSITY: Record<string, number> = {
|
||||
@@ -40,9 +43,10 @@ export function resolvePageAmbientIntensity(pathname: string): number {
|
||||
export function loadBgmEnabled(): boolean {
|
||||
try {
|
||||
const v = localStorage.getItem(BGM_STORAGE_KEY);
|
||||
if (v === null) return true;
|
||||
return v === '1';
|
||||
} catch {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user