20 May '13 - 20:01 *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 
   Home   Help Search Login Register  
Pages: 1 ... 18 19 [20] 21 22 ... 36
  Reply  |  Print  
Author Topic: BASS for iOS (iPhone/iPad)  (Read 109525 times)
spadario
Guest
« Reply #380 on: 5 Feb '12 - 21:29 »
Reply with quoteQuote

Hi All,

I'm trying to build a bass example project exported from Firemonkey to Xcode-FPC.

I did the following:
- Edited bass.pas from Windows Package to add:
{$IFDEF FPC}
  bassdll = 'libbass.a';
{$ENDIF}

Copied libbass.a to Project folder.

Whenever I try to access to a function I get the following error on building the project inside Xcode:
Undefined symbols for architecture i386:
  "_AudioComponentFindNext", referenced from:
      _BASS_Init in libbass.a(bass.o)
  "_AudioComponentInstanceDispose", referenced from:
      _BASS_ChannelIsSliding in libbass.a(bass.o)
  "_AudioComponentInstanceNew", referenced from:
      _BASS_Init in libbass.a(bass.o)
  "_AudioFileClose", referenced from:
      _BASS_SampleFree in libbass.a(bass.o)
  "_AudioFileGetGlobalInfo", referenced from:
      _BASS_SampleFree in libbass.a(bass.o)
  "_AudioFileGetProperty", referenced from:
      _BASS_SampleFree in libbass.a(bass.o)
  "_AudioFileOpenWithCallbacks", referenced from:
      _BASS_SampleFree in libbass.a(bass.o)
  "_AudioFormatGetProperty", referenced from:
      _BASS_SampleFree in libbass.a(bass.o)
  "_AudioOutputUnitStart", referenced from:
      _BASS_FXSetParameters in libbass.a(bass.o)
      _BASS_Start in libbass.a(bass.o)
      _BASS_Init in libbass.a(bass.o)
  "_AudioOutputUnitStop", referenced from:
      _BASS_RecordGetInputName in libbass.a(bass.o)
      _BASS_ChannelIsSliding in libbass.a(bass.o)
      _BASS_FXSetParameters in libbass.a(bass.o)
      _BASS_Pause in libbass.a(bass.o)
      _BASS_RecordFree in libbass.a(bass.o)
  "_AudioQueueAllocateBuffer", referenced from:
      _BASS_RecordGetInputName in libbass.a(bass.o)
  "_AudioQueueDispose", referenced from:
      _BASS_SampleFree in libbass.a(bass.o)
  "_AudioQueueEnqueueBuffer", referenced from:
      _BASS_RecordGetInputName in libbass.a(bass.o)
  "_AudioQueueNewInput", referenced from:
      _BASS_RecordGetInputName in libbass.a(bass.o)
  "_AudioQueueStart", referenced from:
      _BASS_RecordGetInputName in libbass.a(bass.o)
  "_AudioQueueStop", referenced from:
      _BASS_RecordGetInputName in libbass.a(bass.o)
      _BASS_SampleCreate in libbass.a(bass.o)
      _BASS_ChannelPause in libbass.a(bass.o)
  "_AudioSessionGetProperty", referenced from:
      _BASS_RecordGetInfo in libbass.a(bass.o)
  "_AudioSessionInitialize", referenced from:
      _BASS_RecordGetInputName in libbass.a(bass.o)
  "_AudioSessionSetActive", referenced from:
      _BASS_RecordGetInputName in libbass.a(bass.o)
      _BASS_FXSetParameters in libbass.a(bass.o)
      _BASS_RecordInit in libbass.a(bass.o)
      _BASS_Init in libbass.a(bass.o)
  "_AudioSessionSetProperty", referenced from:
      _BASS_RecordGetInputName in libbass.a(bass.o)
      _BASS_Init in libbass.a(bass.o)
  "_AudioUnitGetParameter", referenced from:
      _BASS_GetVolume in libbass.a(bass.o)
  "_AudioUnitGetProperty", referenced from:
      _BASS_Init in libbass.a(bass.o)
  "_AudioUnitInitialize", referenced from:
      _BASS_Init in libbass.a(bass.o)
  "_AudioUnitSetParameter", referenced from:
      _BASS_SetVolume in libbass.a(bass.o)
  "_AudioUnitSetProperty", referenced from:
      _BASS_Init in libbass.a(bass.o)
  "_AudioUnitUninitialize", referenced from:
      _BASS_ChannelIsSliding in libbass.a(bass.o)
  "_CFHTTPMessageAddAuthentication", referenced from:
      _BASS_SampleCreate in libbass.a(bass.o)
  "_CFHTTPMessageCopySerializedMessage", referenced from:
      _BASS_SampleCreate in libbass.a(bass.o)
  "_CFHTTPMessageCreateRequest", referenced from:
      _BASS_SampleCreate in libbass.a(bass.o)
  "_CFHTTPMessageSetHeaderFieldValue", referenced from:
      _BASS_SampleCreate in libbass.a(bass.o)
  "_CFNetworkCopySystemProxySettings", referenced from:
      _BASS_SampleCreate in libbass.a(bass.o)
  "_CFReadStreamCreateForHTTPRequest", referenced from:
      _BASS_SampleCreate in libbass.a(bass.o)
  "_CFReadStreamCreateWithFTPURL", referenced from:
      _BASS_SampleCreate in libbass.a(bass.o)
  "_ExtAudioFileDispose", referenced from:
      _BASS_SampleFree in libbass.a(bass.o)
  "_ExtAudioFileGetProperty", referenced from:
      _BASS_RecordGetInputName in libbass.a(bass.o)
      _BASS_SampleFree in libbass.a(bass.o)
  "_ExtAudioFileRead", referenced from:
      _BASS_RecordGetInputName in libbass.a(bass.o)
  "_ExtAudioFileSeek", referenced from:
      _BASS_ChannelIsSliding in libbass.a(bass.o)
  "_ExtAudioFileSetProperty", referenced from:
      _BASS_SampleFree in libbass.a(bass.o)
  "_ExtAudioFileWrapAudioFileID", referenced from:
      _BASS_SampleFree in libbass.a(bass.o)
  "_kCFHTTPAuthenticationSchemeBasic", referenced from:
      _BASS_SampleCreate in libbass.a(bass.o)
  "_kCFHTTPVersion1_0", referenced from:
      _BASS_SampleCreate in libbass.a(bass.o)
  "_kCFStreamPropertyFTPFetchResourceInfo", referenced from:
      _BASS_SampleCreate in libbass.a(bass.o)
  "_kCFStreamPropertyFTPFileTransferOffset", referenced from:
      _BASS_SampleCreate in libbass.a(bass.o)
  "_kCFStreamPropertyFTPProxy", referenced from:
      _BASS_SampleCreate in libbass.a(bass.o)
  "_kCFStreamPropertyFTPResourceSize", referenced from:
      _BASS_SampleCreate in libbass.a(bass.o)
  "_kCFStreamPropertyFTPUsePassiveMode", referenced from:
      _BASS_SampleCreate in libbass.a(bass.o)
  "_kCFStreamPropertyHTTPProxy", referenced from:
      _BASS_SampleCreate in libbass.a(bass.o)
  "_kCFStreamPropertyHTTPResponseHeader", referenced from:
      _BASS_SampleCreate in libbass.a(bass.o)
  "_kCFStreamPropertySSLSettings", referenced from:
      _BASS_SampleCreate in libbass.a(bass.o)
  "_kCFStreamSSLValidatesCertificateChain", referenced from:
      _BASS_SampleCreate in libbass.a(bass.o)
ld: symbol(s) not found for architecture i386

Does "libbass.a" work inside iPhone Simulator (i386 architecture)?
Logged
Ian @ un4seen
Administrator
Posts: 15253


« Reply #381 on: 6 Feb '12 - 15:04 »
Reply with quoteQuote

IOS- I'm trying to find an example/info on how to play several audio files at the same time and then record them in a new audio file.  Can someone point me in the right direction?  Thanks Smiley

That sounds like you could achieve what you want with the BASSmix and BASSenc add-ons, using the former to mix the files and the latter to write the mix to another file. It could look something like this...

HSTREAM mixer=BASS_Mixer_StreamCreate(freq, chans, BASS_STREAM_DECODE|BASS_MIXER_END); // create a mixer
// add the files to the mix...
for (int a=0; a<filecount; a++) {
HSTREAM decoder=BASS_StreamCreateFile(FALSE, filename[a], 0, 0, BASS_STREAM_DECODE|BASS_SAMPLE_FLOAT); // create a "decoding channel" from a file
BASS_Mixer_StreamAddChannel(mixer, decoder, BASS_STREAM_AUTOFREE); // add it to the mixer
}
BASS_Encode_StartCAFile(mixer, 'm4af', 'alac', BASS_ENCODE_AUTOFREE, 0, outfilename); // set an ALAC encoder on the mixer
while (BASS_ChannelIsActive(mixer) && BASS_Encode_IsActive(mixer)) { // mixer and encoder still going...
BYTE buf[20000];
BASS_ChannelGetData(mixer, buf, sizeof(buf)); // process the mix
}
BASS_StreamFree(mixer); // free the mixer (and sources and encoder due to AUTOFREE)

Please see the documentation for details on the aforementioned functions.

Whenever I try to access to a function I get the following error on building the project inside Xcode:

You need to add the following frameworks to your project: AudioToolbox, SystemConfiguration, CFNetwork.
Logged
sui
Guest
« Reply #382 on: 9 Feb '12 - 13:11 »
Reply with quoteQuote

Quote from: Ian @ un4seen

I'm not sure it's worthwhile bothering with that, as it won't help you to play AAC due to the lack of support for the buffered file system (eg. STREAMFILE_BUFFERPUSH). I'll see if something can be done to add support for the buffered file system (including BASS_StreamCreateURL) when using CoreAudio codecs.


It will be great if it can be possible ! Now I can play an AAC, but a lot of data must be downloaded to allow playing.

Thanks !
Logged
Delphinus
Posts: 39


« Reply #383 on: 10 Feb '12 - 09:29 »
Reply with quoteQuote

Hi,

I've got another question about BASS_FX_BPM_DecodeGet function. I want to have the BPM of a mp3 file so I wrote

double endSec = BASS_ChannelBytes2Seconds(chan, BASS_ChannelGetLength(chan, BASS_POS_BYTE));

float bpm = BASS_FX_BPM_DecodeGet(BASS_FX_TempoGetSource(chan), 0.0, endSec, 0, 0, (BPMPROCESSPROC *)&getBpmProc);


Then when running the project it seems that DecodeGet function is playing the song (really fast). Maybe it is because I did not add the BASS_FX_BPM_BKGRND and the doc says:
 
Quote
Remarks
BASS_FX_BPM_BKGRND flag is not supported in MacOSX, yet.
So any chance to get that function not playing without that flag?

Thanks
Logged
Total Eclipse
Posts: 8


« Reply #384 on: 10 Feb '12 - 14:50 »
Reply with quoteQuote

Hi everyone!

This is my first post here. We'd like to use BASS in our iOS game, but it seems there's no guide on how to set up everything we need, in order to get started.

Going through the sample projects doesn't really help when it comes to the initial set up, so if there's anyone who can provide a tutorial of the process, please let me know.

Thanks!
Argiris
Logged
Ian @ un4seen
Administrator
Posts: 15253


« Reply #385 on: 10 Feb '12 - 16:46 »
Reply with quoteQuote

It will be great if it can be possible !

Indeed! There are still some troublesome things that need to be worked out. Hopefully it will be possible to work them out Smiley

I've got another question about BASS_FX_BPM_DecodeGet function. I want to have the BPM of a mp3 file so I wrote

double endSec = BASS_ChannelBytes2Seconds(chan, BASS_ChannelGetLength(chan, BASS_POS_BYTE));

float bpm = BASS_FX_BPM_DecodeGet(BASS_FX_TempoGetSource(chan), 0.0, endSec, 0, 0, (BPMPROCESSPROC *)&getBpmProc);


Then when running the project it seems that DecodeGet function is playing the song (really fast). Maybe it is because I did not add the BASS_FX_BPM_BKGRND...

I don't think that it related to the BASS_FX_BPM_BKGRND flag. It looks like the BPM detection is taking data from the source (in order to detect the BPM), and that data is then not available for the tempo stream to play, so playback sounds fast/skippy. Do you want to get the current BPM during playback? If so, you can use BASS_FX_BPM_CallbackSet instead, which will check the data as it is being taken from the source by the tempo stream (rather than taking data itself).

This is my first post here. We'd like to use BASS in our iOS game, but it seems there's no guide on how to set up everything we need, in order to get started.

Going through the sample projects doesn't really help when it comes to the initial set up, so if there's anyone who can provide a tutorial of the process, please let me know.

I'm afraid there aren't really any tutorials/guides besides what's in the documentation and examples, but to get started, the basic calls will be BASS_Init to initialize the output, followed by BASS_StreamCreateFile and/or BASS_SampleLoad or BASS_MusicLoad calls to open/load audio files for playback, and then BASS_ChannelPlay to play them. BASS_ChannelSetAttribute is used for volume/panning/rate adjustment. Please see the documentation for details on those functions, and then get back with any follow-up questions that you have.
Logged
Total Eclipse
Posts: 8


« Reply #386 on: 10 Feb '12 - 17:18 »
Reply with quoteQuote

Thank you for your reply, Ian.

I'm mostly talking about the basic things that need to be done regarding static libraries and includes, so that BASS can be used in any iOS project.
Logged
Delphinus
Posts: 39


« Reply #387 on: 10 Feb '12 - 17:25 »
Reply with quoteQuote

I wanted to get the BPM of a my mp3 file and display it after loading all the BASS stuff without playing it. I managed to do that finally, I just put in another channel the BPM decode function then store the val somewhere.

And yes I also use BPM_CallbackSet to detect BPM while playing Wink

It is kinda complicated as I don't really know all those dj stuff. But this lib helps a lot! Smiley
Logged
Ian @ un4seen
Administrator
Posts: 15253


« Reply #388 on: 10 Feb '12 - 17:59 »
Reply with quoteQuote

I'm mostly talking about the basic things that need to be done regarding static libraries and includes, so that BASS can be used in any iOS project.

Ah, OK. You can find some info on that stuff in the 1st post of this thread. Basically, you "include" BASS.H in your source, add the LIBBASS.A file to your project, and add a few frameworks too.

I wanted to get the BPM of a my mp3 file and display it after loading all the BASS stuff without playing it. I managed to do that finally, I just put in another channel the BPM decode function then store the val somewhere.

If you will be completing the BPM detection before starting playback, you could use the same channel handle for both. If you want to have both going at the same time though, then you will need to create a separate channel for each (eg. another BASS_StreamCreateFile call), so that they don't affect each other.
Logged
DrummerB
Posts: 18


« Reply #389 on: 10 Feb '12 - 22:47 »
Reply with quoteQuote

Hi,

One of my users contacted me, because for some music files my app seems to display wrong durations.

He sent me this example:
http://upload.fabali.net/media/SetFireToTheRain.mp3

iTunes, QuickTime or the iPod player have no issues playing it and displaying the correct duration (4:03). My app however displays 15:44. I did some tests and the duration function returns a wrong value:

float sec = BASS_ChannelBytes2Seconds(channel, BASS_ChannelGetLength(channel, BASS_POS_BYTE));

This returns 944.039185 seconds (15:44). I'm not sure if BASS is doing something wrong, the sound file is corrupted or my channel is somehow messed up. The app however works for every other file I ever tested and this is the first report about this problem (the app has been released a year ago).

This is how I set up my channel (nothing special, I think).

if (loopSync && channel) BASS_ChannelRemoveSync(channel, loopSync);
if (mixDSP != 0) BASS_ChannelRemoveDSP(channel, mixDSP);
if (vocalDSP != 0) BASS_ChannelRemoveDSP(channel, vocalDSP);
if (channel) BASS_StreamFree(channel);

// Setup buffer length and update period.
BASS_SetConfig(BASS_CONFIG_UPDATEPERIOD, kBASSUpdatePeriod);
BASS_SetConfig(BASS_CONFIG_BUFFER, kBASSBufferLength);

// Set up stream.
if(!(channel = BASS_StreamCreateFile(0, [songPath cStringUsingEncoding:NSUTF8StringEncoding], 0, 0,
BASS_STREAM_DECODE | BASS_SAMPLE_LOOP))) {
NSLog(@"Can't load stream!");
return NO;
} else {
BASS_CHANNELINFO info;
BASS_ChannelGetInfo(channel, &info);
if (info.chans > 2 || info.chans < 1) {
BASS_StreamFree(channel);
NSLog(@"Only stereo and mono sources are supported.");
return NO;
} else {
if (!(channel = BASS_FX_TempoCreate(channel, BASS_SAMPLE_LOOP | BASS_FX_FREESOURCE))){
BASS_StreamFree(channel);
NSLog(@"Couldn't create a resampled stream!");
return NO;
} else {
BASS_ChannelSetAttribute(channel, BASS_ATTRIB_TEMPO_OPTION_USE_QUICKALGO, YES);
BASS_ChannelSetAttribute(channel, BASS_ATTRIB_TEMPO_OPTION_PREVENT_CLICK, YES);
NSLog(@"Stream initialized.");
}
}
}

Am I missing something? Thanks!
Logged
Total Eclipse
Posts: 8


« Reply #390 on: 13 Feb '12 - 09:42 »
Reply with quoteQuote

Thank you for replying, Ian.

We started a new project, based on the Cocos2D template and added the needed (by BASS) frameworks, along with the static and dynamic libraries and the header files.

When building for a device, everything goes well, but when trying the simulator, we get the following:

GNU gdb 6.3.50-20050815 (Apple version gdb-1708) (Mon Aug 15 16:03:10 UTC 2011)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin".Attaching to process 2270.

2012-02-13 10:47:24.772 BassTest3[2270:207] cocos2d: cocos2d v1.0.0-beta
2012-02-13 10:47:24.773 BassTest3[2270:207] cocos2d: Using Director Type:CCDirectorDisplayLink
2012-02-13 10:47:24.798 BassTest3[2270:207] cocos2d: OS version: 5.0 (0x05000000)
2012-02-13 10:47:24.798 BassTest3[2270:207] cocos2d: GL_VENDOR:   Apple Computer, Inc.
2012-02-13 10:47:24.799 BassTest3[2270:207] cocos2d: GL_RENDERER: Apple Software Renderer
2012-02-13 10:47:24.800 BassTest3[2270:207] cocos2d: GL_VERSION:  OpenGL ES-CM 1.1 APPLE
2012-02-13 10:47:24.802 BassTest3[2270:207] cocos2d: GL_MAX_TEXTURE_SIZE: 4096
2012-02-13 10:47:24.802 BassTest3[2270:207] cocos2d: GL_MAX_MODELVIEW_STACK_DEPTH: 16
2012-02-13 10:47:24.803 BassTest3[2270:207] cocos2d: GL_MAX_SAMPLES: 4
2012-02-13 10:47:24.805 BassTest3[2270:207] cocos2d: GL supports PVRTC: YES
2012-02-13 10:47:24.806 BassTest3[2270:207] cocos2d: GL supports BGRA8888 textures: YES
2012-02-13 10:47:24.807 BassTest3[2270:207] cocos2d: GL supports NPOT textures: YES
2012-02-13 10:47:24.808 BassTest3[2270:207] cocos2d: GL supports discard_framebuffer: YES
2012-02-13 10:47:24.809 BassTest3[2270:207] cocos2d: compiled with NPOT support: NO
2012-02-13 10:47:24.811 BassTest3[2270:207] cocos2d: compiled with VBO support in TextureAtlas : YES
2012-02-13 10:47:24.812 BassTest3[2270:207] cocos2d: compiled with Affine Matrix transformation in CCNode : YES
2012-02-13 10:47:24.813 BassTest3[2270:207] cocos2d: compiled with Profiling Support: NO
2012-02-13 10:47:24.830 BassTest3[2270:207] cocos2d: surface size: 480x320
[Switching to process 2270 thread 0x490b]
[Switching to process 2270 thread 0x207]
2012-02-13 10:47:25.128 BassTest3[2270:207] Error loading /System/Library/Extensions/AudioIPCDriver.kext/Contents/Resources/AudioIPCPlugIn.bundle/Contents/MacOS/AudioIPCPlugIn:  dlopen(/System/Library/Extensions/AudioIPCDriver.kext/Contents/Resources/AudioIPCPlugIn.bundle/Contents/MacOS/AudioIPCPlugIn, 262): Symbol not found: _CFXMLNodeGetInfoPtr
  Referenced from: /System/Library/Frameworks/Security.framework/Versions/A/Security
  Expected in: /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation
 in /System/Library/Frameworks/Security.framework/Versions/A/Security
2012-02-13 10:47:25.141 BassTest3[2270:207] Error loading /System/Library/Extensions/AudioIPCDriver.kext/Contents/Resources/AudioIPCPlugIn.bundle/Contents/MacOS/AudioIPCPlugIn:  dlopen(/System/Library/Extensions/AudioIPCDriver.kext/Contents/Resources/AudioIPCPlugIn.bundle/Contents/MacOS/AudioIPCPlugIn, 262): Symbol not found: _CFXMLNodeGetInfoPtr
  Referenced from: /System/Library/Frameworks/Security.framework/Versions/A/Security
  Expected in: /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation
 in /System/Library/Frameworks/Security.framework/Versions/A/Security
2012-02-13 10:47:25.246 BassTest3[2270:207] Error loading /System/Library/Extensions/AppleHDA.kext/Contents/PlugIns/AppleHDAHALPlugIn.bundle/Contents/MacOS/AppleHDAHALPlugIn:  dlopen(/System/Library/Extensions/AppleHDA.kext/Contents/PlugIns/AppleHDAHALPlugIn.bundle/Contents/MacOS/AppleHDAHALPlugIn, 262): Symbol not found: _CFXMLNodeGetInfoPtr
  Referenced from: /System/Library/Frameworks/Security.framework/Versions/A/Security
  Expected in: /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation
 in /System/Library/Frameworks/Security.framework/Versions/A/Security
2012-02-13 10:47:25.256 BassTest3[2270:207] Error loading /System/Library/Extensions/AppleHDA.kext/Contents/PlugIns/AppleHDAHALPlugIn.bundle/Contents/MacOS/AppleHDAHALPlugIn:  dlopen(/System/Library/Extensions/AppleHDA.kext/Contents/PlugIns/AppleHDAHALPlugIn.bundle/Contents/MacOS/AppleHDAHALPlugIn, 262): Symbol not found: _CFXMLNodeGetInfoPtr
  Referenced from: /System/Library/Frameworks/Security.framework/Versions/A/Security
  Expected in: /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation
 in /System/Library/Frameworks/Security.framework/Versions/A/Security
2012-02-13 10:47:25.274 BassTest3[2270:207] Error loading /System/Library/Extensions/AppleHDA.kext/Contents/PlugIns/AppleHDAHALPlugIn.bundle/Contents/MacOS/AppleHDAHALPlugIn:  dlopen(/System/Library/Extensions/AppleHDA.kext/Contents/PlugIns/AppleHDAHALPlugIn.bundle/Contents/MacOS/AppleHDAHALPlugIn, 262): Symbol not found: _CFXMLNodeGetInfoPtr
  Referenced from: /System/Library/Frameworks/Security.framework/Versions/A/Security
  Expected in: /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation
 in /System/Library/Frameworks/Security.framework/Versions/A/Security
2012-02-13 10:47:25.282 BassTest3[2270:207] Error loading /System/Library/Extensions/AppleHDA.kext/Contents/PlugIns/AppleHDAHALPlugIn.bundle/Contents/MacOS/AppleHDAHALPlugIn:  dlopen(/System/Library/Extensions/AppleHDA.kext/Contents/PlugIns/AppleHDAHALPlugIn.bundle/Contents/MacOS/AppleHDAHALPlugIn, 262): Symbol not found: _CFXMLNodeGetInfoPtr
  Referenced from: /System/Library/Frameworks/Security.framework/Versions/A/Security
  Expected in: /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation
 in /System/Library/Frameworks/Security.framework/Versions/A/Security
2012-02-13 10:47:28.359 BassTest3[2270:207] cocos2d: Frame interval: 1

Any ideas?
Logged
Ian @ un4seen
Administrator
Posts: 15253


« Reply #391 on: 13 Feb '12 - 16:06 »
Reply with quoteQuote

One of my users contacted me, because for some music files my app seems to display wrong durations.

He sent me this example:
http://upload.fabali.net/media/SetFireToTheRain.mp3

iTunes, QuickTime or the iPod player have no issues playing it and displaying the correct duration (4:03). My app however displays 15:44. I did some tests and the duration function returns a wrong value:

float sec = BASS_ChannelBytes2Seconds(channel, BASS_ChannelGetLength(channel, BASS_POS_BYTE));

This returns 944.039185 seconds (15:44). I'm not sure if BASS is doing something wrong, the sound file is corrupted or my channel is somehow messed up. The app however works for every other file I ever tested and this is the first report about this problem (the app has been released a year ago).

I'm getting a length of 4:03 from BASS too here. What BASS version are you using? If it isn't the latest (in the 1st post), please give that a try and see if you still have the problem with it.

We started a new project, based on the Cocos2D template and added the needed (by BASS) frameworks, along with the static and dynamic libraries and the header files.

When building for a device, everything goes well, but when trying the simulator, we get the following:

...
2012-02-13 10:47:25.128 BassTest3[2270:207] Error loading /System/Library/Extensions/AudioIPCDriver.kext/Contents/Resources/AudioIPCPlugIn.bundle/Contents/MacOS/AudioIPCPlugIn:  dlopen(/System/Library/Extensions/AudioIPCDriver.kext/Contents/Resources/AudioIPCPlugIn.bundle/Contents/MacOS/AudioIPCPlugIn, 262): Symbol not found: _CFXMLNodeGetInfoPtr
  Referenced from: /System/Library/Frameworks/Security.framework/Versions/A/Security
  Expected in: /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation
 in /System/Library/Frameworks/Security.framework/Versions/A/Security
...

I've never seen that, so I'm not really sure what the cause could be. Are you linking with any other libraries besides BASS? If so, those libraries may have separate device and simulator builds; check that you are linking with the right one or link with both. If that isn't it, do you still get those errors if you remove LIBBASS.A from the project?
Logged
einsteinx2
Posts: 61


« Reply #392 on: 16 Feb '12 - 08:53 »
Reply with quoteQuote

Just ran into another issue that seems to be a bug in BASS_free(). I have two decode channels that are feeding a third channel to get gapless playback, I posted the relevant code in one of my previous posts. In my decode channels' read proc I have some logic to stall playback when there isn't enough data downloaded yet. That works fine, the only issue is that if BASS_free() gets called while that's happening, it freezes the app (BASS_free() is being called from the main thread so the UI freezes). I make sure that the wait loop in the read proc has finished before calling BASS_free() but it still freezes.

Here's the relevant portions of the read proc:

DWORD bytesRead = fread(buffer, 1, length, userInfo.myFileHandle);

if (bytesRead < length)
{
// Clear the EOF indicator from the stream so it will resume reading
// when more data is available
fpos_t pos;
fgetpos(userInfo.myFileHandle, &pos);
fpos_t newpos = pos - bytesRead;
fsetpos(userInfo.myFileHandle, &newpos);

NSTimeInterval sleepTime = 0.25;
while (!sharedInstance.audioQueueShouldStopWaitingForData
   && !theSong.isFullyCached && theSong.localFileSize < neededSize)
{
// As long as audioQueueShouldStopWaitingForData is false, the song is not fully cached, and
// the file size is less than the needed size, then wait
DLog(@"Not enough data, sleeping for %f   fileSize: %llu  neededSize: %llu", sleepTime, theSong.localFileSize, neededSize);
[NSThread sleepForTimeInterval:sleepTime];
}

// The loop finished, so unless audioQueueShouldStopWaitingForData is true (meaning the wait was cancelled)
// then call fread again to enqueue more data
if (!sharedInstance.audioQueueShouldStopWaitingForData)
{
// Do the read again
bytesRead = fread(buffer, 1, length, userInfo.myFileHandle);
DLog(@"trying again asked for: %i  got: %i  file size: %llu", length, bytesRead, theSong.localFileSize);

if (sharedInstance.state != ISMS_AE_STATE_waitingForDataNoResume)
{
sharedInstance.state = ISMS_AE_STATE_finishedWaitingForData;
//[sharedInstance performSelectorOnMainThread:@selector(playPause) withObject:nil waitUntilDone:YES];
}
}
}

return bytesRead;


and in the other method that actually gets the data from the decode channel for the out channel, it sets self.state == ISMS_AE_doneWaitingForData, so I know that the read proc has returned before bass is freed.

Then here's the code in my bass free method:

// Make sure the read data loop exits
self.audioQueueShouldStopWaitingForData = YES;

// Wait for read function to end
while(self.state == ISMS_AE_STATE_waitingForData)
{
DLog(@"still waiting for data, sleeping");
usleep(50);
}

DLog(@"freeing bass");
BOOL success = BASS_Free();
DLog(@"bass freed");

Everything works perfectly up until BASS_Free is called, then it hangs and does not return. So "freeing bass" is printed to the log then nothing after that.

I've tried a dozen different things and variations and it always hangs on the BASS_Free call if the loop is broken by setting audioQueueShouldStopWaitingForData = NO and then BASS_Free is called after the read proc returns. If the song is playing normally (not currently in the wait loop) and BASS_Free is called, it works fine.

I don't get why it would hang BASS since the read proc has returned at that point, essentially making the while loop irrelevant (though obviously it isn't).
Logged
Ian @ un4seen
Administrator
Posts: 15253


« Reply #393 on: 16 Feb '12 - 15:17 »
Reply with quoteQuote

BASS_Free will free all streams (on the freed device) before returning. It sounds like it might be stuck in that in this case, eg. waiting for a callback function to return. If you build your app with debug symbols and run it under the debugger, and then "pause" when it hangs, what do you see in each thread's call-stack?

By the way, an update with support for buffered file and internet streams with CoreAudio codecs (eg. AAC) should be available shortly, which (if I recall correctly) may allow you to simplify your code. Testing it at the moment.
Logged
einsteinx2
Posts: 61


« Reply #394 on: 16 Feb '12 - 20:07 »
Reply with quoteQuote

Ha! Turned out to be a simple deadlock, and entirely the fault of my code Smiley

Sorry for the implication that it was a BASS issue!

Btw that's great to hear about the buffered stream support for CoreAudio decoded streams.
Logged
einsteinx2
Posts: 61


« Reply #395 on: 16 Feb '12 - 21:34 »
Reply with quoteQuote

Btw, I just noticed in the docs for the BASS_CONFIG_UPDATETHREADS option that on iOS it is limited to 1 thread. Now that there are dual core A5 chips (and the possibility of quad core A6 on the horizon), is it possible to increase that limit or is there a technical reason for it to need to be 1 on iOS?
Logged
Ian @ un4seen
Administrator
Posts: 15253


« Reply #396 on: 17 Feb '12 - 16:36 »
Reply with quoteQuote

The BASS_CONFIG_UPDATETHREADS limit was introduced just to save a bit of filesize on something that wasn't really needed as there were only single core devices available at the time, but it may indeed be due for removal. In fact, an update that does remove it is now up in the 1st post Smiley

The update also adds the previously mentioned support for buffered file and internet streams with CoreAudio codecs. That seems to be working nicely so far, but troublesome cases are always a possibility, so please report if you encounter any any.
Logged
einsteinx2
Posts: 61


« Reply #397 on: 17 Feb '12 - 23:41 »
Reply with quoteQuote

The BASS_CONFIG_UPDATETHREADS limit was introduced just to save a bit of filesize on something that wasn't really needed as there were only single core devices available at the time, but it may indeed be due for removal. In fact, an update that does remove it is now up in the 1st post Smiley

The update also adds the previously mentioned support for buffered file and internet streams with CoreAudio codecs. That seems to be working nicely so far, but troublesome cases are always a possibility, so please report if you encounter any any.
Awesome, thanks! I'll let you know if I run into any issues.
Logged
Delphinus
Posts: 39


« Reply #398 on: 23 Feb '12 - 15:59 »
Reply with quoteQuote

Hi,

I have questions about BPM_Beat function. I was just wondering which way would cost less ressources. I want to retrieve the position in milliseconds of a beat in real-time so I use BASS_FX_BPM_CallbackSet. But I only want to retrieve that when I press a button in my app. Using the Callback_Set function it will retrieve the value any time there is a beat detected e.g once the button pressed it triggers the callback until I reset it. My question is what's better between leaving the callback retrieve the beat every time and just remove the callback when I don't need it anymore?
It means that when I press a button it will detect the beat just once and stop the callback, then if I press the button again it will detect the beat again

In other words will the use of BASS_FX_BPM_BeatCallbackSet then BASS_FX_BPM_BeatCallbackReset cost more ressources than a simple call of BASS_FX_BPM_CallbackSet or it doesn't really matter?

I'm not sure if it is clear sorry Wink
Logged
einsteinx2
Posts: 61


« Reply #399 on: 24 Feb '12 - 01:29 »
Reply with quoteQuote

Ian, I tried out the new BASS lib that you posted but I'm having some issues (not just related to the new version).

First to describe overall what I'm doing, I'm streaming song files that are downloaded by a separate part of the app, using BASS_StreamCreateFileUser. The files may either be fully downloaded, or may be in the process of downloading when BASS_StreamCreateFileUser is called. They are read using DECODE streams fed into an output stream to obtain gapless playback. This works 100% perfectly if the files are all on disk and not in the process of downloading when they are played.

Here are the issues I'm having while playing songs that are currently being downloaded:

1. In my read proc, if I always return the actual file size on disk, it will cause the output channel to think that the file is finished (checking with BASS_ChannelIsActive) if it is still downloading and the read proc hits an EOF. BASS docs say that it should retry when there is no data left (so I would assume it should return STALLED or PAUSED rather than STOPPED from BASS_ChannelIsActive), but that is not the case. It only continues to retry if I fool it by returning the server supplied length rather than the real length. That would be fine, however that causes issue number 2:

2. If I return the server provided length, that makes BASS retry reading the file when it hits the end. So far so good. However, if I free bass while it is waiting for the end of file, it freezes the thread that BASS_Free is called from (in my case the main thread). This is different from the deadlock issue I was experiencing earlier. In this case there are no locks. I added some log statements and found that it was just calling the file size proc over and over again (getting the same server reported file size over and over) and not even calling the read proc. Like it was waiting to see the length get bigger or something.

3. Also, when the file runs out, I'm trying to pause playback until 5 seconds worth of audio has been downloaded. I tried using a BUFFER stream, but it doesn't buffer, it just sets the channel as inactive when it runs out of data just like a NOBUFFER stream. I've been implementing the wait myself by tricking the read proc, but that has issues as well. My trick is to see how many bytes were read. If it is less than the length requested, instead of returning the smaller number, I seek back however many bytes were read and return 0. This forces bass to keep asking for data until I'm ready to give it some, in this case once 5 seconds worth of audio has been downloaded. If I don't do that trick, then bass only pauses for long enough to get one buffer's worth of data, which can cause very stuttered playback. However, the problem with this trick, is that if there is not enough data right away to start playback, it will never start because it keeps waiting for 5 seconds worth to download, reading 0 bytes (which apparently some of the file detection reads are supposed to do), then waiting for 5 more seconds of audio. But I have no way to check that detection has completed to handle that differently.

4. Lastly, for some reason BASS is blocking on BASS_StreamCreateFileUser calls instead of failing when there is not enough data and I'm returning a larger than on disk size from the len proc. I remember it was failing (so I would just retry after a second) when I was first testing BASS a couple months ago, but now it seems to just get stuck in my read and len procs until it identifies the format.


Am I running into bugs in BASS or am I implementing it improperly? I'm assuming the latter, but I'm not sure how else to do it. How would you suggest I accomplish my goal of playing currently downloading files, gapless playback, and pausing for a certain amount of time (based on bytes downloaded) when there is not enough file left?
Logged
Pages: 1 ... 18 19 [20] 21 22 ... 36
  Reply  |  Print  
 
Jump to:  

Powered by SMF 1.1.18 | SMF © 2013, Simple Machines