rockbox/firmware/export/pcm_sink.h
Skye df85814e74
erosqnative: use hwvol at runtime on es9018k2m
Change-Id: I0ea89ff44a7d7c7c4aeb65ec2b56287324533bcc
2026-08-14 22:39:35 +09:00

69 lines
1.9 KiB
C

/***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
*
* Copyright (C) 2025 by Sho Tanimoto
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
****************************************************************************/
#pragma once
#include <stddef.h>
#include <stdint.h>
#include "config.h"
#define PCM_SINK_HWVOL 0
#ifdef WANT_SWVOL
#define PCM_SINK_SWVOL 1
#endif
struct pcm_sink_caps {
const unsigned long* samprs;
uint8_t num_samprs;
uint8_t default_freq;
uint8_t volume_type;
};
struct pcm_sink_ops {
void (*init)(void);
void (*postinit)(void);
void (*set_freq)(uint16_t freq);
void (*lock)(void);
void (*unlock)(void);
void (*play)(const void* addr, size_t size);
void (*stop)(void);
};
struct pcm_sink {
/* characteristics */
struct pcm_sink_caps caps;
/* operations */
const struct pcm_sink_ops ops;
/* runtime states */
unsigned long pending_freq;
unsigned long configured_freq;
};
enum pcm_sink_ids {
PCM_SINK_BUILTIN = 0,
#ifdef USB_ENABLE_IAP
PCM_SINK_IAP,
#endif
PCM_SINK_NUM
};
/* defined in each platform pcm source */
extern struct pcm_sink builtin_pcm_sink;