BASS for iOS (iPhone/iPad)

Started by Ian @ un4seen, 16 Feb '10 - 16:32

Ian @ un4seen


iOS versions of BASS and the add-ons can be found on the BASS webpage.





ken

In there is any C# coders that use MonoTouch framework for developing iPhone apps, I'm happy to tell you that BASS for IPhone works with MonoTouch (yes you can link static libraries in MonoTouch). I can make a simple MonoTouch example if needed.

/Ken

ReymonARG


ken


radio42


StuC


What the Licensing/Cost  of the iPhone version ?



Ian @ un4seen

Licensing is the same on all of the supported platforms. In the case of the Shareware licence, an amendment has been made primarily with the iPhone App Store in mind, whereby the product doesn't actually have to be shareware (eg. "try before you buy") but the price limit is lowered to 10 Euros then.

NeoStrider

I'm having a few issues with a adaptation of the net-radio example.
I`ve successfully adapted it to iPhone and it works fine on the simulator, but I cant seem to build it for the devices. Here is my error log:

ld: warning: in /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/CFNetwork.framework/CFNetwork, missing required architecture arm in file
Undefined symbols:
  "_kCFStreamPropertyFTPFileTransferOffset", referenced from:
      _kCFStreamPropertyFTPFileTransferOffset$non_lazy_ptr in libbass.a(bass.o)
  "_kCFStreamPropertyHTTPShouldAutoredirect", referenced from:
      _kCFStreamPropertyHTTPShouldAutoredirect$non_lazy_ptr in libbass.a(bass.o)
  "_CFHTTPMessageAddAuthentication", referenced from:
      _BASS_RecordGetInputName in libbass.a(bass.o)
      _BASS_RecordGetInputName in libbass.a(bass.o)
  "_CFHTTPMessageCreateRequest", referenced from:
      _BASS_RecordGetInputName in libbass.a(bass.o)
  "_kCFStreamPropertyFTPFetchResourceInfo", referenced from:
      _kCFStreamPropertyFTPFetchResourceInfo$non_lazy_ptr in libbass.a(bass.o)
  "_kCFStreamPropertyFTPResourceSize", referenced from:
      _kCFStreamPropertyFTPResourceSize$non_lazy_ptr in libbass.a(bass.o)
  "_CFReadStreamCreateWithFTPURL", referenced from:
      _BASS_RecordGetInputName in libbass.a(bass.o)
  "_kCFStreamPropertyHTTPResponseHeader", referenced from:
      _kCFStreamPropertyHTTPResponseHeader$non_lazy_ptr in libbass.a(bass.o)
  "_kCFHTTPAuthenticationSchemeBasic", referenced from:
      _kCFHTTPAuthenticationSchemeBasic$non_lazy_ptr in libbass.a(bass.o)
  "_kCFStreamPropertyFTPUsePassiveMode", referenced from:
      _kCFStreamPropertyFTPUsePassiveMode$non_lazy_ptr in libbass.a(bass.o)
  "_CFHTTPMessageCopySerializedMessage", referenced from:
      _BASS_RecordGetInputName in libbass.a(bass.o)
  "_kCFHTTPVersion1_1", referenced from:
      _kCFHTTPVersion1_1$non_lazy_ptr in libbass.a(bass.o)
  "_CFReadStreamCreateForHTTPRequest", referenced from:
      _BASS_RecordGetInputName in libbass.a(bass.o)
  "_kCFStreamPropertyFTPProxy", referenced from:
      _kCFStreamPropertyFTPProxy$non_lazy_ptr in libbass.a(bass.o)
  "_kCFStreamPropertyHTTPProxy", referenced from:
      _kCFStreamPropertyHTTPProxy$non_lazy_ptr in libbass.a(bass.o)
  "_CFHTTPMessageSetHeaderFieldValue", referenced from:
      _BASS_RecordGetInputName in libbass.a(bass.o)
      _BASS_RecordGetInputName in libbass.a(bass.o)
      _BASS_RecordGetInputName in libbass.a(bass.o)
ld: symbol(s) not found
collect2: ld returned 1 exit status

I really need this working ASAP, for a commercial project, please. BASS looks impressive and solved in hours what days of OGG ramblings couldn't help.
Have you guys used stuff only available in CoreServices?

Ian @ un4seen

#8
That looks like it is linking with the wrong library version, eg. the "simulator" BASS when you're building a "device" application. I think the simplest way to avoid that problem is to just add both BASS library versions to the project.

edit: Actually, looking at it again (more closely this time!), that looks like it is linking with the wrong CFNetwork framework version, ie. the OSX version rather than the iPhone version? You could try removing that from the project, and then adding it again, eg. right-click on the project, select "Get Info", click the "+" button below the "Linked Libraries" list, and select "CFNetwork" from the list of frameworks.

NeoStrider

Nevermind...it was XCode fault...again...
Got everything working very well here.
Now is time to evaluate the licenses...
Thanks!

Bert

Do you want to share your working example with us?

Would be very nice!

NeoStrider

Its surprisingly the same as the macosx radio player. The only problem was removing the callbacks and handlers from Carbon Stuff. I still need to write a proper buffer manager, and then I promisse to give back to you something...

rdalton

Hi Ian,

The iPhone port is much appreciated.  Nice work!  I was just wondering if you are using the Tremor decoder (fixed-point Ogg decoder)?  If not, are there any plans to incorporate it sometime soon?

Thanks.

Robert

atatum1

Is there a blackberry version as well please?

hippocoder

#14
Does this work with the iPad?

Bert


hippocoder

Brilliant!

I want to deploy to windows, mac, iphone and ipad. I do have plans to use android and windows mobile but I think I will just have to recode those bits (bite the bullet) so to speak.

Ian @ un4seen

Quote from: rdalton on  6 Apr '10 - 04:45I was just wondering if you are using the Tremor decoder (fixed-point Ogg decoder)?  If not, are there any plans to incorporate it sometime soon?

The fixed-point OGG decoder is used in the WinCE version of BASS, but not the iPhone version, as the iPhone does have an FPU. I don't remember the numbers now, but I seem to recall finding that the fixed-point decoder wasn't faster on the iPhone.

Quote from: atatum1 on  6 Apr '10 - 11:50Is there a blackberry version as well please?

I'm afraid there aren't any plans for that at the moment, but who knows in the future :)

sui

Hi everybody,

I tried BASS for my iPhone application. It works very well but I have a problem...
When my iPhone locks screen, there is no more sound. I read Apple documentation, it seems that I should setup Audio sessions and set the AVAudioSessionCategoryPlayback category. But it has no effect.

Has anyone got this issue ?

Thanks a lot !

ken

Quote from: sui on 22 Apr '10 - 14:19Hi everybody,

I tried BASS for my iPhone application. It works very well but I have a problem...
When my iPhone locks screen, there is no more sound. I read Apple documentation, it seems that I should setup Audio sessions and set the AVAudioSessionCategoryPlayback category. But it has no effect.

Has anyone got this issue ?

Thanks a lot !

Try this code:

AudioSession.Category = AudioSessionCategory.MediaPlayback

sui

I tried two things :

[[AVAudioSession sharedInstance] setDelegate: self];
[[AVAudioSession sharedInstance] setCategory: AVAudioSessionCategoryPlayback error: nil];
NSError *activationError = nil; [[AVAudioSession sharedInstance] setActive: YES error: &activationError];

and
UInt32 sessionCategory = kAudioSessionCategory_MediaPlayback;
AudioSessionSetProperty (kAudioSessionProperty_AudioCategory,  sizeof (sessionCategory), &sessionCategory);

It works with AVAudioPlayer but not with BASS...

I tried your code but I can't compile it (is it Obj C code ?).

Thanks a lot !


sui

Ok, I just fixed it...

Call

BASS_Init(-1,44100,0,NULL,NULL);

BEFORE

UInt32 sessionCategory = kAudioSessionCategory_MediaPlayback;
AudioSessionSetProperty (kAudioSessionProperty_AudioCategory,  sizeof (sessionCategory), &sessionCategory);

And not after... It's better !

Thanks :)

ken

Quote from: sui on 23 Apr '10 - 10:08Ok, I just fixed it...

Thanks :)


Good to hear, I don't code in Obj-C, I use Monotouch and code in C#, thats why my call didn't work right of.


Ian @ un4seen

BASS_Init sets the "audio session category" itself, so that will be why you are having to apply your settings after the BASS_Init call, rather than before it.

BASS currently uses the kAudioSessionCategory_AmbientSound setting, as that allows the system audio to continue in the background, eg. if the user wants to listen to their music while playing a BASS-based game. But it looks like that is now (since iPhoneOS 3.0) possible with the kAudioSessionCategory_MediaPlayback setting too, so an updated build that uses that setting is now in the iPhone package (see the 1st post).

sui

Quote from: Ian @ un4seen on 23 Apr '10 - 16:55BASS_Init sets the "audio session category" itself, so that will be why you are having to apply your settings after the BASS_Init call, rather than before it.

BASS currently uses the kAudioSessionCategory_AmbientSound setting, as that allows the system audio to continue in the background, eg. if the user wants to listen to their music while playing a BASS-based game. But it looks like that is now (since iPhoneOS 3.0) possible with the kAudioSessionCategory_MediaPlayback setting too, so an updated build that uses that setting is now in the iPhone package (see the 1st post).

Ok, thanks Ian, I understood why it did not work.