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

Ian @ un4seen

  • Administrator
  • Posts: 20393
Re: BASS for iPhoneOS
« Reply #50 on: 9 Jun '10 - 13:53 »
Please confirm the roles of BASS and AVAudioPlayer, eg. is BASS playing the background music and AVAudioPlayer playing all of the clips? I haven't really looked at AVAudioPlayer before, but trying it just now, there didn't appear to be any problem mixing it with BASS output, eg. BASS continued playing while/after AVAudioPlayer played another file. Should BASS have stopped when the AVAudioPlayer did? If so, are you doing anything else not shown in the code above, eg. audio session stuff?

lazy_b

  • Posts: 2
Re: BASS for iPhoneOS
« Reply #51 on: 9 Jun '10 - 21:34 »
Bass is playing background music, and I'm using AVAudioPlayer to play sounds over top of bass.  The goal is to have the music playing continuously and occasionally overlay other sounds.  The overlaying works perfectly, the problem is that once the first AVAudioPlayer get kicked off, the music will ONLY play when the AVAudioPlayer is playing.  I looked into the session pretty thoroughly, and there is no change in the following settings between the music starting (no problems) and the AVAudioPlayer playing (music only while avaudioplayer is running).  As far as I can tell, the problem isn't with the session settings, as the audio plays exactly as I'd like it to.  Is there a more preferred way to play sounds on top of a BASS music stream?  I just went with AVAudioPlayer because it was extremely convenient.

Oh, and it does bear mentioning that the app itself is an event-based app, which periodically will wake up from a timer or a UI event (and more than likely want to play a sound) but is ordinarily not continuously processing.  I've been looking around for documentation as to how BASS fits itself into the main application run loop but haven't had any luck as yet.  Are you spawning a pthread to decode/ process the file perhaps?  Could there be some problem with that thread not being scheduled properly?

kAudioSessionProperty_AudioCategory
kAudioSessionProperty_OtherAudioIsPlaying
 kAudioSessionProperty_ServerDied
 kAudioSessionProperty_CurrentHardwareInputNumberChannels
 kAudioSessionProperty_OverrideAudioRoute
 kAudioSessionProperty_OtherMixableAudioShouldDuck
 kAudioSessionProperty_OverrideCategoryMixWithOthers

Ian @ un4seen

  • Administrator
  • Posts: 20393
Re: BASS for iPhoneOS
« Reply #52 on: 10 Jun '10 - 16:14 »
Is there a more preferred way to play sounds on top of a BASS music stream?

You could just use BASS :) ... You could use BASS_StreamCreateFile, like you did with the background music but without the tempo processing (also remove the BASS_STREAM_DECODE flag). Another option is to use BASS_SampleLoad.

Regarding the BASS/AVAudioPlayer troubles, I'll send you a debug version to find out what is happening.

ken

  • Posts: 739
Re: BASS for iPhoneOS
« Reply #53 on: 12 Jun '10 - 16:16 »
It is actually being done ;-)

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

N

Bernd,

How do you suggest I do Recording to wav (or compresed format if possible) and have VU-meters. in PC I use EncoderWAV and DSP for VU-meters but since the Misc namespce is not in iPhone version...

Code: [Select]
public void StartRecording()
{
   Bass.BASS_RecordInit(-1);

   RECORDPROC _recProc = new RECORDPROC(recordPROC);

   int _recChannel = Bass.BASS_RecordStart(44100,2,BASSFlag.BASS_RECORD_PAUSE,_recProc,IntPtr.Zero);
   Bass.BASS_ChannelPlay(_recChannel,false);


}

private int recordPROC(int handle, IntPtr buffer, int length, IntPtr user)
{
   return 1;
}




radio42

  • Posts: 4573
Re: BASS for iPhoneOS
« Reply #54 on: 12 Jun '10 - 16:37 »
I'm not sure about any encoding (as BASSenc isn't currently supported on iPhone) - but you might code your own wave file writer.

yps

  • Posts: 144
Re: BASS for iPhoneOS
« Reply #55 on: 15 Jun '10 - 08:44 »
Doess the iPhone port support full duplex recording and playback? Has anyone tried if that works?

MikaelS

  • Posts: 198
Re: BASS for iPhoneOS
« Reply #56 on: 18 Jun '10 - 10:30 »
When will BASS for iPhone appear for iOS 4.0 ?

It seems like iPhone applications needs to be compiled (and work) with iOS 4.0 to get accepted to the AppStore.
So when I now updated to iOS 4.0, my project will no longer compile.

Thanks in advance for any help!

radio42

  • Posts: 4573
Re: BASS for iPhoneOS
« Reply #57 on: 18 Jun '10 - 11:13 »
A new verison of the .Net iPhone version (to be used with monotouch) is ready:
v2.4.1.0

You can get it here:
    www.un4seen.com/filez/4/Bass24.Net_iphone.zip

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

Ian @ un4seen

  • Administrator
  • Posts: 20393
Re: BASS for iPhoneOS
« Reply #58 on: 18 Jun '10 - 16:24 »
Doess the iPhone port support full duplex recording and playback? Has anyone tried if that works?

Yes, I have tried that (recording and playing simultaneously), and it seems to be fine.

So when I now updated to iOS 4.0, my project will no longer compile.

I haven't tried iOS 4 yet (it's still in beta), but I'll have a look at it shortly. I would have thought it would be back-compatible with iPhoneOS 3.x, though. What error message(s) are you getting from XCode?

MikaelS

  • Posts: 198
Re: BASS for iPhoneOS
« Reply #59 on: 19 Jun '10 - 11:08 »

So when I now updated to iOS 4.0, my project will no longer compile.

I haven't tried iOS 4 yet (it's still in beta), but I'll have a look at it shortly. I would have thought it would be back-compatible with iPhoneOS 3.x, though. What error message(s) are you getting from XCode?

Sorry, my fault. When I upgraded XCode it mangled my project settings and some other things, so after a bit of investigation I managed to revert the settings back to what it should be and now it compiles fine again (Running on iOS 4.0 in the simulator, target os is still 3.1.3)

ken

  • Posts: 739
Re: BASS for iPhoneOS
« Reply #60 on: 25 Jun '10 - 13:48 »
Slightly off-topic... ;D

Anyone know how I should set iPhone SDK's AVAudioRecorder (NSDictionary) for recording in AAC (m4a), or any other compressed format.

/Ken 

MikaelS

  • Posts: 198
Re: BASS for iPhoneOS
« Reply #61 on: 6 Jul '10 - 09:17 »
Sorry for cross-posting, but I figured out that my original post more likely belongs to this thread, since it directly relates to the internals of the BASS for iPhone library.
Below follows the original post:


Hi,

I'm trying to test the new iPhone OS4 remote control events (allows player controlling when the app is executing in background) together with BASS.
Unfortunately as soon as call BASS_Init, this will not work properly.

I have created a test application which consists of one view which is playing a file using AVAudioPlayer (this works well).
When I do a call to BASS_Init in the same application, it will no longer work.

Is this something that's planned to be implemented/corrected for BASS?


Thanks.

Related information can be found here:
http://developer.apple.com/iphone/library/documentation/uikit/reference/UIApplication_Class/Reference/Reference.html#//apple_ref/occ/instm/UIApplication/beginReceivingRemoteControlEvents

Ian @ un4seen

  • Administrator
  • Posts: 20393
Re: BASS for iPhoneOS
« Reply #62 on: 6 Jul '10 - 16:01 »
I'll send you a debug version to hopefully find out what's going wrong.

ssander

  • Posts: 1
Re: BASS for iPhoneOS
« Reply #63 on: 9 Jul '10 - 16:03 »
Hi everybody,

Does anyone of you guys have a working example of BASS on the iPhone (source code of a simple player app)?
I can't seem to get it to work properly, getting the following linker error: ""_BASS_Init", referenced from... symbol(s) not found" even though I added the proper library to the XCode project.

Thanks in advance!

evanchri

  • Posts: 5
Re: BASS for iPhoneOS
« Reply #64 on: 11 Jul '10 - 08:46 »
It has been a while since I looked at the BASS sound engine, and I am please to see it now works on the iPhone.  I was wondering has the BASSMIDI been ported over to the iPhone as well? 

Thanks.

Ian @ un4seen

  • Administrator
  • Posts: 20393
Re: BASS for iPhoneOS
« Reply #65 on: 12 Jul '10 - 14:51 »
Does anyone of you guys have a working example of BASS on the iPhone (source code of a simple player app)?
I can't seem to get it to work properly, getting the following linker error: ""_BASS_Init", referenced from... symbol(s) not found" even though I added the proper library to the XCode project.

I'm afraid there aren't any examples available yet, but that error message does look like the BASS library wasn't included in the project, or perhaps the wrong version was, eg. the simulator instead of the device or vice versa. How have you included LIBBASS.A in your project? It should be in the "Link Binary With Libraries" branch. To avoid device/simulator version issues, I think some people simply include both of the LIBBASS.A versions and let XCode reject the invalid one.

I was wondering has the BASSMIDI been ported over to the iPhone as well? 

It has indeed. In fact, it's included in the package in the 1st post :)

One thing to note is that performance is obviously not as good as a PC, so the BASS_CONFIG_MIDI_VOICES option defaults to 30 (rather than 100). To save a bit more CPU, the filters are also disabled, eg. the resonance & cutoff events have no effect. Reverb and chorus are still supported, but the reverb is missing its low/high-pass filters.

MikaelS

  • Posts: 198
Re: BASS for iPhoneOS
« Reply #66 on: 24 Jul '10 - 09:31 »
When I play music with BASS (background audio enabled) and switch to other applications, the sound mostly continues to play properly except in some cases;

For example if a movie or a YouTube clip is started, the audio of my application will stop.
If I then close the application that stopped my audio, switch back to my BASS application everything seems to be OK, but no audio will be played until I restart my application.

Can this be solved or at least properly handled somehow?

Any tips are welcome.

Thanks in advance, Mikael

Ian @ un4seen

  • Administrator
  • Posts: 20393
Re: BASS for iPhoneOS
« Reply #67 on: 26 Jul '10 - 16:59 »
Perhaps the other process is setting the audio session category so that it is the only thing allowed to play. If so, BASS should receive notification from the OS of that, and then another one once it can resume. I'll send you a debug version to confirm whether that is happening.

Od1n

  • Posts: 7
Re: BASS for iPhoneOS
« Reply #68 on: 28 Jul '10 - 06:25 »
A couple of gotchas for the (otherwise brilliant library).

1. XCode doesn't by default recognize that .a means compiled code; it thinks it means that it's an archive (.ar). If it fails to link, you may need to right click on the library, get info, then under General Tab set File Type to compiled.mach-o.objfile

2. If you're using simulator iOS3.2 or higher, any attempts to play back streaming music will crash the software. Works fine on hardware, and on lower versions.

Allan

Ian @ un4seen

  • Administrator
  • Posts: 20393
Re: BASS for iPhoneOS
« Reply #69 on: 28 Jul '10 - 18:15 »
2. If you're using simulator iOS3.2 or higher, any attempts to play back streaming music will crash the software. Works fine on hardware, and on lower versions.

This seems to be an issue with the "fstat" function in the current simulator; it appears to be using a "stat" structure that doesn't match the SDK's definition, resulting in it writing beyond the end of the allocated structure. That function was used to get file lengths, but it has now been replaced with another method, and an update is in the BASS package (see 1st post). Let me know if you still have the problem with it.

darren

  • Posts: 6
Re: BASS for iPhoneOS
« Reply #70 on: 31 Jul '10 - 01:24 »
I was successfully able to use BASS to modify sounds being processed and output from AudioUnits.
Is this possible when using AVPlayer or AVAudioPlayer?

I'm trying to BASS_INIT using the 'no sound' device, then a BASS_STREAMCreate using the STREAMPROC_DUMMY.
Everything creates and initializes without error, but when I try to invoke the BASS_FXSetParameters on those streams - there is no error, but also and no audible result.

Any ideas?

Ian @ un4seen

  • Administrator
  • Posts: 20393
Re: BASS for iPhoneOS
« Reply #71 on: 2 Aug '10 - 13:53 »
Do AVPlayer or AVAudioPlayer give you access to the sample data? If they do, then it should be possible to apply DSP/FX via a dummy stream (with the same sample format), as described in the following thread...

   www.un4seen.com/forum/?topic=10765

geir

  • Posts: 2
Re: BASS for iPhoneOS
« Reply #72 on: 8 Aug '10 - 18:02 »
When trying to run my app in the 4.0 (iPhone) simulator I get no sound and the following error:

Unable to synchronize the audio input and output devices' sample rates
AddRunningClient starting device on non-zero client count

Its the same error I get when I try to use AVAudioPlayer so its not an error specific to Bass. Anyone experienced this and know what it means ? It works on the device.

Lefteris

  • Posts: 2
Re: BASS for iPhoneOS
« Reply #73 on: 17 Aug '10 - 14:48 »
Hi,

Is there any chance we can get wma playback in the Iphone version ?

Ian @ un4seen

  • Administrator
  • Posts: 20393
Re: BASS for iPhoneOS
« Reply #74 on: 18 Aug '10 - 16:42 »
Unfortunately, I think an iPhone version of the BASSWMA add-on is unlikely. There are GPL libraries available for WMA decoding, but your app would have to be GPL-compatible too, eg. open source.