Hello everyone! Help me figure it out.
There is a direct link to the M4A file on DropBox:
https://www.dropbox.com/scl/fi/1tc1qo8hjd1vflk42ow14/Accept-Midnight-Mover.m4a?rlkey=8ryzfstcmuhoyi5khitoz7kzm&dl=1This link is for the file Accept - Midnight Mover .m4a
Download the file and place it in the application folder.
C# code:
string file = @"Accept - Midnight Mover .m4a";
int stream = Bass.BASS_StreamCreateFile(file, 0, 0, BASSFlag.BASS_DEFAULT);
if (stream == 0)
{
var errorCode = Bass.BASS_ErrorGetCode();
MessageBox.Show("Error code: " + errorCode.ToString());
}
else
{
Bass.BASS_ChannelPlay(stream, false);
}
Run the application. The file plays!
Change the code to:
string url = "
https://www.dropbox.com/scl/fi/1tc1qo8hjd1vflk42ow14/Accept-Midnight-Mover.m4a?rlkey=8ryzfstcmuhoyi5khitoz7kzm&dl=1";
int stream = Bass.BASS_StreamCreateURL(url, 0, BASSFlag.BASS_DEFAULT, null, IntPtr.Zero);
if (stream == 0)
{
var errorCode = Bass.BASS_ErrorGetCode();
MessageBox.Show("Error code: " + errorCode.ToString());
}
else
{
Bass.BASS_ChannelPlay(stream, false);
}
We get the error "Error code: BASS_ERROR_FILEFORM".
Add the BASSFlag.BASS_STREAM_BLOCK flag to the stream creation string. The string will now look like this:
int stream = Bass.BASS_StreamCreateURL(url, 0, BASSFlag.BASS_STREAM_BLOCK | BASSFlag.BASS_DEFAULT, null, IntPtr.Zero);
Now the file from the URL plays!
But the BASSFlag.BASS_STREAM_BLOCK flag blocks the stream. In my application, I need to change the playback position using bass_fx.dll. Changing the tempo works, but I cannot set the position. It's understandable that moving forward doesn't work, as the file hasn't fully loaded yet, but moving backward should work.
If I take another file, for example, MP3, I don't encounter such issues.
There are only 4 files in the application folder:
Accept - Midnight Mover .m4a
bass.dll
Bass.Net.dll
my_app.exe
I tried adding the bass_aac.dll plugin, but it didn't work.
I tried asynchronously downloading the file via WebClient and creating a stream using Bass.BASS_StreamCreateFile, but the playback stops after a short time. Again, the MP3 file plays without any problems in this case.
Please advise on how to make this file play with the ability to change the position. Are there any plugins missing? Do I need any buffer settings? Do I need to add any flags?
I apologize if the message is not formatted correctly according to the rules of the forum. I am a visually impaired programmer.
Thank you in advance!