diff --git a/.gitmodules b/.gitmodules index efa4f3c1e..0953e056c 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,6 +4,6 @@ [submodule "plugins/zynaddsubfx/zynaddsubfx"] path = plugins/zynaddsubfx/zynaddsubfx url = https://github.com/lmms/zynaddsubfx.git -[submodule "plugins/papu/game-music-emu"] - path = plugins/papu/game-music-emu +[submodule "plugins/FreeBoy/game-music-emu"] + path = plugins/FreeBoy/game-music-emu url = https://bitbucket.org/mpyne/game-music-emu.git diff --git a/include/DataFile.h b/include/DataFile.h index 6b6b1a98e..9e4ca13e3 100644 --- a/include/DataFile.h +++ b/include/DataFile.h @@ -127,6 +127,7 @@ private: void upgrade_1_1_91(); void upgrade_1_2_0_rc3(); void upgrade_1_2_0_rc2_42(); + void upgrade_1_3_0(); void upgrade(); diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt index ff807f354..7d962406a 100644 --- a/plugins/CMakeLists.txt +++ b/plugins/CMakeLists.txt @@ -62,7 +62,7 @@ IF("${PLUGIN_LIST}" STREQUAL "") nes opl2 organic - papu + FreeBoy patman peak_controller_effect GigPlayer diff --git a/plugins/papu/CMakeLists.txt b/plugins/FreeBoy/CMakeLists.txt similarity index 75% rename from plugins/papu/CMakeLists.txt rename to plugins/FreeBoy/CMakeLists.txt index 443dd5e37..fb5093ee0 100644 --- a/plugins/papu/CMakeLists.txt +++ b/plugins/FreeBoy/CMakeLists.txt @@ -1,11 +1,9 @@ -# INCLUDE(CheckSubmodule) -# CHECK_SUBMODULE(game-music-emu/CMakeLists.txt) INCLUDE(BuildPlugin) INCLUDE_DIRECTORIES(game-music-emu/gme) -BUILD_PLUGIN(papu - papu_instrument.cpp - papu_instrument.h +BUILD_PLUGIN(freeboy + FreeBoy.cpp + FreeBoy.h Gb_Apu_Buffer.cpp Gb_Apu_Buffer.h game-music-emu/gme/Gb_Apu.cpp @@ -18,6 +16,6 @@ BUILD_PLUGIN(papu game-music-emu/gme/Multi_Buffer.cpp game-music-emu/gme/blargg_source.h game-music-emu/gme/Multi_Buffer.h - MOCFILES papu_instrument.h + MOCFILES FreeBoy.h EMBEDDED_RESOURCES "${CMAKE_CURRENT_SOURCE_DIR}/*.png" ) diff --git a/plugins/papu/papu_instrument.cpp b/plugins/FreeBoy/FreeBoy.cpp similarity index 87% rename from plugins/papu/papu_instrument.cpp rename to plugins/FreeBoy/FreeBoy.cpp index d08592af1..c8aa4b07a 100644 --- a/plugins/papu/papu_instrument.cpp +++ b/plugins/FreeBoy/FreeBoy.cpp @@ -1,5 +1,5 @@ /* - * papu_instrument.cpp - GameBoy papu based instrument + * FreeBoy.cpp - GameBoy papu based instrument * * Copyright (c) 2008 Attila Herman * Csaba Hruska @@ -27,7 +27,7 @@ #include #include -#include "papu_instrument.h" +#include "FreeBoy.h" #include "Gb_Apu_Buffer.h" #include "Multi_Buffer.h" #include "base64.h" @@ -42,9 +42,12 @@ #include "embed.h" +const blip_time_t FRAME_LENGTH = 70224; +const long CLOCK_RATE = 4194304; + extern "C" { -Plugin::Descriptor PLUGIN_EXPORT papu_plugin_descriptor = +Plugin::Descriptor PLUGIN_EXPORT freeboy_plugin_descriptor = { STRINGIFY( PLUGIN_NAME ), "FreeBoy", @@ -61,8 +64,8 @@ Plugin::Descriptor PLUGIN_EXPORT papu_plugin_descriptor = } -papuInstrument::papuInstrument( InstrumentTrack * _instrument_track ) : - Instrument( _instrument_track, &papu_plugin_descriptor ), +FreeBoyInstrument::FreeBoyInstrument( InstrumentTrack * _instrument_track ) : + Instrument( _instrument_track, &freeboy_plugin_descriptor ), m_ch1SweepTimeModel( 4.0f, 0.0f, 7.0f, 1.0f, this, tr( "Sweep time" ) ), m_ch1SweepDirModel( false, this, tr( "Sweep direction" ) ), @@ -112,17 +115,19 @@ papuInstrument::papuInstrument( InstrumentTrack * _instrument_track ) : m_trebleModel( -20.0f, -100.0f, 200.0f, 1.0f, this, tr( "Treble" ) ), m_bassModel( 461.0f, -1.0f, 600.0f, 1.0f, this, tr( "Bass" ) ), - m_graphModel( 0, 15, 32, this, false, 1 ) + m_graphModel( 0, 15, 32, this, false, 1 ), + + m_time(0) { } -papuInstrument::~papuInstrument() +FreeBoyInstrument::~FreeBoyInstrument() { } -void papuInstrument::saveSettings( QDomDocument & _doc, +void FreeBoyInstrument::saveSettings( QDomDocument & _doc, QDomElement & _this ) { m_ch1SweepTimeModel.saveSettings( _doc, _this, "st" ); @@ -165,7 +170,7 @@ void papuInstrument::saveSettings( QDomDocument & _doc, _this.setAttribute( "sampleShape", sampleString ); } -void papuInstrument::loadSettings( const QDomElement & _this ) +void FreeBoyInstrument::loadSettings( const QDomElement & _this ) { m_ch1SweepTimeModel.loadSettings( _this, "st" ); m_ch1SweepDirModel.loadSettings( _this, "sd" ); @@ -207,15 +212,15 @@ void papuInstrument::loadSettings( const QDomElement & _this ) m_graphModel.setSamples( (float*) dst ); } -QString papuInstrument::nodeName() const +QString FreeBoyInstrument::nodeName() const { - return( papu_plugin_descriptor.name ); + return( freeboy_plugin_descriptor.name ); } -/*f_cnt_t papuInstrument::desiredReleaseFrames() const +/*f_cnt_t FreeBoyInstrument::desiredReleaseFrames() const { const float samplerate = Engine::mixer()->processingSampleRate(); int maxrel = 0; @@ -228,14 +233,14 @@ QString papuInstrument::nodeName() const return f_cnt_t( float(relTime[maxrel])*samplerate/1000.0 ); }*/ -f_cnt_t papuInstrument::desiredReleaseFrames() const +f_cnt_t FreeBoyInstrument::desiredReleaseFrames() const { return f_cnt_t( 1000 ); } -void papuInstrument::playNote( NotePlayHandle * _n, +void FreeBoyInstrument::playNote( NotePlayHandle * _n, sampleFrame * _working_buffer ) { const f_cnt_t tfp = _n->totalFramesPlayed(); @@ -249,24 +254,24 @@ void papuInstrument::playNote( NotePlayHandle * _n, if ( tfp == 0 ) { Gb_Apu_Buffer *papu = new Gb_Apu_Buffer(); - papu->set_sample_rate( samplerate ); + papu->set_sample_rate( samplerate, CLOCK_RATE ); // Master sound circuitry power control - papu->write_register( 0, 0xff26, 0x80 ); + papu->write_register( fakeClock(), 0xff26, 0x80 ); data = m_ch1VolumeModel.value(); data = data<<1; data += m_ch1VolSweepDirModel.value(); data = data<<3; data += m_ch1SweepStepLengthModel.value(); - papu->write_register( 0, 0xff12, data ); + papu->write_register( fakeClock(), 0xff12, data ); data = m_ch2VolumeModel.value(); data = data<<1; data += m_ch2VolSweepDirModel.value(); data = data<<3; data += m_ch2SweepStepLengthModel.value(); - papu->write_register( 0, 0xff17, data ); + papu->write_register( fakeClock(), 0xff17, data ); //channel 4 - noise data = m_ch4VolumeModel.value(); @@ -274,10 +279,10 @@ void papuInstrument::playNote( NotePlayHandle * _n, data += m_ch4VolSweepDirModel.value(); data = data<<3; data += m_ch4SweepStepLengthModel.value(); - papu->write_register( 0, 0xff21, data ); + papu->write_register( fakeClock(), 0xff21, data ); //channel 4 init - papu->write_register( 0, 0xff23, 128 ); + papu->write_register( fakeClock(), 0xff23, 128 ); _n->m_pluginData = papu; } @@ -293,35 +298,35 @@ void papuInstrument::playNote( NotePlayHandle * _n, data += m_ch1SweepDirModel.value(); data = data << 3; data += m_ch1SweepRtShiftModel.value(); - papu->write_register( 0, 0xff10, data ); + papu->write_register( fakeClock(), 0xff10, data ); data = m_ch1WavePatternDutyModel.value(); data = data<<6; - papu->write_register( 0, 0xff11, data ); + papu->write_register( fakeClock(), 0xff11, data ); //channel 2 - square data = m_ch2WavePatternDutyModel.value(); data = data<<6; - papu->write_register( 0, 0xff16, data ); + papu->write_register( fakeClock(), 0xff16, data ); //channel 3 - wave //data = m_ch3OnModel.value()?128:0; data = 128; - papu->write_register( 0, 0xff1a, data ); + papu->write_register( fakeClock(), 0xff1a, data ); int ch3voldata[4] = { 0, 3, 2, 1 }; data = ch3voldata[(int)m_ch3VolumeModel.value()]; data = data<<5; - papu->write_register( 0, 0xff1c, data ); + papu->write_register( fakeClock(), 0xff1c, data ); //controls data = m_so1VolumeModel.value(); data = data<<4; data += m_so2VolumeModel.value(); - papu->write_register( 0, 0xff24, data ); + papu->write_register( fakeClock(), 0xff24, data ); data = m_ch4So2Model.value()?128:0; data += m_ch3So2Model.value()?64:0; @@ -331,7 +336,7 @@ void papuInstrument::playNote( NotePlayHandle * _n, data += m_ch3So1Model.value()?4:0; data += m_ch2So1Model.value()?2:0; data += m_ch1So1Model.value()?1:0; - papu->write_register( 0, 0xff25, data ); + papu->write_register( fakeClock(), 0xff25, data ); const float * wpm = m_graphModel.samples(); @@ -339,7 +344,7 @@ void papuInstrument::playNote( NotePlayHandle * _n, { data = (int)floor(wpm[i*2]) << 4; data += (int)floor(wpm[i*2+1]); - papu->write_register( 0, 0xff30 + i, data ); + papu->write_register( fakeClock(), 0xff30 + i, data ); } if( ( freq >= 65 ) && ( freq <=4000 ) ) @@ -349,13 +354,13 @@ void papuInstrument::playNote( NotePlayHandle * _n, data = 2048 - ( ( 4194304 / freq )>>5 ); if( tfp==0 ) { - papu->write_register( 0, 0xff13, data & 0xff ); - papu->write_register( 0, 0xff14, (data>>8) | initflag ); + papu->write_register( fakeClock(), 0xff13, data & 0xff ); + papu->write_register( fakeClock(), 0xff14, (data>>8) | initflag ); } - papu->write_register( 0, 0xff18, data & 0xff ); - papu->write_register( 0, 0xff19, (data>>8) | initflag ); - papu->write_register( 0, 0xff1d, data & 0xff ); - papu->write_register( 0, 0xff1e, (data>>8) | initflag ); + papu->write_register( fakeClock(), 0xff18, data & 0xff ); + papu->write_register( fakeClock(), 0xff19, (data>>8) | initflag ); + papu->write_register( fakeClock(), 0xff1d, data & 0xff ); + papu->write_register( fakeClock(), 0xff1e, (data>>8) | initflag ); } if( tfp == 0 ) @@ -379,7 +384,7 @@ void papuInstrument::playNote( NotePlayHandle * _n, data += m_ch4ShiftRegWidthModel.value(); data = data << 3; data += ropt; - papu->write_register( 0, 0xff22, data ); + papu->write_register( fakeClock(), 0xff22, data ); } int const buf_size = 2048; @@ -391,7 +396,8 @@ void papuInstrument::playNote( NotePlayHandle * _n, int avail = papu->samples_avail(); if( avail <= 0 ) { - papu->end_frame(0); + m_time = 0; + papu->end_frame(FRAME_LENGTH); avail = papu->samples_avail(); } datalen = framesleft>avail?avail:framesleft; @@ -414,7 +420,7 @@ void papuInstrument::playNote( NotePlayHandle * _n, -void papuInstrument::deleteNotePluginData( NotePlayHandle * _n ) +void FreeBoyInstrument::deleteNotePluginData( NotePlayHandle * _n ) { delete static_cast( _n->m_pluginData ); } @@ -422,16 +428,16 @@ void papuInstrument::deleteNotePluginData( NotePlayHandle * _n ) -PluginView * papuInstrument::instantiateView( QWidget * _parent ) +PluginView * FreeBoyInstrument::instantiateView( QWidget * _parent ) { - return( new papuInstrumentView( this, _parent ) ); + return( new FreeBoyInstrumentView( this, _parent ) ); } -class papuKnob : public Knob +class FreeBoyKnob : public Knob { public: - papuKnob( QWidget * _parent ) : + FreeBoyKnob( QWidget * _parent ) : Knob( knobStyled, _parent ) { setFixedSize( 30, 30 ); @@ -447,7 +453,7 @@ public: -papuInstrumentView::papuInstrumentView( Instrument * _instrument, +FreeBoyInstrumentView::FreeBoyInstrumentView( Instrument * _instrument, QWidget * _parent ) : InstrumentView( _instrument, _parent ) { @@ -457,14 +463,14 @@ papuInstrumentView::papuInstrumentView( Instrument * _instrument, pal.setBrush( backgroundRole(), PLUGIN_NAME::getIconPixmap( "artwork" ) ); setPalette( pal ); - m_ch1SweepTimeKnob = new papuKnob( this ); + m_ch1SweepTimeKnob = new FreeBoyKnob( this ); m_ch1SweepTimeKnob->setHintText( tr( "Sweep Time:" ), "" ); m_ch1SweepTimeKnob->move( 5 + 4*32, 106 ); ToolTip::add( m_ch1SweepTimeKnob, tr( "Sweep Time" ) ); m_ch1SweepTimeKnob->setWhatsThis( tr( "The amount of increase or" " decrease in frequency" ) ); - m_ch1SweepRtShiftKnob = new papuKnob( this ); + m_ch1SweepRtShiftKnob = new FreeBoyKnob( this ); m_ch1SweepRtShiftKnob->setHintText( tr( "Sweep RtShift amount:" ) , "" ); m_ch1SweepRtShiftKnob->move( 5 + 3*32, 106 ); @@ -472,7 +478,7 @@ papuInstrumentView::papuInstrumentView( Instrument * _instrument, m_ch1SweepRtShiftKnob->setWhatsThis( tr( "The rate at which increase or" " decrease in frequency occurs" ) ); - m_ch1WavePatternDutyKnob = new papuKnob( this ); + m_ch1WavePatternDutyKnob = new FreeBoyKnob( this ); m_ch1WavePatternDutyKnob->setHintText( tr( "Wave pattern duty:" ) , "" ); m_ch1WavePatternDutyKnob->move( 5 + 2*32, 106 ); @@ -481,14 +487,14 @@ papuInstrumentView::papuInstrumentView( Instrument * _instrument, " the duration (time) that a signal is ON" " versus the total period of the signal." ) ); - m_ch1VolumeKnob = new papuKnob( this ); + m_ch1VolumeKnob = new FreeBoyKnob( this ); m_ch1VolumeKnob->setHintText( tr( "Square Channel 1 Volume:" ) , "" ); m_ch1VolumeKnob->move( 5, 106 ); ToolTip::add( m_ch1VolumeKnob, tr( "Square Channel 1 Volume:" ) ); m_ch1VolumeKnob->setWhatsThis( tr( "Square Channel 1 Volume" ) ); - m_ch1SweepStepLengthKnob = new papuKnob( this ); + m_ch1SweepStepLengthKnob = new FreeBoyKnob( this ); m_ch1SweepStepLengthKnob->setHintText( tr( "Length of each step in sweep:" ) , "" ); m_ch1SweepStepLengthKnob->move( 5 + 32, 106 ); @@ -497,7 +503,7 @@ papuInstrumentView::papuInstrumentView( Instrument * _instrument, - m_ch2WavePatternDutyKnob = new papuKnob( this ); + m_ch2WavePatternDutyKnob = new FreeBoyKnob( this ); m_ch2WavePatternDutyKnob->setHintText( tr( "Wave pattern duty:" ) , "" ); m_ch2WavePatternDutyKnob->move( 5 + 2*32, 155 ); @@ -506,14 +512,14 @@ papuInstrumentView::papuInstrumentView( Instrument * _instrument, " the duration (time) that a signal is ON" " versus the total period of the signal." ) ); - m_ch2VolumeKnob = new papuKnob( this ); + m_ch2VolumeKnob = new FreeBoyKnob( this ); m_ch2VolumeKnob->setHintText( tr( "Square Channel 2 Volume:" ) , "" ); m_ch2VolumeKnob->move( 5, 155 ); ToolTip::add( m_ch2VolumeKnob, tr( "Square Channel 2 Volume" ) ); m_ch2VolumeKnob->setWhatsThis( tr( "Square Channel 2 Volume" ) ); - m_ch2SweepStepLengthKnob = new papuKnob( this ); + m_ch2SweepStepLengthKnob = new FreeBoyKnob( this ); m_ch2SweepStepLengthKnob->setHintText( tr( "Length of each step in sweep:" ) , "" ); m_ch2SweepStepLengthKnob->move( 5 + 32, 155 ); @@ -522,7 +528,7 @@ papuInstrumentView::papuInstrumentView( Instrument * _instrument, - m_ch3VolumeKnob = new papuKnob( this ); + m_ch3VolumeKnob = new FreeBoyKnob( this ); m_ch3VolumeKnob->setHintText( tr( "Wave Channel Volume:" ), "" ); m_ch3VolumeKnob->move( 5, 204 ); ToolTip::add( m_ch3VolumeKnob, tr( "Wave Channel Volume" ) ); @@ -530,13 +536,13 @@ papuInstrumentView::papuInstrumentView( Instrument * _instrument, - m_ch4VolumeKnob = new papuKnob( this ); + m_ch4VolumeKnob = new FreeBoyKnob( this ); m_ch4VolumeKnob->setHintText( tr( "Noise Channel Volume:" ), "" ); m_ch4VolumeKnob->move( 144, 155 ); ToolTip::add( m_ch4VolumeKnob, tr( "Noise Channel Volume" ) ); m_ch4VolumeKnob->setWhatsThis( tr( "Noise Channel Volume" ) ); - m_ch4SweepStepLengthKnob = new papuKnob( this ); + m_ch4SweepStepLengthKnob = new FreeBoyKnob( this ); m_ch4SweepStepLengthKnob->setHintText( tr( "Length of each step in sweep:" ) , "" ); m_ch4SweepStepLengthKnob->move( 144 + 32, 155 ); @@ -545,22 +551,22 @@ papuInstrumentView::papuInstrumentView( Instrument * _instrument, - m_so1VolumeKnob = new papuKnob( this ); + m_so1VolumeKnob = new FreeBoyKnob( this ); m_so1VolumeKnob->setHintText( tr( "SO1 Volume (Right):" ), "" ); m_so1VolumeKnob->move( 5, 58 ); ToolTip::add( m_so1VolumeKnob, tr( "SO1 Volume (Right)" ) ); - m_so2VolumeKnob = new papuKnob( this ); + m_so2VolumeKnob = new FreeBoyKnob( this ); m_so2VolumeKnob->setHintText( tr( "SO2 Volume (Left):" ), "" ); m_so2VolumeKnob->move( 5 + 32, 58 ); ToolTip::add( m_so2VolumeKnob, tr( "SO2 Volume (Left)" ) ); - m_trebleKnob = new papuKnob( this ); + m_trebleKnob = new FreeBoyKnob( this ); m_trebleKnob->setHintText( tr( "Treble:" ), "" ); m_trebleKnob->move( 5 + 2*32, 58 ); ToolTip::add( m_trebleKnob, tr( "Treble" ) ); - m_bassKnob = new papuKnob( this ); + m_bassKnob = new FreeBoyKnob( this ); m_bassKnob->setHintText( tr( "Bass:" ), "" ); m_bassKnob->move( 5 + 3*32, 58 ); ToolTip::add( m_bassKnob, tr( "Bass" ) ); @@ -689,14 +695,14 @@ papuInstrumentView::papuInstrumentView( Instrument * _instrument, } -papuInstrumentView::~papuInstrumentView() +FreeBoyInstrumentView::~FreeBoyInstrumentView() { } -void papuInstrumentView::modelChanged() +void FreeBoyInstrumentView::modelChanged() { - papuInstrument * p = castModel(); + FreeBoyInstrument * p = castModel(); m_ch1SweepTimeKnob->setModel( &p->m_ch1SweepTimeModel ); m_ch1SweepDirButton->setModel( &p->m_ch1SweepDirModel ); @@ -740,7 +746,7 @@ extern "C" // necessary for getting instance out of shared lib Plugin * PLUGIN_EXPORT lmms_plugin_main( Model *, void * _data ) { - return( new papuInstrument( + return( new FreeBoyInstrument( static_cast( _data ) ) ); } diff --git a/plugins/papu/papu_instrument.h b/plugins/FreeBoy/FreeBoy.h similarity index 86% rename from plugins/papu/papu_instrument.h rename to plugins/FreeBoy/FreeBoy.h index 8ba363c4f..69c478505 100644 --- a/plugins/papu/papu_instrument.h +++ b/plugins/FreeBoy/FreeBoy.h @@ -1,5 +1,5 @@ /* - * papu_Instrument.h - GameBoy papu based instrument + * FreeBoyInstrument.h - GameBoy papu based instrument * * Copyright (c) 2008 * Csaba Hruska @@ -23,26 +23,27 @@ * */ -#ifndef _PAPU_H -#define _PAPU_H +#ifndef FREEBOY_H +#define FREEBOY_H #include #include "Instrument.h" #include "InstrumentView.h" #include "Knob.h" #include "Graph.h" +#include "Gb_Apu.h" -class papuInstrumentView; +class FreeBoyInstrumentView; class NotePlayHandle; class PixmapButton; -class papuInstrument : public Instrument +class FreeBoyInstrument : public Instrument { Q_OBJECT public: - papuInstrument( InstrumentTrack * _instrument_track ); - virtual ~papuInstrument(); + FreeBoyInstrument( InstrumentTrack * _instrument_track ); + virtual ~FreeBoyInstrument(); virtual void playNote( NotePlayHandle * _n, sampleFrame * _working_buffer ); @@ -102,16 +103,20 @@ private: graphModel m_graphModel; - friend class papuInstrumentView; + // Fake CPU timing + blip_time_t m_time; + blip_time_t fakeClock() { return m_time += 4; } + + friend class FreeBoyInstrumentView; } ; -class papuInstrumentView : public InstrumentView +class FreeBoyInstrumentView : public InstrumentView { Q_OBJECT public: - papuInstrumentView( Instrument * _instrument, QWidget * _parent ); - virtual ~papuInstrumentView(); + FreeBoyInstrumentView( Instrument * _instrument, QWidget * _parent ); + virtual ~FreeBoyInstrumentView(); private: virtual void modelChanged(); diff --git a/plugins/papu/Gb_Apu_Buffer.cpp b/plugins/FreeBoy/Gb_Apu_Buffer.cpp similarity index 66% rename from plugins/papu/Gb_Apu_Buffer.cpp rename to plugins/FreeBoy/Gb_Apu_Buffer.cpp index 1a817eb2a..0cd8662ac 100644 --- a/plugins/papu/Gb_Apu_Buffer.cpp +++ b/plugins/FreeBoy/Gb_Apu_Buffer.cpp @@ -20,34 +20,21 @@ * Boston, MA 02110-1301 USA. * */ -#include "Gb_Apu.h" #include "Gb_Apu_Buffer.h" -blip_time_t const FRAME_LENGTH = 70224; -long const CLOCK_RATE = 4194304; - -Gb_Apu_Buffer::Gb_Apu_Buffer() : m_time(0) {} +Gb_Apu_Buffer::Gb_Apu_Buffer() {} Gb_Apu_Buffer::~Gb_Apu_Buffer() {} -void Gb_Apu_Buffer::write_register(blip_time_t ignore, unsigned addr, int data) { - Gb_Apu::write_register(clock(), addr, data); +void Gb_Apu_Buffer::end_frame(blip_time_t end_time) { + Gb_Apu::end_frame(end_time); + m_buf.end_frame(end_time); } -int Gb_Apu_Buffer::read_register(blip_time_t ignore, unsigned addr) { - return Gb_Apu::read_register(clock(), addr); -} - -void Gb_Apu_Buffer::end_frame(blip_time_t ignore) { - m_time = 0; - Gb_Apu::end_frame(FRAME_LENGTH); - m_buf.end_frame(FRAME_LENGTH); -} - -// Sets specified sample rate and hard-coded clock rate in Multi_Buffer -blargg_err_t Gb_Apu_Buffer::set_sample_rate(long rate) { +// Sets specified sample rate and clock rate in Multi_Buffer +blargg_err_t Gb_Apu_Buffer::set_sample_rate(long sample_rate, long clock_rate) { Gb_Apu_Buffer::output(m_buf.center(), m_buf.left(), m_buf.right()); - m_buf.clock_rate(CLOCK_RATE); - return m_buf.set_sample_rate(rate); + m_buf.clock_rate(clock_rate); + return m_buf.set_sample_rate(sample_rate); } // Wrap Multi_Buffer::samples_avail() diff --git a/plugins/papu/Gb_Apu_Buffer.h b/plugins/FreeBoy/Gb_Apu_Buffer.h similarity index 85% rename from plugins/papu/Gb_Apu_Buffer.h rename to plugins/FreeBoy/Gb_Apu_Buffer.h index 065fbe82d..5228b7b8a 100644 --- a/plugins/papu/Gb_Apu_Buffer.h +++ b/plugins/FreeBoy/Gb_Apu_Buffer.h @@ -33,21 +33,15 @@ public: Gb_Apu_Buffer(); ~Gb_Apu_Buffer(); - void write_register(blip_time_t, unsigned addr, int data); - int read_register(blip_time_t, unsigned addr); void end_frame(blip_time_t); - blargg_err_t set_sample_rate(long rate); + + blargg_err_t set_sample_rate(long sample_rate, long clock_rate); long samples_avail() const; typedef blip_sample_t sample_t; long read_samples(sample_t* out, long count); - void bass_freq(int freq); private: Stereo_Buffer m_buf; - blip_time_t m_time; - - // faked CPU timing - blip_time_t clock() { return m_time += 4; } }; #endif diff --git a/plugins/papu/artwork.png b/plugins/FreeBoy/artwork.png similarity index 100% rename from plugins/papu/artwork.png rename to plugins/FreeBoy/artwork.png diff --git a/plugins/papu/btn_15.png b/plugins/FreeBoy/btn_15.png similarity index 100% rename from plugins/papu/btn_15.png rename to plugins/FreeBoy/btn_15.png diff --git a/plugins/papu/btn_7.png b/plugins/FreeBoy/btn_7.png similarity index 100% rename from plugins/papu/btn_7.png rename to plugins/FreeBoy/btn_7.png diff --git a/plugins/papu/btn_down.png b/plugins/FreeBoy/btn_down.png similarity index 100% rename from plugins/papu/btn_down.png rename to plugins/FreeBoy/btn_down.png diff --git a/plugins/papu/btn_off.png b/plugins/FreeBoy/btn_off.png similarity index 100% rename from plugins/papu/btn_off.png rename to plugins/FreeBoy/btn_off.png diff --git a/plugins/papu/btn_on.png b/plugins/FreeBoy/btn_on.png similarity index 100% rename from plugins/papu/btn_on.png rename to plugins/FreeBoy/btn_on.png diff --git a/plugins/papu/btn_up.png b/plugins/FreeBoy/btn_up.png similarity index 100% rename from plugins/papu/btn_up.png rename to plugins/FreeBoy/btn_up.png diff --git a/plugins/papu/game-music-emu b/plugins/FreeBoy/game-music-emu similarity index 100% rename from plugins/papu/game-music-emu rename to plugins/FreeBoy/game-music-emu diff --git a/plugins/papu/logo.png b/plugins/FreeBoy/logo.png similarity index 100% rename from plugins/papu/logo.png rename to plugins/FreeBoy/logo.png diff --git a/src/core/DataFile.cpp b/src/core/DataFile.cpp index dc2b1de57..9a1d15064 100644 --- a/src/core/DataFile.cpp +++ b/src/core/DataFile.cpp @@ -968,6 +968,26 @@ void DataFile::upgrade_1_2_0_rc2_42() } +void DataFile::upgrade_1_3_0() +{ + QDomNodeList list = elementsByTagName( "instrument" ); + for( int i = 0; !list.item( i ).isNull(); ++i ) + { + QDomElement el = list.item( i ).toElement(); + if( el.attribute( "name" ) == "papu" ) + { + el.setAttribute( "name", "freeboy" ); + QDomNodeList children = el.elementsByTagName( "papu" ); + for( int j = 0; !children.item( j ).isNull(); ++j ) + { + QDomElement child = children.item( j ).toElement(); + child.setTagName( "freeboy" ); + } + } + } +} + + void DataFile::upgrade() { ProjectVersion version = @@ -1049,6 +1069,10 @@ void DataFile::upgrade() upgrade_1_2_0_rc3(); upgrade_1_2_0_rc2_42(); } + if( version < "1.3.0" ) + { + upgrade_1_3_0(); + } // update document meta data documentElement().setAttribute( "version", LDF_VERSION_STRING );