mirror of
https://github.com/holub/mame
synced 2025-04-20 15:32:45 +03:00
sound/gb.cpp: Fixed master volume control and cleaned up code: (#13483)
* Fixed master volume control. * Fixed output range. * Fixed sweep, wave RAM corruption and GBA read/write emulation. * Use integer bit fields for pulse duty cycle tables. * Reduced duplication made some variables const, improved member names.
This commit is contained in:
parent
ec7eb50bf6
commit
c6313f8049
File diff suppressed because it is too large
Load Diff
@ -9,7 +9,7 @@ class gameboy_sound_device : public device_t,
|
||||
public device_sound_interface
|
||||
{
|
||||
public:
|
||||
static constexpr feature_type imperfect_features() { return feature::SOUND; } // incorrect sound pitch
|
||||
static constexpr feature_type imperfect_features() { return feature::SOUND; }
|
||||
|
||||
gameboy_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
|
||||
|
||||
@ -75,7 +75,7 @@ protected:
|
||||
};
|
||||
|
||||
static const unsigned int FRAME_CYCLES = 8192;
|
||||
static const int wave_duty_table[4][8];
|
||||
static const int wave_duty_table[4];
|
||||
|
||||
sound_stream *m_channel;
|
||||
|
||||
@ -89,26 +89,27 @@ protected:
|
||||
uint8_t length_mask;
|
||||
bool length_counting;
|
||||
bool length_enabled;
|
||||
/* Mode 1, 2, 3 */
|
||||
uint16_t frequency;
|
||||
uint16_t frequency_counter;
|
||||
/* Channel 1, 2, 3 */
|
||||
int64_t cycles_left;
|
||||
int8_t duty;
|
||||
/* Mode 1, 2, 4 */
|
||||
/* Channel 1, 2, 4 */
|
||||
bool envelope_enabled;
|
||||
int8_t envelope_value;
|
||||
int8_t envelope_direction;
|
||||
uint8_t envelope_time;
|
||||
uint8_t envelope_count;
|
||||
int8_t signal;
|
||||
/* Mode 1 */
|
||||
uint16_t frequency;
|
||||
uint16_t frequency_counter;
|
||||
/* Channel 1 */
|
||||
uint16_t frequency_shadow;
|
||||
bool sweep_enabled;
|
||||
bool sweep_neg_mode_used;
|
||||
uint8_t sweep_shift;
|
||||
int32_t sweep_direction;
|
||||
uint8_t sweep_time;
|
||||
uint8_t sweep_count;
|
||||
/* Mode 3 */
|
||||
/* Channel 3 */
|
||||
uint8_t size; // AGB specific
|
||||
uint8_t bank; // AGB specific
|
||||
uint8_t level;
|
||||
@ -116,29 +117,20 @@ protected:
|
||||
uint32_t duty_count;
|
||||
int8_t current_sample;
|
||||
bool sample_reading;
|
||||
/* Mode 4 */
|
||||
/* Channel 4 */
|
||||
bool noise_short;
|
||||
uint16_t noise_lfsr;
|
||||
};
|
||||
|
||||
SOUND m_snd_1;
|
||||
SOUND m_snd_2;
|
||||
SOUND m_snd_3;
|
||||
SOUND m_snd_4;
|
||||
SOUND m_snd[4];
|
||||
|
||||
struct
|
||||
{
|
||||
uint8_t on;
|
||||
bool on;
|
||||
uint8_t vol_left;
|
||||
uint8_t vol_right;
|
||||
uint8_t mode1_left;
|
||||
uint8_t mode1_right;
|
||||
uint8_t mode2_left;
|
||||
uint8_t mode2_right;
|
||||
uint8_t mode3_left;
|
||||
uint8_t mode3_right;
|
||||
uint8_t mode4_left;
|
||||
uint8_t mode4_right;
|
||||
bool chan_left[4];
|
||||
bool chan_right[4];
|
||||
uint64_t cycles;
|
||||
bool wave_ram_locked;
|
||||
} m_snd_control;
|
||||
|
Loading…
Reference in New Issue
Block a user