ref: ac3f4627d63669525e1b22a576277bb840b6a414
parent: 2dc801a4650666d198feb5970d63b20955fa19c4
author: Olav Sørensen <olav.sorensen@live.no>
date: Tue Apr 25 13:42:07 EDT 2023
WAV renderer changes (use current audio settings) + some text string changes + allow up to 384kHz rates
--- a/src/ft2_audio.c
+++ b/src/ft2_audio.c
@@ -102,6 +102,8 @@
resumeAudio();
+ setWavRenderFrequency(audio.freq);
+ setWavRenderBitDepth((config.specialFlags & BITDEPTH_32) ? 32 : 16);
return true;
}
@@ -1103,6 +1105,10 @@
setMixerBPM(song.BPM); // this is important
audio.resetSyncTickTimeFlag = true;
+
+ setWavRenderFrequency(audio.freq);
+ setWavRenderBitDepth((config.specialFlags & BITDEPTH_32) ? 32 : 16);
+
return true;
}
--- a/src/ft2_config.c
+++ b/src/ft2_config.c
@@ -1165,8 +1165,8 @@
textOutShadow(406, 45, PAL_FORGRND, PAL_DSKTOP2, "Large");
textOutShadow(390, 61, PAL_FORGRND, PAL_DSKTOP2, "Audio bit depth:");
- textOutShadow(406, 75, PAL_FORGRND, PAL_DSKTOP2, "16-bit (default)");
- textOutShadow(406, 89, PAL_FORGRND, PAL_DSKTOP2, "32-bit float");
+ textOutShadow(406, 75, PAL_FORGRND, PAL_DSKTOP2, "16-bit");
+ textOutShadow(406, 89, PAL_FORGRND, PAL_DSKTOP2, "32-bit (float)");
textOutShadow(390, 105, PAL_FORGRND, PAL_DSKTOP2, "Interpolation:");
textOutShadow(406, 118, PAL_FORGRND, PAL_DSKTOP2, "Disabled");
@@ -1174,9 +1174,9 @@
textOutShadow(406, 146, PAL_FORGRND, PAL_DSKTOP2, "Sinc (8 point)");
textOutShadow(406, 160, PAL_FORGRND, PAL_DSKTOP2, "Sinc (16 point)");
- textOutShadow(509, 3, PAL_FORGRND, PAL_DSKTOP2, "Output rate:");
+ textOutShadow(509, 3, PAL_FORGRND, PAL_DSKTOP2, "Audio output rate:");
textOutShadow(525, 17, PAL_FORGRND, PAL_DSKTOP2, "44100Hz");
- textOutShadow(525, 31, PAL_FORGRND, PAL_DSKTOP2, "48000Hz (default)");
+ textOutShadow(525, 31, PAL_FORGRND, PAL_DSKTOP2, "48000Hz");
#if CPU_64BIT
textOutShadow(525, 45, PAL_FORGRND, PAL_DSKTOP2, "96000Hz");
#endif
@@ -1185,7 +1185,7 @@
textOutShadow(525, 89, PAL_FORGRND, PAL_DSKTOP2, "Linear (default)");
textOutShadow(509, 105, PAL_FORGRND, PAL_DSKTOP2, "Amplification:");
- charOutShadow(621, 105, PAL_FORGRND, PAL_DSKTOP2, 'X');
+ charOutShadow(621, 105, PAL_FORGRND, PAL_DSKTOP2, 'x');
textOutShadow(509, 133, PAL_FORGRND, PAL_DSKTOP2, "Master volume:");
textOutShadow(525, 160, PAL_FORGRND, PAL_DSKTOP2, "Volume ramping");
--- a/src/ft2_radiobuttons.c
+++ b/src/ft2_radiobuttons.c
@@ -80,9 +80,9 @@
{ 390, 44, 50, RB_GROUP_CONFIG_SOUND_BUFF_SIZE, rbConfigAudioBuffLarge },
// audio bit depth
- //x, y, w, group, funcOnUp
- { 390, 74, 107, RB_GROUP_CONFIG_AUDIO_BIT_DEPTH, rbConfigAudio16Bit },
- { 390, 88, 83, RB_GROUP_CONFIG_AUDIO_BIT_DEPTH, rbConfigAudio32BitFloat },
+ //x, y, w, group, funcOnUp
+ { 390, 74, 52, RB_GROUP_CONFIG_AUDIO_BIT_DEPTH, rbConfigAudio16Bit },
+ { 390, 88, 93, RB_GROUP_CONFIG_AUDIO_BIT_DEPTH, rbConfigAudio32BitFloat },
// audio interpolation
//x, y, w, group, funcOnUp
@@ -92,11 +92,11 @@
{ 390, 159, 102, RB_GROUP_CONFIG_AUDIO_INTERPOLATION, rbConfigAudioIntrp16PointSinc },
// audio output frequency
- //x, y, w, group, funcOnUp
- { 509, 16, 66, RB_GROUP_CONFIG_AUDIO_FREQ, rbConfigAudio44kHz },
- { 509, 30, 121, RB_GROUP_CONFIG_AUDIO_FREQ, rbConfigAudio48kHz },
+ //x, y, w, group, funcOnUp
+ { 509, 16, 66, RB_GROUP_CONFIG_AUDIO_FREQ, rbConfigAudio44kHz },
+ { 509, 30, 66, RB_GROUP_CONFIG_AUDIO_FREQ, rbConfigAudio48kHz },
#if CPU_64BIT
- { 509, 44, 66, RB_GROUP_CONFIG_AUDIO_FREQ, rbConfigAudio96kHz },
+ { 509, 44, 66, RB_GROUP_CONFIG_AUDIO_FREQ, rbConfigAudio96kHz },
#endif
// audio input frequency
@@ -106,7 +106,7 @@
{ 322, 156, 60, RB_GROUP_CONFIG_AUDIO_INPUT_FREQ, rbConfigAudioInput96kHz },
// frequency slides
- //x, y, w, group, funcOnUp
+ //x, y, w, group, funcOnUp
{ 509, 74, 50, RB_GROUP_CONFIG_FREQ_SLIDES, rbConfigFreqSlidesAmiga },
{ 509, 88, 108, RB_GROUP_CONFIG_FREQ_SLIDES, rbConfigFreqSlidesLinear },
@@ -218,8 +218,8 @@
// WAV RENDERER BITDEPTH
//x, y, w, group, funcOnUp
- { 140, 95, 52, RB_GROUP_WAV_RENDER_BITDEPTH, rbWavRenderBitDepth16 },
- { 205, 95, 83, RB_GROUP_WAV_RENDER_BITDEPTH, rbWavRenderBitDepth32 }
+ { 130, 95, 52, RB_GROUP_WAV_RENDER_BITDEPTH, rbWavRenderBitDepth16 },
+ { 195, 95, 93, RB_GROUP_WAV_RENDER_BITDEPTH, rbWavRenderBitDepth32 }
};
void drawRadioButton(uint16_t radioButtonID)
--- a/src/ft2_wav_renderer.c
+++ b/src/ft2_wav_renderer.c
@@ -46,18 +46,23 @@
static void updateWavRenderer(void)
{
- char str[10];
+ char str[16];
- fillRect(209, 116, 41, 51, PAL_DESKTOP);
-
+ fillRect(195, 116, 56, 8, PAL_DESKTOP);
+ textOut(237, 116, PAL_FORGRND, "Hz");
sprintf(str, "%6d", WDFrequency);
- textOutFixed(209, 116, PAL_FORGRND, PAL_DESKTOP, str);
-
+ textOutFixed(195, 116, PAL_FORGRND, PAL_DESKTOP, str);
+
+ fillRect(229, 130, 21, 8, PAL_DESKTOP);
+ charOut(243, 130, PAL_FORGRND, 'x');
sprintf(str, "%02d", WDAmp);
- textOut(237, 130, PAL_FORGRND, str);
+ textOut(229, 130, PAL_FORGRND, str);
+ fillRect(237, 144, 13, 8, PAL_DESKTOP);
hexOut(237, 144, PAL_FORGRND, WDStartPos, 2);
- hexOut(237, 158, PAL_FORGRND, WDStopPos, 2);
+
+ fillRect(237, 158, 13, 8, PAL_DESKTOP);
+ hexOut(237, 158, PAL_FORGRND, WDStopPos, 2);
}
void cbToggleWavRenderBPMMode(void)
@@ -65,6 +70,24 @@
useLegacyBPM ^= 1;
}
+void setWavRenderFrequency(int32_t freq)
+{
+ WDFrequency = CLAMP(freq, MIN_WAV_RENDER_FREQ, MAX_WAV_RENDER_FREQ);
+ if (ui.wavRendererShown)
+ updateWavRenderer();
+}
+
+void setWavRenderBitDepth(uint8_t bitDepth)
+{
+ if (bitDepth == 16)
+ WDBitDepth = 16;
+ else if (bitDepth == 32)
+ WDBitDepth = 32;
+
+ if (ui.wavRendererShown)
+ updateWavRenderer();
+}
+
void updateWavRendererSettings(void) // called when changing config.boostLevel
{
WDAmp = config.boostLevel;
@@ -77,13 +100,13 @@
drawFramework(79, 109, 212, 64, FRAMEWORK_TYPE1);
textOutShadow(4, 96, PAL_FORGRND, PAL_DSKTOP2, "WAV exporting:");
- textOutShadow(156, 96, PAL_FORGRND, PAL_DSKTOP2, "16-bit");
- textOutShadow(221, 96, PAL_FORGRND, PAL_DSKTOP2, "32-bit float");
+ textOutShadow(146, 96, PAL_FORGRND, PAL_DSKTOP2, "16-bit");
+ textOutShadow(211, 96, PAL_FORGRND, PAL_DSKTOP2, "32-bit (float)");
textOutShadow(19, 114, PAL_FORGRND, PAL_DSKTOP2, "Imprecise");
textOutShadow(4, 127, PAL_FORGRND, PAL_DSKTOP2, "BPM (FT2)");
- textOutShadow(85, 116, PAL_FORGRND, PAL_DSKTOP2, "Frequency");
+ textOutShadow(85, 116, PAL_FORGRND, PAL_DSKTOP2, "Audio output rate");
textOutShadow(85, 130, PAL_FORGRND, PAL_DSKTOP2, "Amplification");
textOutShadow(85, 144, PAL_FORGRND, PAL_DSKTOP2, "Start song position");
textOutShadow(85, 158, PAL_FORGRND, PAL_DSKTOP2, "Stop song position");
@@ -459,10 +482,11 @@
{
if (WDFrequency < MAX_WAV_RENDER_FREQ)
{
- if (WDFrequency == 44100) WDFrequency = 48000;
+ if (WDFrequency == 44100) WDFrequency = 48000;
#if CPU_64BIT
- else if (WDFrequency == 48000) WDFrequency = 96000;
- else if (WDFrequency == 96000) WDFrequency = 192000;
+ else if (WDFrequency == 48000) WDFrequency = 96000;
+ else if (WDFrequency == 96000) WDFrequency = 192000;
+ else if (WDFrequency == 192000) WDFrequency = 384000;
#endif
updateWavRenderer();
}
@@ -473,9 +497,10 @@
if (WDFrequency > MIN_WAV_RENDER_FREQ)
{
#if CPU_64BIT
- if (WDFrequency == 192000) WDFrequency = 96000;
- else if (WDFrequency == 96000) WDFrequency = 48000;
- else if (WDFrequency == 48000) WDFrequency = 44100;
+ if (WDFrequency == 384000) WDFrequency = 192000;
+ else if (WDFrequency == 192000) WDFrequency = 96000;
+ else if (WDFrequency == 96000) WDFrequency = 48000;
+ else if (WDFrequency == 48000) WDFrequency = 44100;
#else
if (WDFrequency == 48000) WDFrequency = 44100;
#endif
--- a/src/ft2_wav_renderer.h
+++ b/src/ft2_wav_renderer.h
@@ -7,12 +7,14 @@
#define MIN_WAV_RENDER_FREQ 44100
#if CPU_64BIT
-#define MAX_WAV_RENDER_FREQ 192000
+#define MAX_WAV_RENDER_FREQ 384000
#else
#define MAX_WAV_RENDER_FREQ 48000
#endif
void cbToggleWavRenderBPMMode(void);
+void setWavRenderFrequency(int32_t freq);
+void setWavRenderBitDepth(uint8_t bitDepth);
void updateWavRendererSettings(void);
void drawWavRenderer(void);
void showWavRenderer(void);