Author Topic: Occasional Loud buzzing/hissing with WinXP  (Read 436 times)

Figmo

  • Posts: 1
Occasional Loud buzzing/hissing with WinXP
« on: 26 Feb '13 - 13:51 »
Just released a new Karaoke app that uses Bass for the audio.   I'm noticing a pattern on my installations that are still using WinXP.   After an hour or 2 of using the app - in the middle of song playback - all of a sudden the audio just kicks into distortion with just nothing but noise coming out of the speakers.   Have not seen this on my Win7 installations.  And it does not seem to be song releated.  Restarting the software and playing the same song works fine.

To me - it sounds like a memory/handle leak or something that randomly builds over time to the point of failure.

I'm not really doing anything too fancy with Bass.   Here is my load code...

            if (m_hMP3Stream != 0)
            {
                // Free any previous stream (if any)...
                Bass.BASS_StreamFree(m_hMP3Stream);
                m_hMP3Stream = 0;
            }
            m_hMP3Stream = Bass.BASS_StreamCreateFile(m_strMP3FileName, 0, 0, BASSFlag.BASS_STREAM_DECODE | BASSFlag.BASS_SAMPLE_FLOAT | BASSFlag.BASS_STREAM_PRESCAN);
            m_hMP3Stream = Un4seen.Bass.AddOn.Fx.BassFx.BASS_FX_TempoCreate(m_hMP3Stream, BASSFlag.BASS_FX_FREESOURCE | BASSFlag.BASS_SAMPLE_FLOAT);
            if (m_hMP3Stream == 0)
                throw (new Exception(String.Format("PLAY() Reports: BassSoundLibrary Stream Error {0}", Bass.BASS_ErrorGetCode().ToString())));
            Bass.BASS_ChannelSetAttribute(m_hMP3Stream, BASSAttribute.BASS_ATTRIB_TEMPO_PITCH, 0.0f); //...adjust pitch
            Bass.BASS_ChannelSetAttribute(m_hMP3Stream, BASSAttribute.BASS_ATTRIB_VOL, 1.0f);  //...adjust volume

My play code...
            Bass.BASS_ChannelPlay(m_hMP3Stream, false);

And here is my stop code...
            Bass.BASS_ChannelStop(m_hMP3Stream);
            Bass.BASS_ChannelSetPosition(m_hMP3Stream, 0.00);

Repeated 20 or 30 times until eventual failure.

I'm diggin through my karaoke graphics display code right now looking for memory leaks that might be stomping on something else - but has anybody run into this before?  Is there something else I should be doing to free/load the bass streams from song to song?

Ian @ un4seen

  • Administrator
  • Posts: 20427
Re: Occasional Loud buzzing/hissing with WinXP
« Reply #1 on: 26 Feb '13 - 14:45 »
That code looks fine, eg. it doesn't look like it would be leaking any BASS resources. To confirm that no streams are being leaked, you could use the undocumented BASS_CONFIG_HANDLES option, as described here (it is present in the release version too):

   www.un4seen.com/forum/?topic=13103.msg91188#msg91188

Have you reproduced the problem with more than one soundcard? If not, please try another soundcard/system to check whether the problem may be driver-specific. Also try removing the BASS_SAMPLE_FLOAT flag for the same reason. You could also try removing the tempo stuff (ie. remove the BASS_FX_TempoCreate call and the BASS_STREAM_DECODE flag from the BASS_StreamCreateFile call), to see if the problem is related to the tempo processing.