SID
Commodore 64 SID Library
Classes | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | List of all members
SID Class Reference

Public Member Functions

 SID ()
 
void setVolume (byte volume)
 
void reset ()
 

Static Public Member Functions

static void writeData (unsigned char address, unsigned char data)
 

Public Attributes

SIDVoice V1
 
SIDVoice V2
 
SIDVoice V3
 

Static Public Attributes

static const int MIDI2freq [129]
 

Constructor & Destructor Documentation

SID::SID ( )
Description
Contructor that creates an instance of the SID object that contains three SIDVoice objects. V1, V2, V3 These objects are used to interact with and control the registers for the SID hardware implemented inside the Papilio FPGA board. Calling this contructor will initialize the SID and SIDVoice objects to their default values.
Syntax
SID()
Parameters
none
Example
#include "SID.h"
SID sid;
void setup()
{
sid.setVolume(15);
sid.V1.setInstrument("Calliope",0,0,15,0,0,0,0,1,0); //Calliope
sid.V2.setInstrument("Accordian",12,0,12,0,0,0,1,0,0); //Accordian
sid.V3.setInstrument("Harpsicord",0,9,0,0,0,1,0,0,512); //Harpsicord
sid.V1.setNote(51, 1);
sid.V2.setNote(51, 1);
sid.V3.setNote(51, 1);
}
void loop() {}

Member Function Documentation

void SID::reset ( )
Description
Set all SID registers to their default values.
Syntax
sid.reset()
Parameters
none
Example
#include "SID.h"
SID sid;
void setup()
{
sid.reset();
}
void loop() {}

void SID::setVolume ( byte  volume)
Description
Set the SID master volume
Syntax
sid.setVolume(volume)
Parameters
volumenumber between 0 and 15
Example
#include "SID.h"
SID sid;
void setup()
{
//Turn volume to the max value
sid.setVolume(15);
}
void loop() {}

void SID::writeData ( unsigned char  address,
unsigned char  data 
)
static
Description
Use this public function to bypass the SID and SIDVoice functions and write directly to the registers of the SID hardware. Look at the SID datasheet for the registers (http://www.waitingforfriday.com/index.php/Commodore_SID_6581_Datasheet#SID_Control_Registers)
Syntax
SID::writeData(address, data)
Parameters
addressthe address from the SID datasheet for the register you want to write to.
datawhat you want to write to the SID register
Example
#include "SID.h"
SID sid;
void setup()
{
//This will set Voice 1 Freq Lo to 0
}
void loop() {}

Member Data Documentation

const int SID::MIDI2freq
static
Initial value:
= {
291, 291, 291, 291, 291, 291, 291, 291,
291, 291, 291, 291, 291, 291, 308, 326,
346, 366, 388, 411, 435, 461, 489, 518,
549, 581, 616, 652, 691, 732, 776, 822,
871, 923, 978, 1036, 1097, 1163, 1232, 1305,
1383, 1465, 1552, 1644, 1742, 1845, 1955, 2071,
2195, 2325, 2463, 2610, 2765, 2930, 3104, 3288,
3484, 3691, 3910, 4143, 4389, 4650, 4927, 5220,
5530, 5859, 6207, 6577, 6968, 7382, 7821, 8286,
8779, 9301, 9854, 10440, 11060, 11718, 12415, 13153,
13935, 14764, 15642, 16572, 17557, 18601, 19709, 20897,
22121, 23436, 24830, 26306, 27871, 29528, 31234, 33144,
35115, 37203, 39415, 41759, 44242, 46873, 49660, 52613,
55741, 59056, 62567, 66288, 66288, 66288, 66288, 66288,
66288, 66288, 66288, 66288, 66288, 66288, 66288, 66288,
66288, 66288, 66288, 66288, 66288, 66288, 66288, 66288,
0
}

The documentation for this class was generated from the following files: