GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — code/Chapter11/AudioSystem.h at master · gameprogcpp/code Expand file tree/ Copy pathAudioSystem.hMore file actions 74 lines (65 loc) · 1.97 KB / Copy pathAudioSystem.hFile metadata and controls74 lines (65 loc) · 1.97 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 // ---------------------------------------------------------------- // From Game Programming in C++ by Sanjay Madhav // Copyright (C) 2017 Sanjay Madhav. All rights reserved. // // Released under the BSD License // See LICENSE in root directory for full details. // ---------------------------------------------------------------- #pragma once #include <unordered_map> #include <string> #include "SoundEvent.h" #include "Math.h" // Forward declarations to avoid including FMOD header namespace FMOD { class System; namespace Studio { class Bank; class EventDescription; class EventInstance; class System; class Bus; }; }; class AudioSystem { public: AudioSystem(class Game* game); ~AudioSystem(); bool Initialize(); void Shutdown(); // Load/unload banks void LoadBank(const std::string& name); void UnloadBank(const std::string& name); void UnloadAllBanks(); SoundEvent PlayEvent(const std::string& name); void Update(float deltaTime); // For positional audio void SetListener(const Matrix4& viewMatrix); // Control buses float GetBusVolume(const std::string& name) const; bool GetBusPaused(const std::string& name) const; void SetBusVolume(const std::string& name, float volume); void SetBusPaused(const std::string& name, bool pause); protected: friend class SoundEvent; FMOD::Studio::EventInstance* GetEventInstance(unsigned int id); private: // Tracks the next ID to use for event instances static unsigned int sNextID; class Game* mGame; // Map of loaded banks std::unordered_map<std::string, FMOD::Studio::Bank*> mBanks; // Map of event name to EventDescription std::unordered_map<std::string, FMOD::Studio::EventDescription*> mEvents; // Map of event id to EventInstance std::unordered_map<unsigned int, FMOD::Studio::EventInstance*> mEventInstances; // Map of buses std::unordered_map<std::string, FMOD::Studio::Bus*> mBuses; // FMOD studio system FMOD::Studio::System* mSystem; // FMOD Low-level system (in case needed) FMOD::System* mLowLevelSystem; }; |
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |