How to use Bass_fx.dll attributes?

Asked

Viewed 246 times

0

Next. I was using bass.dll without any problem. But when I try to use the attributes of bass_fx.dll, the bass does not recognize. I performed the installation of the two dlls as follows.

1- I copied the dlls to the exe folder.

2- I added to the project the respective Units duly updated, newly downloaded from the un4seen website.

Follows the code:

program BassFXTest;

uses
    Vcl.Forms,
    Vcl.Dialogs,
    SysUtils,
    Variants,
    bass in 'Bass\bass.pas',
    bass_fx in 'Bass\bass_fx.pas';

var
    Form : TForm;
    Channel : HChannel;
    Sample : HSample;
    Filename : PChar;

begin
    Application.Initialize;
    filename := PChar('sample.ogg');
    Application.MainFormOnTaskBar := true;
    Application.CreateForm(TForm, Form);
    if not Bass_Init(-1, 44100, 0, 0, nil) then
        ShowMessage('Error initing (' + IntToStr(Bass_ErrorGetCode) + ').');
    Sample := Bass_SampleLoad(false, filename, 0, 0, 1000, BASS_UNICODE);
    if Sample = 0 then
        ShowMessage('Error loading sample (' + IntToStr(Bass_ErrorGetCode) + ').');
    Channel := Bass_SampleGetChannel(Sample, false);
    if Channel = 0 then
        ShowMessage('Error creating Channel (' + IntToStr(Bass_ErrorGetCode) + ').');
    if not BASS_ChannelSetAttribute(Channel, BASS_ATTRIB_VOL, 1) then
        ShowMessage('Error VOL (' + IntToStr(Bass_ErrorGetCode) + ').');
    if not BASS_ChannelSetAttribute(Channel, BASS_ATTRIB_TEMPO_PITCH, 3) then
        ShowMessage('Error PITCH (' + IntToStr(Bass_ErrorGetCode) + ').');
    if not BASS_ChannelPlay(Channel, True) then
        ShowMessage('Error Playing Channel (' + IntToStr(Bass_ErrorGetCode) + ').');
    Application.Run;

end.

The above code reproduces the sample, but does not recognize the attribute BASS_ATTRIB_TEMPO_PITCH it only shows the "Error PITCH (19)." message; error which according to the bass documentation means that the attribute does not exist. But according to the bass_fx documentation, this attribute is correct. Where can the error be? Am I installing bass_fx the wrong way?

1 answer

2

Note that the attribute BASS_ATTRIB_TEMPO_PITCH is only supported by time streams, raised with BASS_FX_TempoCreate.

// criar um "canal de decodificação" de um arquivo
decoder:=BASS_StreamCreateFile(FALSE, filename, 0, 0, BASS_STREAM_DECODE OR BASS_UNICODE); 
// criar um tempo stream para ele
tempostream:=BASS_FX_TempoCreate(decoder, BASS_FX_FREESOURCE); 
// definir o campo
BASS_ChannelSetAttribute(tempostream, BASS_ATTRIB_TEMPO_PITCH, pitch); 
// reproduz
BASS_ChannelPlay(tempostream, FALSE); 
  • tempostream, decoder : HStream?

  • The program here, launches an "Application Error". If I run without the line tempostream := BASS_FX_TempoCreate(decoder, BASS_FX_FREESOURCE); it rotates, but it comes under my exceptions.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.