Author Topic: Problem on Ios 64  (Read 1268 times)

nikos

  • Posts: 35
Problem on Ios 64
« on: 28 Oct '18 - 20:07 »
This Code works fine on IOS 32

Code: [Select]
rchan := BASS_RecordStart(44100, 1, 0, @RecordingCallback, nil);
but It doesnt work on IOS64 any Ideas?

I get error in delphi tokyo "Exception 6" and programm hangs
« Last Edit: 29 Oct '18 - 07:52 by nikos »

Chris

  • Posts: 1862
Re: Problem on Ios 64
« Reply #1 on: 29 Oct '18 - 13:11 »
Hi
can you show your RecordingCallback?

Chris

  • Posts: 1862
Re: Problem on Ios 64
« Reply #2 on: 29 Oct '18 - 13:14 »
Be shure that the User Param in the Callback must be a Pointer and not a DWORD!!!

nikos

  • Posts: 35
Re: Problem on Ios 64
« Reply #3 on: 29 Oct '18 - 15:50 »
As i said works fine in IOS32 even if i have DWORD as user declared.

function RecordingCallback(Handle: HRECORD; buffer: Pointer; length: DWORD; user: Pointer): boolean; stdcall;
begin
    Form1.WaveStream.Write(buffer^, length);
    Result := True;
end;


The error is Only in IOS64 Otherwise the code works fine in ios32 i manage to record RIFF WAVE fine.

Ian @ un4seen

  • Administrator
  • Posts: 21682
Re: Problem on Ios 64
« Reply #4 on: 29 Oct '18 - 16:50 »
As i said works fine in IOS32 even if i have DWORD as user declared.

A DWORD is the same size as a 32-bit pointer, so a DWORD "user" parameter will work in 32-bit. But 64-bit pointers are twice the size, so DWORD won't work then.

nikos

  • Posts: 35
Re: Problem on Ios 64
« Reply #5 on: 29 Oct '18 - 16:51 »
so what is the problem in bass_recordStart on Ios 64? maybe i sould changhe the Length to Integer then?

Chris

  • Posts: 1862
Re: Problem on Ios 64
« Reply #6 on: 29 Oct '18 - 17:19 »
Quote
function RecordingCallback(Handle: HRECORD; buffer: Pointer; length: DWORD; user: Pointer): boolean; stdcall;
begin
    Form1.WaveStream.Write(buffer^, length);
    Result := True;
end;
That is correct but its not good to pass Form/Gui Stuff through a Callback;

so just Change your Wavestream Variable from privat/public to var so that it looks like this

Code: [Select]
var
  Form1: TForm1;
  Wavestream:TFileStream; // or TMemorystream

implementation

{$R *.dfm}

function RecordingCallback(Handle: HRECORD; buffer: Pointer; length: DWORD; user: Pointer): boolean; stdcall;
begin
    WaveStream.Write(buffer^, length);
    Result := True;
end;




nikos

  • Posts: 35
Re: Problem on Ios 64
« Reply #7 on: 29 Oct '18 - 17:23 »
yea oky thansk for the tip.
BUT in IOS 64 Bass init succesfull and when i try to BASS_RECORDSTART i get exception 6
The same code in ios 32bit works fine what could be the problem do i need  libbass.a for ios 64 bit? where can i donwload it to test it?

Ian @ un4seen

  • Administrator
  • Posts: 21682
Re: Problem on Ios 64
« Reply #8 on: 29 Oct '18 - 17:43 »
The LIBBASS.A file includes support for all iOS architectures, so there is no need for a separate 64-bit version.

What BASS.PAS file are you using?

nikos

  • Posts: 35
Re: Problem on Ios 64
« Reply #9 on: 29 Oct '18 - 18:29 »

unit BASSFunctions;

interface

Uses
    System.Types;

const
  BASSVERSION = $204;             // API version
  BASSVERSIONTEXT = '2.4';

  // Use these to test for error from functions that return a DWORD or QWORD
  DW_ERROR = LongWord(-1); // -1 (DWORD)
  QW_ERROR = Int64(-1);    // -1 (QWORD)

  // Error codes returned by BASS_ErrorGetCode()
  BASS_OK                 = 0;    // all is OK
  BASS_ERROR_MEM          = 1;    // memory error
  BASS_ERROR_FILEOPEN     = 2;    // can't open the file
  BASS_ERROR_DRIVER       = 3;    // can't find a free sound driver
  BASS_ERROR_BUFLOST      = 4;    // the sample buffer was lost
  BASS_ERROR_HANDLE       = 5;    // invalid handle
  BASS_ERROR_FORMAT       = 6;    // unsupported sample format
  BASS_ERROR_POSITION     = 7;    // invalid position
  BASS_ERROR_INIT         = 8;    // BASS_Init has not been successfully called
  BASS_ERROR_START        = 9;    // BASS_Start has not been successfully called
  BASS_ERROR_ALREADY      = 14;   // already initialized/paused/whatever
  BASS_ERROR_NOCHAN       = 18;   // can't get a free channel
  BASS_ERROR_ILLTYPE      = 19;   // an illegal type was specified
  BASS_ERROR_ILLPARAM     = 20;   // an illegal parameter was specified
  BASS_ERROR_NO3D         = 21;   // no 3D support
  BASS_ERROR_NOEAX        = 22;   // no EAX support
  BASS_ERROR_DEVICE       = 23;   // illegal device number
  BASS_ERROR_NOPLAY       = 24;   // not playing
  BASS_ERROR_FREQ         = 25;   // illegal sample rate
  BASS_ERROR_NOTFILE      = 27;   // the stream is not a file stream
  BASS_ERROR_NOHW         = 29;   // no hardware voices available
  BASS_ERROR_EMPTY        = 31;   // the MOD music has no sequence data
  BASS_ERROR_NONET        = 32;   // no internet connection could be opened
  BASS_ERROR_CREATE       = 33;   // couldn't create the file
  BASS_ERROR_NOFX         = 34;   // effects are not enabled
  BASS_ERROR_NOTAVAIL     = 37;   // requested data is not available
  BASS_ERROR_DECODE       = 38;   // the channel is a "decoding channel"
  BASS_ERROR_DX           = 39;   // a sufficient DirectX version is not installed
  BASS_ERROR_TIMEOUT      = 40;   // connection timedout
  BASS_ERROR_FILEFORM     = 41;   // unsupported file format
  BASS_ERROR_SPEAKER      = 42;   // unavailable speaker
  BASS_ERROR_VERSION      = 43;   // invalid BASS version (used by add-ons)

nikos

  • Posts: 35
Re: Problem on Ios 64
« Reply #10 on: 29 Oct '18 - 18:35 »
I am using basFunctions.pas file with DPF.ios.media Unit because the original bass.pas for ios have errors in PansiChar

nikos

  • Posts: 35
Re: Problem on Ios 64
« Reply #11 on: 30 Oct '18 - 08:06 »
If it helps when i do a
Code: [Select]
BASS_ChannelGetInfo(0,info)  returns info.chans = 0 and when i do
Code: [Select]
  rchan := BASS_RecordStart(44100, 0, 0, @RecordingCallback, nil);I dont get the error but i get
 BASS_ERROR_FORMAT

so the problem is with the channels?

Chris

  • Posts: 1862
Re: Problem on Ios 64
« Reply #12 on: 30 Oct '18 - 08:56 »
Code: [Select]
rchan := BASS_RecordStart(44100, 0, 0, @RecordingCallback, nil);must be
// 1 = mono 2 = stereo
Code: [Select]
rchan := BASS_RecordStart(44100,2, 0, @RecordingCallback, nil);Important in your case can be the following.

Code: [Select]
procedure StartRecording;
var
 RecInfo:Bass_RecordInfo;
 freq:Dword;
begin
    BASS_RecordInit(0) ;// first device
  // check the format
    BASS_RecordGetInfo(RecInfo);
    freq := RecInfo.freq;
   BASS_RecordStart(freq,2,0,@RecordingProc,nil);

end;

// important can also be the supported Formats that you can retrieve from the Bass_RecordInfo Record
« Last Edit: 30 Oct '18 - 09:09 by Chris »

nikos

  • Posts: 35
Re: Problem on Ios 64
« Reply #13 on: 30 Oct '18 - 09:43 »
Chris First of all i want to thank you for spending time and giving me tips.
I try the new Code is the same.
You must understand that in Iphone 5 works FINE ( my code) and everything is as supposed to be.
On Form Create i do a
Code: [Select]
if (not BASS_RecordInit(0)) or (not BASS_Init(-1, 44100, 0, nil, nil)) then
i did again record_init as you suggest but i get error on the line
Code: [Select]
  rchan := BASS_RecordStart(freq, 2, 0, @RecordingCallback, nil);on iphone 6 with ios 12.0.1

I dont know maybe somewho i need to allow iphone 6 to USe CAmera or Mic for record?
i will give a try in delphi berlin

maybe is a Tokyo Bug




nikos

  • Posts: 35
Re: Problem on Ios 64
« Reply #14 on: 30 Oct '18 - 14:24 »
FINALLY!!!!!!!!

The error is not from BASS
is from DPF iOS Componenents i am using
They have a demo AVAudioRecorder I try to Record with the demo and i get the same error.
So the best think to do is to try to compile without the DPF.iOS.Media Unit and when i remove this Unit i get error

Code: [Select]
    Error: "_ExtAudioFileRead", referenced from:      l035 in libbass.a(libbass.a-arm64-master.o);       l039 in libbass.a(libbass.a-arm64-master.o);
      Error: "_AudioUnitSetProperty", referenced from:      l023 in libbass.a(libbass.a-arm64-master.o);       l030 in libbass.a(libbass.a-arm64-master.o);       l032 in libbass.a(libbass.a-arm64-master.o);       _BASS_Init in libbass.a(libbass.a-arm64-master.o);
      Error: "_AudioConverterSetProperty", referenced from:      l035 in libbass.a(libbass.a-arm64-master.o);
      Error: "_AudioFileGetGlobalInfo", referenced from:      l035 in libbass.a(libbass.a-arm64-master.o);
      Error: "_AudioFileGetProperty", referenced from:      l035 in libbass.a(libbass.a-arm64-master.o);       l041 in libbass.a(libbass.a-arm64-master.o);       l474 in libbass.a(libbass.a-arm64-master.o);       l475 in libbass.a(libbass.a-arm64-master.o);
      Error: "_AudioUnitUninitialize", referenced from:      l032 in libbass.a(libbass.a-arm64-master.o);       l240 in libbass.a(libbass.a-arm64-master.o);
      Error: "_AudioSessionSetProperty", referenced from:      _BASS_Init in libbass.a(libbass.a-arm64-master.o);       l293 in libbass.a(libbass.a-arm64-master.o);
      Error: "_AudioUnitGetProperty", referenced from:      l023 in libbass.a(libbass.a-arm64-master.o);
      Error: "_AudioOutputUnitStop", referenced from:      l026 in libbass.a(libbass.a-arm64-master.o);       l032 in libbass.a(libbass.a-arm64-master.o);       l034 in libbass.a(libbass.a-arm64-master.o);       l240 in libbass.a(libbass.a-arm64-master.o);
      Error: "_ExtAudioFileOpenURL", referenced from:      l035 in libbass.a(libbass.a-arm64-master.o);
      Error: "_AudioUnitInitialize", referenced from:      l030 in libbass.a(libbass.a-arm64-master.o);       _BASS_Init in libbass.a(libbass.a-arm64-master.o);
      Error: "_AudioComponentInstanceNew", referenced from:      l030 in libbass.a(libbass.a-arm64-master.o);       _BASS_Init in libbass.a(libbass.a-arm64-master.o);
      Error: "_AudioComponentInstanceDispose", referenced from:      l032 in libbass.a(libbass.a-arm64-master.o);       l240 in libbass.a(libbass.a-arm64-master.o);
      Error: "_AudioComponentFindNext", referenced from:      l030 in libbass.a(libbass.a-arm64-master.o);       _BASS_Init in libbass.a(libbass.a-arm64-master.o);
      Error: "_AudioUnitRender", referenced from:      l031 in libbass.a(libbass.a-arm64-master.o);
      Error: "_AudioConverterDispose", referenced from:      l038 in libbass.a(libbass.a-arm64-master.o);
      Error: "_AudioOutputUnitStart", referenced from:      l033 in libbass.a(libbass.a-arm64-master.o);       l477 in libbass.a(libbass.a-arm64-master.o);
      Error: "_AudioFileReadPackets", referenced from:      l035 in libbass.a(libbass.a-arm64-master.o);       l474 in libbass.a(libbass.a-arm64-master.o);       l476 in libbass.a(libbass.a-arm64-master.o);
      Error: "_ExtAudioFileGetProperty", referenced from:      l035 in libbass.a(libbass.a-arm64-master.o);
      Error: "_AudioFormatGetProperty", referenced from:      l035 in libbass.a(libbass.a-arm64-master.o);
      Error: "_ExtAudioFileSetProperty", referenced from:      l035 in libbass.a(libbass.a-arm64-master.o);
      Error: "_AudioConverterFillComplexBuffer", referenced from:      l039 in libbass.a(libbass.a-arm64-master.o);
      Error: "_ExtAudioFileSeek", referenced from:      l035 in libbass.a(libbass.a-arm64-master.o);       l474 in libbass.a(libbass.a-arm64-master.o);
      Error: "_AudioConverterGetProperty", referenced from:      l035 in libbass.a(libbass.a-arm64-master.o);
      Error: "_AudioFileGetPropertyInfo", referenced from:      l035 in libbass.a(libbass.a-arm64-master.o);
      Error: "_AudioConverterNew", referenced from:      l035 in libbass.a(libbass.a-arm64-master.o);
      Error: "_AudioFileClose", referenced from:      l035 in libbass.a(libbass.a-arm64-master.o);       l038 in libbass.a(libbass.a-arm64-master.o);
      Error: "_AudioFileOpenWithCallbacks", referenced from:      l035 in libbass.a(libbass.a-arm64-master.o);
      Error: "_ExtAudioFileDispose", referenced from:      l038 in libbass.a(libbass.a-arm64-master.o);
      Error: "_AudioConverterReset", referenced from:      l041 in libbass.a(libbass.a-arm64-master.o);
      Error: "_AudioSessionSetActive", referenced from:      _BASS_Init in libbass.a(libbass.a-arm64-master.o);       _BASS_RecordInit in libbass.a(libbass.a-arm64-master.o);       l292 in libbass.a(libbass.a-arm64-master.o);       l294 in libbass.a(libbass.a-arm64-master.o);
      Error: "_AudioUnitAddPropertyListener", referenced from:      _BASS_Init in libbass.a(libbass.a-arm64-master.o);
      Error: "_AudioSessionGetProperty", referenced from:      _BASS_RecordGetInfo in libbass.a(libbass.a-arm64-master.o);
      Error: "_AudioSessionInitialize", referenced from:      l293 in libbass.a(libbass.a-arm64-master.o);

Ian @ un4seen

  • Administrator
  • Posts: 21682
Re: Problem on Ios 64
« Reply #15 on: 30 Oct '18 - 17:12 »
To fix those error messages, you need to add the following frameworks to your app's project: AudioToolbox, SystemConfiguration, CFNetwork, Accelerate.

nikos

  • Posts: 35
Re: Problem on Ios 64
« Reply #16 on: 30 Oct '18 - 18:10 »
All of those FrameWorks are in my SDK library installed.
Is not A Bass problem  event the sample from Embarcadero Doesn Work and says the same error so i stick with Ios 32.
But i have a question i am developing testing apps fro my Iphone only.
Do i have to Buy the licence?
and if i decide to public an app to the apple store with recording bass capabilities how much is the licence for this?

Ian @ un4seen

  • Administrator
  • Posts: 21682
Re: Problem on Ios 64
« Reply #17 on: 1 Nov '18 - 13:39 »
If you are working on the apps yourself as an individual (eg. not working for a company) and you are not making any money from them (eg. from sales/advertising/etc), then you can use BASS in them for free. If you decide to make money from the apps then a Shareware BASS licence would probably be needed. Please see the BASS webpage for the current licence pricing.

nikos

  • Posts: 35
Re: Problem on Ios 64
« Reply #18 on: 1 Nov '18 - 17:14 »
First of all thanks
I liek to inform Delphi users that the problem with the exception 6 was the  NSMicrophoneUsageDescription they sould add it on Options.
It was working on Ios32 because my iphone 5 is jailbreaked.

I have to admin that BASS rocks!!! can do anything.
I dont work to a company i create my apps for me and some friends i dont have ads i dont ask money so i am okey thank you.