Path: blob/a-new-beginning/Cherry/Core/include/audio/Sms_Apu.h
2 views
// Sega Master System SN76489 PSG sound chip emulator12// Sms_Snd_Emu 0.1.43#ifndef SMS_APU_H4#define SMS_APU_H56#include "Sms_Oscs.h"78class Sms_Apu {9public:10// Set overall volume of all oscillators, where 1.0 is full volume11void volume( double );1213// Set treble equalization14void treble_eq( const blip_eq_t& );1516// Outputs can be assigned to a single buffer for mono output, or to three17// buffers for stereo output (using Stereo_Buffer to do the mixing).1819// Assign all oscillator outputs to specified buffer(s). If buffer20// is NULL, silences all oscillators.21void output( Blip_Buffer* mono );22void output( Blip_Buffer* center, Blip_Buffer* left, Blip_Buffer* right );2324// Assign single oscillator output to buffer(s). Valid indicies are 0 to 3,25// which refer to Square 1, Square 2, Square 3, and Noise. If buffer is NULL,26// silences oscillator.27enum { osc_count = 4 };28void osc_output( int index, Blip_Buffer* mono );29void osc_output( int index, Blip_Buffer* center, Blip_Buffer* left, Blip_Buffer* right );3031// Reset oscillators and internal state32void reset( unsigned noise_feedback = 0, int noise_width = 0 );3334// Write GameGear left/right assignment byte35void write_ggstereo( blip_time_t, int );3637// Write to data port38void write_data( blip_time_t, int );3940// Run all oscillators up to specified time, end current frame, then41// start a new frame at time 0.42void end_frame( blip_time_t );4344public:45Sms_Apu();46~Sms_Apu();47private:48// noncopyable49Sms_Apu( const Sms_Apu& );50Sms_Apu& operator = ( const Sms_Apu& );5152Sms_Osc* oscs [osc_count];53Sms_Square squares [3];54Sms_Square::Synth square_synth; // used by squares55blip_time_t last_time;56int latch;57Sms_Noise noise;58unsigned noise_feedback;59unsigned looped_feedback;60unsigned int ggstereo_save;6162void run_until( blip_time_t );63};6465inline void Sms_Apu::output( Blip_Buffer* b ) { output( b, b, b ); }6667inline void Sms_Apu::osc_output( int i, Blip_Buffer* b ) { osc_output( i, b, b, b ); }6869#endif707172