Skip to content

Commit

Permalink
Some more ncsf related playback fixes
Browse files Browse the repository at this point in the history
Small core api changes & output plug-in usage validation improvements
  • Loading branch information
dr0biwan committed Sep 14, 2024
1 parent c0a4e9a commit 3c451be
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 25 deletions.
9 changes: 6 additions & 3 deletions src/in_ncsf/SSEQPlayer/INFOEntry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ INFOEntrySEQ::INFOEntrySEQ() : fileID(0), bank(0), vol(0), ply(0)

void INFOEntrySEQ::Read(PseudoFile &file)
{
this->fileID = file.ReadLE<std::uint32_t>();
this->fileID = file.ReadLE<std::uint16_t>();
file.ReadLE<std::uint16_t>(); // unknown
this->bank = file.ReadLE<std::uint16_t>();
this->vol = file.ReadLE<std::uint8_t>();
if (!this->vol)
Expand All @@ -34,7 +35,8 @@ INFOEntryBANK::INFOEntryBANK() : fileID(0)

void INFOEntryBANK::Read(PseudoFile &file)
{
this->fileID = file.ReadLE<std::uint32_t>();
this->fileID = file.ReadLE<std::uint16_t>();
file.ReadLE<std::uint16_t>(); // unknown
file.ReadLE(this->waveArc);
}

Expand All @@ -44,7 +46,8 @@ INFOEntryWAVEARC::INFOEntryWAVEARC() : fileID(0)

void INFOEntryWAVEARC::Read(PseudoFile &file)
{
this->fileID = file.ReadLE<std::uint32_t>();
this->fileID = file.ReadLE<std::uint16_t>();
file.ReadLE<std::uint16_t>(); // unknown
}

INFOEntryPLAYER::INFOEntryPLAYER() : channelMask(0)
Expand Down
6 changes: 3 additions & 3 deletions src/in_ncsf/SSEQPlayer/INFOEntry.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ struct INFOEntry

struct INFOEntrySEQ : INFOEntry
{
std::uint32_t fileID;
std::uint16_t fileID;
std::uint16_t bank;
std::uint8_t vol;
std::uint8_t ply;
Expand All @@ -35,7 +35,7 @@ struct INFOEntrySEQ : INFOEntry

struct INFOEntryBANK : INFOEntry
{
std::uint32_t fileID;
std::uint16_t fileID;
std::uint16_t waveArc[4];

INFOEntryBANK();
Expand All @@ -45,7 +45,7 @@ struct INFOEntryBANK : INFOEntry

struct INFOEntryWAVEARC : INFOEntry
{
std::uint32_t fileID;
std::uint16_t fileID;

INFOEntryWAVEARC();

Expand Down
2 changes: 1 addition & 1 deletion src/in_ncsf/SSEQPlayer/SDAT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ SDAT::SDAT(PseudoFile &file, std::uint32_t sseqToLoad) : sseq(), sbnk(), player(
// Read SSEQ
if (infoSection.SEQrecord.entries.count(sseqToLoad))
{
std::uint32_t fileID = infoSection.SEQrecord.entries[sseqToLoad].fileID;
std::uint16_t fileID = infoSection.SEQrecord.entries[sseqToLoad].fileID;
std::string name = "SSEQ" + NumToHexString(fileID).substr(2);
if (SYMBOffset)
name = NumToHexString(sseqToLoad).substr(6) + " - " + symbSection.SEQrecord.entries[sseqToLoad];
Expand Down
1 change: 0 additions & 1 deletion src/in_ncsf/SSEQPlayer/Track.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -700,7 +700,6 @@ void Track::Run()

case SSEQCommand::SweepPitch:
this->sweepPitch = this->overriding.val<std::int16_t>(pData, read16);
this->state.set(ConvertFuncs::ToIntegral(TrackState::PortamentoBit));
// Update here?
break;

Expand Down
2 changes: 1 addition & 1 deletion src/in_ncsf/XSFConfig_NCSF.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ enum

unsigned XSFConfig::initSampleRate = 44100;
const std::wstring XSFConfig::commonName = L"NCSF Decoder";
const std::wstring XSFConfig::versionNumber = L"1.13";
const std::wstring XSFConfig::versionNumber = L"1.13.1";
unsigned XSFConfig_NCSF::initInterpolation = 4;
std::string XSFConfig_NCSF::initMutes = "0000000000000000";

Expand Down
8 changes: 4 additions & 4 deletions src/in_ncsf/in_ncsf.rc
Original file line number Diff line number Diff line change
Expand Up @@ -307,8 +307,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
//

VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,13,0,0
PRODUCTVERSION 1,13,0,0
FILEVERSION 1,13,1,0
PRODUCTVERSION 1,13,1,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
Expand All @@ -325,11 +325,11 @@ BEGIN
BEGIN
VALUE "CompanyName", "WACUP"
VALUE "FileDescription", "Input Plug-in"
VALUE "FileVersion", "1.13.0.0"
VALUE "FileVersion", "1.13.1.0"
VALUE "InternalName", "in_ncsf.dll"
VALUE "OriginalFilename", "in_ncsf.dll"
VALUE "ProductName", "NCSF Decoder"
VALUE "ProductVersion", "1.13.0.0"
VALUE "ProductVersion", "1.13.1.0"
END
END
BLOCK "VarFileInfo"
Expand Down
45 changes: 33 additions & 12 deletions src/in_xsf_framework/in_xsf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -244,12 +244,15 @@ int play(const in_char *fn)
seek_needed = -1;
decode_pos_ms = 0;

int maxlatency = (inMod.outMod->Open ? inMod.outMod->Open(tmpxSFPlayer->GetSampleRate(), NumChannels, BitsPerSample, -1, -1) : -1);
const int sampleRate = tmpxSFPlayer->GetSampleRate();
int maxlatency = (inMod.outMod->Open && sampleRate && NumChannels ?
inMod.outMod->Open(sampleRate, NumChannels,
BitsPerSample, -1, -1) : -1);
if (maxlatency < 0)
return 1;
inMod.SetInfo((tmpxSFPlayer->GetSampleRate() * NumChannels * BitsPerSample) / 1000, tmpxSFPlayer->GetSampleRate() / 1000, NumChannels, 1);
inMod.SAVSAInit(maxlatency, tmpxSFPlayer->GetSampleRate());
inMod.VSASetInfo(tmpxSFPlayer->GetSampleRate(), NumChannels);
inMod.SetInfo((sampleRate * NumChannels * BitsPerSample) / 1000, sampleRate / 1000, NumChannels, 1);
inMod.SAVSAInit(maxlatency, sampleRate);
inMod.VSASetInfo(sampleRate, NumChannels);
inMod.outMod->SetVolume(-666);

xSFPlayer = tmpxSFPlayer.release();
Expand All @@ -268,13 +271,19 @@ int play(const in_char *fn)
void pause()
{
paused = true;
inMod.outMod->Pause(1);
if (inMod.outMod)
{
inMod.outMod->Pause(1);
}
}

void unPause()
{
paused = false;
inMod.outMod->Pause(0);
if (inMod.outMod)
{
inMod.outMod->Pause(0);
}
}

int isPaused()
Expand All @@ -295,8 +304,14 @@ void stop()
CloseHandle(thread_handle);
thread_handle = INVALID_HANDLE_VALUE;
}
inMod.outMod->Close();
inMod.SAVSADeInit();
if (inMod.outMod)
{
if (inMod.outMod->Close)
{
inMod.outMod->Close();
}
inMod.SAVSADeInit();
}
delete xSFPlayer;
xSFPlayer = nullptr;
xSFFile = nullptr;
Expand All @@ -311,7 +326,7 @@ int getLength()

int getOutputTime()
{
return inMod.outMod->GetOutputTime();
return (inMod.outMod ? inMod.outMod->GetOutputTime() : 0);
}

void setOutputTime(int time_in_ms)
Expand All @@ -321,12 +336,18 @@ void setOutputTime(int time_in_ms)

void setVolume(int volume)
{
inMod.outMod->SetVolume(volume);
if (inMod.outMod)
{
inMod.outMod->SetVolume(volume);
}
}

void setPan(int pan)
{
inMod.outMod->SetPan(pan);
if (inMod.outMod)
{
inMod.outMod->SetPan(pan);
}
}

void GetFileExtensions(void)
Expand Down Expand Up @@ -529,7 +550,7 @@ extern "C" __declspec(dllexport) int winampGetExtendedFileInfoW(const wchar_t *f
const bool reset = SameStrA(data, "reset");
if (!reset && !nonspecificWinampGetExtendedFileInfo(data, dest, destlen))
{
if (FilePathExists(fn))
if (FilePathExists(fn, NULL))
{
auto file = XSFFile(fn);
return wrapperWinampGetExtendedFileInfo(file, data, dest, destlen);
Expand Down

0 comments on commit 3c451be

Please sign in to comment.