How to use Bass_FX.dll attributes?

0

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

1- Copy the dlls to the exe folder.

2- I added to the project the respective units duly updated, recently downloaded from the un4seen site.

Follow 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 code above reproduces the sample but does not recognize the BASS_ATTRIB_TEMPO_PITCH attribute; it only displays the "PITCH (19) error."; error that according to the documentation of the bass means that the attribute does not exist. But according to the bass_fx documentation, this attribute is correct. Where could the mistake be? Is it that I'm installing bass_fx the wrong way?

    
asked by anonymous 10.03.2014 / 18:19

1 answer

2

Note that the BASS_ATTRIB_TEMPO_PITCH attribute is only supported by time streams , created 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); 
    
13.03.2014 / 11:20