25 May '13 - 18:13 *
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: ASIO Playback too fast  (Read 491 times)
hwahrmann
Posts: 116


« on: 27 Apr '12 - 16:38 »
Reply with quoteQuote

Hi,

got a problem with playback of streams with different sample rates.
Problem is, that only a file with the same Sample Rate and Channels as the first one played after init, plays ok. All the others in the middle play too fast.


I have a Device with 8 Channels.

playback is from a Mixer like this:
_mixer = BassMix.BASS_Mixer_StreamCreate(stream.ChannelInfo.freq, stream.ChannelInfo.chans, BASSFlag.BASS_MIXER_NONSTOP | BASSFlag.BASS_SAMPLE_FLOAT | BASSFlag.BASS_STREAM_DECODE | BASSFlag.BASS_MIXER_NORAMPIN);


And i use either the Bass.Net Asio Handler:

_asioHandler = new BassAsioHandler(_asioDevice, 0, _mixer);

or also tried without the handler, by enabling the first channel and joining the other channels.
Both methods show the same behaviour.

Sequence is like this:

1. Create a stream for a file
2. Check, if the new stream has the same amount of channels and same Sample rate as the already existing Mixer
3. If not, Create a new Mixer with the specs for the new stream and setup the ASIO

using that as you can see from the output of my test program, which is attached, a playback of the 66 channel Flac file on 96k was started. it played ok.
All the other files in between played too fast.
The last file in the list was again a 6 channel flac file with 96k, as the first one. And this played ok again.

Any clue, what i'm doing wrong?

thanks,

Helmut





* files.zip (5.27 KB - downloaded 2 times.)
Logged
Ian @ un4seen
Administrator
Posts: 15276


« Reply #1 on: 27 Apr '12 - 17:16 »
Reply with quoteQuote

Please check the return values from the BASSASIO function calls. It looks like the problem may be that BASS_ASIO_Stop is not called to stop the ASIO output before changes to the ASIO channel setup are attempted via BASS_ASIO_ChannelReset/Enable/Join, in which case those calls will be failing. It also appears that the old mixer isn't getting freed (via BASS_StreamFree) when a new one is created?
Logged
hwahrmann
Posts: 116


« Reply #2 on: 28 Apr '12 - 14:35 »
Reply with quoteQuote

You're right. The calls to BASS_ASIO_ChannelReset/Enable/Join failed, because the device is started.
Having a problem with the mixer tough. if i free the mixer and then create a new one, when i start theAsio device again, i'll get AccessVilotaion exceptions in the Asio Callback.
have no clue why, this happens.
Logged
Ian @ un4seen
Administrator
Posts: 15276


« Reply #3 on: 30 Apr '12 - 15:13 »
Reply with quoteQuote

To confirm that it's crashing in the "AsioCallback" function and perhaps get some additional clues, please try adding some logging there. For example, something like this...

    private int AsioCallback(bool input, int channel, IntPtr buffer, int length, IntPtr user)
    {
// log parameters here
      // Note: 'user' contains the underlying stream channel (see above)
      // We can simply use the bass method to get some data from a decoding channel
      // and store it to the asio buffer in the same moment...
      int r=Bass.BASS_ChannelGetData(user.ToInt32(), buffer, length);
// log return value here
      reutrn r;
    }

If you do that, what does the log look like prior to the crash?
Logged
hwahrmann
Posts: 116


« Reply #4 on: 5 May '12 - 14:56 »
Reply with quoteQuote

Crash was in the Callback.
But never mind, it only happens in this test program.
In my "real" program the crash diesn not occur.

And because i am stopping the asio device now and releasing the mixer, the problem is solved.
Logged
Pages: [1]
  Reply  |  Print  
 
Jump to:  

Powered by SMF 1.1.18 | SMF © 2013, Simple Machines