TB2026-YDS Firmware
Loading...
Searching...
No Matches
audio_settings.c File Reference

Audio settings: output routing (top) and an L/R balance slider (bottom). More...

#include "audio_settings.h"
#include "bluetooth_settings.h"
#include "navigator.h"
#include "status_bar.h"
#include "gfx.h"
#include "player.h"
#include "volume.h"
#include "bluetooth.h"
#include <stdio.h>
#include <stdlib.h>

Macros

#define CONTENT_TOP   (STATUS_BAR_H)
#define CONTENT_BOT   (GFX_H)
#define MID_Y   ((CONTENT_TOP + CONTENT_BOT) / 2) /* separator, at the middle */
#define ROW_H   16
#define CARET_X   4
#define LABEL_X   16
#define DOT_X   (GFX_W - 14) /* active-output marker, right-aligned */
#define OUT_GROUP_H   (16 + 3 * ROW_H)
#define OUT_HDR_Y   (CONTENT_TOP + ((MID_Y - CONTENT_TOP) - OUT_GROUP_H) / 2)
#define ROW0_Y   (OUT_HDR_Y + 16) /* first output row */
#define SEP_Y   MID_Y /* separator between the two sections */
#define BAL_GROUP_H   50
#define BAL_HDR_Y   (MID_Y + ((CONTENT_BOT - MID_Y) - BAL_GROUP_H) / 2)
#define BAR_X   18
#define BAR_W   140
#define BAR_Y   (BAL_HDR_Y + 24)
#define BAR_H   6
#define VAL_Y   (BAR_Y + 18) /* numeric readout under the bar */
#define ACCENT   gfx_rgb(255, 0, 0) /* Settings identity colour (see root_menu) */
#define DIM   gfx_rgb(110, 110, 110)
#define BAL_MAX   40 /* 40 steps * 0.5 dB = +20 dB per side */

Enumerations

enum  {
  SEL_JACK = 0 , SEL_BT , SEL_BT_SETTINGS , SEL_SLIDER ,
  N_SEL
}

Functions

screen_taudio_settings_screen (void)
 Get the singleton Audio settings screen, ready to push onto the navigator.

Detailed Description

Audio settings: output routing (top) and an L/R balance slider (bottom).

Two stacked sections below the status bar, like the Bluetooth screen. The top mirrors the Now-Playing output popup (Jack / Bluetooth / BT Settings) but in the Settings red accent, and applies the choice in place – the active output keeps its filled dot, the Bluetooth row is dimmed and inert while nothing is connected. The bottom is a centred balance slider: pushing it left makes the LEFT channel louder, right the RIGHT one, up to +20 dB per side.

The slider drives the DAC L/R trim live (volume_set_balance) for immediate feedback; the value is persisted to NVS once, on screen exit (volume_save_balance), and restored by volume_init at boot – so a still slider costs no flash writes.

Note
Développé avec l'assistance de Claude Opus 4.8 (Anthropic), sous la direction de Y. Dos Santos : spécification, revue et validation sur cible par l'auteur.

Macro Definition Documentation

◆ ACCENT

#define ACCENT   gfx_rgb(255, 0, 0) /* Settings identity colour (see root_menu) */

◆ BAL_GROUP_H

#define BAL_GROUP_H   50

◆ BAL_HDR_Y

#define BAL_HDR_Y   (MID_Y + ((CONTENT_BOT - MID_Y) - BAL_GROUP_H) / 2)

◆ BAL_MAX

#define BAL_MAX   40 /* 40 steps * 0.5 dB = +20 dB per side */

◆ BAR_H

#define BAR_H   6

◆ BAR_W

#define BAR_W   140

◆ BAR_X

#define BAR_X   18

◆ BAR_Y

#define BAR_Y   (BAL_HDR_Y + 24)

◆ CARET_X

#define CARET_X   4

◆ CONTENT_BOT

#define CONTENT_BOT   (GFX_H)

◆ CONTENT_TOP

#define CONTENT_TOP   (STATUS_BAR_H)

◆ DIM

#define DIM   gfx_rgb(110, 110, 110)

◆ DOT_X

#define DOT_X   (GFX_W - 14) /* active-output marker, right-aligned */

◆ LABEL_X

#define LABEL_X   16

◆ MID_Y

#define MID_Y   ((CONTENT_TOP + CONTENT_BOT) / 2) /* separator, at the middle */

◆ OUT_GROUP_H

#define OUT_GROUP_H   (16 + 3 * ROW_H)

◆ OUT_HDR_Y

#define OUT_HDR_Y   (CONTENT_TOP + ((MID_Y - CONTENT_TOP) - OUT_GROUP_H) / 2)

◆ ROW0_Y

#define ROW0_Y   (OUT_HDR_Y + 16) /* first output row */

◆ ROW_H

#define ROW_H   16

◆ SEP_Y

#define SEP_Y   MID_Y /* separator between the two sections */

◆ VAL_Y

#define VAL_Y   (BAR_Y + 18) /* numeric readout under the bar */

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
SEL_JACK 
SEL_BT 
SEL_BT_SETTINGS 
SEL_SLIDER 
N_SEL 

Function Documentation

◆ audio_settings_screen()

screen_t * audio_settings_screen ( void )

Get the singleton Audio settings screen, ready to push onto the navigator.

Returns
Pointer to the Audio settings screen.