ref: 6d4ea7ae0f7253bed01a62c15a9ceffa076166ba
parent: cbfbcc413d629aa99bdf7f1f1b6b7b67a569e095
author: Olav Sørensen <olav.sorensen@live.no>
date: Fri Feb 23 12:42:05 EST 2024
Removed 32-bit specific code (32-bit binaries now support all features)
--- a/src/ft2_audio.c
+++ b/src/ft2_audio.c
@@ -205,8 +205,8 @@
fDownSample2 = fDownSample2_8;
// modelled after OpenMPT
- audio.sincRatio1 = (uintCPUWord_t)(1.1875 * MIXER_FRAC_SCALE);
- audio.sincRatio2 = (uintCPUWord_t)(1.5 * MIXER_FRAC_SCALE);
+ audio.sincRatio1 = (uint64_t)(1.1875 * MIXER_FRAC_SCALE);
+ audio.sincRatio2 = (uint64_t)(1.5 * MIXER_FRAC_SCALE);
audio.sincInterpolation = true;
}
@@ -216,8 +216,8 @@
fDownSample1 = fDownSample1_32;
fDownSample2 = fDownSample2_32;
- audio.sincRatio1 = (uintCPUWord_t)(2.375 * MIXER_FRAC_SCALE);
- audio.sincRatio2 = (uintCPUWord_t)(3.0 * MIXER_FRAC_SCALE);
+ audio.sincRatio1 = (uint64_t)(2.375 * MIXER_FRAC_SCALE);
+ audio.sincRatio2 = (uint64_t)(3.0 * MIXER_FRAC_SCALE);
audio.sincInterpolation = true;
}
@@ -400,7 +400,7 @@
const double dHz = dPeriod2Hz(ch->finalPeriod);
// set voice delta
- const uintCPUWord_t delta = v->oldDelta = (intCPUWord_t)((dHz * audio.dHz2MixDeltaMul) + 0.5); // Hz -> fixed-point delta (rounded)
+ const uint64_t delta = v->oldDelta = (int64_t)((dHz * audio.dHz2MixDeltaMul) + 0.5); // Hz -> fixed-point delta (rounded)
//const double dRatio = delta / (double)MIXER_FRAC_SCALE;
@@ -416,7 +416,7 @@
// set scope delta
const double dHz2ScopeDeltaMul = SCOPE_FRAC_SCALE / (double)SCOPE_HZ;
- v->scopeDelta = (intCPUWord_t)((dHz * dHz2ScopeDeltaMul) + 0.5); // Hz -> fixed-point delta (rounded)
+ v->scopeDelta = (int64_t)((dHz * dHz2ScopeDeltaMul) + 0.5); // Hz -> fixed-point delta (rounded)
}
v->delta = v->oldDelta;
@@ -993,11 +993,7 @@
return false;
}
-#if CPU_64BIT
if (have.freq != 44100 && have.freq != 48000 && have.freq != 96000)
-#else // 32-bit CPUs only support .16fp resampling precision. Not sensible with high rates.
- if (have.freq != 44100 && have.freq != 48000)
-#endif
{
if (showErrorMsg)
showErrorMsgBox("Couldn't open audio device:\nThis program doesn't support an audio output rate of %dHz. Sorry!", have.freq);
--- a/src/ft2_audio.h
+++ b/src/ft2_audio.h
@@ -4,7 +4,6 @@
#include <stdbool.h>
#include <SDL2/SDL.h>
#include "ft2_replayer.h"
-#include "ft2_cpu.h"
enum
{
@@ -15,12 +14,7 @@
#define DEFAULT_AUDIO_FREQ 48000
#define MIN_AUDIO_FREQ 44100
-
-#if CPU_64BIT
#define MAX_AUDIO_FREQ 96000
-#else
-#define MAX_AUDIO_FREQ 48000
-#endif
#define MAX_AUDIO_DEVICES 99
@@ -52,7 +46,7 @@
uint32_t audLatencyPerfValInt, tickTimeIntTab[(MAX_BPM-MIN_BPM)+1];
uint64_t audLatencyPerfValFrac, tickTimeFracTab[(MAX_BPM-MIN_BPM)+1];
- uintCPUWord_t sincRatio1, sincRatio2;
+ uint64_t sincRatio1, sincRatio2;
uint64_t tickTime64, tickTime64Frac;
@@ -71,8 +65,7 @@
uint8_t mixFuncOffset, panning, loopType, scopeVolume;
int32_t position, sampleEnd, loopStart, loopLength, oldPeriod;
uint32_t volumeRampLength;
-
- uintCPUWord_t positionFrac, delta, oldDelta, scopeDelta;
+ uint64_t positionFrac, delta, oldDelta, scopeDelta;
// if (loopEnabled && hasLooped && samplingPos <= loopStart+MAX_LEFT_TAPS) readFixedTapsFromThisPointer();
const int8_t *leftEdgeTaps8;
--- a/src/ft2_config.c
+++ b/src/ft2_config.c
@@ -32,7 +32,6 @@
#include "ft2_tables.h"
#include "ft2_bmp.h"
#include "ft2_structs.h"
-#include "ft2_cpu.h"
config_t config; // globalized
@@ -155,11 +154,7 @@
config.recQuantRes = 16;
}
-#if CPU_64BIT
if (config.audioFreq != 44100 && config.audioFreq != 48000 && config.audioFreq != 96000)
-#else
- if (config.audioFreq != 44100 && config.audioFreq != 48000)
-#endif
config.audioFreq = DEFAULT_AUDIO_FREQ;
if (config.audioInputFreq <= 1) // default value from FT2 (this was cdr_Sync) - set defaults
@@ -848,9 +843,7 @@
{
case 44100: tmpID = RB_CONFIG_AUDIO_44KHZ; break;
default: case 48000: tmpID = RB_CONFIG_AUDIO_48KHZ; break;
-#if CPU_64BIT
case 96000: tmpID = RB_CONFIG_AUDIO_96KHZ; break;
-#endif
}
radioButtons[tmpID].state = RADIOBUTTON_CHECKED;
@@ -1180,9 +1173,8 @@
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");
-#if CPU_64BIT
textOutShadow(525, 45, PAL_FORGRND, PAL_DSKTOP2, "96000Hz");
-#endif
+
textOutShadow(509, 61, PAL_FORGRND, PAL_DSKTOP2, "Frequency slides:");
textOutShadow(525, 75, PAL_FORGRND, PAL_DSKTOP2, "Amiga");
textOutShadow(525, 89, PAL_FORGRND, PAL_DSKTOP2, "Linear (default)");
@@ -1661,13 +1653,11 @@
setNewAudioSettings();
}
-#if CPU_64BIT
void rbConfigAudio96kHz(void)
{
config.audioFreq = 96000;
setNewAudioSettings();
}
-#endif
void rbConfigAudioInput44kHz(void)
{
--- a/src/ft2_config.h
+++ b/src/ft2_config.h
@@ -4,7 +4,6 @@
#include <stdbool.h>
#include "ft2_replayer.h"
#include "ft2_palette.h"
-#include "ft2_cpu.h"
#define CFG_ID_STR "FastTracker 2.0 configuration file\x1A"
#define CONFIG_FILE_SIZE 1736
@@ -225,9 +224,7 @@
void rbConfigAudioIntrp32PointSinc(void);
void rbConfigAudio44kHz(void);
void rbConfigAudio48kHz(void);
-#if CPU_64BIT
void rbConfigAudio96kHz(void);
-#endif
void rbConfigAudioInput44kHz(void);
void rbConfigAudioInput48kHz(void);
void rbConfigAudioInput96kHz(void);
--- a/src/ft2_cpu.h
+++ /dev/null
@@ -1,32 +1,0 @@
-#pragma once
-
-#include <stdint.h>
-
-#ifdef _WIN32
-
-#ifdef _WIN64
-#define CPU_64BIT 1
-#else
-#define CPU_64BIT 0
-#endif
-
-#else
-#include <limits.h>
-
-#if __WORDSIZE == 64
-#define CPU_64BIT 1
-#else
-#define CPU_64BIT 0
-#endif
-
-#endif
-
-#if CPU_64BIT
-#define CPU_BITS 64
-#define uintCPUWord_t uint64_t
-#define intCPUWord_t int64_t
-#else
-#define CPU_BITS 32
-#define uintCPUWord_t uint32_t
-#define intCPUWord_t int32_t
-#endif
--- a/src/ft2_radiobuttons.c
+++ b/src/ft2_radiobuttons.c
@@ -96,9 +96,7 @@
//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 },
-#endif
// audio input frequency
//x, y, w, group, funcOnUp
--- a/src/ft2_radiobuttons.h
+++ b/src/ft2_radiobuttons.h
@@ -2,7 +2,6 @@
#include <stdint.h>
#include <stdbool.h>
-#include "ft2_cpu.h"
enum // RADIOBUTTONS
{
@@ -65,9 +64,7 @@
// AUDIO FREQUENCY
RB_CONFIG_AUDIO_44KHZ,
RB_CONFIG_AUDIO_48KHZ,
-#if CPU_64BIT
RB_CONFIG_AUDIO_96KHZ,
-#endif
// AUDIO INPUT FREQUENCY
RB_CONFIG_AUDIO_INPUT_44KHZ,
--- a/src/ft2_replayer.h
+++ b/src/ft2_replayer.h
@@ -5,8 +5,6 @@
#include "ft2_unicode.h"
#include "mixer/ft2_cubic_spline.h"
#include "mixer/ft2_windowed_sinc.h"
-#include "ft2_cpu.h"
-
enum
{
// voice flags
@@ -198,7 +196,7 @@
uint8_t status, pianoNoteNum, smpNum, instrNum;
int32_t smpStartPos;
uint8_t scopeVolume;
- uintCPUWord_t scopeDelta;
+ uint64_t scopeDelta;
}
#ifdef __GNUC__
__attribute__ ((packed))
--- a/src/ft2_video.c
+++ b/src/ft2_video.c
@@ -34,7 +34,6 @@
#include "ft2_midi.h"
#include "ft2_bmp.h"
#include "ft2_structs.h"
-#include "ft2_cpu.h"
static const uint8_t textCursorData[12] =
{
@@ -879,31 +878,17 @@
strncpy(songTitleTrunc, songTitle, sizeof (songTitleTrunc)-1);
songTitleTrunc[sizeof (songTitleTrunc)-1] = '\0';
-#if CPU_BITS==32
if (song.isModified)
- sprintf(wndTitle, "Fasttracker II clone v%s (32-bit) - \"%s\" (unsaved)", PROG_VER_STR, songTitleTrunc);
- else
- sprintf(wndTitle, "Fasttracker II clone v%s (32-bit) - \"%s\"", PROG_VER_STR, songTitleTrunc);
-#else
- if (song.isModified)
sprintf(wndTitle, "Fasttracker II clone v%s - \"%s\" (unsaved)", PROG_VER_STR, songTitleTrunc);
else
sprintf(wndTitle, "Fasttracker II clone v%s - \"%s\"", PROG_VER_STR, songTitleTrunc);
-#endif
}
else
{
-#if CPU_BITS==32
if (song.isModified)
- sprintf(wndTitle, "Fasttracker II clone v%s (32-bit) - \"untitled\" (unsaved)", PROG_VER_STR);
- else
- sprintf(wndTitle, "Fasttracker II clone v%s (32-bit) - \"untitled\"", PROG_VER_STR);
-#else
- if (song.isModified)
sprintf(wndTitle, "Fasttracker II clone v%s - \"untitled\" (unsaved)", PROG_VER_STR);
else
sprintf(wndTitle, "Fasttracker II clone v%s - \"untitled\"", PROG_VER_STR);
-#endif
}
SDL_SetWindowTitle(video.window, wndTitle);
--- a/src/ft2_wav_renderer.c
+++ b/src/ft2_wav_renderer.c
@@ -484,11 +484,10 @@
if (WDFrequency < MAX_WAV_RENDER_FREQ)
{
if (WDFrequency == 44100) WDFrequency = 48000;
-#if CPU_64BIT
else if (WDFrequency == 48000) WDFrequency = 96000;
else if (WDFrequency == 96000) WDFrequency = 192000;
else if (WDFrequency == 192000) WDFrequency = 384000;
-#endif
+
updateWavRenderer();
}
}
@@ -497,14 +496,11 @@
{
if (WDFrequency > MIN_WAV_RENDER_FREQ)
{
-#if CPU_64BIT
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
+
updateWavRenderer();
}
}
--- a/src/ft2_wav_renderer.h
+++ b/src/ft2_wav_renderer.h
@@ -2,15 +2,9 @@
#include <stdint.h>
#include "ft2_header.h"
-#include "ft2_cpu.h"
#define MIN_WAV_RENDER_FREQ 44100
-
-#if CPU_64BIT
#define MAX_WAV_RENDER_FREQ 384000
-#else
-#define MAX_WAV_RENDER_FREQ 48000
-#endif
void cbToggleWavRenderBPMMode(void);
void setWavRenderFrequency(int32_t freq);
--- a/src/mixer/ft2_mix.c
+++ b/src/mixer/ft2_mix.c
@@ -2,7 +2,6 @@
#include <stdbool.h>
#include "ft2_mix.h"
#include "ft2_mix_macros.h"
-#include "../ft2_cpu.h"
/*
** ------------ 32-bit floating-point audio channel mixer ------------
@@ -11,7 +10,7 @@
** Specifications:
** - Interpolation: None, 2-tap linear, 4-tap cubic spline, 8-tap windowed-sinc, 32-tap windowed-sinc
** - FT2-styled linear volume ramping (can be turned off)
-** - 32.32 (16.16 if 32-bit CPU) fixed-point precision for resampling delta/position
+** - 32.32 fixed-point precision for resampling delta/position
** - 32-bit floating-point precision for mixing and interpolation
**
** This file has separate routines for EVERY possible sampling variation:
@@ -37,7 +36,7 @@
float fSample, *fMixBufferL, *fMixBufferR;
int32_t position;
uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac;
+ uint64_t positionFrac;
GET_VOL
GET_MIXER_VARS
@@ -79,7 +78,7 @@
float fSample, *fMixBufferL, *fMixBufferR;
int32_t position;
uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac;
+ uint64_t positionFrac;
GET_VOL
GET_MIXER_VARS
@@ -121,7 +120,7 @@
float fSample, *fMixBufferL, *fMixBufferR;
int32_t position;
uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac, tmpDelta;
+ uint64_t positionFrac, tmpDelta;
GET_VOL
GET_MIXER_VARS
@@ -164,7 +163,7 @@
float fSample, *fMixBufferL, *fMixBufferR;
int32_t position;
uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac;
+ uint64_t positionFrac;
GET_VOL
GET_MIXER_VARS
@@ -207,7 +206,7 @@
float fSample, *fMixBufferL, *fMixBufferR;
int32_t position;
uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac;
+ uint64_t positionFrac;
GET_VOL
GET_MIXER_VARS
@@ -274,7 +273,7 @@
float fSample, *fMixBufferL, *fMixBufferR;
int32_t position;
uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac, tmpDelta;
+ uint64_t positionFrac, tmpDelta;
GET_VOL
GET_MIXER_VARS
@@ -342,7 +341,7 @@
float fSample, *fMixBufferL, *fMixBufferR;
int32_t position;
uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac;
+ uint64_t positionFrac;
GET_VOL
GET_MIXER_VARS
@@ -384,7 +383,7 @@
float fSample, *fMixBufferL, *fMixBufferR;
int32_t position;
uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac;
+ uint64_t positionFrac;
GET_VOL
GET_MIXER_VARS
@@ -426,7 +425,7 @@
float fSample, *fMixBufferL, *fMixBufferR;
int32_t position;
uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac, tmpDelta;
+ uint64_t positionFrac, tmpDelta;
GET_VOL
GET_MIXER_VARS
@@ -470,7 +469,7 @@
float fSample, *fMixBufferL, *fMixBufferR;
int32_t position;
uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac;
+ uint64_t positionFrac;
GET_VOL
GET_MIXER_VARS
@@ -513,7 +512,7 @@
float fSample, *fMixBufferL, *fMixBufferR;
int32_t position;
uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac;
+ uint64_t positionFrac;
GET_VOL
GET_MIXER_VARS
@@ -580,7 +579,7 @@
float fSample, *fMixBufferL, *fMixBufferR;
int32_t position;
uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac, tmpDelta;
+ uint64_t positionFrac, tmpDelta;
GET_VOL
GET_MIXER_VARS
@@ -648,7 +647,7 @@
float fSample, *fMixBufferL, *fMixBufferR;
int32_t position;
uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac;
+ uint64_t positionFrac;
GET_VOL
GET_MIXER_VARS
@@ -691,7 +690,7 @@
float fSample, *fMixBufferL, *fMixBufferR;
int32_t position;
uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac;
+ uint64_t positionFrac;
GET_VOL
GET_MIXER_VARS
@@ -758,7 +757,7 @@
float fSample, *fMixBufferL, *fMixBufferR;
int32_t position;
uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac, tmpDelta;
+ uint64_t positionFrac, tmpDelta;
GET_VOL
GET_MIXER_VARS
@@ -827,7 +826,7 @@
int32_t position;
float fVolumeLDelta, fVolumeRDelta, fVolumeL, fVolumeR;
uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac;
+ uint64_t positionFrac;
GET_VOL_RAMP
GET_MIXER_VARS_RAMP
@@ -877,7 +876,7 @@
int32_t position;
float fVolumeLDelta, fVolumeRDelta, fVolumeL, fVolumeR;
uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac;
+ uint64_t positionFrac;
GET_VOL_RAMP
GET_MIXER_VARS_RAMP
@@ -927,7 +926,7 @@
int32_t position;
float fVolumeLDelta, fVolumeRDelta, fVolumeL, fVolumeR;
uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac, tmpDelta;
+ uint64_t positionFrac, tmpDelta;
GET_VOL_RAMP
GET_MIXER_VARS_RAMP
@@ -979,7 +978,7 @@
int32_t position;
float fVolumeLDelta, fVolumeRDelta, fVolumeL, fVolumeR;
uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac;
+ uint64_t positionFrac;
GET_VOL_RAMP
GET_MIXER_VARS_RAMP
@@ -1030,7 +1029,7 @@
int32_t position;
float fVolumeLDelta, fVolumeRDelta, fVolumeL, fVolumeR;
uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac;
+ uint64_t positionFrac;
GET_VOL_RAMP
GET_MIXER_VARS_RAMP
@@ -1110,7 +1109,7 @@
int32_t position;
float fVolumeLDelta, fVolumeRDelta, fVolumeL, fVolumeR;
uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac, tmpDelta;
+ uint64_t positionFrac, tmpDelta;
GET_VOL_RAMP
GET_MIXER_VARS_RAMP
@@ -1191,7 +1190,7 @@
int32_t position;
float fVolumeLDelta, fVolumeRDelta, fVolumeL, fVolumeR;
uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac;
+ uint64_t positionFrac;
GET_VOL_RAMP
GET_MIXER_VARS_RAMP
@@ -1241,7 +1240,7 @@
int32_t position;
float fVolumeLDelta, fVolumeRDelta, fVolumeL, fVolumeR;
uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac;
+ uint64_t positionFrac;
GET_VOL_RAMP
GET_MIXER_VARS_RAMP
@@ -1291,7 +1290,7 @@
int32_t position;
float fVolumeLDelta, fVolumeRDelta, fVolumeL, fVolumeR;
uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac, tmpDelta;
+ uint64_t positionFrac, tmpDelta;
GET_VOL_RAMP
GET_MIXER_VARS_RAMP
@@ -1343,7 +1342,7 @@
int32_t position;
float fVolumeLDelta, fVolumeRDelta, fVolumeL, fVolumeR;
uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac;
+ uint64_t positionFrac;
GET_VOL_RAMP
GET_MIXER_VARS_RAMP
@@ -1394,7 +1393,7 @@
int32_t position;
float fVolumeLDelta, fVolumeRDelta, fVolumeL, fVolumeR;
uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac;
+ uint64_t positionFrac;
GET_VOL_RAMP
GET_MIXER_VARS_RAMP
@@ -1474,7 +1473,7 @@
int32_t position;
float fVolumeLDelta, fVolumeRDelta, fVolumeL, fVolumeR;
uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac, tmpDelta;
+ uint64_t positionFrac, tmpDelta;
GET_VOL_RAMP
GET_MIXER_VARS_RAMP
@@ -1555,7 +1554,7 @@
int32_t position;
float fVolumeLDelta, fVolumeRDelta, fVolumeL, fVolumeR;
uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac;
+ uint64_t positionFrac;
GET_VOL_RAMP
GET_MIXER_VARS_RAMP
@@ -1606,7 +1605,7 @@
int32_t position;
float fVolumeLDelta, fVolumeRDelta, fVolumeL, fVolumeR;
uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac;
+ uint64_t positionFrac;
GET_VOL_RAMP
GET_MIXER_VARS_RAMP
@@ -1686,7 +1685,7 @@
int32_t position;
float fVolumeLDelta, fVolumeRDelta, fVolumeL, fVolumeR;
uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac, tmpDelta;
+ uint64_t positionFrac, tmpDelta;
GET_VOL_RAMP
GET_MIXER_VARS_RAMP
@@ -1770,7 +1769,7 @@
float fSample, *fMixBufferL, *fMixBufferR;
int32_t position;
uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac;
+ uint64_t positionFrac;
GET_VOL
GET_MIXER_VARS
@@ -1812,7 +1811,7 @@
float fSample, *fMixBufferL, *fMixBufferR;
int32_t position;
uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac;
+ uint64_t positionFrac;
GET_VOL
GET_MIXER_VARS
@@ -1854,7 +1853,7 @@
float fSample, *fMixBufferL, *fMixBufferR;
int32_t position;
uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac, tmpDelta;
+ uint64_t positionFrac, tmpDelta;
GET_VOL
GET_MIXER_VARS
@@ -1898,7 +1897,7 @@
float fSample, *fMixBufferL, *fMixBufferR;
int32_t position;
uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac;
+ uint64_t positionFrac;
GET_VOL
GET_MIXER_VARS
@@ -1941,7 +1940,7 @@
float fSample, *fMixBufferL, *fMixBufferR;
int32_t position;
uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac;
+ uint64_t positionFrac;
GET_VOL
GET_MIXER_VARS
@@ -2008,7 +2007,7 @@
float fSample, *fMixBufferL, *fMixBufferR;
int32_t position;
uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac, tmpDelta;
+ uint64_t positionFrac, tmpDelta;
GET_VOL
GET_MIXER_VARS
@@ -2076,7 +2075,7 @@
float fSample, *fMixBufferL, *fMixBufferR;
int32_t position;
uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac;
+ uint64_t positionFrac;
GET_VOL
GET_MIXER_VARS
@@ -2118,7 +2117,7 @@
float fSample, *fMixBufferL, *fMixBufferR;
int32_t position;
uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac;
+ uint64_t positionFrac;
GET_VOL
GET_MIXER_VARS
@@ -2160,7 +2159,7 @@
float fSample, *fMixBufferL, *fMixBufferR;
int32_t position;
uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac, tmpDelta;
+ uint64_t positionFrac, tmpDelta;
GET_VOL
GET_MIXER_VARS
@@ -2204,7 +2203,7 @@
float fSample, *fMixBufferL, *fMixBufferR;
int32_t position;
uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac;
+ uint64_t positionFrac;
GET_VOL
GET_MIXER_VARS
@@ -2247,7 +2246,7 @@
float fSample, *fMixBufferL, *fMixBufferR;
int32_t position;
uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac;
+ uint64_t positionFrac;
GET_VOL
GET_MIXER_VARS
@@ -2314,7 +2313,7 @@
float fSample, *fMixBufferL, *fMixBufferR;
int32_t position;
uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac, tmpDelta;
+ uint64_t positionFrac, tmpDelta;
GET_VOL
GET_MIXER_VARS
@@ -2382,7 +2381,7 @@
float fSample, *fMixBufferL, *fMixBufferR;
int32_t position;
uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac;
+ uint64_t positionFrac;
GET_VOL
GET_MIXER_VARS
@@ -2425,7 +2424,7 @@
float fSample, *fMixBufferL, *fMixBufferR;
int32_t position;
uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac;
+ uint64_t positionFrac;
GET_VOL
GET_MIXER_VARS
@@ -2492,7 +2491,7 @@
float fSample, *fMixBufferL, *fMixBufferR;
int32_t position;
uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac, tmpDelta;
+ uint64_t positionFrac, tmpDelta;
GET_VOL
GET_MIXER_VARS
@@ -2561,7 +2560,7 @@
int32_t position;
float fVolumeLDelta, fVolumeRDelta, fVolumeL, fVolumeR;
uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac;
+ uint64_t positionFrac;
GET_VOL_RAMP
GET_MIXER_VARS_RAMP
@@ -2611,7 +2610,7 @@
int32_t position;
float fVolumeLDelta, fVolumeRDelta, fVolumeL, fVolumeR;
uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac;
+ uint64_t positionFrac;
GET_VOL_RAMP
GET_MIXER_VARS_RAMP
@@ -2661,7 +2660,7 @@
int32_t position;
float fVolumeLDelta, fVolumeRDelta, fVolumeL, fVolumeR;
uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac, tmpDelta;
+ uint64_t positionFrac, tmpDelta;
GET_VOL_RAMP
GET_MIXER_VARS_RAMP
@@ -2713,7 +2712,7 @@
int32_t position;
float fVolumeLDelta, fVolumeRDelta, fVolumeL, fVolumeR;
uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac;
+ uint64_t positionFrac;
GET_VOL_RAMP
GET_MIXER_VARS_RAMP
@@ -2764,7 +2763,7 @@
int32_t position;
float fVolumeLDelta, fVolumeRDelta, fVolumeL, fVolumeR;
uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac;
+ uint64_t positionFrac;
GET_VOL_RAMP
GET_MIXER_VARS_RAMP
@@ -2844,7 +2843,7 @@
int32_t position;
float fVolumeLDelta, fVolumeRDelta, fVolumeL, fVolumeR;
uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac, tmpDelta;
+ uint64_t positionFrac, tmpDelta;
GET_VOL_RAMP
GET_MIXER_VARS_RAMP
@@ -2925,7 +2924,7 @@
int32_t position;
float fVolumeLDelta, fVolumeRDelta, fVolumeL, fVolumeR;
uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac;
+ uint64_t positionFrac;
GET_VOL_RAMP
GET_MIXER_VARS_RAMP
@@ -2975,7 +2974,7 @@
int32_t position;
float fVolumeLDelta, fVolumeRDelta, fVolumeL, fVolumeR;
uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac;
+ uint64_t positionFrac;
GET_VOL_RAMP
GET_MIXER_VARS_RAMP
@@ -3025,7 +3024,7 @@
int32_t position;
float fVolumeLDelta, fVolumeRDelta, fVolumeL, fVolumeR;
uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac, tmpDelta;
+ uint64_t positionFrac, tmpDelta;
GET_VOL_RAMP
GET_MIXER_VARS_RAMP
@@ -3077,7 +3076,7 @@
int32_t position;
float fVolumeLDelta, fVolumeRDelta, fVolumeL, fVolumeR;
uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac;
+ uint64_t positionFrac;
GET_VOL_RAMP
GET_MIXER_VARS_RAMP
@@ -3128,7 +3127,7 @@
int32_t position;
float fVolumeLDelta, fVolumeRDelta, fVolumeL, fVolumeR;
uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac;
+ uint64_t positionFrac;
GET_VOL_RAMP
GET_MIXER_VARS_RAMP
@@ -3208,7 +3207,7 @@
int32_t position;
float fVolumeLDelta, fVolumeRDelta, fVolumeL, fVolumeR;
uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac, tmpDelta;
+ uint64_t positionFrac, tmpDelta;
GET_VOL_RAMP
GET_MIXER_VARS_RAMP
@@ -3289,7 +3288,7 @@
int32_t position;
float fVolumeLDelta, fVolumeRDelta, fVolumeL, fVolumeR;
uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac;
+ uint64_t positionFrac;
GET_VOL_RAMP
GET_MIXER_VARS_RAMP
@@ -3340,7 +3339,7 @@
int32_t position;
float fVolumeLDelta, fVolumeRDelta, fVolumeL, fVolumeR;
uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac;
+ uint64_t positionFrac;
GET_VOL_RAMP
GET_MIXER_VARS_RAMP
@@ -3420,7 +3419,7 @@
int32_t position;
float fVolumeLDelta, fVolumeRDelta, fVolumeL, fVolumeR;
uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac, tmpDelta;
+ uint64_t positionFrac, tmpDelta;
GET_VOL_RAMP
GET_MIXER_VARS_RAMP
--- a/src/mixer/ft2_mix.h
+++ b/src/mixer/ft2_mix.h
@@ -1,7 +1,6 @@
#pragma once
#include <stdint.h>
-#include "../ft2_cpu.h"
#define MAX_TAPS 32
#define MAX_LEFT_TAPS ((MAX_TAPS/2)-1)
@@ -8,13 +7,9 @@
#define MAX_RIGHT_TAPS (MAX_TAPS/2)
// the fractional bits are hardcoded, changing these will break things!
-#if CPU_64BIT
#define MIXER_FRAC_BITS 32
-#else
-#define MIXER_FRAC_BITS 16
-#endif
-#define MIXER_FRAC_SCALE ((intCPUWord_t)1 << MIXER_FRAC_BITS)
+#define MIXER_FRAC_SCALE ((int64_t)1 << MIXER_FRAC_BITS)
#define MIXER_FRAC_MASK (MIXER_FRAC_SCALE-1)
typedef void (*mixFunc)(void *, uint32_t, uint32_t);
--- a/src/mixer/ft2_mix_macros.h
+++ b/src/mixer/ft2_mix_macros.h
@@ -20,7 +20,7 @@
v->fCurrVolumeR = fVolumeR;
#define GET_MIXER_VARS \
- const uintCPUWord_t delta = v->delta; \
+ const uint64_t delta = v->delta; \
fMixBufferL = audio.fMixBufferL + bufferPos; \
fMixBufferR = audio.fMixBufferR + bufferPos; \
position = v->position; \
@@ -27,7 +27,7 @@
positionFrac = v->positionFrac;
#define GET_MIXER_VARS_RAMP \
- const uintCPUWord_t delta = v->delta; \
+ const uint64_t delta = v->delta; \
fMixBufferL = audio.fMixBufferL + bufferPos; \
fMixBufferR = audio.fMixBufferR + bufferPos; \
fVolumeLDelta = v->fVolumeLDelta; \
@@ -346,20 +346,13 @@
/* SAMPLES-TO-MIX LIMITING MACROS */
/* ----------------------------------------------------------------------- */
-#if CPU_64BIT
-#define LIMIT_NUM
-#else
-#define LIMIT_NUM if (i > (1<<(32-MIXER_FRAC_BITS))-1) i = (1<<(32-MIXER_FRAC_BITS))-1;
-#endif
-
#define LIMIT_MIX_NUM \
samplesToMix = INT32_MAX; \
if (v->delta != 0) \
{ \
i = (v->sampleEnd - 1) - position; \
- LIMIT_NUM \
- const uintCPUWord_t dividend = ((uintCPUWord_t)i << MIXER_FRAC_BITS) | ((uint32_t)positionFrac ^ MIXER_FRAC_MASK); \
- samplesToMix = (uint32_t)(dividend / (uintCPUWord_t)v->delta) + 1; \
+ const uint64_t dividend = ((uint64_t)i << MIXER_FRAC_BITS) | ((uint32_t)positionFrac ^ MIXER_FRAC_MASK); \
+ samplesToMix = (uint32_t)(dividend / (uint64_t)v->delta) + 1; \
} \
\
if (samplesToMix > samplesLeft) \
@@ -379,7 +372,7 @@
smpPtr = base + position; \
} \
\
- const int32_t deltaHi = (intCPUWord_t)tmpDelta >> MIXER_FRAC_BITS; \
+ const int32_t deltaHi = (int64_t)tmpDelta >> MIXER_FRAC_BITS; \
const uint32_t deltaLo = tmpDelta & MIXER_FRAC_MASK;
#define LIMIT_MIX_NUM_RAMP \
--- a/src/mixer/ft2_silence_mix.c
+++ b/src/mixer/ft2_silence_mix.c
@@ -1,6 +1,5 @@
#include <stdint.h>
#include "../ft2_audio.h"
-#include "../ft2_cpu.h"
// used for the audio channel mixer when voice volume is zero
@@ -9,10 +8,10 @@
const uint64_t samplesToMix = (uint64_t)v->delta * (uint32_t)numSamples; // fixed-point
const uint32_t samples = (uint32_t)(samplesToMix >> MIXER_FRAC_BITS);
- const uintCPUWord_t samplesFrac = (samplesToMix & MIXER_FRAC_MASK) + v->positionFrac;
+ const uint64_t samplesFrac = (samplesToMix & MIXER_FRAC_MASK) + v->positionFrac;
uint32_t position = v->position + samples + (uint32_t)(samplesFrac >> MIXER_FRAC_BITS);
- uintCPUWord_t positionFrac = samplesFrac & MIXER_FRAC_MASK;
+ uint64_t positionFrac = samplesFrac & MIXER_FRAC_MASK;
if (position < (unsigned)v->sampleEnd) // we haven't reached the sample's end yet
{
--- a/src/scopes/ft2_scopedraw.c
+++ b/src/scopes/ft2_scopedraw.c
@@ -3,7 +3,6 @@
#include "ft2_scopes.h"
#include "ft2_scopedraw.h"
#include "ft2_scope_macros.h"
-#include "../ft2_cpu.h"
static void scopeLine(int32_t x1, int32_t y1, int32_t y2);
--- a/src/scopes/ft2_scopes.h
+++ b/src/scopes/ft2_scopes.h
@@ -4,21 +4,11 @@
#include <stdbool.h>
#include "../ft2_header.h"
#include "../ft2_audio.h"
-#include "../ft2_cpu.h"
#define SCOPE_HEIGHT 36
-#if CPU_64BIT
#define SCOPE_FRAC_BITS 32
-#else
-/* Max safe amount of fracbits for uint32_t on scopes @ 64Hz.
-** Since the scopes deltas are always high'ish, 13-bit
-** fractional precision is OK.
-*/
-#define SCOPE_FRAC_BITS 13
-#endif
-
-#define SCOPE_FRAC_SCALE ((intCPUWord_t)1 << SCOPE_FRAC_BITS)
+#define SCOPE_FRAC_SCALE ((int64_t)1 << SCOPE_FRAC_BITS)
#define SCOPE_FRAC_MASK (SCOPE_FRAC_SCALE-1)
int32_t getSamplePosition(uint8_t ch);
@@ -38,7 +28,7 @@
bool wasCleared, sample16Bit;
uint8_t loopType;
int32_t volume, direction, loopStart, loopLength, sampleEnd, position;
- uintCPUWord_t delta, positionFrac;
+ uint64_t delta, positionFrac;
} scope_t;
typedef struct lastChInstr_t
--- a/vs2019_project/ft2-clone/ft2-clone.vcxproj
+++ b/vs2019_project/ft2-clone/ft2-clone.vcxproj
@@ -390,7 +390,6 @@
<ClInclude Include="..\..\src\ft2_bmp.h" />
<ClInclude Include="..\..\src\ft2_checkboxes.h" />
<ClInclude Include="..\..\src\ft2_config.h" />
- <ClInclude Include="..\..\src\ft2_cpu.h" />
<ClInclude Include="..\..\src\ft2_diskop.h" />
<ClInclude Include="..\..\src\ft2_edit.h" />
<ClInclude Include="..\..\src\ft2_events.h" />
--- a/vs2019_project/ft2-clone/ft2-clone.vcxproj.filters
+++ b/vs2019_project/ft2-clone/ft2-clone.vcxproj.filters
@@ -319,9 +319,6 @@
<ClInclude Include="..\..\src\scopes\ft2_scopes.h">
<Filter>scopes</Filter>
</ClInclude>
- <ClInclude Include="..\..\src\ft2_cpu.h">
- <Filter>headers</Filter>
- </ClInclude>
<ClInclude Include="..\..\src\ft2_hpc.h">
<Filter>headers</Filter>
</ClInclude>