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

Ian @ un4seen

  • Administrator
  • Posts: 26083
Re: BASS for iOS (iPhone/iPad)
« Reply #1300 on: 29 Oct '18 - 16:55 »
What error code is the BASS_RecordStart call generating? Use BASS_ErrorGetCode immediately after to check that.

Ian @ un4seen

  • Administrator
  • Posts: 26083
Re: BASS for iOS (iPhone/iPad)
« Reply #1301 on: 30 Oct '18 - 17:13 »
The iOS version of the BASSOPUS 2.4.1.12 release is up now in the 1st post.

norbert

  • Posts: 135
Re: BASS for iOS (iPhone/iPad)
« Reply #1302 on: 4 Nov '18 - 17:17 »
Using BASS_ATTRIB_NOBUFFER option gave me super low latency playback  on my iPad  on iOS 10.x
Now I tested it again after serveral months running iOS 11 and there is a latency of about 400 ms.
No BASS errors and the BASS_SetAttribute returns true.
Updating to the latest BASS libs did not help. 
Any idea what could be the cause, the only difference seems to be the updated os version...?
 

Ian @ un4seen

  • Administrator
  • Posts: 26083
Re: BASS for iOS (iPhone/iPad)
« Reply #1303 on: 5 Nov '18 - 12:46 »
The BASS 2.4.13 release did introduce a bug to the BASS_ATTRIB_NOBUFFER option, which makes it behave opposite to how it should, ie. 1 = buffering, 0 = no buffering. That bug can be avoided by using the BASS_ATTRIB_BUFFER option instead, ie. setting that to 0 to disable buffering. The bug has been fixed for the 2.4.14 release, and I have now put the latest build up in the package in the 1st post. So you can re-download to get that.

Ian @ un4seen

  • Administrator
  • Posts: 26083
Re: BASS for iOS (iPhone/iPad)
« Reply #1304 on: 5 Nov '18 - 17:09 »
The iOS versions of the new BASSenc_MP3 and BASSenc_OPUS releases are now up in the 1st post.

Ian @ un4seen

  • Administrator
  • Posts: 26083
Re: BASS for iOS (iPhone/iPad)
« Reply #1305 on: 6 Nov '18 - 17:23 »
The iOS version of the BASSenc_FLAC 2.4.2 release is up now in the 1st post.

Ian @ un4seen

  • Administrator
  • Posts: 26083
Re: BASS for iOS (iPhone/iPad)
« Reply #1306 on: 9 Nov '18 - 17:40 »
The iOS version of the BASSMIDI 2.4.12 release is up now in the 1st post.

Ian @ un4seen

  • Administrator
  • Posts: 26083
Re: BASS for iOS (iPhone/iPad)
« Reply #1307 on: 17 Jan '19 - 16:37 »
The iOS version of the BASS 2.4.14 release is up now in the 1st post.

Viatiy

  • Posts: 1
Re: BASS for iOS (iPhone/iPad)
« Reply #1308 on: 25 Feb '19 - 14:47 »
Hello!
Sorry for my stupid question, but how do I connect Bass to a Swift project?

Ian @ un4seen

  • Administrator
  • Posts: 26083
Re: BASS for iOS (iPhone/iPad)
« Reply #1309 on: 26 Feb '19 - 16:04 »
I'm not a Swift user myself, so I'm afraid I'm unable to advise on the specifics of that, but perhaps this will help you get started:

   https://github.com/Starling-Inc/Bass

Ian @ un4seen

  • Administrator
  • Posts: 26083
Re: BASS for iOS (iPhone/iPad)
« Reply #1310 on: 13 Mar '19 - 14:03 »
The iOS version of the BASSHLS 2.4.2 release is up now in the 1st post.

Ian @ un4seen

  • Administrator
  • Posts: 26083
Re: BASS for iOS (iPhone/iPad)
« Reply #1311 on: 28 Mar '19 - 12:56 »
There was a bug in the recent BASSmix 2.4.9.8 update that could result in a mixer source being muted after calling BASS_Mixer_ChannelSetPosition on it. Another update (2.4.9.9) is up now in the 1st post to fix that. The 2.4.9.8 update was only posted for iOS and Android, so other platforms are unaffected.

JustinJMNet

  • Posts: 2
Re: BASS for iOS (iPhone/iPad)
« Reply #1312 on: 9 Apr '19 - 13:53 »
Hi, trying to get a simple MIDI Player working in iOS/Objective-C with the BASSMIDI library similar to the Android MIDITest.java example provided in the Android version of the BASS library. 

I'm seeing that the MIDI file is getting a handle/channel number so it appears to be loading successfully.  I just don't get any audio (Audio works fine when playing an MP3)

Here's the code - again runs but getting no audio. 

Code: [Select]
- (BOOL)loadMIDIWithURL:(NSURL *)url autoPlay:(BOOL)autoplay
{
    [self.audioSession setCategory:AVAudioSessionCategoryPlayback error: nil];
    [self.audioSession setActive:YES error:nil];
   

    //Stop channel;
    BASS_ChannelStop(_channel);
   
    //Free memory
    BASS_StreamFree(_channel);
   
    _channel = BASS_MIDI_StreamCreateFile(false, [[url path] cStringUsingEncoding:NSUTF8StringEncoding], 0, 0 ,0, 0);
   
    //Set callback
    BASS_ChannelSetSync(_channel, BASS_SYNC_END, 0, ChannelEndedCallback, (__bridge void *)self);
   
    if(!BASS_MIDI_StreamEvent(_channel, 0, 9, 16363)){
        // an error occured
    };
   
    /* Play if needed */
    if (autoplay) {
        [self play];
    }
   
    int code = BASS_ErrorGetCode();
    return code == 0;
}

Started with https://github.com/Alterplay/APAudioPlayer  and attempted to add the BASSMIDI types and methods to the bass.h header file - based on what is in the Android Library. 

Any help pointing out what I'm missing here is greatly appreciated!  :)
« Last Edit: 9 Apr '19 - 14:16 by JustinJMNet »

Ian @ un4seen

  • Administrator
  • Posts: 26083
Re: BASS for iOS (iPhone/iPad)
« Reply #1313 on: 9 Apr '19 - 17:58 »
An SF2 soundfont (or SFZ) is needed to provide the instrument sounds for BASSMIDI to play. If you don't already have one, a couple are available from the BASS webpage (next to the BASSMIDI download). If you will be using a single soundfont in your app, you can activate it via the BASS_CONFIG_MIDI_DEFFONT option, something like this:

Code: [Select]
BASS_SetConfigPtr(BASS_CONFIG_MIDI_DEFFONT, [[[NSBundle mainBundle] pathForResource:@"soundfont.sf2" ofType:nil] UTF8String]);

BASS_MIDI_FontInit and BASS_MIDI_StreamSetFonts can be used for more complex soundfont arrangements.

JustinJMNet

  • Posts: 2
Re: BASS for iOS (iPhone/iPad)
« Reply #1314 on: 9 Apr '19 - 18:29 »
Yep, looks like I was missing the sound font on init.  MIDI Audio is now working for me.  Thank you!

sergiou87

  • Posts: 1
Re: BASS for iOS (iPhone/iPad)
« Reply #1315 on: 3 May '19 - 23:25 »
Hello!

I've noticed a weird regression in BASS Mix. I'm doing fade out effect on pause and then fade in on resume, and it worked perfectly so far with BASS Mix version 2.4.9.0, until recently I updated it.

The code I use is this:
Code: [Select]
  BASS_MIXER_NODE nodes[2];
  nodes[0].pos = 0;
  nodes[0].value = 0;
  nodes[1].pos = BASS_ChannelSeconds2Bytes(m_resampler, 0.2);
  nodes[1].value = 1;

  BASS_Mixer_ChannelSetSync(m_resampler, BASS_SYNC_MIXER_ENVELOPE | BASS_SYNC_ONETIME, 0, OnChannelResumed, this);
  BASS_Mixer_ChannelSetEnvelope(m_resampler, BASS_MIXER_ENV_VOL, nodes, 2);

I've tested upgrading BASS Mix to both 2.4.9.8 and 2.4.9.9 versions (keeping the rest of libraries the same) and I get this unexpected behavior:
- on fade out for pause, I can notice how the right channel suddenly stops while the left channel fades out nicely as expected.
- after that, I cannot "resume" playback. Or actually, I do resume playback but volume is stuck at 0.

And these might be interesting data points while I tried to workaround the issue:
- if I force the volume back to 1 on resume (before the fade in envelope), the fade in effect works... but only on the left speaker, the right speaker is still mute for the rest of the playback session.
- if I force pan=right during the whole playback session (I just wanted to know how broken it was), I notice how playback abruptly switches to the left speaker during the fade in and fade out effects, and then back to the right speaker as I enforced.

As mentioned before, if I go back to version 2.4.9.0 everything works great again.

I hope this info helps you fix the bug. If you need more info, I'm more than happy to help resolving it.

Ian @ un4seen

  • Administrator
  • Posts: 26083
Re: BASS for iOS (iPhone/iPad)
« Reply #1316 on: 8 May '19 - 13:26 »
Oops! A tweak in BASSmix 2.4.9.8 did indeed introduce a problem to the envelope processing. A BASSmix update to fix that is up now in the 1st post. The Android version was also affected, so an update is up in the Android thread too.

Ian @ un4seen

  • Administrator
  • Posts: 26083
Re: BASS for iOS (iPhone/iPad)
« Reply #1317 on: 9 Aug '19 - 16:13 »
The iOS version of the new BASSWEBM add-on is up now in the 1st post.

Ian @ un4seen

  • Administrator
  • Posts: 26083
Re: BASS for iOS (iPhone/iPad)
« Reply #1318 on: 25 Sep '19 - 18:18 »
A BASS update to fix an AAC internet (and buffered user file) streaming bug on iOS 13 is up now in the 1st post.

Ian @ un4seen

  • Administrator
  • Posts: 26083
Re: BASS for iOS (iPhone/iPad)
« Reply #1319 on: 7 Oct '19 - 17:58 »
A BASS update to fix a bug in the internet connection timeout (BASS_CONFIG_NET_TIMEOUT) processing is up now in the 1st post.

pgruebele

  • Posts: 94
iOS background CPU usage bug
« Reply #1320 on: 21 Oct '19 - 19:46 »
Looks like I found a pretty serious bug in Bass for iOS.

I have a Xamarin Forms C# iOS app and if I call Bass.BASS_Init(...) then even when the app is in the background it seems that considerable CPU is consumed by Bass causing battery drain to be about 4x compared to normal.  I have confirmed this using the "Time Profiler" XCode 11.1 instrument which shows this recurring callstack:

   6  258.0  HALB_IOThread::Entry  0x8d7c4 :0
   5 libsystem_pthread.dylib 258.0  thread_start
   4 libsystem_pthread.dylib 258.0  _pthread_start
   3 CoreAudio 258.0  HALB_IOThread::Entry(void*)
   2 CoreAudio 258.0  invocation function for block in HALC_ProxyIOContext::HALC_ProxyIOContext(unsigned int, unsigned int)
   1 libsystem_kernel.dylib 131.0  mach_msg
   0 libsystem_kernel.dylib 130.0  mach_msg_trap

I have tried calling Bass.BASS_Pause() and Bass.BASS_Stop() but those make no difference.  I also tried various flags but nothing seems to have an effect on this issue.  I am not making any other Bass calls, so this is purely an issue caused by Bass.BASS_Init().   My app has background audio entitlement and I am using the latest Bass libraries as of today.  It happens in the simulator and real phone.  Latest XCode and iOS versions.

Cheers
Philip

Ian @ un4seen

  • Administrator
  • Posts: 26083
Re: BASS for iOS (iPhone/iPad)
« Reply #1321 on: 22 Oct '19 - 15:41 »
What device is that with, and how much CPU usage are we talking? BASS on iOS does currently leave the output running when nothing is playing (ie. BASS_CONFIG_DEV_NONSTOP is always enabled), but signals that it's silence so that the OS can skip additional processing. BASS_Pause or BASS_Stop will totally stop the output processing though, so it's strange that that made no difference for you. Are you sure it's having no effect? That HALB_IOThread thread should get terminated when the output is stopped.

pgruebele

  • Posts: 94
Re: BASS for iOS (iPhone/iPad)
« Reply #1322 on: 22 Oct '19 - 16:04 »
I am sure that pause and stop have no effect so I think that there is something unexpected happening there.  With bass enabled and no output playing (and nothing else happening in the app and having it in the background with screen off), the battery drains about 4x faster than without Bass.Init().  Without Bass.Init() the battery drains about 1% per hour and with Bass.Init() it drains about 4.5% per hour so this output audio thread is definitely burning through the battery.

It happens on iPhoneX simulator and real iPhone 8 - both with latest iOS installed.

I managed to temporarily avoid the issue by using Bass.Init(0,...).  This avoids the issue but of course I cannot play audio.  But this way I can do other Bass audio processing in the app.

Based on what I see it should be pretty easy to duplicate this issue.

Cheers
Philip

Ian @ un4seen

  • Administrator
  • Posts: 26083
Re: BASS for iOS (iPhone/iPad)
« Reply #1323 on: 23 Oct '19 - 16:20 »
When I check it here, Instruments shows the HALB_IOThread thread getting terminated when BASS_Pause or BASS_Stop is called (and a new one is created when BASS_Start is called). Is that definitely not happening there? If so, what does BASS_IsStarted return after calling BASS_Pause or BASS_Stop? Is that 4.5% battery drain with or without calling BASS_Pause or BASS_Stop? For comparison, what battery drain do you see when you do the opposite?

Dragan Petrovic

  • Guest
Re: BASS for iOS (iPhone/iPad)
« Reply #1324 on: 24 Oct '19 - 11:06 »
Hello there,

any experience in using BASS for iOS and Audiobus 3?

Can we stream BASS audio stream to Audiobus?

Thanks,

Dragan