all repos — mgba @ 6d898542c765f4efc4a094c5ebd3f3465c36f417

mGBA Game Boy Advance Emulator

src/core/sync.h (view raw)

 1/* Copyright (c) 2013-2016 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 M_CORE_SYNC_H
 7#define M_CORE_SYNC_H
 8
 9#include "util/common.h"
10
11CXX_GUARD_START
12
13#include "util/threading.h"
14
15struct mCoreSync {
16	int videoFramePending;
17	bool videoFrameWait;
18	bool videoFrameOn;
19	Mutex videoFrameMutex;
20	Condition videoFrameAvailableCond;
21	Condition videoFrameRequiredCond;
22
23	bool audioWait;
24	Condition audioRequiredCond;
25	Mutex audioBufferMutex;
26
27	float fpsTarget;
28};
29
30void mCoreSyncPostFrame(struct mCoreSync* sync);
31void mCoreSyncForceFrame(struct mCoreSync* sync);
32bool mCoreSyncWaitFrameStart(struct mCoreSync* sync);
33void mCoreSyncWaitFrameEnd(struct mCoreSync* sync);
34void mCoreSyncSetVideoSync(struct mCoreSync* sync, bool wait);
35
36void mCoreSyncProduceAudio(struct mCoreSync* sync, bool wait);
37void mCoreSyncLockAudio(struct mCoreSync* sync);
38void mCoreSyncUnlockAudio(struct mCoreSync* sync);
39void mCoreSyncConsumeAudio(struct mCoreSync* sync);
40
41CXX_GUARD_END
42
43#endif