25 May '13 - 05:17 *
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]
  Reply  |  Print  
Author Topic: Bass on iPhone simply doesn't have any playback at all of samples and no errors  (Read 1780 times)
hippocoder
Posts: 14


« on: 15 Apr '10 - 15:56 »
Reply with quoteQuote

Please help me figure why there's no sound on device or sim (I am compiling and using bass and there's no errors and bass isnt returning errors)

// initialize default output device
if (!BASS_Init(-1,44100,0,0,NULL))
{
Log("Can't initialize device");
return;
}

NSString *resourcePath = [[NSBundle mainBundle] resourcePath];
[[NSFileManager defaultManager] changeCurrentDirectoryPath:resourcePath];

//log
Log("LoadSample("+filename+")");

//temp
sSound sound;

//filename
sound.filename = filename;

//flags
int flags = 0;
if (looping)
{
flags = BASS_SAMPLE_LOOP;
}

//load and return
char* cstring = (char*)filename.c_str();
sound.data = BASS_SampleLoad(FALSE, cstring, 0, 0, 1, 0);//flags|BASS_SAMPLE_OVER_POS);

if (sound.data == 0) Log("Failed to load sample.");


//Tried HCHANNEL with no luck too
HSTREAM channel = BASS_SampleGetChannel(sound.data, TRUE); // get a sample channel
bool success = BASS_ChannelPlay(channel, FALSE); // play it - second param good for machine guns or stuff

if (channel && success)
{
Log("PlaySampleChannel("+sound.filename+")");
}
else
{
Log("PlaySampleChannel("+sound.filename+") FAILED.");
}
« Last Edit: 15 Apr '10 - 16:13 by hippocoder » Logged
hippocoder
Posts: 14


« Reply #1 on: 15 Apr '10 - 16:15 »
Reply with quoteQuote

All I am trying to do is load mp3s or random sounds as samples and play them in game as music and sound effects, nothing special.

I don't mind preloading mp3 music either. I just want the simplest form of playback and its not happening, and I don't know what I am missing. Still examining the examples and docs 8 hours later since last night.
Logged
Ian @ un4seen
Administrator
Posts: 15276


« Reply #2 on: 15 Apr '10 - 16:49 »
Reply with quoteQuote

That's strange. Trying the same code, I do hear the sample play. To see if the problem you're having is limited to samples, do you hear anything if you use BASS_StreamCreateFile instead to play the file? Please also try checking what BASS_ChannelIsActive and BASS_ChannelGetPosition say, eg. in a timer.
Logged
hippocoder
Posts: 14


« Reply #3 on: 15 Apr '10 - 17:16 »
Reply with quoteQuote

Hi Ian, thank you for replying. I did as you suggested:

* The same is happening with BASS_StreamCreateFile.

* The output of BASS_ChannelIsActive() is: "BASS_ACTIVE_STOPPED   The channel is not active, or handle is not a valid channel."

* Samples used work with Cocos sound library for iphone, cocos denshion, and are just a mario theme tune and boing jump sample for testing purposes.

The handle I am using looks like a large int, it certainly isn't null. And is obtained via HCHANNEL channel = BASS_SampleGetChannel(sound.data, TRUE).  BASS_SampleGetChannel seems to be creating a valid handle at least.
« Last Edit: 15 Apr '10 - 17:22 by hippocoder » Logged
hippocoder
Posts: 14


« Reply #4 on: 15 Apr '10 - 17:43 »
Reply with quoteQuote

One more thing: I have tested it with GCC 4.0 and 4.2. I have tested only on 3.1 SDK(I can't roll back to 3.0).

Logged
Ian @ un4seen
Administrator
Posts: 15276


« Reply #5 on: 15 Apr '10 - 17:49 »
Reply with quoteQuote

To confirm... you can hear sound from other apps, so it's not just that the volume is turned down? Smiley

If so, I think I will have to send you a debug version to find out what's going wrong.
Logged
hippocoder
Posts: 14


« Reply #6 on: 15 Apr '10 - 17:50 »
Reply with quoteQuote

Yes my sound is loud and clear on itunes etc Smiley

you can mail to my forum account email or anything you like and I'll get the info to you asap (working all day today on sound).
Logged
hippocoder
Posts: 14


« Reply #7 on: 15 Apr '10 - 18:54 »
Reply with quoteQuote

I hope you are able to discover the issue - fmod changelogs show a few iphone gotchas, might be a 3.1 thing?
Logged
hippocoder
Posts: 14


« Reply #8 on: 16 Apr '10 - 12:25 »
Reply with quoteQuote

May be limited to 3.1 and above. I have sadly had to move to using openAL as I don't have time. I'll be back though as BASS is cross platform and sexy. Just not for deadline sensitive.
Logged
Ian @ un4seen
Administrator
Posts: 15276


« Reply #9 on: 16 Apr '10 - 13:13 »
Reply with quoteQuote

I'm using 3.1.3 myself, so I don't think that's the problem. It would be interesting to find out what the problem is, though. I sent you a debug version shortly after my last post yesterday, so it should have arrived there by now. If you don't see it, perhaps it has ended up in your spam folder?
Logged
hippocoder
Posts: 14


« Reply #10 on: 16 Apr '10 - 13:37 »
Reply with quoteQuote

Ouch it was probably there in the spam folder quite some time, forcing me to roll my own. When I get time I shall run it for you. But at the moment have other deadlines to finish. Will get back in touch in this topic/email Smiley
Logged
hippocoder
Posts: 14


« Reply #11 on: 17 Apr '10 - 22:13 »
Reply with quoteQuote

Found time,

I have tested the output, I may have got some things wrong so I sent you output and code. Had to copy my example from above as I forgot how bass worked Smiley

Let me know what you think.
Logged
Pages: [1]
  Reply  |  Print  
 
Jump to:  

Powered by SMF 1.1.18 | SMF © 2013, Simple Machines