19 Jun '13 - 10:14 *
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 ... 12 13 [14] 15 16 ... 37
  Reply  |  Print  
Author Topic: BASS for iOS (iPhone/iPad)  (Read 115560 times)
johan
Posts: 18


« Reply #260 on: 21 Jul '11 - 11:54 »
Reply with quoteQuote

Hello!

Been using the iOS version a while and it's working great.
Is there a way to enable AirPlay for BASS?

http://www.apple.com/itunes/airplay/

I know it's possible in MPMoviePlayerController in iOS 4.3+, but I can't find any other way to enable it with other sound sources...
Logged
Ian @ un4seen
Administrator
Posts: 15363


« Reply #261 on: 21 Jul '11 - 16:48 »
Reply with quoteQuote

I'm having trouble with  BASS_ChannelSetPosition.

When I call this line several times one-by-one:
BASS_ChannelSetPosition(playedChannel, BASS_ChannelSeconds2Bytes(playedChannel, 0.0), BASS_POS_BYTE);       
Some "click" sound appears at every start each of playing.
How can I fix it?

Thanks in advance.

UPDATE:
The same effect ("click sound") caused by (while channel is playing):
BASS_ChannelStop(playedChannel);   

There can be a click due to a sudden change of level, eg. when a loud sound suddenly stops. To avoid that, you could try setting the volume to 0 before seeking/stopping, and then raising it again after. BASS will ramp volume changes, which should remove the click. You could do something like this...

BASS_ChannelSetAttribute(playedChannel, 0); // silence the channel
usleep(10000); // wait a bit for it to take effect on the output
BASS_ChannelSetPosition(playedChannel, ...); // seek
BASS_ChannelSetAttribute(playedChannel, 1); // restore the volume level

Is there a way how to change default audio session category on iOS?

I'm using the latest version (1 Jul '11) on iPad and I want to set kAudioSessionCategory_SoloAmbientSound category - it seems that Bass is using kAudioSessionCategory_MediaPlayback by default (the music/sounds are not muted by silent switch and when the power button is pressed, and also the music/sounds are mixed with iPod music).

BASS does indeed set the audio session category to kAudioSessionCategory_MediaPlayback by default. An update is now up, in which an "ambient" category option is added to the BASS_CONFIG_IOS_MIXAUDIO option. See the 1st post for details.

Is there a way to enable AirPlay for BASS?

http://www.apple.com/itunes/airplay/

I know it's possible in MPMoviePlayerController in iOS 4.3+, but I can't find any other way to enable it with other sound sources...

I haven't tried it myself, so I'm not sure about it, but searching the Apple documentation throws up this...

   http://developer.apple.com/library/ios/#documentation/MediaPlayer/Reference/MPVolumeView_Class/Reference/Reference.html
Logged
johan
Posts: 18


« Reply #262 on: 22 Jul '11 - 12:16 »
Reply with quoteQuote

Oh didn't see that, will try and see if that works, thanks!

Another thing I'm wondering is if BASS_STREAM_RESTRATE is broken on
the iPhone version? It doesn't seem to restrict the speed at all while
in use. I need to minimize the CPU usage since I'm streaming two songs
at once from the network, and the CPU usage is much higher while the
song is downloading at full speed. How does that flag work? I ran
Instruments on the process while begining to stream a single 18 MB 320
kbps MP3, it's looking something like this:

(Network samples from Instruments)
Net Bytes in Per Second:
382 KB
1.31 MB
1.47 MB
1.83 MB
2.41 MB
3.69 MB
5.00 MB

So the entire 18 MB file is downloaded in a matter of seconds. This is
really hard on the iPhone's CPU. I'm creating a decoder stream from a
network location like so:

decoderFlags = BASS_STREAM_RESTRATE | BASS_STREAM_DECODE | BASS_SAMPLE_FLOAT;
decoderStream = BASS_StreamCreateURL([url cStringUsingEncoding: NSUTF8StringEncoding], 0, decoderFlags, NULL, 0)

I have not modified NET_BUFFER or NET_PREBUF in any way...
Logged
Ian @ un4seen
Administrator
Posts: 15363


« Reply #263 on: 22 Jul '11 - 17:04 »
Reply with quoteQuote

Oops, it looks like the BASS_STREAM_RESTRATE flag was broken around the 2.4.7.8 build. An update to correct that is up in the 1st post now.
Logged
johan
Posts: 18


« Reply #264 on: 22 Jul '11 - 21:06 »
Reply with quoteQuote

Oops, it looks like the BASS_STREAM_RESTRATE flag was broken around the 2.4.7.8 build. An update to correct that is up in the 1st post now.

Works great now, much lower CPU usage Smiley!
Logged
mits
Posts: 6


« Reply #265 on: 27 Jul '11 - 07:59 »
Reply with quoteQuote

Hello,

I am trying to export a channel to AAC file using BASSenc in iPhone 4 and  it's not working.

I have tried this code:
BASS_Encode_StartCAFile(channel, 'mp4f', 'aac ', 0, 128000, "output.mp4");

But error BASS_ERROR_FORMAT is returned by BASS_ErrorGetCode().

I also tried in AIFC and ALAC format with the same channel, and these work fine.
How can I output it in AAC?

Thanks in advance.
Logged
Ian @ un4seen
Administrator
Posts: 15363


« Reply #266 on: 28 Jul '11 - 15:29 »
Reply with quoteQuote

A BASS_ERROR_FORMAT error indicates that the source sample format wasn't accepted by the encoder. What is the format? You can use BASS_ChannelGetInfo to check that (the "freq" and "chans" information).
Logged
mits
Posts: 6


« Reply #267 on: 29 Jul '11 - 04:09 »
Reply with quoteQuote

The format of the source file is AAC. These were imported from CD using iTunes.
And channel info from BASS_ChannelGetInfo() as follows.

freq : 44100
chans : 2
flags : 0x10114
ctype : 0x10007
origres : 0


Is there any problem?
Logged
Ian @ un4seen
Administrator
Posts: 15363


« Reply #268 on: 29 Jul '11 - 15:22 »
Reply with quoteQuote

44100 Hz stereo should of course be supported by the AAC codec, so that's strange. To check whether it's anything to do with the source file being AAC itself, please see what happens when you try encoding from another format, eg. WAV. Please also confirm what iOS version you have installed, and does the problem happen on the simulator too?
Logged
mits
Posts: 6


« Reply #269 on: 30 Jul '11 - 05:48 »
Reply with quoteQuote

I tried other source file formated MP3 and WAV, but same problem was happened.

I also tried from AAC file by the following setting. All of them worked fine.
BASS_Encode_StartCAFile(channel, 'm4af', 'alac', 0, 0, "output.m4a");

BASS_Encode_StartCAFile(channel, 'AIFC', 'ima4', 0, 0, "output.aif");

BASS_Encode_StartCAFile(channel, 'WAVE', 'ulaw', 0, 0, "output.wav");


And there was no problem on the simulator. The channel was encoded to AAC.
But I can not encode AAC on the device. The iOS version of my device is 4.3.3.
« Last Edit: 30 Jul '11 - 06:07 by mits » Logged
daviticus
Posts: 8


« Reply #270 on: 31 Jul '11 - 16:12 »
Reply with quoteQuote

Hi,

I'm using libbass for iOS and I'm having some issues with simultaneous playback and recording. I'm playing wav files within my app using the following code (paraphrased, but this includes all BASS-related calls):

BASS_Init(-1, 44100, 0, 0, NULL);
BASS_RecordInit(-1);
HSAMPLE sample = BASS_SampleLoad(false, "test.wav", 0, 0, 1, BASS_SAMPLE_OVER_POS);
HCHANNEL chan = BASS_SampleGetChannel(sample, false);
BASS_ChannelSetAttribute(chan, BASS_ATTRIB_VOL, 1.0);
BASS_ChannelPlay(chan, true);

If I omit the call to BASS_RecordInit, everything works fine, but with that call included the playback is suddenly extremely quiet, almost inaudible even at maximum volume. (It does still play, though, so something is still happening.) Am I missing some configuration or extra step I need to play and record at the same time?
Logged
daviticus
Posts: 8


« Reply #271 on: 31 Jul '11 - 17:26 »
Reply with quoteQuote

Never mind -- answered my own question after a couple more hours of troubleshooting. I needed to add the line:

BASS_SetConfig(BASS_CONFIG_IOS_SPEAKER, 1);

I gather this is off by default to prevent feedback caused by playing in the same location as the microphone (but feedback isn't an issue for my app, so this works fine for me)...

That was one of my last issues, so I bought my shareware license and will hopefully submit my app this week! My only other question is... any chance of an Android version in the works?  Roll Eyes
« Last Edit: 31 Jul '11 - 22:30 by daviticus » Logged
Ian @ un4seen
Administrator
Posts: 15363


« Reply #272 on: 1 Aug '11 - 13:35 »
Reply with quoteQuote

But I can not encode AAC on the device. The iOS version of my device is 4.3.3.

It totally slipped my mind earlier, but I suspect the issue is the BASS_CONFIG_IOS_MIXAUDIO setting. That needs to be set to 0 (via BASS_SetConfig) in order to use AAC encoding. I will add a note of that in the 1st post (it's currently only mentioned somewhere in amongst this large thread).

any chance of an Android version in the works?  Roll Eyes

Not yet, but there are some plans for an Android version. At this stage, I can't say when (or even if for certain) it will be available, but the aim is to have something ready later this year.
Logged
mits
Posts: 6


« Reply #273 on: 4 Aug '11 - 16:53 »
Reply with quoteQuote

But I can not encode AAC on the device. The iOS version of my device is 4.3.3.

It totally slipped my mind earlier, but I suspect the issue is the BASS_CONFIG_IOS_MIXAUDIO setting. That needs to be set to 0 (via BASS_SetConfig) in order to use AAC encoding. I will add a note of that in the 1st post (it's currently only mentioned somewhere in amongst this large thread).

Thank you Ian! It works fine. Smiley
Logged
Mnemonic
Posts: 1


« Reply #274 on: 6 Aug '11 - 09:28 »
Reply with quoteQuote

Hello, I have a question regarding the mute button. I noticed that BASS doesn't react to muting sound on iPad2. Is the application supposed to handle muting itself, or do I need to do something to support muting? Thanks.

I'm using the latest BASS build and iOS 4.3.5.
Logged
skinnyTod
Posts: 22


« Reply #275 on: 8 Aug '11 - 14:25 »
Reply with quoteQuote

Hi - using the latest Bass iOS version to play midi files and dynamically generated midi events. I am finding a couple of issues:

- I am not able to get sync events to fire when using 'BASS_MIDI_StreamCreate'  - I AM able to get sync events when playing a midi file using 'BASS_MIDI_StreamCreateFile'. I set up the streams and syncs like this:

   chanIn = BASS_MIDI_StreamCreate(1, BASS_MIDI_NOFX, 0);
    chan=BASS_MIDI_StreamCreateFile(FALSE,[path cStringUsingEncoding:
                                           NSUTF8StringEncoding],0,0,0,0);
  
    BASS_ChannelSetSync(chanIn, BASS_SYNC_MIDI_EVENT, MIDI_EVENT_NOTE, FileNoteIn, self);
    BASS_ChannelSetSync(chan, BASS_SYNC_MIDI_EVENT|BASS_SYNC_MIXTIME, MIDI_EVENT_NOTE, UserNoteIn, self);

And then to test for sync event, trigger the code below through a button press. The note sounds but the sync callback doesn't get called.
I've tried everything I can think of. Am I setting the sync up wrong?

BASS_MIDI_StreamEvent(chanIn, 0, MIDI_EVENT_NOTE,  MAKEWORD(77, 127));

sync callback:
void CALLBACK FileNoteIn(HSYNC handle, DWORD channel, DWORD data, void* user)
{
     NSLog(@"FileNoteIn");
    int note=LOBYTE(data); // note
    int vel=HIBYTE(data); // velocity
 
}


The other thing I've found is that 'BASS_MIDI_StreamEvents' throws an error:
EDIT: just noticed the reply to my post @ this issue in a different thread. Will try the updated lib.
 
undefined symbols for architecture i386:
  "_BASS_MIDI_StreamEvents", referenced from:
      -[BassController initBassWithView:user:] in BassController.o
ld: symbol(s) not found for architecture i386
collect2: ld returned 1 exit status

Thanks for any help!
« Last Edit: 8 Aug '11 - 14:27 by skinnyTod » Logged
Ian @ un4seen
Administrator
Posts: 15363


« Reply #276 on: 10 Aug '11 - 15:21 »
Reply with quoteQuote

- I am not able to get sync events to fire when using 'BASS_MIDI_StreamCreate'  - I AM able to get sync events when playing a midi file using 'BASS_MIDI_StreamCreateFile'.

BASS_SYNC_MIDI_EVENT syncs aren't triggered by BASS_MIDI_StreamEvent calls. One typical use of BASS_MIDI_StreamEvent is to override events within BASS_SYNC_MIDI_EVENT sync callbacks, and without some special consideration by the callback function, that would result in recursive callbacks and an eventual stack overflow if the syncs were triggered by BASS_MIDI_StreamEvent.

The BASS_MIDI_StreamEvents function has since been added, and that does include the option of having BASS_SYNC_MIDI_EVENT syncs triggered via the BASS_MIDI_EVENTS_SYNC flag. As well as supporting multiple events, that can also be used in place of BASS_MIDI_StreamEvent (with mode=BASS_MIDI_EVENTS_STRUCT) to play a single event.
Logged
skinnyTod
Posts: 22


« Reply #277 on: 10 Aug '11 - 17:26 »
Reply with quoteQuote

Thanks. I finally saw in the docs that 'BASS_MIDI_StreamEvent' didn't support sync.

I was finally able to get things working with the code below - getting MIDI packets (CoreMidi) from a keyboard attached to an iPad through a Camera Connector and repackaging the data in the BASS_MIDI_EVENT struct format. Not pretty I guess but it works. Is there a better way to do this? I tried the 'BASS_MIDI_EVENTS_RAW' mode but that didn't work. I think I'm going to run into some issues with non-key midi events.

Since iOS now supports midi in, are there any plans to add that to Bass?

Thanks for the help!

- (void) MidiIn:(const MIDIPacketList*)packetList
{
    int len = packetList->numPackets;
    const MIDIPacket *packet = &packetList->packet[0];
    BASS_MIDI_EVENT events[len];
   
    for (int i = 0; i < len; ++i)
    {
        events[i].event = MIDI_EVENT_NOTE;
        events[i].param=MAKEWORD(packet->data[1], packet->data[2]);
        events[i].chan=0;
        packet = MIDIPacketNext(packet);
    }
   
    BASS_MIDI_StreamEvents(chanIn, BASS_MIDI_EVENTS_SYNC, events, len);
}
Logged
Ian @ un4seen
Administrator
Posts: 15363


« Reply #278 on: 10 Aug '11 - 17:59 »
Reply with quoteQuote

Since iOS now supports midi in, are there any plans to add that to Bass?

I haven't tried it myself yet, but a BASSMIDI build including the MIDI input functions is now up in the iOS package (see 1st post). Please report how you get on with it.

Note BASSMIDI delivers raw MIDI data (not MIDI_EVENT_NOTE/etc), so you would use the mode=BASS_MIDI_EVENTS_RAW option with BASS_MIDI_StreamEvents to play it via a MIDI stream. If you would like to see an example of that, you can find one in the SYNTH example that's included in the BASSMIDI package on one of the other supported platforms; although it's a different platform, the BASS/MIDI calls will be the same.
Logged
skinnyTod
Posts: 22


« Reply #279 on: 16 Aug '11 - 02:55 »
Reply with quoteQuote

Trying MIDI in with Bass iOS - I get 'Undefined symbols' errors for all the MIDI in calls.

Undefined symbols for architecture i386:
  "_BASS_MIDI_InGetDeviceInfo", referenced from:
      -[BassController getDeviceInfo] in BassController.o

  "_BASS_MIDI_InInit", referenced from:
      -[BassController getDeviceInfo] in BassController.o
ld: symbol(s) not found for architecture i386
collect2: ld returned 1 exit status
Logged
Pages: 1 ... 12 13 [14] 15 16 ... 37
  Reply  |  Print  
 
Jump to:  

Powered by SMF 1.1.18 | SMF © 2013, Simple Machines