Advertisement
Guill

The program here throws an Application Error

Mar 14th, 2014
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 2.06 KB | None | 0 0
  1. program BassFXTest;
  2.  
  3. uses
  4.     Vcl.Forms,
  5.     Vcl.Dialogs,
  6.     SysUtils,
  7.     Variants,
  8.     bass in 'Bass\bass.pas',
  9.     bass_fx in 'Bass\bass_fx.pas';
  10.  
  11. var
  12.     Form : TForm;
  13.     Channel : HChannel;
  14.     Sample : HSample;
  15.     Filename : PChar;
  16.     Decoder, TempoStream : HStream;
  17. begin
  18.     Application.Initialize;
  19.     filename := PChar('pokeball_go.ogg');
  20.     Application.MainFormOnTaskBar := true;
  21.     Application.CreateForm(TForm, Form);
  22.     if not Bass_Init(-1, 44000, 0, 0, nil) then
  23.         ShowMessage('Error initing (' + IntToStr(Bass_ErrorGetCode) + ').');
  24.    // Sample := Bass_SampleLoad(false, filename, 0, 0, 1000, BASS_UNICODE);
  25.  //   if Sample = 0 then
  26.  //       ShowMessage('Error loading sample (' + IntToStr(Bass_ErrorGetCode) + ').');
  27.  //   Channel := Bass_SampleGetChannel(Sample, false);
  28.   //  if Channel = 0 then
  29.   //      ShowMessage('Error creating Channel (' + IntToStr(Bass_ErrorGetCode) + ').');
  30.    // if not BASS_ChannelSetAttribute(Channel, BASS_ATTRIB_VOL, 1) then
  31.    //     ShowMessage('Error VOL (' + IntToStr(Bass_ErrorGetCode) + ').');
  32.     //if not BASS_ChannelSetAttribute(Channel, BASS_ATTRIB_TEMPO_PITCH, 3) then
  33.     //    ShowMessage('Error PITCH (' + IntToStr(Bass_ErrorGetCode) + ').');
  34.     //if not BASS_ChannelPlay(Channel, True) then
  35.     //    ShowMessage('Error Playing Channel (' + IntToStr(Bass_ErrorGetCode) + ').');
  36.  
  37.     Decoder := BASS_StreamCreateFile(FALSE, filename, 0, 0, BASS_STREAM_DECODE OR BASS_UNICODE);
  38.     if Decoder = 0 then
  39.         ShowMessage('Error decoding (' + IntToStr(Bass_ErrorGetCode) + ').');
  40.  
  41.     TempoStream := BASS_FX_TempoCreate(Decoder, BASS_FX_FREESOURCE);
  42.  
  43.     if TempoStream = 0 then
  44.         ShowMessage('Error streaming (' + IntToStr(Bass_ErrorGetCode) + ').');
  45.     if not BASS_ChannelSetAttribute(tempostream, BASS_ATTRIB_TEMPO_PITCH, 3) then
  46.         ShowMessage('Error PITCH (' + IntToStr(Bass_ErrorGetCode) + ').');
  47.     if not BASS_ChannelPlay(TempoStream, True) then
  48.         ShowMessage('Error Playing Channel (' + IntToStr(Bass_ErrorGetCode) + ').');
  49.  
  50.     Application.Run;
  51.  
  52. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement