19 May '13 - 08:44 *
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: Multiple samples clipping while being played  (Read 2755 times)
Digriz
Posts: 6


« on: 16 Jan '06 - 22:03 »
Reply with quoteQuote

Hi,

I've just implemented BASS into my shareware game and i cannot figure out a little problem to do with the sound engine.

Every sound effect(WAV) that i load using BASS_SampleLoad is given a maximum number of channels of 5.

Basically one of the samples, a laser noise, is fired off pretty much continuously.  When i fire off my explosion samples or pick up samples they start to play and are then stopped or at least clipped.

If i don't have the laser sample playing continuously then these other samples play correctly.

I am using the BASS_SampleGetChannel function to get the next available channel per sample and it isn't failing.

Can anyone tell me what i am doing wrong here?

thanks,
Digriz
Logged
Ian @ un4seen
Administrator
Posts: 15244


« Reply #1 on: 17 Jan '06 - 15:17 »
Reply with quoteQuote

What soundcard/drivers do you have, and have you tried reproducing the problem on another system?

Also, what does your BASS_SampleLoad call look like? You could see if adding the BASS_SAMPLE_SOFTWARE flag helps.
Logged
Digriz
Posts: 6


« Reply #2 on: 17 Jan '06 - 15:47 »
Reply with quoteQuote

I've tried it on my work and home pc's.

My work one has one built into the motherboard and it's called SoundMAX Integrated Digital Audio.  I have the latest version of DX9 installed on both machines.  Without checking my machine at home, i couldn't say what the card is exactly but i know it's a Creative Labs card and it's a few years old.

Below the line of code taken straight out, i did try the BASS_SAMPLE_SOFTWARE flag but as far as i could tell it didn't make any difference.

m_hSfx = BASS_SampleLoad( FALSE, pszSfxName, 0, 0, 5, BASS_SAMPLE_OVER_POS/* | BASS_SAMPLE_SOFTWARE*/);

to play the sample, i use:-

HCHANNEL nChannel = BASS_SampleGetChannel( m_hSfx, FALSE);

BASS_ChannelSetAttributes( nChannel, -1, (S32)(cAudio::GetDefaultSfxVolume() * 100.0f),-101);
BASS_ChannelPlay( nChannel, FALSE);


If it's any use, i have played games on both machines that use the BASS sdk and they don't appear to have any problems.  I'm assuming it's something that i'm doing.

[EDIT]  Just did a dxdiagnostic and it says that my sound card does not have hardware buffers.
« Last Edit: 17 Jan '06 - 15:54 by Digriz » Logged
Ian @ un4seen
Administrator
Posts: 15244


« Reply #3 on: 18 Jan '06 - 16:47 »
Reply with quoteQuote

The only time a sample should be stopped prematurely is when the sample's "max" playbacks is reached, but that shouldn't be affected by other samples (eg. your laser). Are you certain the laser sample is affecting the playback of other samples, and it's not just that there are already 5 simultaneous playbacks of the chopped samples? You could try raising the "max" parameter to test that.

If you are sure the laser sample is affecting the others, could you whip together a small example to reproduce the problem?
Logged
Digriz
Posts: 6


« Reply #4 on: 18 Jan '06 - 17:05 »
Reply with quoteQuote

Hi,

I did set the "max" variable to 50 and i got the same results.  I will knock up a sample program tonight to try and get the same problem to happen.

I will try to get it to you this evening or tomorrow..

Or if you prefer, i can send you the entire project as it stands.  It's pretty small.

Thanks.
Logged
Digriz
Posts: 6


« Reply #5 on: 19 Jan '06 - 09:57 »
Reply with quoteQuote

I have sent you an email via the contact form and have put a small example onto your ftp site.
Logged
Ian @ un4seen
Administrator
Posts: 15244


« Reply #6 on: 19 Jan '06 - 14:43 »
Reply with quoteQuote

Yep, I received your example. The samples are being chopped because BASS_SampleStop is called before each sample playback Smiley
Logged
Digriz
Posts: 6


« Reply #7 on: 19 Jan '06 - 15:29 »
Reply with quoteQuote

Ooh....how embarassing for me.  Roll Eyes

Thanks for the help ian.  That has fixed it.  I had created a similar music class, copied the class but forgot to remove that sfx class stop functionality.

Sometimes, i guess i can't see the wood for the trees.

« Last Edit: 19 Jan '06 - 15:58 by Digriz » Logged
Pages: [1]
  Reply  |  Print  
 
Jump to:  

Powered by SMF 1.1.18 | SMF © 2013, Simple Machines