-
Notifications
You must be signed in to change notification settings - Fork 2.2k
CD-i: Add Audio Mixing #14481
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
CD-i: Add Audio Mixing #14481
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -29,6 +29,7 @@ | |
|
|
||
| #define VERBOSE (0) | ||
| #include "logmacro.h" | ||
| #include "cdi.h" | ||
|
|
||
| // device type definition | ||
| DEFINE_DEVICE_TYPE(CDI_SLAVE_HLE, cdislave_hle_device, "cdislavehle", "CD-i Mono-I Slave HLE") | ||
|
|
@@ -227,6 +228,12 @@ void cdislave_hle_device::slave_w(offs_t offset, uint16_t data) | |
| { | ||
| switch (m_in_buf[0]) | ||
| { | ||
| case 0xc0: case 0xc1: case 0xc2: case 0xc3: case 0xc4: case 0xc5: case 0xc6: case 0xc7: | ||
| case 0xc8: case 0xc9: case 0xca: case 0xcb: case 0xcc: case 0xcd: case 0xce: case 0xcf: | ||
| dynamic_cast<cdi_state*>(m_owner)->m_cdic->atten_w(m_in_buf); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is unportable, you should rather provide this communication thru
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Acknowledged. If it is acceptable, I will use a follow up PR on this detail. |
||
| m_in_index = 0; | ||
| m_in_count = 0; | ||
| break; | ||
| case 0xf0: // Set Front Panel LCD | ||
| memset(m_in_buf + 1, 0, 16); | ||
| m_in_count = 17; | ||
|
|
@@ -264,6 +271,13 @@ void cdislave_hle_device::slave_w(offs_t offset, uint16_t data) | |
| m_in_count = 0; | ||
| break; | ||
| } | ||
| case 0xc0: case 0xc1: case 0xc2: case 0xc3: case 0xc4: case 0xc5: case 0xc6: case 0xc7: | ||
| case 0xc8: case 0xc9: case 0xca: case 0xcb: case 0xcc: case 0xcd: case 0xce: case 0xcf: | ||
| { | ||
| LOGMASKED(LOG_COMMANDS, "slave_w: Channel %d: Set Attenuation Audio\n", offset); | ||
| m_in_count = 5; | ||
| break; | ||
| } | ||
| case 0xf0: // Set Front Panel LCD | ||
| LOGMASKED(LOG_COMMANDS, "slave_w: Channel %d: Set Front Panel LCD (0xf0)\n", offset); | ||
| m_in_count = 17; | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Following on from Kale's comment, it's pretty unlikely that the real hardware connection between the SLAVE and CDIC devices is 20 individual traces for the 20 bits of state represented by
argshere.The correct way to do this would be to have
atten_wtake a singleuint8_t, have a private member that increments on each call from 0 to 4 and wrapping around, in order to determine how to apply the incoming byte to them_attenarray. You would then have adevcb_write8with a public callback-registration function incdislavehle_device- there are plenty of examples throughout the codebase on how to do this - and then in the machine configuration function forcdi_state::cdimono1_base, do -m_slave_hle->atten_callback().set(m_cdic, FUNC(cdicdic_device::atten_w));rather than grabbing into a protected class member in a way that doesn't compile.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a temporary fix to expose the cdic for dynamic casting just so that it compiles so it can be validated it worked. Thanks for the feedback, I'll look into the callback change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the example. Excluding the Mute bits here will result in popping sounds. Hotel Mario shows that this solution is close, but not entirely correct. I don't exactly know what the correct technical implementation is supposed to be yet.
If it is acceptable, I will commit this in the (largely) working state. I have left a TODO here.