Beispiel #1
0
        private void GetChannelInfo(int channel)
        {
            if (channel == 0)
            {
                return;
            }
            if (!Bass.BASS_ChannelGetInfo(channel, this._channelInfo))
            {
                throw new ArgumentException("Invalid channel: " + Enum.GetName(typeof(BASSError), Bass.BASS_ErrorGetCode()));
            }
            this._samplerate = this._channelInfo.freq;
            this._numchans   = this._channelInfo.chans;
            if ((this._channelInfo.flags & BASSFlag.BASS_SAMPLE_MONO) != BASSFlag.BASS_DEFAULT)
            {
                this._numchans = 1;
            }
            this._bitwidth = 16;
            bool flag = Bass.BASS_GetConfig(BASSConfig.BASS_CONFIG_FLOATDSP) == 1;

            if ((this._channelInfo.flags & BASSFlag.BASS_SAMPLE_FLOAT) > BASSFlag.BASS_DEFAULT || flag)
            {
                this._bitwidth = 32;
                return;
            }
            if ((this._channelInfo.flags & BASSFlag.BASS_SAMPLE_8BITS) != BASSFlag.BASS_DEFAULT)
            {
                this._bitwidth = 8;
            }
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            Un4seen.Bass.BassNet.Registration("*****@*****.**", "2X113281839322");
            Un4seen.Bass.BassNet.OmitCheckVersion = true;
            bool bassinit = Un4seen.Bass.Bass.BASS_Init(0, sampleRate, Un4seen.Bass.BASSInit.BASS_DEVICE_DEFAULT, System.IntPtr.Zero);

            if (bassinit)
            {
                streamCreate = new STREAMPROC(WaveformProc);
                channel      = Bass.BASS_StreamCreate(sampleRate, 2, BASSFlag.BASS_DEFAULT, streamCreate, IntPtr.Zero);
                if (channel != 0)
                {
                    bufferLength = Bass.BASS_ChannelSeconds2Bytes(channel, (double)Bass.BASS_GetConfig(BASSConfig.BASS_CONFIG_BUFFER) / 1000d);
                    data         = new short[bufferLength];

                    playSine();
                }
                else
                {
                    Un4seen.Bass.BASSError error = Un4seen.Bass.Bass.BASS_ErrorGetCode();
                    Console.WriteLine(error.ToString());
                }
            }
            else
            {
                Console.WriteLine("FAIL");
            }

            Console.ReadLine();
        }
Beispiel #3
0
 public DSP_BufferStream(int channel, int priority) : base(channel, priority, IntPtr.Zero)
 {
     _configBuffer      = 500;
     _isOutputBuffered  = true;
     _bufferStreamFlags = BASSFlag.BASS_MUSIC_DECODE;
     ConfigBuffer       = Bass.BASS_GetConfig(BASSConfig.BASS_CONFIG_BUFFER);
     _streamProc        = new STREAMPROC(BassStreamProc);
 }
Beispiel #4
0
 public DSP_BufferStream()
 {
     _configBuffer      = 500;
     _isOutputBuffered  = true;
     _bufferStreamFlags = BASSFlag.BASS_MUSIC_DECODE;
     ConfigBuffer       = Bass.BASS_GetConfig(BASSConfig.BASS_CONFIG_BUFFER);
     _streamProc        = new STREAMPROC(BassStreamProc);
 }
Beispiel #5
0
 public BaseDSP()
 {
     this._dspProc = new DSPPROC(this.DSPCallback);
     if (Bass.BASS_GetConfig(BASSConfig.BASS_CONFIG_FLOATDSP) == 1)
     {
         this._bitwidth = 32;
     }
 }
Beispiel #6
0
        private Socket CreateSocket(string serveraddress, int port)
        {
            Socket socket = null;

            try
            {
                if (serveraddress.StartsWith("http://"))
                {
                    serveraddress.Substring(7);
                }
                IPAddress[] ipfromHost = StreamingServer.GetIPfromHost(serveraddress);
                if (ipfromHost != null)
                {
                    foreach (IPAddress address in ipfromHost)
                    {
                        try
                        {
                            IPEndPoint ipendPoint = new IPEndPoint(address, port);
                            Socket     socket2    = new Socket(ipendPoint.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
                            socket2.Connect(ipendPoint);
                            if (socket2.Connected)
                            {
                                socket             = socket2;
                                socket.SendTimeout = Bass.BASS_GetConfig(BASSConfig.BASS_CONFIG_ENCODE_CAST_TIMEOUT);
                                break;
                            }
                        }
                        catch (Exception ex)
                        {
                            base.LastError        = StreamingServer.STREAMINGERROR.Error_CreatingConnection;
                            base.LastErrorMessage = ex.Message;
                            socket = null;
                        }
                    }
                }
            }
            catch (Exception ex2)
            {
                base.LastError        = StreamingServer.STREAMINGERROR.Error_ResolvingServerAddress;
                base.LastErrorMessage = ex2.Message;
                socket = null;
            }
            return(socket);
        }
Beispiel #7
0
 private void InitChannel(int channel)
 {
     this._channel = channel;
     if (this._channel != 0)
     {
         if (!Bass.BASS_ChannelGetInfo(channel, this._channelInfo))
         {
             this._channelInfo.chans = 2;
             this._channelInfo.ctype = BASSChannelType.BASS_CTYPE_UNKNOWN;
             this._channelInfo.freq  = 44100;
         }
         this._samplerate = this._channelInfo.freq;
         this._numchans   = this._channelInfo.chans;
         if ((this._channelInfo.flags & BASSFlag.BASS_SAMPLE_MONO) != BASSFlag.BASS_DEFAULT)
         {
             this._numchans = 1;
         }
         this._bitwidth = 16;
         bool flag = Bass.BASS_GetConfig(BASSConfig.BASS_CONFIG_FLOATDSP) == 1;
         if ((this._channelInfo.flags & BASSFlag.BASS_SAMPLE_FLOAT) > BASSFlag.BASS_DEFAULT || flag)
         {
             this._bitwidth = 32;
             return;
         }
         if ((this._channelInfo.flags & BASSFlag.BASS_SAMPLE_8BITS) != BASSFlag.BASS_DEFAULT)
         {
             this._bitwidth = 8;
             return;
         }
     }
     else
     {
         this._channel     = 0;
         this._bitwidth    = 16;
         this._samplerate  = 44100;
         this._numchans    = 2;
         this._channelInfo = new BASS_CHANNELINFO();
     }
 }
Beispiel #8
0
 /// <summary>
 /// 获取选项值
 /// </summary>
 /// <param name="option">选项</param>
 /// <returns>选项值</returns>
 public static int BASS_GetConfig(BassConfigOption option)
 {
     return(Bass.BASS_GetConfig(option));
 }
Beispiel #9
0
        public override bool Start(ENCODEPROC proc, IntPtr user, bool paused)
        {
            if (base.EncoderHandle != 0 || (proc != null && !this.SupportsSTDOUT))
            {
                return(false);
            }
            this._paused      = paused;
            this._encoderProc = null;
            this._byteSend    = 0L;
            BASSWMAEncode basswmaencode = BASSWMAEncode.BASS_WMA_ENCODE_DEFAULT;

            if (this.WMA_ForceStandard)
            {
                basswmaencode |= BASSWMAEncode.BASS_WMA_ENCODE_STANDARD;
            }
            else
            {
                if (this.WMA_UsePro)
                {
                    basswmaencode |= BASSWMAEncode.BASS_WMA_ENCODE_PRO;
                }
                if (this.WMA_Use24Bit)
                {
                    basswmaencode |= BASSWMAEncode.BASS_WMA_ENCODE_24BIT;
                    basswmaencode |= BASSWMAEncode.BASS_WMA_ENCODE_PRO;
                }
            }
            this._channel             = base.ChannelHandle;
            this.WMA_TargetNumChans   = base.ChannelNumChans;
            this.WMA_TargetSampleRate = base.ChannelSampleRate;
            if (base.InputFile != null)
            {
                this._channel = Bass.BASS_StreamCreateFile(base.InputFile, 0L, 0L, BASSFlag.BASS_STREAM_DECODE | (this.WMA_Use24Bit ? BASSFlag.BASS_SAMPLE_FLOAT : BASSFlag.BASS_DEFAULT));
                if (this._channel == 0)
                {
                    return(false);
                }
                if (this.WMA_Use24Bit)
                {
                    basswmaencode |= BASSWMAEncode.BASS_SAMPLE_FLOAT;
                }
            }
            else if (base.ChannelBitwidth == 32)
            {
                basswmaencode |= BASSWMAEncode.BASS_SAMPLE_FLOAT;
            }
            else if (base.ChannelBitwidth == 8)
            {
                basswmaencode |= BASSWMAEncode.BASS_SAMPLE_8BITS;
            }
            if (this.WMA_UseNetwork)
            {
                basswmaencode |= BASSWMAEncode.BASS_WMA_ENCODE_SCRIPT;
            }
            int bitrate = this.WMA_Bitrate * 1000;

            if (this.WMA_UseVBR && this.WMA_VBRQuality > 0 && this.WMA_VBRQuality <= 100)
            {
                bitrate = this.WMA_VBRQuality;
            }
            if (proc != null && !this.WMA_UseNetwork)
            {
                this._encoderProc   = proc;
                this._wmEncoderProc = new WMENCODEPROC(this.EncodingWMAHandler);
            }
            if (base.OutputFile == null)
            {
                if (this.WMA_UseNetwork && !this.WMA_UsePublish)
                {
                    if (this.WMA_MultiBitrate != null && this.WMA_MultiBitrate.Length != 0)
                    {
                        int[] array = new int[this.WMA_MultiBitrate.Length];
                        for (int i = 0; i < this.WMA_MultiBitrate.Length; i++)
                        {
                            array[i] = this.WMA_MultiBitrate[i] * 1000;
                        }
                        base.EncoderHandle = BassWma.BASS_WMA_EncodeOpenNetworkMulti(this.WMA_TargetSampleRate, this.WMA_TargetNumChans, basswmaencode, array, this.WMA_NetworkPort, this.WMA_NetworkClients);
                    }
                    else
                    {
                        if (this.WMA_MultiBitrate != null)
                        {
                            bitrate = this.WMA_MultiBitrate[0];
                        }
                        base.EncoderHandle = BassWma.BASS_WMA_EncodeOpenNetwork(this.WMA_TargetSampleRate, this.WMA_TargetNumChans, basswmaencode, bitrate, this.WMA_NetworkPort, this.WMA_NetworkClients);
                    }
                }
                else if (this.WMA_UseNetwork && this.WMA_UsePublish)
                {
                    if (this.WMA_MultiBitrate != null && this.WMA_MultiBitrate.Length > 1)
                    {
                        int[] array2 = new int[this.WMA_MultiBitrate.Length];
                        for (int j = 0; j < this.WMA_MultiBitrate.Length; j++)
                        {
                            array2[j] = this.WMA_MultiBitrate[j] * 1000;
                        }
                        base.EncoderHandle = BassWma.BASS_WMA_EncodeOpenPublishMulti(this.WMA_TargetSampleRate, this.WMA_TargetNumChans, basswmaencode, array2, this.WMA_PublishUrl, this.WMA_PublishUsername, this.WMA_PublishPassword);
                    }
                    else
                    {
                        base.EncoderHandle = BassWma.BASS_WMA_EncodeOpenPublish(this.WMA_TargetSampleRate, this.WMA_TargetNumChans, basswmaencode, bitrate, this.WMA_PublishUrl, this.WMA_PublishUsername, this.WMA_PublishPassword);
                    }
                }
                else if (proc != null)
                {
                    base.EncoderHandle = BassWma.BASS_WMA_EncodeOpen(this.WMA_TargetSampleRate, this.WMA_TargetNumChans, basswmaencode, bitrate, this._wmEncoderProc, user);
                }
            }
            else
            {
                base.EncoderHandle = BassWma.BASS_WMA_EncodeOpenFile(this.WMA_TargetSampleRate, this.WMA_TargetNumChans, basswmaencode, bitrate, base.OutputFile);
                if (base.TAGs != null)
                {
                    if (!string.IsNullOrEmpty(base.TAGs.title))
                    {
                        this.SetTag("Title", base.TAGs.title);
                    }
                    if (!string.IsNullOrEmpty(base.TAGs.artist))
                    {
                        this.SetTag("Author", base.TAGs.artist);
                    }
                    if (!string.IsNullOrEmpty(base.TAGs.album))
                    {
                        this.SetTag("WM/AlbumTitle", base.TAGs.album);
                    }
                    if (!string.IsNullOrEmpty(base.TAGs.albumartist))
                    {
                        this.SetTag("WM/AlbumArtist", base.TAGs.albumartist);
                    }
                    if (!string.IsNullOrEmpty(base.TAGs.year))
                    {
                        this.SetTag("WM/Year", base.TAGs.year);
                    }
                    if (!string.IsNullOrEmpty(base.TAGs.track))
                    {
                        this.SetTag("WM/TrackNumber", base.TAGs.track);
                    }
                    if (!string.IsNullOrEmpty(base.TAGs.disc))
                    {
                        this.SetTag("WM/PartOfSet", base.TAGs.disc);
                    }
                    if (!string.IsNullOrEmpty(base.TAGs.genre))
                    {
                        this.SetTag("WM/Genre", base.TAGs.genre);
                    }
                    if (!string.IsNullOrEmpty(base.TAGs.comment))
                    {
                        this.SetTag("Description", base.TAGs.comment);
                    }
                    if (!string.IsNullOrEmpty(base.TAGs.composer))
                    {
                        this.SetTag("WM/Composer", base.TAGs.composer);
                    }
                    if (!string.IsNullOrEmpty(base.TAGs.conductor))
                    {
                        this.SetTag("WM/Conductor", base.TAGs.conductor);
                    }
                    if (!string.IsNullOrEmpty(base.TAGs.lyricist))
                    {
                        this.SetTag("WM/Writer", base.TAGs.lyricist);
                    }
                    if (!string.IsNullOrEmpty(base.TAGs.remixer))
                    {
                        this.SetTag("WM/ModifiedBy", base.TAGs.remixer);
                    }
                    if (!string.IsNullOrEmpty(base.TAGs.producer))
                    {
                        this.SetTag("WM/Producer", base.TAGs.producer);
                    }
                    if (!string.IsNullOrEmpty(base.TAGs.encodedby))
                    {
                        this.SetTag("WM/EncodedBy", base.TAGs.encodedby);
                    }
                    if (!string.IsNullOrEmpty(base.TAGs.copyright))
                    {
                        this.SetTag("Copyright", base.TAGs.copyright);
                    }
                    if (!string.IsNullOrEmpty(base.TAGs.publisher))
                    {
                        this.SetTag("WM/Publisher", base.TAGs.publisher);
                    }
                    if (!string.IsNullOrEmpty(base.TAGs.bpm))
                    {
                        this.SetTag("WM/BeatsPerMinute", base.TAGs.bpm);
                    }
                    if (!string.IsNullOrEmpty(base.TAGs.grouping))
                    {
                        this.SetTag("WM/ContentGroupDescription", base.TAGs.grouping);
                    }
                    if (!string.IsNullOrEmpty(base.TAGs.rating))
                    {
                        this.SetTag("WM/Rating", base.TAGs.rating);
                    }
                    if (!string.IsNullOrEmpty(base.TAGs.mood))
                    {
                        this.SetTag("WM/Mood", base.TAGs.mood);
                    }
                    if (!string.IsNullOrEmpty(base.TAGs.isrc))
                    {
                        this.SetTag("WM/ISRC", base.TAGs.isrc);
                    }
                    if (base.TAGs.replaygain_track_peak >= 0f)
                    {
                        this.SetTag("replaygain_track_peak", base.TAGs.replaygain_track_peak.ToString("R", CultureInfo.InvariantCulture));
                    }
                    if (base.TAGs.replaygain_track_gain >= -60f && base.TAGs.replaygain_track_gain <= 60f)
                    {
                        this.SetTag("replaygain_track_gain", base.TAGs.replaygain_track_gain.ToString("R", CultureInfo.InvariantCulture) + " dB");
                    }
                }
            }
            if (base.EncoderHandle == 0)
            {
                return(false);
            }
            this._dspCallback = new DSPPROC(this.EncodingDSPHandler);
            this._dspHandle   = Bass.BASS_ChannelSetDSP(base.ChannelHandle, this._dspCallback, IntPtr.Zero, Bass.BASS_GetConfig(BASSConfig.BASS_CONFIG_ENCODE_PRIORITY));
            if (this._dspHandle == 0)
            {
                this.Stop();
                return(false);
            }
            if (base.InputFile != null)
            {
                Utils.DecodeAllData(this._channel, true);
            }
            this._channel = 0;
            return(base.EncoderHandle != 0);
        }
 public DSP_BufferStream(int channel, int priority) : base(channel, priority, IntPtr.Zero)
 {
     this.ConfigBuffer = Bass.BASS_GetConfig(BASSConfig.BASS_CONFIG_BUFFER);
     this._streamProc  = new STREAMPROC(this.BassStreamProc);
 }
 public DSP_BufferStream()
 {
     this.ConfigBuffer = Bass.BASS_GetConfig(BASSConfig.BASS_CONFIG_BUFFER);
     this._streamProc  = new STREAMPROC(this.BassStreamProc);
 }
Beispiel #12
0
        private static void Main(string[] args)
        {
            Console.OutputEncoding = Encoding.Unicode;
            Console.InputEncoding  = Encoding.Unicode;
            Thread.Sleep(1);
            var rand       = RCutN(new Random((int)((Stopwatch.GetTimestamp() + DateTime.Now.Ticks) % int.MaxValue)), Environment.TickCount % 257);
            var mainmoddir = Path.GetDirectoryName(Path.GetFullPath(Process.GetCurrentProcess().MainModule.FileName));

            if (Directory.Exists(mainmoddir))
            {
                Bass.BASS_PluginLoadDirectory(mainmoddir);
            }
            if (!Bass.BASS_Init(-1, 96000, BASSInit.BASS_DEVICE_DEFAULT, IntPtr.Zero))
            {
                Console.Write($"Init failed:{Bass.BASS_ErrorGetCode().ToString()} ...");
                Console.ReadKey(true);
                return;
            }
            string GetFullPath(string path)
            {
                try {
                    return(Path.GetFullPath(path));
                } catch {
                    return(null);
                }
            }

            var narg = args.Length;
            var iarg = 0;

            //Bass.BASS_SetVolume(0.5f);
            Bass.BASS_SetConfig(BASSConfig.BASS_CONFIG_GVOL_STREAM, 2500);
            var osv = Environment.OSVersion;

            if (osv.Platform != PlatformID.Win32NT || osv.Version.Major < 10)
            {
                Console.SetBufferSize(256, 9999);
            }
            string        cmd;
            List <string> files    = null;
            var           datas    = new HashSet <string>();
            string        listfile = null;

            for (; ;)
            {
                Console.Write("输入文件夹/列表文件>");
                if (iarg < narg)
                {
                    Console.WriteLine(cmd = args[iarg++]);
                }
                else
                {
                    cmd = Console.ReadLine();
                }
                cmd = cmd.Replace("\"", string.Empty);
                if (!(Directory.Exists(cmd) || File.Exists(cmd)))
                {
                    Console.WriteLine($"路径 {cmd} 不存在/不合法");
                    continue;
                }
                cmd = GetFullPath(cmd);
                if (File.Exists(cmd))
                {
                    foreach (var _file in File.ReadAllLines(cmd, Encoding.UTF8))
                    {
                        if (_file is null)
                        {
                            continue;
                        }
                        if (_file.Length <= 0)
                        {
                            continue;
                        }
                        var file = _file;
                        if (int.TryParse(file, out var number))
                        {
                            Bass.BASS_SetConfig(BASSConfig.BASS_CONFIG_GVOL_STREAM, Math.Min(10000, Math.Max(0, number)));
                        }
                        else if (Check(file = GetFullPath(file.Replace("\"", string.Empty))) && datas.Add(file))
                        {
                            Console.WriteLine(file);
                        }
                    }
                    listfile = cmd;
                }
                else
                {
                    var last_time = DateTime.Now.AddSeconds(-1);
                    void f(string path)
                    {
                        var t = DateTime.Now;

                        if (t.Subtract(last_time).TotalMilliseconds > 33)
                        {
                            last_time     = t;
                            Console.Title = $"...{path}";
                        }
                        try {
                            foreach (var file in Directory.GetFiles(path))
                            {
                                if (Check(file))
                                {
                                    if (datas.Add(file))
                                    {
                                        Console.WriteLine(file);
                                    }
                                }
                            }
                        } catch (Exception e) {
                            Console.WriteLine(e);
                        }
                        try {
                            foreach (var dir in Directory.GetDirectories(path))
                            {
                                f(dir);
                            }
                        } catch (Exception e) {
                            Console.WriteLine(e);
                        }
                    }

                    f(cmd);
                }
                Console.WriteLine($"一共{datas.Count}个文件");
                files = new List <string>(datas);
                break;
            }
            var nfile = files.Count;

            cmd = null;
            var ch = new Mutex();

            (new Thread(() => {
                for (; ;)
                {
                    if (cmd is null)
                    {
                        ch.WaitOne();
                        Console.Write('>'); cmd = Console.ReadLine();
                        ch.ReleaseMutex();
                        if (cmd is "exit" || cmd is "quit")
                        {
                            break;
                        }
                    }
                    Thread.Sleep(666);
                }
            })).Start();
            var started = false;
            var notquit = true;
            var re_vol  = new Regex(@"^vol\s+(?<number>\d+)\s?$", RegexOptions.Compiled | RegexOptions.ExplicitCapture);

            void save()
            {
                try {
                    File.WriteAllLines(listfile, files, Encoding.UTF8);
                    File.AppendAllText(listfile, $"\n{Bass.BASS_GetConfig(BASSConfig.BASS_CONFIG_GVOL_STREAM).ToString()}\n");
                    Console.WriteLine($"已保存到{listfile}");
                } catch (Exception e) {
                    Console.WriteLine($"保存到{listfile}失败");
                    Console.WriteLine(e);
                }
            }

            string             playing = null;
            double             last_pos;
            Predicate <string> toplay = null;

            bool pcmd()
            {
                if (cmd is null)
                {
                    return(true);
                }
                ch.WaitOne();
                switch (cmd)
                {
                case "exit":
                case "quit": {
                    return(notquit = false);
                }

                case "start": started = true; break;

                case "":
                case "help":
                case "?":
                    Console.WriteLine(@"
命令列表:
    help/?          显示当前信息
    start           开始播放列表
    stop            停止播放(不会记录播放位置)
    next            下一首
    now/playing/`/??输出当前正在播放的文件路径
    exit/quit       退出
    save <path>     保存当前播放列表到文件<path>,包括音量
    vol [<value>]   设置/显示当前音量,值范围 [0, 10000] 整数,如果已有列表文件(启动加载时输入的或者中途save命令保存的),会同时保存到列表文件里
    ?<pattern>      使用 pattern 筛选显示歌曲路径,pattern 以 \ 开头则为正则表达式(除了开头的\外),否则为子串查找
    =<pattern>      播放符合 pattern 的第一首歌曲,pattern 格式同 ?<pattern>
    -<pattern>      从列表里删除所有符合 pattern 的歌曲,pattern 格式同 ?<pattern>,如果已有列表文件(启动加载时输入的或者中途save命令保存的),会同时保存到列表文件里
    add <path>      增加 path 文件夹下/文件的歌曲,如果已有列表文件(启动加载时输入的或者中途save命令保存的),会同时保存到列表文件里
    =               (不含 pattern) 还没开始播放时相当于 start 命令;开始播放后相当于 next 命令
    -               (不含 pattern) 还没开始播放时没有效果;开始播放后相当于 stop 命令
");
                    break;

                case "next": {
                    cmd = null;
                    ch.ReleaseMutex();
                    return(false);
                }

                case "??":
                case "now":
                case "`":
                case "playing":
                    Console.WriteLine(playing ?? "<当前没有播放任何文件>");
                    break;

                case "stop": {
                    cmd = null;
                    ch.ReleaseMutex();
                    started = false;
                    if (!(playing is null))
                    {
                        Console.WriteLine($"之前播放: {playing}");
                    }
                    return(false);
                }

                case "=": {
                    if (started)
                    {
                        goto case "next";
                    }
                    else
                    {
                        goto case "start";
                    }
                }

                case "-":
                    if (started)
                    {
                        goto case "stop";
                    }
                    else
                    {
                        Console.WriteLine("当前没有播放");
                    }
                    break;

                default:
                    if (cmd.StartsWith("save"))
                    {
                        if (cmd.Length > 5)
                        {
                            listfile = GetFullPath(cmd.Substring(5).Replace("\"", string.Empty));
                        }
                        if (listfile is null || listfile is "")
                        {
                            Console.WriteLine("没有导出路径,请使用 save <file path> 命令指定导出路径");
                        }
                        else
                        {
                            save();
                        }
                    }
Beispiel #13
0
        public void tInitialize(ESoundDeviceType soundDeviceType, int _nSoundDelayExclusiveWASAPI, int _nSoundDelayASIO, int _nASIODevice, int _nSoundDelayBASS, bool _bUseOSTimer)
        {
            //SoundDevice = null;						// 後で再初期化することがあるので、null初期化はコンストラクタに回す
            rc演奏用タイマ = null;                                    // Global.Bass 依存(つまりユーザ依存)
            nMixing  = 0;

            SoundDelayExclusiveWASAPI = _nSoundDelayExclusiveWASAPI;
            SoundDelayASIO            = _nSoundDelayASIO;
            SoundDelayBASS            = _nSoundDelayBASS;
            ASIODevice  = _nASIODevice;
            bUseOSTimer = _bUseOSTimer;

            ESoundDeviceType[] ESoundDeviceTypes = new ESoundDeviceType[6]
            {
                ESoundDeviceType.SharedWASAPI,
                ESoundDeviceType.ExclusiveWASAPI,
                ESoundDeviceType.ASIO,
                ESoundDeviceType.BASS,
                ESoundDeviceType.OpenAL,
                ESoundDeviceType.Unknown
            };

            int n初期デバイス;

            switch (soundDeviceType)
            {
            case ESoundDeviceType.SharedWASAPI:
                n初期デバイス = 0;
                break;

            case ESoundDeviceType.ExclusiveWASAPI:
                n初期デバイス = 1;
                break;

            case ESoundDeviceType.ASIO:
                n初期デバイス = 2;
                break;

            case ESoundDeviceType.BASS:
                n初期デバイス = 3;
                break;

            case ESoundDeviceType.OpenAL:
                n初期デバイス = 4;
                break;

            default:
                n初期デバイス = 5;
                break;
            }
            for (SoundDeviceType = ESoundDeviceTypes[n初期デバイス]; ; SoundDeviceType = ESoundDeviceTypes[++n初期デバイス])
            {
                try
                {
                    t現在のユーザConfigに従ってサウンドデバイスとすべての既存サウンドを再構築する();
                    break;
                }
                catch (Exception e)
                {
                    Trace.TraceError(e.ToString());
                    Trace.TraceError("An exception has occurred, but processing continues.");
                    if (ESoundDeviceTypes[n初期デバイス] == ESoundDeviceType.Unknown)
                    {
                        Trace.TraceError(string.Format("サウンドデバイスの初期化に失敗しました。"));
                        break;
                    }
                }
            }
            if (SoundDeviceType == ESoundDeviceType.ExclusiveWASAPI || SoundDeviceType == ESoundDeviceType.SharedWASAPI || SoundDeviceType == ESoundDeviceType.ASIO || SoundDeviceType == ESoundDeviceType.BASS)
            {
                Trace.TraceInformation("BASS_CONFIG_UpdatePeriod=" + Bass.BASS_GetConfig(BASSConfig.BASS_CONFIG_UPDATEPERIOD));
                Trace.TraceInformation("BASS_CONFIG_UpdateThreads=" + Bass.BASS_GetConfig(BASSConfig.BASS_CONFIG_UPDATETHREADS));
            }
        }