all repos — mgba @ ce085623de93a4baf202a01a11cadadc347b71ba

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
11#include "util/threading.h"
12
13struct mCoreSync {
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 mCoreSyncPostFrame(struct mCoreSync* sync);
27void mCoreSyncForceFrame(struct mCoreSync* sync);
28bool mCoreSyncWaitFrameStart(struct mCoreSync* sync);
29void mCoreSyncWaitFrameEnd(struct mCoreSync* sync);
30void mCoreSyncSetVideoSync(struct mCoreSync* sync, bool wait);
31
32void mCoreSyncProduceAudio(struct mCoreSync* sync, bool wait);
33void mCoreSyncLockAudio(struct mCoreSync* sync);
34void mCoreSyncUnlockAudio(struct mCoreSync* sync);
35void mCoreSyncConsumeAudio(struct mCoreSync* sync);
36
37#endif