all repos — mgba @ 50402c830729f2ba5a6fc3e6facfd8b258f7f97d

mGBA Game Boy Advance Emulator

src/gba/context/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	bool videoFrameOn;
17	Mutex videoFrameMutex;
18	Condition videoFrameAvailableCond;
19	Condition videoFrameRequiredCond;
20
21	bool audioWait;
22	Condition audioRequiredCond;
23	Mutex audioBufferMutex;
24};
25
26void GBASyncPostFrame(struct GBASync* sync);
27void GBASyncForceFrame(struct GBASync* sync);
28bool GBASyncWaitFrameStart(struct GBASync* sync);
29void GBASyncWaitFrameEnd(struct GBASync* sync);
30void GBASyncSetVideoSync(struct GBASync* sync, bool wait);
31
32void GBASyncProduceAudio(struct GBASync* sync, bool wait);
33void GBASyncLockAudio(struct GBASync* sync);
34void GBASyncUnlockAudio(struct GBASync* sync);
35void GBASyncConsumeAudio(struct GBASync* sync);
36
37#endif