Author Topic: BASS for iOS (iPhone/iPad)  (Read 463963 times)

Ian @ un4seen

  • Administrator
  • Posts: 20600
Re: BASS for iOS (iPhone/iPad)
« Reply #1225 on: 12 Jan '18 - 16:42 »
You can indeed change the device output rate via "setPreferredSampleRate", and BASS will pick that up and change its output accordingly (you can check the BASS_INFO "freq" value to confirm). You could change the mixer's rate to match via its BASS_ATTRIB_FREQ setting, but that will result in any already buffered data (in the mixer's playback buffer) being played at an incorrect rate, and will also bit a bit fiddly regarding source rates. So it would probably be best to recreate the mixer with the new rate (if you want to avoid resampling). You could also disable buffering via the mixer's BASS_ATTRIB_BUFFER setting a bit prior to changing the rate, so that there is no buffered data at the time of the rate change, and you can immediately stop the old mixer and start the new one.

puzzler

  • Posts: 10
Re: BASS for iOS (iPhone/iPad)
« Reply #1226 on: 17 Jan '18 - 17:48 »
Latest iOS bass version. Latest iOS version on iPhone 7.
1. run app and play some music/sounds
2. call to this phone
3. after call completed and focus returned to app - no any music/sounds at all

How to fix it? Or possible to fix it?

Ian @ un4seen

  • Administrator
  • Posts: 20600
Re: BASS for iOS (iPhone/iPad)
« Reply #1227 on: 18 Jan '18 - 17:40 »
Do you see any messages in the console when the problem happens? Are you requesting interruption notifications (eg. AVAudioSessionInterruptionNotification), and if so, do you get notified when the interruption begins and ends? If you aren't using your own interruption notifications, please try using the BASS_CONFIG_IOS_NOTIFY option and see if you receive notifications then, something like this:

Code: [Select]
BASS_SetConfigPtr(BASS_CONFIG_IOS_NOTIFY, IOSNotifyProc);

...

void IOSNotifyProc(DWORD status)
{
NSLog(@"IOSNotifyProc(%d)", status);
}

Also confirm whether you are using either of the BASS_CONFIG_IOS_MIXAUDIO or BASS_CONFIG_IOS_NOCATEGORY config options.

puzzler

  • Posts: 10
Re: BASS for iOS (iPhone/iPad)
« Reply #1228 on: 18 Jan '18 - 19:23 »
I use BASS_SetConfig(BASS_CONFIG_IOS_MIXAUDIO, 5), don't use any interruption notifications, don't use flag BASS_CONFIG_IOS_NOCATEGORY

After app gets focus I get error at console "AUIClient_StartIO failed (561015905)
test with notify returns "IOSNotifyProc(2)"

Ian @ un4seen

  • Administrator
  • Posts: 20600
Re: BASS for iOS (iPhone/iPad)
« Reply #1229 on: 19 Jan '18 - 14:48 »
OK. That looks like the same problem that another user reported with iOS 8 here:

   www.un4seen.com/forum/?topic=10910.msg116472#msg116472

The solution then was to delay the resumption (seems like the notification is received too soon). I will send you a debug BASS version to get some more info on what's happening there.

norbert

  • Posts: 131
Re: BASS for iOS (iPhone/iPad)
« Reply #1230 on: 20 Jan '18 - 10:46 »
Can't get a sample in a SFZ file loaded:

 BASS_MIDI_FontGetInfo  shows presets=1, samsize=0, samload=0, although I do a BASS_MIDI_FontLoad afterwards):

At runtime I create the sfz file with content:
Code: [Select]
<region>
sample=beat.wav

I've tried various other combinations for the sample path (absolute paths).

- The file beat.wav is located in the same folder as the sfz file (both in "Documents")
- The  file beat.wav actually  exists (tested with File.Exists())
-  Bass_GetError returns BASS_OK after each single call
- The same works on Android and there samload shows a value > 0 after BASS_MIDI_FontLoad

How should the path to a sample in a sfz file be specified in iOS ?

Ian @ un4seen

  • Administrator
  • Posts: 20600
Re: BASS for iOS (iPhone/iPad)
« Reply #1231 on: 22 Jan '18 - 12:56 »
Are you using BASS_MIDI_FontInit or BASS_MIDI_FontInitUser to load the SFZ file? If you're using BASS_MIDI_FontInit, then you should provide the full/absolute path to the SFZ file, but you don't need to do that for the samples (if they're in the same directory). If you're using BASS_MIDI_FontInitUser, then you will need to provide the full path to the samples in the SFZ file. I tried both ways just now, and they worked fine, so it's strange that they apparently aren't there. In my tests, I put the files in the app's resources and got the path like this:

Code: [Select]
const char *sfzfile=[[[NSBundle mainBundle] pathForResource:@"test.sfz" ofType:nil] UTF8String];

norbert

  • Posts: 131
Re: BASS for iOS (iPhone/iPad)
« Reply #1232 on: 22 Jan '18 - 16:21 »
using BASS_MIDI_FontInit
bass can find the sfz file,it can find the preset that it named like the soundfont (font get presets)
I can see both wav and sfz  file in the finder ( simulator documents folder)
I m creating the sfz file at runtime in the documents folder and then copy the wav file from the resources folder to the documents folder.


using xamarin.ios.

I've now also tried with NSBundle.MainBundle.PathForResource for the sfz file, and again it shows presets =1 and samload = 0.  ( Both  wav and sfz  added as bundle resource )
« Last Edit: 22 Jan '18 - 17:58 by norbert »

Ian @ un4seen

  • Administrator
  • Posts: 20600
Re: BASS for iOS (iPhone/iPad)
« Reply #1233 on: 23 Jan '18 - 16:52 »
Are you sure the sample file (beat.wav) is valid, eg. can you open it (at the same path) with BASS_StreamCreateFile?

norbert

  • Posts: 131
Re: BASS for iOS (iPhone/iPad)
« Reply #1234 on: 23 Jan '18 - 17:48 »
Yes, BASS can load the wav file:

Code: [Select]
  string metronomeFile = NSBundle.MainBundle.PathForResource("metronome.sfz", null);
  string beatFile = NSBundle.MainBundle.PathForResource("beat.wav", null);
  int chan=  Bass.BASS_StreamCreateFile(beatFile, 0, 0, BASSFlag.BASS_DEFAULT); // returns -21467898

int newfont = BassMidi.BASS_MIDI_FontInit(metronomeFile , BASSFlag.BASS_DEFAULT);  // returns 1
BassMidi.BASS_MIDI_FontLoad(newfont, -1, -1);

BASS_MIDI_FONTINFO fontInfo = new BASS_MIDI_FONTINFO();
BassMidi.BASS_MIDI_FontGetInfo(newfont, fontInfo); // samload is 0
       


metronome.sfz:
Code: [Select]
<region>
sample=beat.wav
« Last Edit: 23 Jan '18 - 17:59 by norbert »

Ian @ un4seen

  • Administrator
  • Posts: 20600
Re: BASS for iOS (iPhone/iPad)
« Reply #1235 on: 24 Jan '18 - 16:48 »
That's strange. The same code (in objective-C) is working fine here, so I'm not really sure what could be going wrong there. What is the sample format of the BEAT.WAV file? It must be mono or stereo, and 16-bit or 24-bit.

norbert

  • Posts: 131
Re: BASS for iOS (iPhone/iPad)
« Reply #1236 on: 24 Jan '18 - 17:19 »
it's bitrate shows 705 kbit/s, so that should be 44.1khz 16 bit mono.

I also tried Bass.BASS_ChannelPlay(beatfile,true) and it plays the sound !

Maybe you could provide a debug version of bassmidi (don't know whether it would help finding the problem)?
« Last Edit: 24 Jan '18 - 17:42 by norbert »

Ian @ un4seen

  • Administrator
  • Posts: 20600
Re: BASS for iOS (iPhone/iPad)
« Reply #1237 on: 24 Jan '18 - 17:58 »
BASS will play 8-bit WAV files, while BASSMIDI won't. So that could be one explanation. Please upload the file to have a look at here:

   ftp.un4seen.com/incoming

norbert

  • Posts: 131
Re: BASS for iOS (iPhone/iPad)
« Reply #1238 on: 24 Jan '18 - 19:57 »
I uploaded sfz + wav file.  The same wav file works on Android with bassmidi...

Ian @ un4seen

  • Administrator
  • Posts: 20600
Re: BASS for iOS (iPhone/iPad)
« Reply #1239 on: 25 Jan '18 - 17:52 »
Ah, I see what the problem is now. Your SFZ file begins with a UTF-8 BOM, which means that the first line ("<region>") won't be recognised. Here's an update that will check for a UTF-8 BOM and skip it:

   www.un4seen.com/stuff/libbassmidi.a

Let me know if you still have the problem with that.
« Last Edit: 26 Jan '18 - 17:49 by Ian @ un4seen »

norbert

  • Posts: 131
Re: BASS for iOS (iPhone/iPad)
« Reply #1240 on: 25 Jan '18 - 18:18 »
After changing the link to  libbassmidi.a  I can tell you that it's working now ! Thanks! I guess there will be an official update ?
« Last Edit: 25 Jan '18 - 18:27 by norbert »

Ian @ un4seen

  • Administrator
  • Posts: 20600
Re: BASS for iOS (iPhone/iPad)
« Reply #1241 on: 26 Jan '18 - 17:50 »
Good to hear that the BASSMIDI update did indeed fix the problem. It is now up in the package in the 1st post.

Aven

  • Guest
Re: BASS for iOS (iPhone/iPad)
« Reply #1242 on: 31 Jan '18 - 12:02 »
Hello,

I build in the configuration "Debug" and there are some errors:

Code: [Select]
Undefined symbols for architecture armv7:
  "_vDSP_create_fftsetup", referenced from:
      _BASS_ChannelGetData in libbass.a(libbass.a-armv7-master.o)
  "_vDSP_fft_zip", referenced from:
      _BASS_ChannelGetData in libbass.a(libbass.a-armv7-master.o)
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)

What could be the problem?
I will appreciate for any help!

P.S.: While the build release is going well.

Ian @ un4seen

  • Administrator
  • Posts: 20600
Re: BASS for iOS (iPhone/iPad)
« Reply #1243 on: 31 Jan '18 - 14:14 »
Adding the Accelerate framework to your project should fix that. A full list of required frameworks can be found in the 1st post.

Ian @ un4seen

  • Administrator
  • Posts: 20600
Re: BASS for iOS (iPhone/iPad)
« Reply #1244 on: 1 Feb '18 - 17:50 »
The iOS version of the BASSHLS 2.4.1 release is up now in the package in the 1st post.

Ian @ un4seen

  • Administrator
  • Posts: 20600
Re: BASS for iOS (iPhone/iPad)
« Reply #1245 on: 6 Feb '18 - 16:52 »
The iOS version of the new BASS 2.4.13.8 release is up in the 1st post.