Skip to content

Commit

Permalink
spec: minor tweaks to TZXFile loading - fixed Jet Pac
Browse files Browse the repository at this point in the history
  • Loading branch information
LukeUsher committed Jun 25, 2023
1 parent d7fd2cc commit 682fc36
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions thirdparty/TZXFile/TZXAudioGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ void TZXAudioGenerator::GeneratePulse(int lengthInTStates, bool toggleAmp)
{
// Calculate the length of the pulse in terms of samples
// Note this method is not completely accurate so may need some finessing for very high speed turbo loaders to work accurately...
double cycle = 44100.0 / 3500000.0;
double cycle = (double)TZX_AUDIO_DATARATE / (double)TZX_TSTATES_PER_SECOND;
int samples = ((unsigned int)(0.5 + (cycle*(double)lengthInTStates)));
for (int i = 0; i < samples; i++)
{
Expand Down Expand Up @@ -135,7 +135,7 @@ bool TZXAudioGenerator::SaveAsUncompressedWav(const char *szFilename)
short channels = 1;
if (fwrite(&channels, 2, 1, hFile) != 1) { fclose(hFile); return false; }

int sampleRate = 44100;
int sampleRate = TZX_AUDIO_DATARATE;
if (fwrite(&sampleRate, 4, 1, hFile) != 1) { fclose(hFile); return false; }
if (fwrite(&sampleRate, 4, 1, hFile) != 1) { fclose(hFile); return false; }

Expand Down
4 changes: 2 additions & 2 deletions thirdparty/TZXFile/TZXFile.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@
#define TZX_SECOND_SYNC_PULSE_LENGTH 735
#define TZX_ZERO_BIT_LENGTH 885 // Spec says 855 but two different sources for other projects both use 885, suspect typo in spec.
#define TZX_ONE_BIT_LENGTH 1710
#define TZX_PILOT_PULSES_HEADER 8063 // Spec says 8063 but other apps have 8064
#define TZX_PILOT_PULSES_DATA 3219 // Spec says 3223 but other apps have 3220
#define TZX_PILOT_PULSES_HEADER 8064 // Spec says 8063 but other apps have 8064
#define TZX_PILOT_PULSES_DATA 3220 // Spec says 3223 but other apps have 3220

typedef enum {
FileTypeUndetermined,
Expand Down

0 comments on commit 682fc36

Please sign in to comment.