C
C#12mo ago
Abdesol

✅ Bass Library Error: Device(Illegal Device Number)

I am having hard time with using the bass library on MacOS. I am not able to get rid of the Device(Illegal Device Number) issue after publishing. It works perfectly in debug mode. After publishing for microsoft windows too, it is having problem but I am not sure about that. But I am sure about the MacOS problem.
11 Replies
SinFluxx
SinFluxx12mo ago
$details
MODiX
MODiX12mo ago
When you ask a question, make sure you include as much detail as possible. Such as code, the issue you are facing, and what you expect the result to be. Upload code here https://paste.mod.gg/ (see $code for more information on how to paste your code)
Abdesol
Abdesol12mo ago
So yeah, I have this method that records audio:
public Task StartNewRecording()
{
_name = DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss");
_name += " - " + Guid.NewGuid().ToString()[..4];
_name += ".wav";
var path = Path.Combine(_mainPath, _name);
_writer = new WaveFileWriter(new FileStream(path, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.Read),
new WaveFormat());

Bass.RecordInit();
_recordingHandle = Bass.RecordStart(44100, 2, BassFlags.RecordPause, RecordingCallback);
Bass.ChannelPlay(_recordingHandle, true);
_startTime = DateTimeOffset.UtcNow.ToUnixTimeSeconds();

return Task.CompletedTask;
}
public Task StartNewRecording()
{
_name = DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss");
_name += " - " + Guid.NewGuid().ToString()[..4];
_name += ".wav";
var path = Path.Combine(_mainPath, _name);
_writer = new WaveFileWriter(new FileStream(path, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.Read),
new WaveFormat());

Bass.RecordInit();
_recordingHandle = Bass.RecordStart(44100, 2, BassFlags.RecordPause, RecordingCallback);
Bass.ChannelPlay(_recordingHandle, true);
_startTime = DateTimeOffset.UtcNow.ToUnixTimeSeconds();

return Task.CompletedTask;
}
But on the line here Bass.RecordInit(); it is returning false and when I try to check the last error it is device error which translates as illegal device number. I am using the ManagedBass library and you have to download the dll from the offical website or some projects on github. Basically, it works on development both on windows and mac. But it doesn't work after publishing on both platforms but they are different problems. Illegal device number error is from MacOS
SinFluxx
SinFluxx12mo ago
Could it be it's not finding any (enabled) devices?
Abdesol
Abdesol12mo ago
it is weird because, how will this not be an issue on development mode by development mode, I mean running the code directly from src
SinFluxx
SinFluxx12mo ago
I'm not sure tbh, have you tried to just run something simple to get the list of available devices to double check?
Abdesol
Abdesol12mo ago
Yes. There is a property for that in the library and it returns 6 morethan enough tbh
SinFluxx
SinFluxx12mo ago
have you tried specifying a device rather than letting it choose the default?
Abdesol
Abdesol12mo ago
Yeah. Bass.RecordInit(); means use default
SinFluxx
SinFluxx12mo ago
I know, I'm saying have you tried specifying a different device (if you have some other mic input) to see if that works?
Accord
Accord12mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.