Hello
I have a few short wave files (about 150ms) that I need to play
These shorts wav files are loaded once in the app lifetime using BASS_SampleLoad call.
I tried on two devices: MoBo built-in and the one built in the monitor I use (DELL).
On my MoBo device, all is good.
On the DELL device, the first time I play that sample, the playback is empty.
The second call it works.
Here is some Delphi code. I reproduced the effect from my main App (with code I cannot share for length reasons) into a simple app, this is the reason for the BASS_CONFIG_XX used.
BASS initialization:
procedure TForm1.InitButtonClick(Sender: TObject);
begin
BASS_Init(3, 44100, 0, 0, nil); // -> 3 is my DELL device
BASS_SetConfig(BASS_CONFIG_UPDATEPERIOD, 5);
BASS_SetConfig(BASS_CONFIG_CURVE_VOL, 0);
BASS_SetConfig(BASS_CONFIG_NORAMP, 1); //I tried to remove RAMP altogether, but with or without this line, I get the exact same results
BASS_SetConfig(BASS_CONFIG_DEV_NONSTOP, 1); //this line commented out can give a different outcome see below
end;
sound loading/playing (I put it in a simple...button):
var
shortSample: HSAMPLE = 0; //global var holding the sample handle
procedure TForm1.PlayButtonClick(Sender: TObject);
var
f: pchar;
chan: HCHANNEL;
sync: cardinal;
begin
if shortSample = 0 then
begin
f := PChar(ExtractFilePath(Application.ExeName) + 'ShortSound.wav');
shortSample:= BASS_SampleLoad(false, f, 0, 0, 5, 0 {$IFDEF UNICODE} or BASS_UNICODE {$ENDIF});
end;
chan:= BASS_sampleGetChannel(shortSample, BASS_SAMCHAN_STREAM or BASS_STREAM_AUTOFREE);
BASS_ChannelSetAttribute(chan, BASS_ATTRIB_PAN, 0);
BASS_ChannelSetAttribute(chan, BASS_ATTRIB_VOL, 1);
BASS_ChannelSetPosition(chan, 0, BASS_POS_RESET);
BASS_ChannelPlay(chan, true);
Interestingly, if I remove the BASS_CONFIG_DEV_NONSTOP = 1 option, then the issue reoccurs if I play the sound let's say 3 seconds later. Sometimes, the sound is barely audible like in the middle of a fade in/out process. If I then play the sample repeatedly (or within a second) then the sample sounds normally (I cannot tell if it is actually slightly ramped or not, but it sounds nominal).
BASS_CONFIG_NORAMP = 1 gave me the same results on each device (all good on MoBo, bad on DELL...)
Do you believe it is a faulty driver here? or is there something I can work on? I could play the sound once before the app needs to run, though on "good" devices it will actually sound, and I have no way to tell before hand if a device will work correctly or not...
Thanks a lot
Jean Luc