Inheritance: SoundWAVI
Beispiel #1
0
        public SoundWAVInstance(SoundWAV sound, bool looped)
            : base(sound)
        {
            this.sound  = sound;
            this.looped = looped;
            State       = SoundStates.Stopped;
            volume      = 1;

            instance = new AudioUnit(sound.audio.component);
            instance.SetAudioFormat(sound.desc, AudioUnitScopeType.Input, 0);
            if (sound.channels == 2)
            {
                switch (sound.bitDepth)
                {
                case 8: instance.RenderCallback += render2Channel8BitCallback; break;

                case 16: instance.RenderCallback += render2Channel16BitCallback; break;

                default: Debug.ThrowError("SoundWAVInstance", "Unsuported WAV bit depth"); break;
                }
            }
            else
            {
                switch (sound.bitDepth)
                {
                case 8: instance.RenderCallback += render1Channel8BitCallback; break;

                case 16: instance.RenderCallback += render1Channel16BitCallback; break;

                default: Debug.ThrowError("SoundWAVInstance", "Unsuported WAV bit depth"); break;
                }
            }
            instance.Initialize();

                        #if iOS
            OS.CurrentApplication.PauseCallback  += Pause;
            OS.CurrentApplication.ResumeCallback += resume;
                        #endif
        }
Beispiel #2
0
        public SoundWAVInstance(SoundWAV sound, bool looped)
            : base(sound)
        {
            this.sound = sound;
            this.looped = looped;
            State = SoundStates.Stopped;
            volume = 1;

            instance = new AudioUnit(sound.audio.component);
            instance.SetAudioFormat(sound.desc, AudioUnitScopeType.Input, 0);
            if (sound.channels == 2)
            {
                switch (sound.bitDepth)
                {
                    case 8: instance.RenderCallback += render2Channel8BitCallback; break;
                    case 16: instance.RenderCallback += render2Channel16BitCallback; break;
                    default: Debug.ThrowError("SoundWAVInstance", "Unsuported WAV bit depth"); break;
                }
            }
            else
            {
                switch (sound.bitDepth)
                {
                    case 8: instance.RenderCallback += render1Channel8BitCallback; break;
                    case 16: instance.RenderCallback += render1Channel16BitCallback; break;
                    default: Debug.ThrowError("SoundWAVInstance", "Unsuported WAV bit depth"); break;
                }
            }
            instance.Initialize();

            #if iOS
            OS.CurrentApplication.PauseCallback += Pause;
            OS.CurrentApplication.ResumeCallback += resume;
            #endif
        }