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

C# FMOD.Channel类代码示例

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

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



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

示例1: ChannelInfo

 public ChannelInfo(Channel channel, IMediaFile file, Action playNextFileAction)
 {
     this.Channel = channel;
     this.Channel.getSystemObject(out system).ERRCHECK();
     this.File = file;
     this.playNextFileAction = playNextFileAction;
     this.channelEndCallback = new FMOD.CHANNEL_CALLBACK(ChannelEndCallback);
     this.Channel.setCallback(this.channelEndCallback).ERRCHECK();
     this.Volume = 0f;
 }
开发者ID:kaushik1605,项目名称:sample_DotNet,代码行数:10,代码来源:ChannelInfo.cs


示例2: LoadSong

        //Loads a song into memory given a sample size and file-path to an audio file.
        //The most commonly used and accurate Sample Size is 1024.
        public void LoadSong(int sSize, string audioString)
        {
            //Take in Aruguments
            sampleSize = sSize;
            songString = audioString;

            stopW.Start();
            areWePlaying = true;
            specFlux = 0.0f;
            timeBetween = 0;
            initialTime = (int)stopW.ElapsedMilliseconds;
            currentTime = 0;
            currentSeconds = 0;
            lastSeconds = 0;
            currentMillis = 0;
            currentMinutes = 0;
            median = 0.0f;
            smoothMedian = 0.0f;
            beatThreshold = 0.6f;
            thresholdSmoother = 0.6f;
            started = false;
            lastBeatRegistered = new TimeStamp();
            audio = new FMOD.Sound();
            songChannel1 = new FMOD.Channel();

            channelMusic = new FMOD.ChannelGroup();

            previousFFT = new float[sampleSize
                / 2 + 1];
            for (int i = 0; i < sampleSize / 2; i++)
            {
                previousFFT[i] = 0;
            }

            //Brute force for testing
            //songString = "Music/drums.wav";

            //Create channel and audio
            FMODErrorCheck(system.createChannelGroup(null, ref channelMusic));
               // CREATESOUNDEXINFO ex = new CREATESOUNDEXINFO();

            FMODErrorCheck(system.createStream(songString, FMOD.MODE.SOFTWARE, ref audio));

            audio.getLength(ref seconds, FMOD.TIMEUNIT.MS);
            audio.getDefaults(ref sampleRate, ref zeroF, ref zeroF, ref zero);
            seconds = ((seconds + 500) / 1000);
            minutes = seconds / 60;
            fullSeconds = (int)seconds;
            seconds = seconds - (minutes * 60);

            FMODErrorCheck(system.playSound(FMOD.CHANNELINDEX.FREE, audio, true, ref songChannel1));

            //hzRange = (sampleRate / 2) / static_cast<float>(sampleSize);
            songChannel1.setChannelGroup(channelMusic);
            songChannel1.setPaused(true);

            Console.WriteLine("Song Length: " + minutes + ":" + seconds);
            Console.WriteLine("Sample Rate: " + sampleRate);

            //std::cout << "Freq Range: " << hzRange << std::endl;
            //songChannel1.setVolume(0);
        }
开发者ID:SkuliSheepman,项目名称:BeatDetectorForGames,代码行数:64,代码来源:BeatDetector.cs


示例3: getChannel

        public RESULT getChannel(int index, ref Channel channel)
        {
            var result = RESULT.OK;
            var channelraw = new IntPtr();
            Channel channelnew = null;

            try
            {
                result = FMOD_ChannelGroup_GetChannel(channelgroupraw, index, ref channelraw);
            }
            catch
            {
                result = RESULT.ERR_INVALID_PARAM;
            }
            if (result != RESULT.OK)
            {
                return result;
            }

            if (channel == null)
            {
                channelnew = new Channel();
                channelnew.setRaw(channelraw);
                channel = channelnew;
            }
            else
            {
                channel.setRaw(channelraw);
            }

            return result;
        }
开发者ID:nathan-alden,项目名称:old-text-adventure,代码行数:32,代码来源:fmod.cs


示例4: playSound

 public RESULT playSound(Sound sound, ChannelGroup channelGroup, bool paused, out Channel channel)
 {
     channel = null;
     IntPtr channelGroup2 = (!(channelGroup != null)) ? IntPtr.Zero : channelGroup.getRaw();
     IntPtr raw;
     RESULT result = System.FMOD5_System_PlaySound(this.rawPtr, sound.getRaw(), channelGroup2, paused, out raw);
     channel = new Channel(raw);
     return result;
 }
开发者ID:GameDiffs,项目名称:TheForest,代码行数:9,代码来源:System.cs


示例5: Play

        private static void Play(string path, bool isBGM)
        {
            var file = NLVFS.NLVFS.LoadFile(path);
            if (file == null)
            {
                NLog.Warn("fmod Play file not Found " + path);
                return;
            }

            var info = new CREATESOUNDEXINFO();
            info.length = (uint)file.Length;
            Sound s;
            var result = _fmod.createSound(file, MODE.OPENMEMORY, ref info, out s);
            if (result != RESULT.OK)
            {
                NLog.Error("fmod createSound " + result);
            }
            
            Channel channel;
            result = _fmod.playSound(s, null, false, out channel);
            _fmod.update();
            int index;
            channel.getIndex(out index);
            if (result != RESULT.OK)
            {
                NLog.Error("fmod playSound " + result);
            }

            if (isBGM)
            {
                _channelBGM = channel;
            }
        }
开发者ID:narlon,项目名称:TOMClassic,代码行数:33,代码来源:SoundManager.cs


示例6: getChannel

        public RESULT getChannel(int channelid, ref Channel channel)
        {
            RESULT result      = RESULT.OK;
            IntPtr      channelraw  = new IntPtr();
            Channel     channelnew  = null;

            try
            {
                result = FMOD_System_GetChannel(systemraw, channelid, ref channelraw);
            }
            catch
            {
                result = RESULT.ERR_INVALID_PARAM;
            }
            if (result != RESULT.OK)
            {
                return result;
            }

            if (channel == null)
            {
                channelnew = new Channel();
                channelnew.setRaw(channelraw);
                channel = channelnew;
            }
            else
            {
                channel.setRaw(channelraw);
            }

            return result;
        }
开发者ID:huming2207,项目名称:ghgame,代码行数:32,代码来源:fmod.cs


示例7: FMOD_System_GetChannel

        public RESULT getChannel             (int channelid, out Channel channel)
        {
            channel = null;

            IntPtr channelraw;
            RESULT result = FMOD_System_GetChannel(rawPtr, channelid, out channelraw);
            channel = new Channel(channelraw);

            return result;
        }
开发者ID:Cocotus,项目名称:simple-music-player,代码行数:10,代码来源:fmod.cs


示例8: WavEffect

        public WavEffect(FMOD.System system, string path, bool loop, float baseVol)
        {
            this.system = system;
            callback = new CHANNEL_CALLBACK(SyncCallback);

            baseVolume = baseVol;
            volume = 1;

            system.createSound(path, MODE.SOFTWARE | (loop ? MODE.LOOP_NORMAL : MODE.LOOP_OFF), ref sound);
            channel = new Channel();
            playCount = 0;
        }
开发者ID:Tesserex,项目名称:C--MegaMan-Engine,代码行数:12,代码来源:SoundEffect.cs


示例9: IntPtr

        public RESULT playSound              (Sound sound, ChannelGroup channelGroup, bool paused, ref Channel channel)
        {
            RESULT result      = RESULT.OK;
            IntPtr      channelraw;
            Channel     channelnew  = null;

            if (channel != null)
            {
                channelraw = channel.getRaw();
            }
            else
            {
                channelraw  = new IntPtr();
            }

            IntPtr channelGroupRaw = (channelGroup != null) ? channelGroup.getRaw() : (IntPtr)0;


            try
            {
                result = FMOD_System_PlaySound(systemraw, sound.getRaw(), channelGroupRaw, (paused ? 1 : 0), ref channelraw);
            }
            catch
            {
                result = RESULT.ERR_INVALID_PARAM;
            }
            if (result != RESULT.OK)
            {
                return result;
            }

            if (channel == null)
            {
                channelnew = new Channel();
                channelnew.setRaw(channelraw);
                channel = channelnew;
            }
            else
            {
                channel.setRaw(channelraw);
            }
                             
            return result;                                                                    
        }
开发者ID:whztt07,项目名称:GameEngine,代码行数:44,代码来源:fmod.cs


示例10: FMOD5_System_PlayDSP

        public RESULT playDSP                (DSP dsp, bool paused, out Channel channel)
        {
            channel = null;

            IntPtr channelraw;
            RESULT result = FMOD5_System_PlayDSP(rawPtr, dsp.getRaw(), paused, out channelraw);
            channel = new Channel(channelraw);

            return result;
        }
开发者ID:Backman,项目名称:Hellbound,代码行数:10,代码来源:fmod.cs


示例11: loadSongToDelay

        //This function is used to add a delay in the detection to playback ratio.
        //For example, if an obstacle is spawned to the music, it will be spawned immediately
        //upon the song detecting a beat, when oftentimes we want to line up that obstacle
        //with the point in the music it plays. So, the obstacle will spawn before the song gets
        //to the beat detected point.
        //Use milliseconds to express the amount of delay time you want between playback and detection.
        public void loadSongToDelay(int milliseconds)
        {
            delayedSong = true;
            songChannel1.setVolume(0);

            audio2 = new FMOD.Sound();
            FMODErrorCheck(system.createStream(songString, FMOD.MODE.SOFTWARE, ref audio2));

            songChannel2 = new FMOD.Channel();
            FMODErrorCheck(system.playSound(FMOD.CHANNELINDEX.FREE, audio2, true, ref songChannel2));
            songChannel2.setChannelGroup(channelMusic);
            timeToDelay = milliseconds;
        }
开发者ID:SkuliSheepman,项目名称:BeatDetectorForGames,代码行数:19,代码来源:BeatDetector.cs


示例12: Stop

 public void Stop()
 {
     if (musicChannel != null)
     {
         RESULT result = musicChannel.stop();
         musicChannel = null;
         ErrCheck(result);
     }
 }
开发者ID:Pamilator,项目名称:mywindowmediaplayer-epitech2013,代码行数:9,代码来源:MusicPlayer.cs


示例13: FMOD_System_PlayDSP

        public RESULT playDSP                (DSP dsp, ChannelGroup channelGroup, bool paused, out Channel channel)
        {
            channel = null;

            IntPtr channelGroupRaw = (channelGroup != null) ? channelGroup.getRaw() : IntPtr.Zero;

            IntPtr channelraw;
            RESULT result = FMOD_System_PlayDSP(rawPtr, dsp.getRaw(), channelGroupRaw, paused, out channelraw);
            channel = new Channel(channelraw);

            return result;
        }
开发者ID:Cocotus,项目名称:simple-music-player,代码行数:12,代码来源:fmod.cs


示例14: OnEndMusic

 public RESULT OnEndMusic(IntPtr channelraw, FMOD.CHANNEL_CALLBACKTYPE type, IntPtr commanddata1, IntPtr commanddata2)
 {
     if (EndMusic != null)
         EndMusic(currentMusicPath, new EventArgs());
     musicChannel = null;
     return RESULT.OK;
 }
开发者ID:Pamilator,项目名称:mywindowmediaplayer-epitech2013,代码行数:7,代码来源:MusicPlayer.cs


示例15: FMOD_ChannelGroup_GetChannel

        public RESULT getChannel             (int index, out Channel channel)
        {
            channel = null;

            IntPtr channelraw;
            RESULT result = FMOD_ChannelGroup_GetChannel(getRaw(), index, out channelraw);
            channel = new Channel(channelraw);

            return result;
        }
开发者ID:Cocotus,项目名称:simple-music-player,代码行数:10,代码来源:fmod.cs


示例16: getChannel

 public RESULT getChannel(int channelid, out Channel channel)
 {
     channel = null;
     IntPtr raw;
     RESULT result = System.FMOD5_System_GetChannel(this.rawPtr, channelid, out raw);
     channel = new Channel(raw);
     return result;
 }
开发者ID:GameDiffs,项目名称:TheForest,代码行数:8,代码来源:System.cs


示例17: playSound

        public RESULT playSound(CHANNELINDEX channelid, Sound sound, bool paused, ref Channel channel)
        {
            RESULT result      = RESULT.OK;
            IntPtr      channelraw;
            Channel     channelnew  = null;

            if (channel != null)
            {
                channelraw = channel.getRaw();
            }
            else
            {
                channelraw  = new IntPtr();
            }

            try
            {
                result = FMOD_System_PlaySound(systemraw, channelid, sound.getRaw(), (paused ? 1 : 0), ref channelraw);
            }
            catch
            {
                result = RESULT.ERR_INVALID_PARAM;
            }
            if (result != RESULT.OK)
            {
                return result;
            }

            if (channel == null)
            {
                channelnew = new Channel();
                channelnew.setRaw(channelraw);
                channel = channelnew;
            }
            else
            {
                channel.setRaw(channelraw);
            }

            return result;
        }
开发者ID:huming2207,项目名称:ghgame,代码行数:41,代码来源:fmod.cs


示例18: DeckControl

        public DeckControl()
        {
            _mixerBackground = new Image();
            _mixerBackground.Height = 488;
            _mixerBackground.Width = 710;
            BitmapImage bmp = new BitmapImage();
            bmp.BeginInit();
            bmp.UriSource = new Uri("png/deck_background.png", UriKind.Relative);
            bmp.EndInit();
            _mixerBackground.Source = bmp;
            this.Children.Add(_mixerBackground);

            _recordController = new RecordController(RECORD_DIAMETER, RECORD_DIAMETER);
            _recordController.Margin = new Thickness(RECORD_MARGIN_LEFT, RECORD_MARGIN_TOP, 0, 0);
            _recordController.SetBackgroundImage(@"png/record.png");
            _recordController.Width = RECORD_DIAMETER;
            _recordController.Height = RECORD_DIAMETER;
            _recordController.TouchDown += new EventHandler<TouchEventArgs>(RecordTouchDown);
            _recordController.TouchUp += new EventHandler<TouchEventArgs>(RecordTouchUp);
            _recordController.TouchMove += new EventHandler<TouchEventArgs>(RecordTouchMove);
            _recordController.DragEnter += new System.Windows.DragEventHandler(RecordDragEnter);
            _recordController.DragLeave += new System.Windows.DragEventHandler(RecordDragLeave);
            _recordController.Drop += new System.Windows.DragEventHandler(RecordDrop);
            _recordController.AllowDrop = true;
            this.Children.Add(_recordController);

            _highPassKnob = new KnobControl(KNOB_DIAMETER, KNOB_DIAMETER);
            _highPassKnob.Margin = new Thickness(KNOB_MARGIN_LEFT, KNOB_MARGIN_TOP, 0, 0);
            _highPassKnob.SetBackgroundImage(@"png/dial_background.png");
            _highPassKnob.SetCenterImage(@"png/dial_knob.png");
            _highPassKnob.Width = KNOB_DIAMETER;
            _highPassKnob.Height = KNOB_DIAMETER;
            //_highPassKnob.TouchDown += new EventHandler<TouchEventArgs>(HPKnobTouchDown);
            //_highPassKnob.TouchUp += new EventHandler<TouchEventArgs>(HPKnobTouchUp);
            _highPassKnob.TouchMove += new EventHandler<TouchEventArgs>(HPKnobTouchMove);
            this.Children.Add(_highPassKnob);

            _lowPassKnob = new KnobControl(KNOB_DIAMETER, KNOB_DIAMETER);
            _lowPassKnob.Margin = new Thickness(KNOB_MARGIN_LEFT, KNOB_MARGIN_TOP + KNOB_DIAMETER * 1 + KNOB_PADDING * 1, 0, 0);
            _lowPassKnob.SetBackgroundImage(@"png/dial_background.png");
            _lowPassKnob.SetCenterImage(@"png/dial_knob.png");
            _lowPassKnob.Width = KNOB_DIAMETER;
            _lowPassKnob.Height = KNOB_DIAMETER;
            _lowPassKnob.TouchMove += new EventHandler<TouchEventArgs>(LPKnobTouchMove);
            this.Children.Add(_lowPassKnob);

            _reverbKnob = new KnobControl(KNOB_DIAMETER, KNOB_DIAMETER);
            _reverbKnob.Margin = new Thickness(KNOB_MARGIN_LEFT, KNOB_MARGIN_TOP + KNOB_DIAMETER * 2 + KNOB_PADDING * 2, 0, 0);
            _reverbKnob.SetBackgroundImage(@"png/dial_background.png");
            _reverbKnob.SetCenterImage(@"png/dial_knob.png");
            _reverbKnob.Width = KNOB_DIAMETER;
            _reverbKnob.Height = KNOB_DIAMETER;
            this.Children.Add(_reverbKnob);
            

            angle = 1;
            _recordMidPoint = new System.Windows.Point(_recordController.Width / 2 + _recordController.Margin.Left, _recordController.Height / 2 + _recordController.Margin.Top);
            rotate = new RotateTransform(1, _recordController.Width / 2, _recordController.Height / 2);
            transform = new TransformGroup();
            transform.Children.Add(rotate);

            dispatcherTimer = new DispatcherTimer();
            dispatcherTimer.Tick += new EventHandler(dispatcherTimer_Tick);
            dispatcherTimer.Interval = new TimeSpan(0, 0, 0, 0, 1);
            dispatcherTimer.Start();

            system = new FMOD.System();
            FMOD.RESULT result = Factory.System_Create(ref system);
            system.init(8, INITFLAGS.NORMAL, (IntPtr)null);
            channel = new Channel(system);
            channel.Initialize(0);
            channel.SetHighPass(1.0f);
            _isPlaying = false;
        }
开发者ID:GunioRobot,项目名称:Project-Volcano,代码行数:74,代码来源:DeckControl.cs


示例19: Dispose

 public void Dispose()
 {
     if(m_fadeTimer.Enabled) {
         m_fadeTimer.Enabled = false;
     }
     bool playing = false;
     if(m_channel != null) {
         m_channel.isPlaying(ref playing);
         if(playing) {
             m_channel.stop();
         }
         m_channel = null;
     }
     if(m_sound != null) {
         m_sound.release();
         m_sound = null;
     }
     GC.SuppressFinalize(this);
 }
开发者ID:komby,项目名称:vixen,代码行数:19,代码来源:fmod_wrapper.cs


示例20: UnloadSongs

 internal void UnloadSongs()
 {
     _log.Info("Unloading SongManager...");
     Stop();
     _log.Debug("Setting song channel to NULL...");
     _channel = null;
     _nowPlaying = null;
     _log.Debug("Clearing song list...");
     _songs.Clear();
 }
开发者ID:Sharparam,项目名称:DiseasedToast,代码行数:10,代码来源:SongManager.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# FMOD.ChannelGroup类代码示例发布时间:2022-05-24
下一篇:
C# FMOD.CREATESOUNDEXINFO类代码示例发布时间: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