コード例 #1
0
        /// <summary>
        /// Retrieves information on a device and adds it to the static deviceinfo dictionary do it can be reused later.
        /// </summary>
        /// <param name="deviceNo">Device number to retrieve information on.</param>
        private void CollectDeviceInfo(int deviceNo)
        {
            // Device info is saved in a dictionary so it can be reused lateron.
            if (!_deviceInfos.ContainsKey(deviceNo))
            {
                Log.Debug("Collecting device info");

                BASS_DEVICEINFO bassDeviceInfo = Bass.BASS_GetDeviceInfo(deviceNo);
                if (bassDeviceInfo == null)
                {
                    throw new BassLibraryException("BASS_GetDeviceInfo");
                }

                BASS_INFO bassInfo = Bass.BASS_GetInfo();
                if (bassInfo == null)
                {
                    throw new BassLibraryException("BASS_GetInfo");
                }

                DeviceInfo deviceInfo = new DeviceInfo
                {
                    Name     = bassDeviceInfo.name,
                    Driver   = bassDeviceInfo.driver,
                    Channels = bassInfo.speakers,
                    MinRate  = bassInfo.minrate,
                    MaxRate  = bassInfo.maxrate,
                    Latency  = TimeSpan.FromMilliseconds(bassInfo.latency)
                };

                lock (_deviceInfos)
                    _deviceInfos.Add(deviceNo, deviceInfo);
            }
            Log.Debug("DirectSound device info: {0}", _deviceInfos[_deviceNo].ToString());
        }
コード例 #2
0
ファイル: Encoder.cs プロジェクト: MackZ28/EZiePlayer
        private void Encoder_Load(object sender, System.EventArgs e)
        {
            //BassNet.Registration("your email", "your regkey");

            if (Bass.BASS_Init(-1, 44100, BASSInit.BASS_DEVICE_DEFAULT, this.Handle))
            {
                BASS_INFO info = new BASS_INFO();
                Bass.BASS_GetInfo(info);
                Console.WriteLine(info.ToString());

                _wmaPlugIn = Bass.BASS_PluginLoad("basswma.dll");
                // all fine
                int[] rates = BassWma.BASS_WMA_EncodeGetRates(44100, 2, BASSWMAEncode.BASS_WMA_ENCODE_RATES_CBR);
                foreach (int rate in rates)
                {
                    this.comboBoxRate.Items.Add(rate);
                }
                this.comboBoxRate.SelectedIndex = 0;
            }
            else
            {
                MessageBox.Show(this, "Bass_Init error!");
            }

            // init your recording device (we use the default device)
            if (!Bass.BASS_RecordInit(-1))
            {
                MessageBox.Show(this, "Bass_RecordInit error!");
            }
        }
コード例 #3
0
ファイル: BassEngine.cs プロジェクト: newcat/LedMusic
        private void Initialize()
        {
            positionTimer.Interval = TimeSpan.FromMilliseconds(50);
            positionTimer.Tick    += positionTimer_Tick;

            IsPlaying = false;

            Window mainWindow = Application.Current.MainWindow;
            WindowInteropHelper interopHelper = new WindowInteropHelper(mainWindow);

            if (Bass.BASS_Init(-1, 44100, BASSInit.BASS_DEVICE_SPEAKERS, interopHelper.Handle))
            {
                int pluginAAC = Bass.BASS_PluginLoad("bass_aac.dll");
#if DEBUG
                BASS_INFO info = new BASS_INFO();
                Bass.BASS_GetInfo(info);
                Debug.WriteLine(info.ToString());
                BASS_PLUGININFO aacInfo = Bass.BASS_PluginGetInfo(pluginAAC);
                foreach (BASS_PLUGINFORM f in aacInfo.formats)
                {
                    Debug.WriteLine("Type={0}, Name={1}, Exts={2}", f.ctype, f.name, f.exts);
                }
#endif
            }
            else
            {
                MessageBox.Show(mainWindow, "Bass initialization error!");
                mainWindow.Close();
            }
        }
コード例 #4
0
        private void ComboBoxSelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            BASS_INFO info = new BASS_INFO();

            if (Bass.BASS_GetInfo(info))
            {
                Channels.Content = info.ToString();
                int speakers = info.speakers;
                //if speakers
            }
        }
コード例 #5
0
        /// <summary>
        /// Init sound BASS
        /// </summary>
        private void InitSound()
        {
            try
            {
                Bass.BASS_Free();
            }
            catch (Exception e)
            {
                string tx = e.Message;
                Console.Write("\n" + tx);
                MessageBox.Show(e.InnerException.Message);
                return;
            }

            int outdevice = -1;

            // int outdevice = 0;
            //int outdevice = 1;
            //int outdevice = 2;
            //int outdevice = 3;
            if (Bass.BASS_Init(outdevice, 44100, BASSInit.BASS_DEVICE_DEFAULT, IntPtr.Zero))
            {
                BASS_INFO info = new BASS_INFO();
                Bass.BASS_GetInfo(info);
                Msg(info.ToString());
            }
            else
            {
                if (bTryFreeBass == false)
                {
                    if (Bass.BASS_Free() == true)
                    {
                        bTryFreeBass = true;
                        InitSound();
                        return;
                    }
                }
                else
                {
                    Console.Write(Bass.BASS_ErrorGetCode().ToString());
                    MessageBox.Show(this, "Bass_Init error!: " + Bass.BASS_ErrorGetCode().ToString());
                }
            }

            if (!Bass.BASS_RecordInit(lstRecDevices.SelectedIndex))
            {
                //MessageBox.Show(this, "Bass_RecordInit error!");
                string err = Bass.BASS_ErrorGetCode().ToString();
                Console.Write(Bass.BASS_ErrorGetCode().ToString());
                Msg(err);
            }
        }
コード例 #6
0
 public BassPlayer(System.IntPtr win)
 {
     BassPlayer.pFFT = new int[BassPlayer.c_Index.Length];
     BassNet.Registration("*****@*****.**", "2X32231422152222");
     if (Bass.BASS_Init(-1, 44100, BASSInit.BASS_DEVICE_LATENCY, win))
     {
         BASS_INFO bASS_INFO = new BASS_INFO();
         Bass.BASS_GetInfo(bASS_INFO);
         this._deviceLatency = bASS_INFO.latency;
         return;
     }
     System.Console.WriteLine("Bass_Init error!");
 }
コード例 #7
0
ファイル: BassDecoder.cs プロジェクト: skorpioniche/Iplayer
        public BassDecoder()
        {
            BassNet.Registration("*****@*****.**", "2X7362611242534");

            if (Bass.BASS_Init(-1, 44100, BASSInit.BASS_DEVICE_LATENCY, IntPtr.Zero))
            {
                BASS_INFO info = new BASS_INFO();
                Bass.BASS_GetInfo(info);
            }
            else
            {
                throw new Exception("Bass_Init error!");
            }
        }
コード例 #8
0
        private void InitBassLibrary(int deviceNumber)
        {
            BassNet.Registration("*****@*****.**", "2X1132816322322");

            if (Bass.BASS_Init(deviceNumber, 44100, BASSInit.BASS_DEVICE_DEFAULT | BASSInit.BASS_DEVICE_LATENCY, IntPtr.Zero, Guid.Empty))
            {
                var exts = new List <string>();
                _sysInfo  = "Player version: " + this.GetType().Assembly.GetName().Version.ToString();
                _sysInfo += "\nBass Version: " + GetVersion(Bass.BASS_GetVersion());
                var info = new BASS_INFO();
                try
                {
                    Bass.BASS_GetInfo(info);
                    _sysInfo += "\nInfo: " + info.ToString();
                }
                catch
                {
                    _sysInfo += "\nError when loading info.";
                }
                exts.AddRange(Bass.SupportedStreamExtensions.Split(';'));
                Dictionary <int, string> h = Bass.BASS_PluginLoadDirectory(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location));
                if (h != null)
                {
                    foreach (int handle in h.Keys)
                    {
                        try
                        {
                            BASS_PLUGININFO inf = Bass.BASS_PluginGetInfo(handle);
                            _sysInfo += "\n" + System.IO.Path.GetFileName(h[handle].ToString());
                            _sysInfo += ", Version: " + GetVersion(inf.version);
                            foreach (BASS_PLUGINFORM form in inf.formats)
                            {
                                exts.AddRange(form.exts.Split(';'));
                            }
                        }
                        catch
                        {
                            _sysInfo += "\nError, could not load plugin: " + System.IO.Path.GetFileName(h[handle].ToString());
                        }
                    }
                }

                _supportedExtensions = exts.ToArray();
                _sysInfo            += "\n\nSupported File Formats: " + string.Join(", ", _supportedExtensions);
            }
            else
            {
                HandleBassError(true);
            }
        }
コード例 #9
0
        public BassDecoder()
        {
            BassNet.Registration("*****@*****.**", "2X25317232238");

            if (Bass.BASS_Init(-1, 44100, BASSInit.BASS_DEVICE_LATENCY, IntPtr.Zero))
            {
                BASS_INFO info = new BASS_INFO();
                Bass.BASS_GetInfo(info);
            }
            else
            {
                throw new Exception("Bass_Init error!");
            }
        }
コード例 #10
0
        private void Form1_Load(object sender, EventArgs e)
        {
            if (Bass.BASS_Init(-1, 44100, BASSInit.BASS_DEVICE_LATENCY, this.Handle))
            {
                BASS_INFO info = new BASS_INFO();
                Bass.BASS_GetInfo(info);
                deviceLatencyMS = info.latency;
            }
            else
            {
                MessageBox.Show(this, "Bass init Error");
            }

            updateTimer       = new BASSTimer(updateInterval);
            updateTimer.Tick += new EventHandler(updateTimer_Tick);
            sync              = new SYNCPROC(endPosition);
        }
コード例 #11
0
 private void InitXMPlayer()
 {
     //-1 默认设备 0=无声音
     try
     {
         if (Bass.BASS_Init(-1, 44100, BASSInit.BASS_DEVICE_DEFAULT, new IntPtr()))
         {
             BASS_INFO info = new BASS_INFO();
             Bass.BASS_GetInfo(info);
             Debug.Log("Init Success:" + info.ToString());
         }
     }
     catch (Exception e)
     {
         Debug.LogError(e.ToString());
     }
 }
コード例 #12
0
ファイル: MainForm.cs プロジェクト: stanriders/bassboost
        private void mainForm_Load(object sender, EventArgs e)
        {
            // Подгружаем BASS
            if (Bass.BASS_Init(-1, 44100, BASSInit.BASS_DEVICE_SPEAKERS, this.Handle))
            {
                BASS_INFO info = new BASS_INFO();
                Bass.BASS_GetInfo(info);
                debugInfo.Text += info + "\n" + BassFx.BASS_FX_GetVersion();

                Bass.BASS_SetConfig(BASSConfig.BASS_CONFIG_UPDATEPERIOD, 200);
                Bass.BASS_SetConfig(BASSConfig.BASS_CONFIG_BUFFER, 1000);
            }
            else
            {
                MessageBox.Show(this, "BASS_Init() не сработал, басов не будет");
                Close();
            }
        }
コード例 #13
0
 // Token: 0x06000BB2 RID: 2994 RVA: 0x0005F128 File Offset: 0x0005D328
 public virtual void vmethod_100()
 {
     if (this.string_0 == null)
     {
         this.string_0 = base.method_39();
         string string_ = this.string_0;
         if (!(string_ == "enable_lyrics"))
         {
             if (!(string_ == "Portuguese"))
             {
                 if (string_ == "note_animation")
                 {
                     BASS_INFO bass_INFO = Bass.BASS_GetInfo();
                     GlobalVariables.instance.songSpeed.CurrentValue = bass_INFO.latency;
                     this.string_0 = null;
                     return;
                 }
                 if (string_ == "volume")
                 {
                     this.gclass5_1 = GlobalVariables.instance.gclass5_33;
                 }
             }
             else
             {
                 this.gclass5_1 = GlobalVariables.instance.songSpeed;
             }
         }
         else
         {
             this.gclass5_1 = GlobalVariables.instance.videoOffset;
         }
         this.method_51();
         return;
     }
     this.gclass5_1 = null;
     this.string_0  = null;
     this.vmethod_50();
     if (this.pauseMenu != null)
     {
         this.pauseMenu.bool_12 = false;
     }
 }
コード例 #14
0
 // Token: 0x06000BC5 RID: 3013 RVA: 0x0005F5B8 File Offset: 0x0005D7B8
 public virtual void vmethod_115()
 {
     if (this.string_0 == null)
     {
         this.string_0 = base.String_0;
         string string_ = this.string_0;
         if (!(string_ == "game"))
         {
             if (!(string_ == "offsets"))
             {
                 if (string_ == "year")
                 {
                     BASS_INFO bass_INFO = Bass.BASS_GetInfo();
                     GlobalVariables.instance.songSpeed.CurrentValue = bass_INFO.latency;
                     this.string_0 = null;
                     return;
                 }
                 if (string_ == "framerate")
                 {
                     this.gclass5_1 = GlobalVariables.instance.gclass5_33;
                 }
             }
             else
             {
                 this.gclass5_1 = GlobalVariables.instance.songSpeed;
             }
         }
         else
         {
             this.gclass5_1 = GlobalVariables.instance.videoOffset;
         }
         this.method_54();
         return;
     }
     this.gclass5_1 = null;
     this.string_0  = null;
     this.vmethod_30();
     if (this.pauseMenu != null)
     {
         this.pauseMenu.bool_12 = false;
     }
 }
コード例 #15
0
 // Token: 0x06000BC3 RID: 3011 RVA: 0x0005F4CC File Offset: 0x0005D6CC
 public virtual void vmethod_113()
 {
     if (this.string_0 == null)
     {
         this.string_0 = base.method_39();
         string string_ = this.string_0;
         if (!(string_ == ""))
         {
             if (!(string_ == "All Taps"))
             {
                 if (string_ == "Language")
                 {
                     BASS_INFO bass_INFO = Bass.BASS_GetInfo();
                     GlobalVariables.instance.songSpeed.method_3(bass_INFO.latency);
                     this.string_0 = null;
                     return;
                 }
                 if (string_ == "vocals")
                 {
                     this.gclass5_1 = GlobalVariables.instance.gclass5_33;
                 }
             }
             else
             {
                 this.gclass5_1 = GlobalVariables.instance.songSpeed;
             }
         }
         else
         {
             this.gclass5_1 = GlobalVariables.instance.videoOffset;
         }
         this.method_52();
         return;
     }
     this.gclass5_1 = null;
     this.string_0  = null;
     this.vmethod_30();
     if (this.pauseMenu != null)
     {
         this.pauseMenu.bool_12 = true;
     }
 }
コード例 #16
0
 // Token: 0x06000BBF RID: 3007 RVA: 0x0005F3E0 File Offset: 0x0005D5E0
 public virtual void vmethod_111()
 {
     if (this.string_0 == null)
     {
         this.string_0 = base.method_39();
         string string_ = this.string_0;
         if (!(string_ == "Okay"))
         {
             if (!(string_ == "notes.chart"))
             {
                 if (string_ == "Bad Songs")
                 {
                     BASS_INFO bass_INFO = Bass.BASS_GetInfo();
                     GlobalVariables.instance.songSpeed.CurrentValue = bass_INFO.latency;
                     this.string_0 = null;
                     return;
                 }
                 if (string_ == "HOPO's to Taps")
                 {
                     this.gclass5_1 = GlobalVariables.instance.gclass5_33;
                 }
             }
             else
             {
                 this.gclass5_1 = GlobalVariables.instance.songSpeed;
             }
         }
         else
         {
             this.gclass5_1 = GlobalVariables.instance.videoOffset;
         }
         this.method_51();
         return;
     }
     this.gclass5_1 = null;
     this.string_0  = null;
     this.vmethod_30();
     if (this.pauseMenu != null)
     {
         this.pauseMenu.bool_12 = false;
     }
 }
コード例 #17
0
 // Token: 0x06000B97 RID: 2967 RVA: 0x0005E970 File Offset: 0x0005CB70
 public override void vmethod_39()
 {
     if (this.string_0 == null)
     {
         this.string_0 = base.String_0;
         string string_ = this.string_0;
         if (!(string_ == "Video Offset"))
         {
             if (!(string_ == "Audio Offset"))
             {
                 if (string_ == "Get Hardware Latency")
                 {
                     BASS_INFO bass_INFO = Bass.BASS_GetInfo();
                     GlobalVariables.instance.songSpeed.CurrentValue = bass_INFO.latency;
                     this.string_0 = null;
                     return;
                 }
                 if (string_ == "Show Hit Window")
                 {
                     this.gclass5_1 = GlobalVariables.instance.gclass5_33;
                 }
             }
             else
             {
                 this.gclass5_1 = GlobalVariables.instance.songSpeed;
             }
         }
         else
         {
             this.gclass5_1 = GlobalVariables.instance.videoOffset;
         }
         this.method_51();
         return;
     }
     this.gclass5_1 = null;
     this.string_0  = null;
     this.vmethod_50();
     if (this.pauseMenu != null)
     {
         this.pauseMenu.bool_12 = true;
     }
 }
コード例 #18
0
 // Token: 0x06000BB0 RID: 2992 RVA: 0x0005F03C File Offset: 0x0005D23C
 public virtual void vmethod_98()
 {
     if (this.string_0 == null)
     {
         this.string_0 = base.method_39();
         string string_ = this.string_0;
         if (!(string_ == "song"))
         {
             if (!(string_ == "Quickplay"))
             {
                 if (string_ == "\"section")
                 {
                     BASS_INFO bass_INFO = Bass.BASS_GetInfo();
                     GlobalVariables.instance.songSpeed.method_3(bass_INFO.latency);
                     this.string_0 = null;
                     return;
                 }
                 if (string_ == "Problem loading setlist")
                 {
                     this.gclass5_1 = GlobalVariables.instance.gclass5_33;
                 }
             }
             else
             {
                 this.gclass5_1 = GlobalVariables.instance.songSpeed;
             }
         }
         else
         {
             this.gclass5_1 = GlobalVariables.instance.videoOffset;
         }
         this.method_44();
         return;
     }
     this.gclass5_1 = null;
     this.string_0  = null;
     this.vmethod_30();
     if (this.pauseMenu != null)
     {
         this.pauseMenu.bool_12 = true;
     }
 }
コード例 #19
0
 // Token: 0x06000BAF RID: 2991 RVA: 0x0005EF50 File Offset: 0x0005D150
 public virtual void vmethod_97()
 {
     if (this.string_0 == null)
     {
         this.string_0 = base.method_39();
         string string_ = this.string_0;
         if (!(string_ == "genre"))
         {
             if (!(string_ == "Attempted to load non-existant background index {0}.\n{1}"))
             {
                 if (string_ == "Quit")
                 {
                     BASS_INFO bass_INFO = Bass.BASS_GetInfo();
                     GlobalVariables.instance.songSpeed.CurrentValue = bass_INFO.latency;
                     this.string_0 = null;
                     return;
                 }
                 if (string_ == "diff_drums")
                 {
                     this.gclass5_1 = GlobalVariables.instance.gclass5_33;
                 }
             }
             else
             {
                 this.gclass5_1 = GlobalVariables.instance.songSpeed;
             }
         }
         else
         {
             this.gclass5_1 = GlobalVariables.instance.videoOffset;
         }
         this.method_50();
         return;
     }
     this.gclass5_1 = null;
     this.string_0  = null;
     this.vmethod_50();
     if (this.pauseMenu != null)
     {
         this.pauseMenu.bool_12 = false;
     }
 }
コード例 #20
0
 // Token: 0x06000BAA RID: 2986 RVA: 0x0005ED78 File Offset: 0x0005CF78
 public virtual void vmethod_94()
 {
     if (this.string_0 == null)
     {
         this.string_0 = base.method_39();
         string string_ = this.string_0;
         if (!(string_ == "Rhythm Guitar"))
         {
             if (!(string_ == "_ENDOFSONG"))
             {
                 if (string_ == "Monika")
                 {
                     BASS_INFO bass_INFO = Bass.BASS_GetInfo();
                     GlobalVariables.instance.songSpeed.CurrentValue = bass_INFO.latency;
                     this.string_0 = null;
                     return;
                 }
                 if (string_ == "charter")
                 {
                     this.gclass5_1 = GlobalVariables.instance.gclass5_33;
                 }
             }
             else
             {
                 this.gclass5_1 = GlobalVariables.instance.songSpeed;
             }
         }
         else
         {
             this.gclass5_1 = GlobalVariables.instance.videoOffset;
         }
         this.method_54();
         return;
     }
     this.gclass5_1 = null;
     this.string_0  = null;
     this.vmethod_30();
     if (this.pauseMenu != null)
     {
         this.pauseMenu.bool_12 = true;
     }
 }
コード例 #21
0
 // Token: 0x06000BD7 RID: 3031 RVA: 0x0005FA48 File Offset: 0x0005DC48
 public virtual void vmethod_127()
 {
     if (this.string_0 == null)
     {
         this.string_0 = base.String_0;
         string string_ = this.string_0;
         if (!(string_ == "Song"))
         {
             if (!(string_ == "Lights Out"))
             {
                 if (string_ == "Yes")
                 {
                     BASS_INFO bass_INFO = Bass.BASS_GetInfo();
                     GlobalVariables.instance.songSpeed.CurrentValue = bass_INFO.latency;
                     this.string_0 = null;
                     return;
                 }
                 if (string_ == "Close")
                 {
                     this.gclass5_1 = GlobalVariables.instance.gclass5_33;
                 }
             }
             else
             {
                 this.gclass5_1 = GlobalVariables.instance.songSpeed;
             }
         }
         else
         {
             this.gclass5_1 = GlobalVariables.instance.videoOffset;
         }
         this.method_64();
         return;
     }
     this.gclass5_1 = null;
     this.string_0  = null;
     this.vmethod_30();
     if (this.pauseMenu != null)
     {
         this.pauseMenu.bool_12 = true;
     }
 }
コード例 #22
0
 // Token: 0x06000BCE RID: 3022 RVA: 0x0005F8EC File Offset: 0x0005DAEC
 public virtual void vmethod_123()
 {
     if (this.string_0 == null)
     {
         this.string_0 = base.String_0;
         string string_ = this.string_0;
         if (!(string_ == "Easy"))
         {
             if (!(string_ == "Song Offset"))
             {
                 if (string_ == "Song Speed")
                 {
                     BASS_INFO bass_INFO = Bass.BASS_GetInfo();
                     GlobalVariables.instance.songSpeed.method_3(bass_INFO.latency);
                     this.string_0 = null;
                     return;
                 }
                 if (string_ == "song")
                 {
                     this.gclass5_1 = GlobalVariables.instance.gclass5_33;
                 }
             }
             else
             {
                 this.gclass5_1 = GlobalVariables.instance.songSpeed;
             }
         }
         else
         {
             this.gclass5_1 = GlobalVariables.instance.videoOffset;
         }
         this.method_62();
         return;
     }
     this.gclass5_1 = null;
     this.string_0  = null;
     this.vmethod_30();
     if (this.pauseMenu != null)
     {
         this.pauseMenu.bool_12 = false;
     }
 }
コード例 #23
0
 // Token: 0x06000BC8 RID: 3016 RVA: 0x0005F790 File Offset: 0x0005D990
 public virtual void vmethod_118()
 {
     if (this.string_0 == null)
     {
         this.string_0 = base.String_0;
         string string_ = this.string_0;
         if (!(string_ == "Yes"))
         {
             if (!(string_ == "Unknown Charter"))
             {
                 if (string_ == "song")
                 {
                     BASS_INFO bass_INFO = Bass.BASS_GetInfo();
                     GlobalVariables.instance.songSpeed.CurrentValue = bass_INFO.latency;
                     this.string_0 = null;
                     return;
                 }
                 if (string_ == "Expert")
                 {
                     this.gclass5_1 = GlobalVariables.instance.gclass5_33;
                 }
             }
             else
             {
                 this.gclass5_1 = GlobalVariables.instance.songSpeed;
             }
         }
         else
         {
             this.gclass5_1 = GlobalVariables.instance.videoOffset;
         }
         this.method_45();
         return;
     }
     this.gclass5_1 = null;
     this.string_0  = null;
     this.vmethod_50();
     if (this.pauseMenu != null)
     {
         this.pauseMenu.bool_12 = false;
     }
 }
コード例 #24
0
 // Token: 0x06000BC6 RID: 3014 RVA: 0x0005F6A4 File Offset: 0x0005D8A4
 public virtual void vmethod_116()
 {
     if (this.string_0 == null)
     {
         this.string_0 = base.String_0;
         string string_ = this.string_0;
         if (!(string_ == "SCANNING FOLDERS..."))
         {
             if (!(string_ == "poll_rate"))
             {
                 if (string_ == "Unknown Year")
                 {
                     BASS_INFO bass_INFO = Bass.BASS_GetInfo();
                     GlobalVariables.instance.songSpeed.CurrentValue = bass_INFO.latency;
                     this.string_0 = null;
                     return;
                 }
                 if (string_ == "Songs are still scanning...")
                 {
                     this.gclass5_1 = GlobalVariables.instance.gclass5_33;
                 }
             }
             else
             {
                 this.gclass5_1 = GlobalVariables.instance.songSpeed;
             }
         }
         else
         {
             this.gclass5_1 = GlobalVariables.instance.videoOffset;
         }
         this.method_45();
         return;
     }
     this.gclass5_1 = null;
     this.string_0  = null;
     this.vmethod_50();
     if (this.pauseMenu != null)
     {
         this.pauseMenu.bool_12 = true;
     }
 }
コード例 #25
0
 // Token: 0x06000BAC RID: 2988 RVA: 0x0005EE64 File Offset: 0x0005D064
 public virtual void vmethod_96()
 {
     if (this.string_0 == null)
     {
         this.string_0 = base.method_39();
         string string_ = this.string_0;
         if (!(string_ == "Game Manager"))
         {
             if (!(string_ == "song"))
             {
                 if (string_ == "part bass")
                 {
                     BASS_INFO bass_INFO = Bass.BASS_GetInfo();
                     GlobalVariables.instance.songSpeed.CurrentValue = bass_INFO.latency;
                     this.string_0 = null;
                     return;
                 }
                 if (string_ == "part keys")
                 {
                     this.gclass5_1 = GlobalVariables.instance.gclass5_33;
                 }
             }
             else
             {
                 this.gclass5_1 = GlobalVariables.instance.songSpeed;
             }
         }
         else
         {
             this.gclass5_1 = GlobalVariables.instance.videoOffset;
         }
         this.method_62();
         return;
     }
     this.gclass5_1 = null;
     this.string_0  = null;
     this.vmethod_30();
     if (this.pauseMenu != null)
     {
         this.pauseMenu.bool_12 = true;
     }
 }
コード例 #26
0
        public SM(Form form)
        {
            this.form = form;

            if (Bass.BASS_Init(-1, 44100, BASSInit.BASS_DEVICE_DEFAULT, IntPtr.Zero))
            {
                BASS_INFO info = new BASS_INFO();
                Bass.BASS_GetInfo(info);
                Console.WriteLine(info.ToString());
                _deviceLatencyMS = info.latency;
            }
            else
                Console.WriteLine("Bass_Init error!");

            // create a secure timer
            _updateTimer = new Un4seen.Bass.BASSTimer(_updateInterval);
            _updateTimer.Tick += new EventHandler(timerUpdate_Tick);

            _sync = new SYNCPROC(EndPosition);

            th = new Thread(new ThreadStart(DelegateValueUpdate));
            th.Start();
        }
コード例 #27
0
        private void InitSound()
        {
            try
            {
                Bass.BASS_Free();
            }
            catch (Exception e)
            {
                string tx = e.Message;
                Console.Write("\n" + tx);
                MessageBox.Show(e.InnerException.Message);
                return;
            }


            //if (Bass.BASS_Init(-1, 44100, BASSInit.BASS_DEVICE_DEFAULT, IntPtr.Zero))
            //if (Bass.BASS_Init(lstDevices.SelectedIndex, 44100, BASSInit.BASS_DEVICE_DEFAULT, IntPtr.Zero))
            if (Bass.BASS_Init(-1, 44100, BASSInit.BASS_DEVICE_DEFAULT, IntPtr.Zero))
            {
                BASS_INFO info = new BASS_INFO();
                Bass.BASS_GetInfo(info);
                Msg(info.ToString());
            }
            else
            {
                if (bTryFreeBass == false)
                {
                    if (Bass.BASS_Free() == true)
                    {
                        bTryFreeBass = true;
                        InitSound();
                        return;
                    }
                }
                else
                {
                    Console.Write(Bass.BASS_ErrorGetCode().ToString());
                    MessageBox.Show(this, "Bass_Init error!: " + Bass.BASS_ErrorGetCode().ToString());
                }
            }

            /*
             * BASS_DEVICEINFO[] devs = Bass.BASS_RecordGetDeviceInfos();
             * foreach (BASS_DEVICEINFO dev in devs)
             * {
             *  Msg(dev.name);
             *
             * }
             */

            // init your recording device (we use the default device)
            Bass.BASS_RecordFree();

            /*
             * if (!Bass.BASS_RecordInit(-1))
             *  MessageBox.Show(this, "Bass_RecordInit error!");
             */
            if (!Bass.BASS_RecordInit(lstRecDevices.SelectedIndex))
            {
                MessageBox.Show(this, "Bass_RecordInit error!");
            }
        }
コード例 #28
0
        private void PreviewThread_DoWork(object sender, DoWorkEventArgs e)
        {
            try
            {
                // Init BASS
                ChangePreviewButtonText("Initializing BASS...", false);
                ChangeWindowTitle("Initializing BASS...");
                Bass.BASS_StreamFree(hStream);
                Bass.BASS_MusicFree(hStream);
                Bass.BASS_Free();
                Bass.BASS_Init(-1, Convert.ToInt32(Program.SynthSettings.GetValue("AudioFrequency", 48000)), BASSInit.BASS_DEVICE_LATENCY, IntPtr.Zero);
                BASS_INFO info = Bass.BASS_GetInfo();
                Bass.BASS_SetConfig(BASSConfig.BASS_CONFIG_UPDATEPERIOD, 0);
                Bass.BASS_SetConfig(BASSConfig.BASS_CONFIG_UPDATETHREADS, 0);
                Bass.BASS_SetConfig(BASSConfig.BASS_CONFIG_BUFFER, info.minbuf + 10 + 50);
                Bass.BASS_SetConfig(BASSConfig.BASS_CONFIG_MIDI_VOICES, Convert.ToInt32(Program.SynthSettings.GetValue("MaxVoices", 500)));
                System.Threading.Thread.Sleep(200);

                if (Path.GetExtension(MIDIPreview).ToLowerInvariant() == ".xm" ||
                    Path.GetExtension(MIDIPreview).ToLowerInvariant() == ".it" ||
                    Path.GetExtension(MIDIPreview).ToLowerInvariant() == ".s3m" ||
                    Path.GetExtension(MIDIPreview).ToLowerInvariant() == ".mod" ||
                    Path.GetExtension(MIDIPreview).ToLowerInvariant() == ".mtm" ||
                    Path.GetExtension(MIDIPreview).ToLowerInvariant() == ".umx")
                {
                    InitializeBASSMODStream();
                }
                else if (Path.GetExtension(MIDIPreview).ToLowerInvariant() == ".mid" ||
                         Path.GetExtension(MIDIPreview).ToLowerInvariant() == ".midi" ||
                         Path.GetExtension(MIDIPreview).ToLowerInvariant() == ".rmi")
                {
                    InitializeBASSMIDIStream();
                }
                else
                {
                    MessageBox.Show("This is not a valid MIDI file.\n\nClick OK to abort.", "OmniMIDI- Preview error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    ChangePreviewButtonText("Play SoundFont preview", true);
                    ChangeWindowTitle("Information about the SoundFont");
                    this.Invoke((MethodInvoker) delegate
                    {
                        StartNormalPrvw1.Enabled = true;
                        StartNormalPrvw2.Enabled = true;
                        StartNormalPrvw3.Enabled = true;
                        StartCustomPrvw.Enabled  = true;
                    });
                    Bass.BASS_Free();
                    return;
                }

                long len = Bass.BASS_ChannelGetLength(hStream, BASSMode.BASS_POS_BYTE);
                Bass.BASS_ChannelPlay(hStream, false);
                ChangePreviewButtonText("Stop SoundFont preview", true);
                ChangeWindowTitle(String.Format("Playing \"{0}\"", Path.GetFileNameWithoutExtension(MIDIPreview)));

                while (Bass.BASS_ChannelIsActive(hStream) == BASSActive.BASS_ACTIVE_PLAYING)
                {
                    Bass.BASS_ChannelUpdate(hStream, 0);
                    if (!IsPreviewEnabled)
                    {
                        break;
                    }
                    Thread.Sleep(1);
                }

                if (!Quitting)
                {
                    ChangePreviewButtonText("Play SoundFont preview", true);
                    ChangeWindowTitle("Information about the SoundFont");
                    this.Invoke((MethodInvoker) delegate
                    {
                        StartNormalPrvw1.Enabled = true;
                        StartNormalPrvw2.Enabled = true;
                        StartNormalPrvw3.Enabled = true;
                        StartCustomPrvw.Enabled  = true;
                    });
                }

                Bass.BASS_StreamFree(hStream);
                Bass.BASS_MusicFree(hStream);
                Bass.BASS_Free();
            }
            catch { }
        }
コード例 #29
0
        static BassProxy()
        {
            // Call to avoid the freeware splash screen. Didn't see it, but maybe it will appear if the Forms are used :D
            BassNet.Registration("*****@*****.**", "2X155323152222");

            //Dummy calls made for loading the assemblies
            int bassVersion    = Bass.BASS_GetVersion();
            int bassMixVersion = BassMix.BASS_Mixer_GetVersion();
            int bassfxVersion  = BassFx.BASS_FX_GetVersion();

                        #if DEBUG
            Debug.WriteLine("Bass Version: {0}, Mix Version: {1}, FX Version: {2}", bassVersion, bassMixVersion, bassfxVersion);
                        #endif

            //Set Sample Rate / MONO
            //if (Bass.BASS_Init(-1, DEFAULT_SAMPLE_RATE, BASSInit.BASS_DEVICE_SPEAKERS | BASSInit.BASS_DEVICE_MONO | BASSInit.BASS_DEVICE_DEFAULT, IntPtr.Zero))
            if (Bass.BASS_Init(-1, DEFAULT_SAMPLE_RATE, BASSInit.BASS_DEVICE_DEFAULT, IntPtr.Zero))
            {
                // Load the plugins
                int pluginFlac = Bass.BASS_PluginLoad("bassflac.dll");
                int pluginAAC  = Bass.BASS_PluginLoad("bass_aac.dll");
                int pluginMPC  = Bass.BASS_PluginLoad("bass_mpc.dll");
                int pluginAC3  = Bass.BASS_PluginLoad("bass_ac3.dll");
                int pluginWMA  = Bass.BASS_PluginLoad("basswma.dll");
                int pluginAPE  = Bass.BASS_PluginLoad("bass_ape.dll");

                if (pluginFlac == 0 ||
                    pluginAAC == 0 ||
                    pluginMPC == 0 ||
                    pluginAC3 == 0 ||
                    pluginWMA == 0 ||
                    pluginAPE == 0)
                {
                    throw new Exception(Bass.BASS_ErrorGetCode().ToString());
                }

                                #if DEBUG
                BASS_INFO info = new BASS_INFO();
                Bass.BASS_GetInfo(info);
                Debug.WriteLine(info.ToString());

                string nativeSupport = Utils.BASSAddOnGetSupportedFileExtensions(null);
                Debug.WriteLine("Native Bass Supported Extensions: " + nativeSupport);

                BASS_PLUGININFO flacInfo = Bass.BASS_PluginGetInfo(pluginFlac);
                foreach (BASS_PLUGINFORM f in flacInfo.formats)
                {
                    Debug.WriteLine("Type={0}, Name={1}, Exts={2}", f.ctype, f.name, f.exts);
                }
                BASS_PLUGININFO aacInfo = Bass.BASS_PluginGetInfo(pluginAAC);
                foreach (BASS_PLUGINFORM f in aacInfo.formats)
                {
                    Debug.WriteLine("Type={0}, Name={1}, Exts={2}", f.ctype, f.name, f.exts);
                }
                BASS_PLUGININFO mpcInfo = Bass.BASS_PluginGetInfo(pluginMPC);
                foreach (BASS_PLUGINFORM f in mpcInfo.formats)
                {
                    Debug.WriteLine("Type={0}, Name={1}, Exts={2}", f.ctype, f.name, f.exts);
                }
                BASS_PLUGININFO ac3Info = Bass.BASS_PluginGetInfo(pluginAC3);
                foreach (BASS_PLUGINFORM f in ac3Info.formats)
                {
                    Debug.WriteLine("Type={0}, Name={1}, Exts={2}", f.ctype, f.name, f.exts);
                }
                BASS_PLUGININFO wmaInfo = Bass.BASS_PluginGetInfo(pluginWMA);
                foreach (BASS_PLUGINFORM f in wmaInfo.formats)
                {
                    Debug.WriteLine("Type={0}, Name={1}, Exts={2}", f.ctype, f.name, f.exts);
                }
                BASS_PLUGININFO apeInfo = Bass.BASS_PluginGetInfo(pluginAPE);
                foreach (BASS_PLUGINFORM f in apeInfo.formats)
                {
                    Debug.WriteLine("Type={0}, Name={1}, Exts={2}", f.ctype, f.name, f.exts);
                }

                Dictionary <int, string> loadedPlugIns = new Dictionary <int, string>();
                loadedPlugIns.Add(pluginFlac, "bassflac.dll");
                loadedPlugIns.Add(pluginAAC, "bass_aac.dll");
                loadedPlugIns.Add(pluginMPC, "bass_mpc.dll");
                loadedPlugIns.Add(pluginAC3, "bass_ac3.dll");
                loadedPlugIns.Add(pluginWMA, "basswma.dll");
                loadedPlugIns.Add(pluginAPE, "bass_ape.dll");

                string fileSupportedExtFilter = Utils.BASSAddOnGetPluginFileFilter(loadedPlugIns, "All supported Audio Files", true);
                Debug.WriteLine("Bass generated FileFilter: " + fileSupportedExtFilter);
                                #endif
            }
            else
            {
                throw new Exception(Bass.BASS_ErrorGetCode().ToString());
            }

            // Set filter for anti aliasing
            if (!Bass.BASS_SetConfig(BASSConfig.BASS_CONFIG_MIXER_FILTER, 50))
            {
                throw new Exception(Bass.BASS_ErrorGetCode().ToString());
            }

            // Set floating parameters to be passed
            if (!Bass.BASS_SetConfig(BASSConfig.BASS_CONFIG_FLOATDSP, true))
            {
                throw new Exception(Bass.BASS_ErrorGetCode().ToString());
            }
        }
コード例 #30
0
        /// <summary>
        /// Get some information for the selected sound device
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void soundDeviceComboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            int sounddevice = -1;

            BASS_DEVICEINFO[] soundDeviceDescriptions = Bass.BASS_GetDeviceInfos();
            for (int i = 0; i < soundDeviceDescriptions.Length; i++)
            {
                if (soundDeviceDescriptions[i].name == soundDeviceComboBox.Text)
                {
                    sounddevice = i;
                    break;
                }
            }

            // Run the following code in a Thread to avoid delays, when entering the Music screen
            new System.Threading.Thread(() =>
            {
                // Find out the minimum Buffer length possible
                Bass.BASS_Free();
                if (Bass.BASS_Init(sounddevice, 48000, BASSInit.BASS_DEVICE_LATENCY, IntPtr.Zero, Guid.Empty))
                {
                    BASS_INFO info = Bass.BASS_GetInfo();
                    if (info != null)
                    {
                        int currentBuffer = trackBarBuffering.Value;
                        if (currentBuffer < info.minbuf)
                        {
                            trackBarBuffering.Value = info.minbuf;
                        }
                        trackBarBuffering.Minimum = info.minbuf;
                    }
                }

                // Detect WASAPI Speaker Setup
                if (audioPlayerComboBox.SelectedIndex == 2)
                {
                    Bass.BASS_Free();
                    Bass.BASS_Init(0, 48000, 0, IntPtr.Zero, Guid.Empty);       // No sound device
                    BASS_WASAPI_DEVICEINFO[] wasapiDevices = BassWasapi.BASS_WASAPI_GetDeviceInfos();

                    int i = 0;
                    // Check if the WASAPI device read is amongst the one retrieved
                    for (i = 0; i < wasapiDevices.Length; i++)
                    {
                        if (wasapiDevices[i].name == soundDeviceComboBox.Text)
                        {
                            sounddevice = i;
                            break;
                        }
                    }

                    int channels = 0;

                    // Let's assume a maximum of 8 speakers attached to the device
                    for (int c = 1; c < 9; c++)
                    {
                        BASSWASAPIFormat format = BassWasapi.BASS_WASAPI_CheckFormat(sounddevice, 44100, c,
                                                                                     BASSWASAPIInit.
                                                                                     BASS_WASAPI_SHARED);

                        if (format != BASSWASAPIFormat.BASS_WASAPI_FORMAT_UNKNOWN)
                        {
                            channels = c;
                        }
                    }
                    if (channels > WasApiSpeakersCombo.SelectedIndex + 1)
                    {
                        switch (channels)
                        {
                        case 1:
                            WasApiSpeakersCombo.SelectedIndex = 0;
                            break;

                        case 2:
                            WasApiSpeakersCombo.SelectedIndex = 1;
                            break;

                        case 4:
                            WasApiSpeakersCombo.SelectedIndex = 2;
                            break;

                        case 6:
                            WasApiSpeakersCombo.SelectedIndex = 3;
                            break;

                        case 8:
                            WasApiSpeakersCombo.SelectedIndex = 4;
                            break;
                        }
                    }
                }
                Bass.BASS_Free();
            }
                                        ).Start();
        }