当前位置: 首页>>代码示例>>C#>>正文


C# FMOD.Channel类代码示例

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


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


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