Skip to content

Commit

Permalink
Merge pull request #7046 from lioncash/priv
Browse files Browse the repository at this point in the history
EXI_DeviceMic: Make data members of CEXIMic private
  • Loading branch information
leoetlino committed Jun 2, 2018
2 parents d67de4c + 3906859 commit 62fdef0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
8 changes: 4 additions & 4 deletions Source/Core/Core/HW/EXI/EXI_DeviceMic.cpp
Expand Up @@ -40,14 +40,14 @@ static void state_callback(cubeb_stream* stream, void* user_data, cubeb_state st
{
}

static long data_callback(cubeb_stream* stream, void* user_data, const void* inputbuffer,
void* /*outputbuffer*/, long nframes)
long CEXIMic::DataCallback(cubeb_stream* stream, void* user_data, const void* input_buffer,
void* /*output_buffer*/, long nframes)
{
CEXIMic* mic = static_cast<CEXIMic*>(user_data);

std::lock_guard<std::mutex> lk(mic->ring_lock);

const s16* buff_in = static_cast<const s16*>(inputbuffer);
const s16* buff_in = static_cast<const s16*>(input_buffer);
for (long i = 0; i < nframes; i++)
{
mic->stream_buffer[mic->stream_wpos] = buff_in[i];
Expand Down Expand Up @@ -87,7 +87,7 @@ void CEXIMic::StreamStart()

if (cubeb_stream_init(m_cubeb_ctx.get(), &m_cubeb_stream, "Dolphin Emulated GameCube Microphone",
nullptr, &params, nullptr, nullptr,
std::max<u32>(buff_size_samples, minimum_latency), data_callback,
std::max<u32>(buff_size_samples, minimum_latency), DataCallback,
state_callback, this) != CUBEB_OK)
{
ERROR_LOG(EXPANSIONINTERFACE, "Error initializing cubeb stream");
Expand Down
22 changes: 11 additions & 11 deletions Source/Core/Core/HW/EXI/EXI_DeviceMic.h
Expand Up @@ -60,6 +60,17 @@ class CEXIMic : public IEXIDevice
};
};

static long DataCallback(cubeb_stream* stream, void* user_data, const void* input_buffer,
void* output_buffer, long nframes);

void TransferByte(u8& byte) override;

void StreamInit();
void StreamTerminate();
void StreamStart();
void StreamStop();
void StreamReadOne();

// 64 is the max size, can be 16 or 32 as well
int ring_pos;
u8 ring_buffer[64 * sample_size];
Expand All @@ -73,14 +84,6 @@ class CEXIMic : public IEXIDevice
std::shared_ptr<cubeb> m_cubeb_ctx = nullptr;
cubeb_stream* m_cubeb_stream = nullptr;

void StreamLog(const char* msg);
void StreamInit();
void StreamTerminate();
void StreamStart();
void StreamStop();
void StreamReadOne();

public:
UStatus status;

std::mutex ring_lock;
Expand All @@ -97,8 +100,5 @@ class CEXIMic : public IEXIDevice
int stream_wpos;
int stream_rpos;
int samples_avail;

protected:
void TransferByte(u8& byte) override;
};
} // namespace ExpansionInterface

0 comments on commit 62fdef0

Please sign in to comment.