all repos — mgba @ 97447ffa40d6f90ae5f1daf84987e6ff7688d0b8

mGBA Game Boy Advance Emulator

src/gba/supervisor/sync.h (view raw)

 1/* Copyright (c) 2013-2015 Jeffrey Pfau
 2 *
 3 * This Source Code Form is subject to the terms of the Mozilla Public
 4 * License, v. 2.0. If a copy of the MPL was not distributed with this
 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 6#ifndef GBA_SYNC_H
 7#define GBA_SYNC_H
 8
 9#include "util/common.h"
10
11#include "util/threading.h"
12
13struct GBASync {
14	int videoFramePending;
15	bool videoFrameWait;
16	int videoFrameSkip;
17	bool videoFrameOn;
18	Mutex videoFrameMutex;
19	Condition videoFrameAvailableCond;
20	Condition videoFrameRequiredCond;
21
22	bool audioWait;
23	Condition audioRequiredCond;
24	Mutex audioBufferMutex;
25};
26
27void GBASyncPostFrame(struct GBASync* sync);
28void GBASyncForceFrame(struct GBASync* sync);
29bool GBASyncWaitFrameStart(struct GBASync* sync, int frameskip);
30void GBASyncWaitFrameEnd(struct GBASync* sync);
31bool GBASyncDrawingFrame(struct GBASync* sync);
32void GBASyncSetVideoSync(struct GBASync* sync, bool wait);
33
34void GBASyncProduceAudio(struct GBASync* sync, bool wait);
35void GBASyncLockAudio(struct GBASync* sync);
36void GBASyncUnlockAudio(struct GBASync* sync);
37void GBASyncConsumeAudio(struct GBASync* sync);
38
39#endif