Example #1
0
        public GameMetadataHandler(OnScreenDisplayHandler osdHandler)
        {
            onScreenDisplayHandler = osdHandler;

            XmlRootAttribute root;
            XmlSerializer    serializer;

            /* Read No-Intro .dat files */
            datFiles = new Dictionary <string, DatFile>();
            foreach (var file in Directory.EnumerateFiles(datDirectoryPath, "*.dat"))
            {
                root = new XmlRootAttribute("datafile")
                {
                    IsNullable = true
                };
                serializer = new XmlSerializer(typeof(DatFile), root);
                using (FileStream stream = new FileStream(Path.Combine(datDirectoryPath, file), FileMode.Open))
                {
                    datFiles.Add(Path.GetFileName(file), (DatFile)serializer.Deserialize(stream));
                }
            }

            /* Read cartridge metadata database */
            cartMetadataDatabase = metadataDatabaseFilePath.DeserializeFromFile <List <CartridgeJSON> >();

            onScreenDisplayHandler.EnqueueMessageSuccess($"Metadata initialized; {NumKnownGames} game(s) known across {NumKnownSystems} system(s).");
        }
Example #2
0
        public SoundHandler(OnScreenDisplayHandler osdHandler, int sampleFrequency, int numChannels)
        {
            onScreenDisplayHandler = osdHandler;

            SampleFrequency = sampleFrequency;
            NumChannels     = numChannels;

            source      = -1;
            filter      = -1;
            buffers     = new int[numBuffers];
            sampleQueue = new Queue <short[]>();

            InitializeOpenAL();
            InitializeFilters();

            onScreenDisplayHandler.EnqueueMessageSuccess($"Sound initialized; {SampleFrequency} Hz, {NumChannels} channel(s).");
        }
Example #3
0
        public SoundHandler(OnScreenDisplayHandler osdHandler, int sampleRate, int numChannels, Action <Exception> exceptionHandler = null)
        {
            this.exceptionHandler = exceptionHandler;

            onScreenDisplayHandler = osdHandler;

            SampleRate  = sampleRate;
            NumChannels = numChannels;

            MaxQueueLength = 2;

            source  = -1;
            filter  = -1;
            buffers = new int[numBuffers];

            sampleQueue = new Queue <short[]>();
            lastSamples = new short[512];

            InitializeOpenAL();
            InitializeFilters();

            onScreenDisplayHandler.EnqueueMessageSuccess($"Sound initialized; {SampleRate} Hz, {NumChannels} channel(s).");
        }