22 May '13 - 10:37 *
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: Playing an audio file with BASS  (Read 309 times)
Graham1
Posts: 35


« on: 3 Aug '12 - 17:07 »
Reply with quoteQuote

I am writing an application in Delphi that has a whole bunch of visual components. I press a button to start playing a file and all appears to be fine.

The first minor issue is that most of the Hints associated with all the buttons don't appear while the file is playing. The buttons still work but just no Hints.

The second problem is that if I start do do other things in the application while the file is playing, for example, if I drag an object from one string grid to another, I can hear a disturbance in the audio output. Is there a fix for this?

Would it help if I create another thread and play all the files from there. I don't know enough about the internal workings of BASS to know if that would make any difference.

Apologies for putting 2 questions in the same topic.

Any help much appreciated.
Logged
Ian @ un4seen
Administrator
Posts: 15259


« Reply #1 on: 3 Aug '12 - 17:22 »
Reply with quoteQuote

BASS creates dedicated thread(s) that decode data during playback, so playback should not be affected by GUI stuff. One way that it can be affected is if a callback function (eg. DSPPROC or STREAMPROC or "mixtime" SYNCPROC) does stuff that has to wait for the main/GUI thread. Are you using any callback functions, and if so, are they doing any GUI stuff, eg. updating controls? If so, you could have the callback just post a message (eg. PostMessage) to the main thread and do the GUI updating in the message handler.
Logged
Graham1
Posts: 35


« Reply #2 on: 5 Aug '12 - 17:51 »
Reply with quoteQuote

The only callbacks I use are to tell me when I have reached the end of the file. However, I have discovered the problem. While the file was playing, the actions I was performing in the GUI were causing other threads to be created. And it appears the action of creating a thread while a file is playing causes the disturbance. So scrapping these threads and just running this code in the main application fixes the problem.

Thanks for you help. Much appreciated.
Graham
Logged
Pages: [1]
  Reply  |  Print  
 
Jump to:  

Powered by SMF 1.1.18 | SMF © 2013, Simple Machines