Rename papu to FreeBoy
Make API calls more intuitive
4
.gitmodules
vendored
@@ -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
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ IF("${PLUGIN_LIST}" STREQUAL "")
|
||||
nes
|
||||
opl2
|
||||
organic
|
||||
papu
|
||||
FreeBoy
|
||||
patman
|
||||
peak_controller_effect
|
||||
GigPlayer
|
||||
|
||||
@@ -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"
|
||||
)
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* papu_instrument.cpp - GameBoy papu based instrument
|
||||
* FreeBoy.cpp - GameBoy papu based instrument
|
||||
*
|
||||
* Copyright (c) 2008 Attila Herman <attila589/at/gmail.com>
|
||||
* Csaba Hruska <csaba.hruska/at/gmail.com>
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
#include <QPainter>
|
||||
#include <QDomElement>
|
||||
#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<Gb_Apu_Buffer *>( _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<papuInstrument>();
|
||||
FreeBoyInstrument * p = castModel<FreeBoyInstrument>();
|
||||
|
||||
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<InstrumentTrack *>( _data ) ) );
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* papu_Instrument.h - GameBoy papu based instrument
|
||||
* FreeBoyInstrument.h - GameBoy papu based instrument
|
||||
*
|
||||
* Copyright (c) 2008 <Attila Herman <attila589/at/gmail.com>
|
||||
* Csaba Hruska <csaba.hruska/at/gmail.com>
|
||||
@@ -23,26 +23,27 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _PAPU_H
|
||||
#define _PAPU_H
|
||||
#ifndef FREEBOY_H
|
||||
#define FREEBOY_H
|
||||
|
||||
#include <QObject>
|
||||
#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();
|
||||
@@ -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()
|
||||
@@ -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
|
||||
|
Before Width: | Height: | Size: 64 KiB After Width: | Height: | Size: 64 KiB |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 3.8 KiB |
@@ -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 );
|
||||
|
||||