Skip to content

Commit

Permalink
Fix BASS_StreamFree called twice for 3d audio streams. (#210)
Browse files Browse the repository at this point in the history
* Fix BASS_StreamFree called twice for 3d audio streams.

* Added BASS library version check.
  • Loading branch information
MiranDMC authored Sep 24, 2024
1 parent 7a262f1 commit 468e2d7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
5 changes: 0 additions & 5 deletions cleo_plugins/Audio/C3DAudioStream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,6 @@ C3DAudioStream::C3DAudioStream(const char* filepath) : CAudioStream()
ok = true;
}

C3DAudioStream::~C3DAudioStream()
{
if (streamInternal) BASS_StreamFree(streamInternal);
}

void C3DAudioStream::Set3dPosition(const CVector& pos)
{
link = nullptr;
Expand Down
1 change: 0 additions & 1 deletion cleo_plugins/Audio/C3DAudioStream.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ namespace CLEO
{
public:
C3DAudioStream(const char* filepath);
virtual ~C3DAudioStream();

// overloaded actions
virtual void Set3dPosition(const CVector& pos);
Expand Down
11 changes: 10 additions & 1 deletion cleo_plugins/Audio/CSoundSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ namespace CLEO

void EnumerateBassDevices(int& total, int& enabled, int& default_device)
{
TRACE(""); // separator
TRACE("Listing audio devices:");

BASS_DEVICEINFO info;
Expand Down Expand Up @@ -63,6 +62,16 @@ namespace CLEO
{
if (initialized) return true; // already done

TRACE(""); // separator
TRACE("Initializing SoundSystem...");

auto ver = HIWORD(BASS_GetVersion());
TRACE("BASS library version is %d (required %d or newer)", ver, BASSVERSION);
if (ver < BASSVERSION)
{
SHOW_ERROR("Invalid BASS library version! Expected at least %d, found %d.", BASSVERSION, ver);
}

auto config = GetConfigFilename();
LegacyModeDefaultStreamType = (eStreamType)GetPrivateProfileInt("General", "LegacyModeDefaultStreamType", 0, config.c_str());
allowNetworkSources = GetPrivateProfileInt("General", "AllowNetworkSources", 1, config.c_str()) != 0;
Expand Down

0 comments on commit 468e2d7

Please sign in to comment.