Make scale_sample inline

This commit is contained in:
Ian Scott committed 2025-08-07 19:51:07 -06:00
1 parent b2fc8ea00d
commit 94fa236b7f
3 files changed
+11 -11

No files matched your search

+1
View File
@@ -15,6 +15,7 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#pragma once
#ifdef INTERP_CLAMP
#include "hardware/interp.h"
-10
View File
@@ -22,8 +22,6 @@
#include "flash_settings.h"
#include "pico/stdlib.h"
#include "volctrl.h"
#include "clamp.h"
#include "flash_settings.h"
extern Settings settings;
int32_t opl_volume = 0x10000; // default 1.0x volume
@@ -47,14 +45,6 @@ int32_t set_volume_scale (uint8_t percent) {
return volume;
}
int32_t scale_sample (int32_t sample, int32_t scale, int clamp) {
sample = (sample * scale) >> 16;
if (clamp)
clamp16(sample);
return sample;
}
void set_volume(uint16_t mode) {
+10 -1
View File
@@ -25,6 +25,7 @@ extern "C" {
#include <stdbool.h>
#include "../common/picogus.h"
#include "flash_settings.h"
#include "clamp.h"
extern int32_t opl_volume;
extern int32_t sb_volume;
@@ -34,7 +35,15 @@ extern int32_t psg_volume;
extern int32_t set_volume_scale (uint8_t percent);
extern int32_t scale_sample (int32_t sample, int32_t scale, int clamp);
static inline int32_t scale_sample (int32_t sample, int32_t scale, int clamp) {
sample = (sample * scale) >> 16;
if (clamp)
sample = clamp16(sample);
return sample;
}
void set_volume(uint16_t mode);