Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
stevehjohn committed Aug 16, 2024
1 parent d3d3bde commit 601b0d7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/Zen.System/Modules/Audio/Engines/Bass/ManagedBass.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,8 @@ public static class ManagedBass
[return: MarshalAs((UnmanagedType) 2)]
public static extern bool BASS_Free();

[DllImport("Libraries/libbass")]
public static extern int BASS_ErrorGetCode();

public delegate void SyncProc(int handle, int channel, int data, IntPtr user);
}
8 changes: 6 additions & 2 deletions src/Zen.System/Modules/Audio/Engines/BassAudioEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,18 @@ private void Initialise()
{
if (! ManagedBass.BASS_Init(-1, Constants.SampleRate, BassInit.BASS_DEVICE_MONO, IntPtr.Zero))
{
throw new BassException("Error initialising BASS library.");
var code = ManagedBass.BASS_ErrorGetCode();

throw new BassException($"Error {code} initialising BASS library.");
}

_sampleHandle = ManagedBass.BASS_SampleCreate(Constants.DefaultBufferSize * 4, Constants.SampleRate, 1, 1, BassFlag.BASS_SAMPLE_FLOAT);

if (_sampleHandle == 0)
{
throw new BassException("Error creating BASS sample.");
var code = ManagedBass.BASS_ErrorGetCode();

throw new BassException($"Error {code} creating BASS sample.");
}
}
catch (Exception exception)
Expand Down

0 comments on commit 601b0d7

Please sign in to comment.