Ejemplo n.º 1
0
        private void Start()
        {
            //Debug.WriteLine("{0} {1} {2} {3}", "Start ASIO handler: ", AsioDevNum, AsioChannel, MixerStream);
            //Bass.Configure(Configuration.UpdatePeriod, 0);
            BassAsio.CurrentDevice = AsioDevNum;
            AsioInfo asioinfo;

            BassAsio.GetInfo(out asioinfo);
            BassAsio.Rate = 44100;
            dAsioProc     = new AsioProcedure(AsioProc);
            Cfg.AsioProcs.Add(dAsioProc); //prevent Garbage Collection
            CheckOKHard(BassAsio.ChannelEnable(false, 0, dAsioProc));
            CheckOKHard(BassAsio.ChannelJoin(false, 1, 0));
            BassAsio.ChannelSetFormat(false, 0, AsioSampleFormat.Bit16);
            BassAsio.ChannelSetFormat(false, 1, AsioSampleFormat.Bit16);
            SetdB();
            CheckOKHard(BassAsio.Start(asioinfo.PreferredBufferLength));
            //CheckOK(Bass.ChannelPlay(MixerStream, false));  //can't play decode chan
        }
Ejemplo n.º 2
0
        internal clsBASSOutDevAsio()
        {
            //* create mixer stream
            //* get asio infos
            AsioDeviceInfo asiodevinfo = new AsioDeviceInfo();

            BassAsio.GetDeviceInfo(AsioDevNum, out asiodevinfo);
            Debug.WriteLine("AsioDevInfo " + AsioDevNum + ": " + asiodevinfo.ToString());

            AsioInfo asioinfo;
            bool     ok = BassAsio.GetInfo(out asioinfo);

            if (!ok || asioinfo.Name == "")
            {
                Debug.WriteLine("No Asio Info");
            }
            else
            {
                Debug.WriteLine("AsioInfo " + ": " + asioinfo.ToString());
            }

            //AsioChannelInfo chaninfo = BassAsio.ChannelGetInfo(false, AsioDevNum);
            //if (chaninfo.Name == null || chaninfo.Name == "") Debug.WriteLine("No Asio Channel Info");
            //else Debug.WriteLine("AsioChannelInfo " + ": " + chaninfo.ToString());

            //* init
            //* no update - not played via BASS
            //* init nosound device
            Bass.Configure(Configuration.UpdatePeriod, 0);
            CheckOKHard(Bass.Init(0, 48000, 0, P.frmSC.Handle)); //44100 ignored (dev0=nosound/decode)
            //CheckOKHard(Bass.SetConfig(BASSConfig.BASS_CONFIG_UPDATEPERIOD, 0));
            //Bass.UpdatePeriod = 0;
            //* int mixer stream (no sound 2 channels=stereo)
            //MixerStream = TestBass.BASS_Mixer_StreamCreate(44100, 2,
            //  BASSFlag.BASS_SAMPLE_FLOAT | BASSFlag.BASS_STREAM_DECODE);
            MixerStream = CheckHandleHard(BassMix.CreateMixerStream(44100, 2,
                                                                    BassFlags.Decode));
            //* init asio stream on asiodevnum (optional)
            //TestBass.BASS_ASIO_Init(AsioDevNum, BASSASIOInit.BASS_ASIO_DEFAULT);  //(asiodev, flags)
            CheckOKHard(BassAsio.Init(AsioDevNum, AsioInitFlags.None)); //(asiodev, flags)
            Start();                                                    //should be OK to start and add channels later
        }