24 May '13 - 22: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 problem with Digigram VX442e  (Read 379 times)
dfusek
Posts: 2


« on: 27 May '12 - 21:07 »
Reply with quoteQuote

I have a problem with digigram driver for VX442e card. This app should encode/decode strema for VOIP purposes.
As I need sample freq of 8 khz, I try to initialize inputs and outputs with 8000 sample rate.
It works for outputs (card nicely play audio), but when I try to initialze inputs (ChannelSetRatee(true, Globali.Line1InAudioChannel, 8000d),
app hangs, and driver stop to function until computer reset. If I use Asio4All driver with onboard audio card everything works fine.
I appreciate any idea, or am I trying something wrong ?

Thanks !

public void StartAudioCards()
        {
            Bass.BASS_SetConfig(BASSConfig.BASS_CONFIG_UPDATEPERIOD, 0);
            Bass.BASS_Init(-1, 48000, BASSInit.BASS_DEVICE_DEFAULT, IntPtr.Zero);
            BassAsio.BASS_ASIO_Init(0, BASSASIOInit.BASS_ASIO_DEFAULT);
            BASS_ASIO_INFO info = new BASS_ASIO_INFO();
            BassAsio.BASS_ASIO_GetInfo(info);
            BassAsio.BASS_ASIO_SetRate(48000d);

            //-BEGIN-----------------------------------------------------------Define audio output
            PushOut[0] = Bass.BASS_StreamCreatePush( Convert.ToInt32(Globali.OutputSampleFreq) , 1,
                                                        BASSFlag.BASS_STREAM_DECODE | BASSFlag.BASS_SAMPLE_8BITS,
                                                        IntPtr.Zero);
            AsioOut[0] = new BassAsioHandler(false, 0, Globali.Line1OutAudioChannel, 1, BASSASIOFormat.BASS_ASIO_FORMAT_16BIT, Convert.ToInt32(Globali.OutputSampleFreq));
            AsioOut[0].OutputChannel = PushOut[0];
            BassAsio.BASS_ASIO_ChannelSetRate(false, 0, 8000); // 8000 je sample rate iz odabranog codeca
            BassAsio.BASS_ASIO_ChannelSetFormat(false, Globali.Line1OutAudioChannel, BASSASIOFormat.BASS_ASIO_FORMAT_16BIT);
            //-END-----------------------------------------------------------Define audio output

            //-BEGIN-----------------------------------------------------------Define audio input
            PushIn[0] = Bass.BASS_StreamCreatePush(8000, 1,
                                                        BASSFlag.BASS_STREAM_DECODE | BASSFlag.BASS_SAMPLE_8BITS | BASSFlag.BASS_SAMPLE_MONO,
                                                        IntPtr.Zero); //postavljamo Push stream kao 1 kanalni stream
            BassAsio.BASS_ASIO_ChannelSetFormat(true, Globali.Line1InAudioChannel, BASSASIOFormat.BASS_ASIO_FORMAT_16BIT);
            BassAsio.BASS_ASIO_ChannelSetRate(true, Globali.Line1InAudioChannel, 8000d);
            MyAsioProcCh0 = new ASIOPROC(AsioInputCallbackCh0);
            BassAsio.BASS_ASIO_ChannelEnable(true, Globali.Line1InAudioChannel, MyAsioProcCh0, new IntPtr(PushIn[0]));
            //-END-----------------------------------------------------------Define audio input
           
            BassAsio.BASS_ASIO_Start(0);
            if (info.outputs > 0)
                AsioOut[0].Start(0);
        }

        private bool NewRtpPacketLine1(RTPPacket packet, byte[] rawBuffer)
        {
          if (_decoder[0] != null)
                {
                    byte[] pcm = _decoder[0].Decode(packet);
                    if (pcm != null)
                    {
                        Bass.BASS_StreamPutData(PushOut[0], pcm, pcm.Length);
                        if (BassAsio.BASS_ASIO_ChannelIsActive(false, 0) == BASSASIOActive.BASS_ASIO_ACTIVE_PAUSED)
                        {
                            BassAsio.BASS_ASIO_ChannelReset(false, 0, BASSASIOReset.BASS_ASIO_RESET_PAUSE);
                        }
                        //_asioOut[0].Start(0);
                    }
                }
                return false;
            }
        }
       
        private int AsioInputCallbackCh0(bool input, int channel, IntPtr buffer, int length, IntPtr user)
        {
                if (length > 0)
                {
                    byte[] ch0Bytes = new byte[length];
                    // the buffer member now contains the input sample data
                    if (_encoder[0] != null)
                    {
                        Bass.BASS_StreamPutData(PushIn[0], buffer, length);
                        Bass.BASS_ChannelGetData(PushIn[0], ch0Bytes, length);
                        RTPFrame frame = _encoder[0].EncodeToFrame(ch0Bytes);

                        if (frame != null) // && frame.PacketCount > 0)
                        {
                            if (_encoder[0] != null)
                            {
                                _session[0].Send(frame);
                            }
                        }
                    }
                }
                return 0;
            }
        }
    }
}
Logged
Ian @ un4seen
Administrator
Posts: 15276


« Reply #1 on: 28 May '12 - 15:46 »
Reply with quoteQuote

Is it getting stuck in the BASS_ASIO_ChannelSetRate call, ie. that never returns, or does it get stuck somewhere after that? If it is after, perhaps it is in the ASIOPROC function ("AsioInputCallbackCh0"). You could add logging to that, eg. log the entry and exit and see what the final log entry is when it gets stuck. Please also confirm what BASSASIO.DLL version you are using (you can use BASS_ASIO_GetVersion to check that), and what BASS.Net version too. If they aren't the latest versions, please try upgrading and see if the problem still occurs. If it does, I will probably need to send you a debug version to find out what's going wrong.
Logged
dfusek
Posts: 2


« Reply #2 on: 28 May '12 - 19:52 »
Reply with quoteQuote

Application hangs at BASS_ASIO_ChannelSetRate. When I stop app, Digigram driver is not functioning any more, and if I restart app it won't stuck, but also would not produce any sound.
When I restart computer, Digigram driver works, and app again hangs on first start.
I am using Bass.Net 2.4.8.4., and BASSASIO.DLL ver 1.2.
Could it be because VX442e supports only sample freq above 32 kHz ?
Logged
Ian @ un4seen
Administrator
Posts: 15276


« Reply #3 on: 29 May '12 - 13:20 »
Reply with quoteQuote

I'll send you a debug version to find out what's happening.
Logged
Pages: [1]
  Reply  |  Print  
 
Jump to:  

Powered by SMF 1.1.18 | SMF © 2013, Simple Machines