forked from xenia-project/xenia
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial files related to microphone support
- Loading branch information
Showing
24 changed files
with
624 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/** | ||
****************************************************************************** | ||
* Xenia : Xbox 360 Emulator Research Project * | ||
****************************************************************************** | ||
* Copyright 2022 Ben Vanik. All rights reserved. * | ||
* Released under the BSD license - see LICENSE in the root for more details. * | ||
****************************************************************************** | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include "xenia/base/assert.h" | ||
#include "xenia/base/byte_order.h" | ||
|
||
namespace xe { | ||
namespace hid { | ||
|
||
/* States of microphone | ||
0 - Not connected | ||
1 - Connected, not initialized for user_index 0 | ||
2 - Connected, not initialized for user_index 1 | ||
3 - Connected, not initialized for user_index 2 | ||
4 - Connected, not initialized for user_index 3 | ||
5 - Ready (for user_index 0?) | ||
*/ | ||
|
||
typedef struct { | ||
xe::be<uint16_t> request_type; | ||
xe::be<uint16_t> user_index; | ||
xe::be<uint32_t> state; // 8 | ||
|
||
xe::be<uint64_t> unk1; // 16 | ||
xe::be<uint64_t> unk2; // 24 | ||
} XMICINFO; | ||
|
||
typedef struct { | ||
xe::be<uint32_t> features; | ||
xe::be<uint16_t> format_tag; | ||
xe::be<uint16_t> channels; | ||
xe::be<uint32_t> sample_rates; | ||
xe::be<uint16_t> bits_per_sample; | ||
xe::be<uint16_t> frame_length; // 0xE | ||
xe::be<uint8_t> mic_color; // 0x10 | ||
xe::be<uint16_t> vendor_id; | ||
xe::be<uint16_t> product_id; | ||
xe::be<uint16_t> revision; | ||
xe::be<uint32_t> device_id; | ||
|
||
} XMICCAPABILITIES; | ||
static_assert_size(XMICCAPABILITIES, 0x1C); | ||
|
||
typedef struct { | ||
XMICINFO info; | ||
XMICCAPABILITIES capabilities; | ||
|
||
} X_MIC_DEVICE; | ||
|
||
} // namespace hid | ||
} // namespace xe |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/** | ||
****************************************************************************** | ||
* Xenia : Xbox 360 Emulator Research Project * | ||
****************************************************************************** | ||
* Copyright 2022 Ben Vanik. All rights reserved. * | ||
* Released under the BSD license - see LICENSE in the root for more details. * | ||
****************************************************************************** | ||
*/ | ||
|
||
#ifndef XENIA_HID_MICROPHONE_DRIVER_H_ | ||
#define XENIA_HID_MICROPHONE_DRIVER_H_ | ||
|
||
#include "xenia/xbox.h" | ||
|
||
namespace xe { | ||
namespace hid { | ||
|
||
class MicrophoneSystem; | ||
|
||
class MicrophoneDriver { | ||
public: | ||
virtual ~MicrophoneDriver() = default; | ||
|
||
virtual X_STATUS Setup() = 0; | ||
|
||
virtual X_RESULT GetCapabilities(uint32_t user_index, uint32_t flags, | ||
void* out_caps) = 0; | ||
virtual X_RESULT GetState(uint32_t user_index, uint32_t* out_state) = 0; | ||
virtual X_RESULT GetData(uint32_t user_index, void* out_ptr) = 0; | ||
|
||
void set_is_active_callback(std::function<bool()> is_active_callback) { | ||
is_active_callback_ = is_active_callback; | ||
} | ||
|
||
protected: | ||
explicit MicrophoneDriver() {} | ||
|
||
bool is_active() const { | ||
return !is_active_callback_ || is_active_callback_(); | ||
} | ||
|
||
private: | ||
std::function<bool()> is_active_callback_ = nullptr; | ||
}; | ||
} | ||
} // namespace xe | ||
|
||
#endif // XENIA_HID_MICROPHONE_DRIVER_H_ |
Oops, something went wrong.