BASS for iOS (iPhone/iPad)

Started by Ian @ un4seen,

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: suiOk, 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 @ un4seenBASS_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.

Jon Schøpzinsky

Ive been trying to use the Bass.Net.dll with monotouch for some time now, and everytime i use a part of the Bass.Net SDK, the build fails with "mtouch failed with no output".

Could anyone enlighten me, with how i get this working on MonoTouch?

Ive linked the needed library and frameworks, but it still fails.

/Jon

ken

Quote from: Jon SchøpzinskyIve been trying to use the Bass.Net.dll with monotouch for some time now, and everytime i use a part of the Bass.Net SDK, the build fails with "mtouch failed with no output".

Could anyone enlighten me, with how i get this working on MonoTouch?

Ive linked the needed library and frameworks, but it still fails.

/Jon

For now you can't use Bass.Net with Monotouch, there are dependencys like Drawing.Image that Monotouch don't support. But Bernd is working on a iPhone version, with most fatures that works for iPhone.

/Ken

Jon Schøpzinsky

Ah, that explains it  :)

Well, then ill be looking forward to it being released. Is there any (im a developer myself so i cant believe im asking...) estimate on when its done?

/Jon

radio42

It is actually being done ;-)

You can get a pre-version here:
    www.un4seen.com/filez/4/Bass.Net.iphone.zip

Note, that the iphone version has the following limitations:
a) no picture tag reading support
b) no WaveForm rendering support

The Bass.Net iphone version already has support for:
- BASS
- BASSFLAC
- BASSMIDI
- BASSWV
- BASSmix
- BASS_AAC (which is not yet available from Ian, but might be soon)
- BASS_FX (which is not yet available from Jobby, but might be soon)

Jon Schøpzinsky

Now, that was good news  ;)

I will try it right away.
Is there anywhere you want bugs reported and such?

Jon

ken

Quote from: radio42It is actually being done ;-)

You can get a pre-version here:
    www.un4seen.com/filez/4/Bass.Net.iphone.zip



When using ChannelSync for reading Meta tags, my app crash on the iPhone device but works just fine in the simulator.

I set sync like this:
mySync = new SYNCPROC(MetaSync);
Bass.BASS_ChannelSetSync(_stream, BASSSync.BASS_SYNC_META, 0, mySync, IntPtr.Zero);

and get meta data like this:
private void MetaSync(int handle, int channel, int data, IntPtr user)
{
       
  TAG_INFO tags = new TAG_INFO();


  if (tags.UpdateFromMETA(Bass.BASS_ChannelGetTags(_stream, BASSTag.BASS_TAG_META), false, true))
  {

          _NetStreamEventArgs.Artist = tags.artist;
          _NetStreamEventArgs.Title = tags.title;
                   
    }
           
 }


The app crash on "Bass.BASS_ChannelSetSync", here is the debug info I get from Monotouch
QuoteUnhandled Exception: System.ExecutionEngineException: Attempting to JIT compile method '(wrapper native-to-managed) CasterPlay.AudioEngine:MetaSync (int,int,int,intptr)' while running with --aot-only.

  at (wrapper managed-to-native) Un4seen.Bass.Bass:BASS_ChannelSetSync (int,Un4seen.Bass.BASSSync,long,Un4seen.Bass.SYNCPROC,intptr)


I can read tags "manually" like this (but then I need a timer to pull the data..

TAG_INFO  _tagInfo = new TAG_INFO(URL);

if (BassTags.BASS_TAG_GetFromURL(_stream, _tagInfo))
 {

      _NetStreamEventArgs.Artist = _tagInfo.artist;
       _NetStreamEventArgs.Title = _tagInfo.title;
}
         

Is is Bass, Bass.Net or me...?


/Ken

radio42

Sounds this could be related to an AOT (ahead-of-time compilation) issue with mono?
Did you to to NOT use AOT?
And did you try to use a static SYNCPROC instead of a private method?

I'm unable to reproduce this, as I don't have a Mac...

MikaelS

#32
When I try to build a test project using BASS for iPhone, the compiler gives me the following warning message:
ld: warning: in /Users/mikael/Documents/BASSTest/basslib/libbass.a, file was built for unsupported file format which is not the architecture being linked (i386)

My application is a "clean" View Based iPhone application with no code added.
The only think I did as to add libbass.a into "Targets > BASSTest > Link Binary With Libraries" node.

It does not matter if I take the libbass.a file from the root folder or from the "Simulator" folder.

Any ideas? A working example project would be nice :)

Thanks in advance!

Edit: I'm using (have added) the bass.h file from the OSX setup to my project.
If I do not include this file (#import "bass.h") I do not get the warning. Help!

MikaelS

Nevermind my prior post.. It was XCode mixing things up ;)

MikaelS

What should be used to set the device general output volume with BASS for iPhone?

Can "BASS_SetConfig(BASS_CONFIG_GVOL_STREAM, XXX);" be used or do I need to use AVAudioSession property?

Please help!

Thanks in advance.

ken

Quote from: MikaelSWhat should be used to set the device general output volume with BASS for iPhone?

You have to use "MPVolumeView" in iPhone SDK, this class will give you a slider that controls volume and are "connected" to the volume buttons on the iPhone. Not that The volumeslider will not show in simulator, only shows on a iPhone device.  MPVolumeView doc: http://bit.ly/blzs6w


MikaelS

Thanks for the reply Ken, it works like a charm :)

George

BASS for iPhoneOS is really great.

There seams to be a small bug. When VoiceOver (for blind people) is activated, there will be no sound from BASS on iPhoneOS.
Settings-->General-->Accessibility-->VoiceOver.

VoiceOver is in iPhone 3GS, iPad and latest iPod Touch.

It happens on all this devices...

Probably a device sharing issue?

Ian @ un4seen

I don't see that option on my test device or the simulator, so I can't try it at the moment, but I'll send you a debug version to get some info.

George

Hi Ian

The VoiceOver option is on iPhone 3GS, iPad and probably latest iPod Touch...

Probably you have iPhone 3G.

I did not received debug version. Please send with advice how to debug.

Regards