Skip to content

Commit

Permalink
Updated Freeboy files from Game Music Emu 0.6.1. (LMMS#3618)
Browse files Browse the repository at this point in the history
Uses upstream files to fix LMMS#326
  • Loading branch information
karmux authored and tresf committed Jul 14, 2017
1 parent d9c0b88 commit 3f10fbb
Show file tree
Hide file tree
Showing 16 changed files with 1,606 additions and 1,533 deletions.
14 changes: 5 additions & 9 deletions plugins/papu/Basic_Gb_Apu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,11 @@ more details. You should have received a copy of the GNU Lesser General
Public License along with this module; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */

gb_time_t const frame_length = 70224;
blip_time_t const frame_length = 70224;

Basic_Gb_Apu::Basic_Gb_Apu()
{
time = 0;

// Adjust frequency equalization to make it sound like a tiny speaker
apu.treble_eq( -20.0 ); // lower values muffle it more
buf.bass_freq( 461 ); // higher values simulate smaller speaker
}

Basic_Gb_Apu::~Basic_Gb_Apu()
Expand All @@ -36,21 +32,21 @@ blargg_err_t Basic_Gb_Apu::set_sample_rate( long rate )
return buf.set_sample_rate( rate );
}

void Basic_Gb_Apu::write_register( gb_addr_t addr, int data )
void Basic_Gb_Apu::write_register( blip_time_t addr, int data )
{
apu.write_register( clock(), addr, data );
}

int Basic_Gb_Apu::read_register( gb_addr_t addr )
int Basic_Gb_Apu::read_register( blip_time_t addr )
{
return apu.read_register( clock(), addr );
}

void Basic_Gb_Apu::end_frame()
{
time = 0;
bool stereo = apu.end_frame( frame_length );
buf.end_frame( frame_length, stereo );
apu.end_frame( frame_length );
buf.end_frame( frame_length );
}

long Basic_Gb_Apu::samples_avail() const
Expand Down
20 changes: 10 additions & 10 deletions plugins/papu/Basic_Gb_Apu.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,23 @@ class Basic_Gb_Apu {
public:
Basic_Gb_Apu();
~Basic_Gb_Apu();

// Set output sample rate
blargg_err_t set_sample_rate( long rate );

// Pass reads and writes in the range 0xff10-0xff3f
void write_register( gb_addr_t, int data );
int read_register( gb_addr_t );
void write_register( blip_time_t, int data );
int read_register( blip_time_t );

// End a 1/60 sound frame and add samples to buffer
void end_frame();

// Samples are generated in stereo, left first. Sample counts are always
// a multiple of 2.

// Number of samples in buffer
long samples_avail() const;

// Read at most 'count' samples out of buffer and return number actually read
typedef blip_sample_t sample_t;
long read_samples( sample_t* out, long count );
Expand All @@ -41,12 +41,12 @@ class Basic_Gb_Apu {
void treble_eq( const blip_eq_t& eq );
void bass_freq( int bf );
//<---

private:
Gb_Apu apu;
Stereo_Buffer buf;
blip_time_t time;

// faked CPU timing
blip_time_t clock() { return time += 4; }
};
Expand Down
2 changes: 1 addition & 1 deletion plugins/papu/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ INCLUDE(BuildPlugin)
# Disable C++11
REMOVE_DEFINITIONS(-std=c++0x)

BUILD_PLUGIN(papu papu_instrument.cpp papu_instrument.h Basic_Gb_Apu.cpp Basic_Gb_Apu.h gb_apu/Gb_Oscs.cpp gb_apu/Gb_Apu.h gb_apu/Blip_Buffer.cpp gb_apu/Gb_Apu.cpp gb_apu/Gb_Oscs.h gb_apu/blargg_common.h gb_apu/Blip_Buffer.h gb_apu/Multi_Buffer.cpp gb_apu/blargg_source.h gb_apu/Blip_Synth.h gb_apu/Multi_Buffer.h MOCFILES papu_instrument.h EMBEDDED_RESOURCES "${CMAKE_CURRENT_SOURCE_DIR}/*.png")
BUILD_PLUGIN(papu papu_instrument.cpp papu_instrument.h Basic_Gb_Apu.cpp Basic_Gb_Apu.h gb_apu/Gb_Oscs.cpp gb_apu/Gb_Apu.h gb_apu/Blip_Buffer.cpp gb_apu/Gb_Apu.cpp gb_apu/Gb_Oscs.h gb_apu/blargg_common.h gb_apu/Blip_Buffer.h gb_apu/Multi_Buffer.cpp gb_apu/blargg_source.h gb_apu/Multi_Buffer.h MOCFILES papu_instrument.h EMBEDDED_RESOURCES "${CMAKE_CURRENT_SOURCE_DIR}/*.png")
Loading

0 comments on commit 3f10fbb

Please sign in to comment.