• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# IWavePlayer类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中IWavePlayer的典型用法代码示例。如果您正苦于以下问题:C# IWavePlayer类的具体用法?C# IWavePlayer怎么用?C# IWavePlayer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IWavePlayer类属于命名空间,在下文中一共展示了IWavePlayer类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: MainForm

 public MainForm()
 {
     waveOutDevice = null;
     mainOutputStream = null;
     volumeStream = null;
     InitializeComponent();
 }
开发者ID:dolvlo,项目名称:ssamplerates,代码行数:7,代码来源:MainForm.cs


示例2: PianoSynth

        public PianoSynth()
        {
            mixer = new WaveMixerStream32();
            mixer.AutoStop = false;

            int i = 0;
            foreach (var note in noteFiles)
            {
                reader[i] = new WaveFileReader(note);

                offsetStream[i] = new WaveOffsetStream(reader[i]);
                channelSteam[i] = new WaveChannel32(offsetStream[i]);
                channelSteam[i].Position = channelSteam[i].Length;
                mixer.AddInputStream(channelSteam[i]);

                i++;
            }

            if (waveOutDevice == null)
            {
                waveOutDevice = new WaveOut {DeviceNumber = 0};
                waveOutDevice.Init(mixer);
                waveOutDevice.Volume = 0;
                waveOutDevice.Play();
                waveOutDevice.Volume = 100;
            }
        }
开发者ID:grazulis,项目名称:KinectRainbowSynth,代码行数:27,代码来源:PianoSynth.cs


示例3: Load

 public bool Load(string path, Guid device)
 {
     var cext = path.GetExt();
     _myWaveOut = new DirectSoundOut(device);
     try
     {
         _myWaveStream = _codecs.First(v => v.Extensions.Contains(cext)).CreateWaveStream(path);
     }
     catch
     {
         return false;
     }
     if (_myWaveStream == null) return false;
     if (_myWaveStream.WaveFormat.Channels == 2)
     {
         _myBalanceSampleProvider = new BalanceSampleProvider(_myWaveStream.ToSampleProvider());
         _myVolumeSampleProvider = new VolumeSampleProvider(_myBalanceSampleProvider);
         _myBalanceSampleProvider.Pan = (float)Balance;
     }
     else _myVolumeSampleProvider = new VolumeSampleProvider(_myWaveStream.ToSampleProvider());
     _myEqualizer = new Equalizer(_myVolumeSampleProvider, _equalizerBands) { Enabled = _enableEqualizer };
     _myWaveOut.Init(_myEqualizer);
     _myWaveOut.PlaybackStopped += MyWaveOutOnPlaybackStopped;
     _myVolumeSampleProvider.Volume = (float)Volume;
     return true;
 }
开发者ID:OronDF343,项目名称:Sky-Jukebox,代码行数:26,代码来源:NAudioPlayer.cs


示例4: Play

        private async void Play()
        {
            if (reader == null)
            {
                return;
            }

            if (player == null)
            {
                // Exclusive mode - fails with a weird buffer alignment error

                //player = new MediaElementOut(MediaElement);
                player = new WasapiOutRT(AudioClientShareMode.Shared, 200);

                player.PlaybackStopped += PlayerOnPlaybackStopped;
            }

            if (player.PlaybackState != PlaybackState.Playing)
            {
                reader.Seek(0, SeekOrigin.Begin);
                await player.Init(reader);
                player.Play();
                StopCommand.IsEnabled = true;
                PauseCommand.IsEnabled = true;
            }
        }
开发者ID:KarimLUCCIN,项目名称:NAudioCustom,代码行数:26,代码来源:MainPageViewModel.cs


示例5: playWave

 /// <summary>
 /// Lejátszik egy .mp3 fájlt
 /// </summary>
 /// <param name="audioFile">.mp3 fájl</param>
 public static void playWave(string audioFile)
 {
     thread = new WaveOut();
     stream = CreateInputStream(audioFile);
     thread.Init(stream);
     thread.Play();
 }
开发者ID:Easimer,项目名称:bearded-spider,代码行数:11,代码来源:Audio.cs


示例6: play_Click

        private void play_Click(object sender, EventArgs e)
        {
            if (playlist.SelectedItems.Count>0)
            {
                id = fn.IndexOf(playlist.SelectedItem.ToString());
                if (waveOutDevice.PlaybackState.ToString() != "Paused")
                {
                    t.Stop();
                    stp();
                    audioFileReader = new AudioFileReader(fp[id]);
                    waveOutDevice = new WaveOut();
                    waveOutDevice.Init(audioFileReader);
                    trackbar.Maximum = (int)audioFileReader.TotalTime.TotalSeconds + 1;
                    //deb.Items.Add(audioFileReader.TotalTime.Seconds.ToString());
                    audioFileReader.Volume = (float)vol.Value / 100;
                    waveOutDevice.Play();
                    t.Start();

                }
                else
                {
                    waveOutDevice.Play();
                    t.Start();
                }
            }
            
           
            
        }
开发者ID:npuMa94,项目名称:npuMathecreator,代码行数:29,代码来源:Form1.cs


示例7: CreateWaveOut

 private void CreateWaveOut()
 {
     CloseWaveOut();
     int latency = 300;
     _waveOut = SelectedOutputAudioDeviceFactory.CreateDevice(latency);
     _waveOut.PlaybackStopped += OnPlaybackStopped;
 }
开发者ID:kidaa,项目名称:Pulse,代码行数:7,代码来源:AudioPlaybackPanel.cs


示例8: Connect

        private void Connect(IPEndPoint endPoint, int inputDeviceNumber, INetworkChatCodec codec)
        {
            waveIn = new WaveIn();
            waveIn.BufferMilliseconds = 50;
            waveIn.DeviceNumber = inputDeviceNumber;
            waveIn.WaveFormat = codec.RecordFormat;
            waveIn.DataAvailable += waveIn_DataAvailable;
            waveIn.StartRecording();

            udpSender = new UdpClient();
            udpListener = new UdpClient();

            // To allow us to talk to ourselves for test purposes:
            // http://stackoverflow.com/questions/687868/sending-and-receiving-udp-packets-between-two-programs-on-the-same-computer
            udpListener.Client.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true);
            udpListener.Client.Bind(endPoint);

            udpSender.Connect(endPoint);

            waveOut = new WaveOut();
            waveProvider = new BufferedWaveProvider(codec.RecordFormat);
            waveOut.Init(waveProvider);
            waveOut.Play();

            connected = true;
            var state = new ListenerThreadState { Codec = codec, EndPoint = endPoint };
            ThreadPool.QueueUserWorkItem(ListenerThread, state);
        }
开发者ID:LibertyLocked,项目名称:NAudio,代码行数:28,代码来源:NetworkChatPanel.cs


示例9: AudioPlaybackEngine

 public AudioPlaybackEngine(int sampleRate = 44100, int channelCount = 2)
 {
     outputDevice = new WaveOutEvent();
     mixer = new MixingSampleProvider(WaveFormat.CreateIeeeFloatWaveFormat(sampleRate, channelCount));
     mixer.ReadFully = true;
     outputDevice.Init(mixer);
     outputDevice.Play();
 }
开发者ID:carsonk,项目名称:MistyMixer,代码行数:8,代码来源:AudioPlaybackEngine.cs


示例10: PlayFile

 public int PlayFile(string filename)
 {
     waveOutDevice = new WaveOut();
     mainOutputStream = CreateInputStream(filename);
     waveOutDevice.Init(mainOutputStream);
     waveOutDevice.Play();
     return 0;
 }
开发者ID:jorik041,项目名称:soundfingerprinting,代码行数:8,代码来源:NAudioService.cs


示例11: Audio

 public Audio(string filename)
 {
     this.fileName = filename;
     waveOutDevice = new DirectSoundOut(50);
     mainOutputStream = CreateInputStream(filename);
     waveOutDevice.Init(mainOutputStream);
     isPlaying = false;
 }
开发者ID:AviiNL,项目名称:Ccs2DLcd,代码行数:8,代码来源:Audio.cs


示例12: frmMain_FormClosing

		private void frmMain_FormClosing(object sender, FormClosingEventArgs e)
		{
			if (this._player.PlaybackState == PlaybackState.Playing)
				this._player.Stop();

			this._player.Dispose();
			this._player = null;
		}
开发者ID:lockflatboy,项目名称:Sublime-Text-2-Patcher,代码行数:8,代码来源:frmMain.cs


示例13: Dispose

 public void Dispose()
 {
     Stop();
     if (playbackDevice != null)
     {
         playbackDevice.Dispose();
         playbackDevice = null;
     }
 }
开发者ID:chantsunman,项目名称:helix-toolkit,代码行数:9,代码来源:AudioPlayback.cs


示例14: Stop

 private void Stop()
 {
     if (waveOut != null)
     {
         this.patternSequencer = null;
         waveOut.Dispose();
         waveOut = null;
     }
 }
开发者ID:LuckyLuik,项目名称:_GLDNBT,代码行数:9,代码来源:DrumMachineDemoViewModel.cs


示例15: AudioPlaya

 public AudioPlaya(string filename) {
     waveOutDevice = new WaveOut();
     waveOutDevice.Init(stream = loadFromFile(filename));
     waveOutDevice.PlaybackStopped += (object sender, StoppedEventArgs e) =>
     {
         if (Finished != null)
             Finished(this);
     };
 }
开发者ID:miktemk,项目名称:MiktemkCommons,代码行数:9,代码来源:AudioPlaya.cs


示例16: CloseWaveOut

        private void CloseWaveOut()
        {
            _waveOut?.Stop();

            if (_waveOut != null)
            {
                _waveOut.Dispose();
                _waveOut = null;
            }
        }
开发者ID:akimoto-akira,项目名称:Pulse,代码行数:10,代码来源:AudioPlaybackPanel.cs


示例17: RadioStationMain

 public RadioStationMain(string baseFolder)
 {
     if (player == null)
     {
         player = new WaveOut();
         player.PlaybackStopped += OnPlaybackStopped;
     }
     randomFileSelector = new RandomFileSelector(baseFolder);
     CurrentPlayingFileName = LoadRandomFile();
 }
开发者ID:dotinfinity,项目名称:srw,代码行数:10,代码来源:RadioStationMain.cs


示例18: MainWindow

        public MainWindow()
        {
            InitializeComponent();
            Termination = false;
            waveOutDevice = new WaveOut();
            waveOutDevice.PlaybackStopped += WaveOutDevice_PlaybackStopped;

            Play_List.ItemsSource = upcoming;
            cFunctions = new Cloud.CloudFunctions();
        }
开发者ID:Hitchhikrr,项目名称:Jukebox,代码行数:10,代码来源:MainWindow.xaml.cs


示例19: Mp3Player

        public Mp3Player()
        {
            _waveOutDevice = new WaveOut();

            _waveOutDevice.PlaybackStopped += (sender, args) =>
            {
                _ms.Dispose();
                _mainOutputStream.Dispose();
            };
        }
开发者ID:ukionik,项目名称:VDesktopeNew,代码行数:10,代码来源:Mp3Player.cs


示例20: PlaySong

 public void PlaySong()
 {
     // Instantiate audio player
     waveOutDevice = new WaveOut();
     // Set MP3 to play
     audioFileReader = new AudioFileReader(GetSong());
     // Init device and call play
     waveOutDevice.Init(audioFileReader);
     waveOutDevice.Play();
 }
开发者ID:Brendo311,项目名称:AlarmClockWakeTheFuckUp,代码行数:10,代码来源:SoundAlarm.cs



注:本文中的IWavePlayer类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IWaveProvider类代码示例发布时间:2022-05-24
下一篇:
C# IWaitIndicator类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap