Ejemplo n.º 1
0
MetronomeWindow::MetronomeWindow(MetronomeConf* conf)
{
	setupUi(this);

	this->statusBar()->showMessage("Stopped");

	timer = new QTimer(this);
	this->setTimerInterval();

	this->conf = conf;
	ticker = new Ticker( this->conf );

	this->tickIndex = 0;
	this->setAccents( this->accentsBox->value() );

	connect( this->timer, SIGNAL(timeout()), this, SLOT(doTick()) );
	connect( this->startStopTickingButton, SIGNAL(clicked()), this, SLOT(startStopTicking()) );
	connect( this->setBpmButton, SIGNAL(clicked()), this, SLOT(setBPM()) );
	connect( this->accentsBox, SIGNAL(valueChanged(int)), this, SLOT(setAccents(int)) );
	connect( this->quitAction, SIGNAL(triggered()), qApp, SLOT(quit()) );
	connect( this->aboutAction, SIGNAL(triggered()), this, SLOT(showAboutBox()) );

	connect( this->bpm60, SIGNAL(clicked()), this, SLOT(bpmPreset60()) );
	connect( this->bpm70, SIGNAL(clicked()), this, SLOT(bpmPreset70()) );
	connect( this->bpm80, SIGNAL(clicked()), this, SLOT(bpmPreset80()) );
	connect( this->bpm90, SIGNAL(clicked()), this, SLOT(bpmPreset90()) );
	connect( this->bpm100, SIGNAL(clicked()), this, SLOT(bpmPreset100()) );
	connect( this->bpm110, SIGNAL(clicked()), this, SLOT(bpmPreset110()) );
	connect( this->bpm120, SIGNAL(clicked()), this, SLOT(bpmPreset120()) );
}
Ejemplo n.º 2
0
void Seq::loadPattern_1()
{
	if(seqInit)
	{
		setBPM(120.00);
		p[2].note[0] = true;
		p[2].note[16] = true;
		p[2].note[48] = true;
		p[2].note[112] = true;
		p[2].note[144] = true;
		p[2].note[152] = true;
		p[2].note[192] = true;
		p[2].note[208] = true;
		p[2].note[240] = true;

		p[3].note[32] = true;
		p[3].note[96] = true;
		p[3].note[160] = true;
		p[3].note[224] = true;

		p[1].note[0] = true;
		p[1].note[48] = true;
		p[1].note[112] = true;
		p[1].note[192] = true;

		for(int i = 0; i < NUMBER_OF_NOTES_PER_BEAT*NUMBER_OF_BEATS; i= i + 16){
			p[7].note[i] = true;
		}

		p[10].note[16] = true;
		p[10].note[144] = true;
		p[10].note[240] = true;
	}
}
Ejemplo n.º 3
0
//--------------------------------------------------------------
void testApp::setup(){
	
	ofSoundStreamSetup(2,0,this, 44100, 512, 4);
	
	ofSetColor(255, 255, 255);
	
	ofSetFrameRate(60);
	
	//set up the notes
	for(int i=0;i<24;i++){
		notePlayer[23-i].setup();
		notePlayer[23-i].setVolume(1.0);
		notePlayer[23-i].setFrequency(midi.getFreqForNote(48+i));
	}
	
	resetSequencer();
	
	setBPM(220); // set the bpm to 220
    
    length = 32;
    xPos = 0;
    yPos = ofGetHeight()-length;
    xVel = 5;
    yVel = 0;
    gravity = 0.3;
    checkXpos = 0;
    checkYpos = 0;
}
Ejemplo n.º 4
0
void initGroovebox() {
  seqPreview = false;
  metronomeMode = METRONOME_MODE_OFF;
  lastBPMReading = sampledAnalogRead(BPM_POT);
  unsigned int newBPM = (unsigned int)map(lastBPMReading, 0, 1023, MIN_BPM, MAX_BPM);
  setBPM(newBPM);
  for(byte t=0;t<SEQ_NUM_TRACKS;t++) {
    settings[t].volumeReading = sampledAnalogRead(TRACK_FADER_POT);
    settings[t].sustainVolLevel = 1.0;

    track[t].noteSeqIndex = 0;
    track[t].state = SEQ_PLAY;
    track[t].volumeScale = 1.0;

    faderPotTolerance = POT_LOCK_TOLERANCE;

    for(byte s=0;s<SEQ_LENGTH;s++) {
      seq[s][t].midiVal = UNSET;
      seq[s][t].transpose = 0;
      seq[s][t].velocity = 0;
      seq[s][t].duration = 0;
      seq[s][t].noteIndex = 0;
      seq[s][t].startPulse = 0;
    }
  }
}
Ejemplo n.º 5
0
//--------------------------------------------------------------
void Device::loadXMLBPM(ofxXmlSettings& settings)
{
  bool		bpmEnable		= settings.getValue("device:bpm:enable",0) > 0 ? true : false;
  int	 	bpm 			= settings.getValue("device:bpm:value",90);
  if (bpm<=0) bpm = 100;

  setBPMEnable(bpmEnable);
  setBPM(bpm);
}
Ejemplo n.º 6
0
void SoundSource::processBpmString(QString tagName, QString sBpm) {
    if (s_bDebugMetadata)
        qDebug() << tagName << "BPM" << sBpm;
    if (sBpm.length() > 0) {
        float fBpm = str2bpm(sBpm);
        if (fBpm > 0)
            setBPM(fBpm);
    }
}
Ejemplo n.º 7
0
void ofxTLBeatTicker::setup() {
	bpmScreenPoints.clear();
	ofxTLTicker::setup();
	(*(getTimeline()->getPages().begin()))->setTicker(this);
	getTimeline()->setTicker(this);
	setBPM(getTimeline()->getBPM());
	isSetup = true;
	refreshTickMarks();
	bMouseCursorInside = false;
	disabled = false;
}
Ejemplo n.º 8
0
xsync::xsync() : Thread (T("Sync thread"))
{
	setPriority (7);
	updateAsync = 0;
	timeBPM = 120;
	timeElapsed = 0;
	timeNow = 0;
	setBPM (120);
	midiQuarterNote = midiTicks = midiEighthNote = midiSixteenthNote = 0;

	Logger::writeToLog (T("xsync created"));
}
Ejemplo n.º 9
0
void Seq::loadDaFunkPattern()
{
	if(seqInit)
	{
		setBPM(111.00);
		p[2].note[0] = true;
		p[2].note[63] = true;
		p[2].note[127] = true;
		p[2].note[192] = true;

		p[1].note[63] = true;
		p[1].note[192] = true;

		p[3].note[32] = true;
		p[6].note[32] = true;

		p[3].note[96] = true;
		p[6].note[96] = true;

		p[3].note[160] = true;
		p[6].note[160] = true;

		p[3].note[224] = true;
		p[6].note[224] = true;

		p[0].note[0] = true;
		p[0].note[15] = true;
		p[0].note[31] = true;
		p[0].note[47] = true;
		p[0].note[55] = true;

		p[0].note[64] = true;
		p[0].note[64+15] = true;
		p[0].note[64+31] = true;
		p[0].note[64+47] = true;
		p[0].note[64+55] = true;

		p[0].note[2*64] = true;
		p[0].note[2*64+15] = true;
		p[0].note[2*64+31] = true;
		p[0].note[2*64+47] = true;
		p[0].note[2*64+55] = true;

		p[0].note[3*64] = true;
		p[0].note[3*64+15] = true;
		p[0].note[3*64+31] = true;
		p[0].note[3*64+47] = true;
		p[0].note[3*64+55] = true;
	}
}
Ejemplo n.º 10
0
void initializeEverything()
{
	int i, j, k;
	uint32_t increment;
	LCDInitialize();
	SPI_Initialize();
	//* setup oscs
	initializeOscillators();
	// Setup the keyboard usb
	SynthStationUsbInitialize();
	//calculate the note frequencies
		WaveformTablesInitialize();
		
	/** Calculate frequency increments */
	for(i = 0; i < 120; i++)
	{
		increment = noteTable[i];
		noteTable[i] = getIncrement(increment);
	}
	
	/** Initialize sequencer layerw */
	
	for(i = 0; i < 8; i++)
	{
		for(j = 0; j < SEQUENCER_STEPS; j++)
		{
				synthLayers[i].sequenceNotes[j] = 0xFFFF;
		}
		synthLayers[i].waveType = currentSelectedWaveForm;
	}
	
	synthLayers[0].layerFlags |= LAYER_FLAGS_ENABLED;
	synthLayers[1].layerFlags |= LAYER_FLAGS_ENABLED;
	
	noteListHead = (noteListItem *)malloc(sizeof(noteListItem));
	noteListHead->pNextItem = NULL;
	noteListHead->pNote = NULL;
	noteListTail = noteListHead;
		
	currentSelectedMode = SYNTH_RECORDING;
	setBPM(DEFAULT_BPM);
	
	BEAT_LED_START_DD = BEAT_LED_DD = 1;
	BEAT_LED_START = BEAT_LED = 0;
	
	//listTest();
	
}
Ejemplo n.º 11
0
CustomPlayHead::CustomPlayHead (AudioProcessor* audioProcessor) :
AudioProcessorCallback (audioProcessor),
sampleRate (0),
bpm (120),
timeSigNumerator (4),
timeSigDenominator (4),
timeInSeconds (0),
ppqPosition (0),
ppqPositionOfLastBarStart (0),
playing (false),
recording (false),
timeInSecondsOffset (0),
ppqPositionOffset (0),
timeInSecondsSinceLastBPMChange (0)
{
	setBPM (bpm);
}
Ejemplo n.º 12
0
//-------------------------------------------------
// DDSパラメータの初期化
//
// parameter: track: 計算するトラックデータ
//
void initDDSParameter(struct track* tracks)
{
    uint8_t i;

    setBPM(INITIAL_BPM);

    for (i = 0; i < TRACK_N; i++) {
        // 波形
        //tracks[i].waveTuningWord = tracks[i].waveFrequency * POW_2_32 / SAMPLE_CLOCK;
        setWaveDDSParameter(&tracks[i]);
        tracks[i].wavePhaseRegister = 0;

        // モジュレーション
        setModDDSParameter(&tracks[i]);
        tracks[i].decayPhaseRegister = 0;
        tracks[i].decayStop = 0;
    }
}
Ejemplo n.º 13
0
//=================================================
// シーケンサー基板からのパラメーターの設定
// parameter: track: トラックデータの配列
//            track_n: 設定するトラック番号
//            pram: シーケンサーパラメータ
//
//=================================================
void setTrack(struct track *tracks, int track_n, struct sequencer_parameter *param)
{
    int i;

    if (param->update & (UPDATE_POT1 | UPDATE_POT2)) {
        setBPM((param->pot2 << 4) | param->pot1);
        for (i = 0; i < TRACK_N; i++) {
            setModDDSParameter(&tracks[i]);
        }
    }
    if (param->update & UPDATE_SEQUENCE1) {
        for (i = 0; i < 8; i++) {
            tracks[track_n].sequence[i] = (param->sequence1 & (1 << i)) >> i;
        }
    }
    if (param->update & UPDATE_SEQUENCE2) {
        for (i = 0; i < 8; i++) {
            tracks[track_n].sequence[i + 8] = (param->sequence2 & (1 << i)) >> i;
        }
    }
}
Ejemplo n.º 14
0
void OsuUISongBrowserInfoLabel::setFromBeatmap(OsuBeatmap *beatmap, OsuBeatmapDifficulty *diff)
{
	m_iBeatmapId = diff->beatmapId;

	setArtist(diff->artist);
	setTitle(diff->title);
	setDiff(diff->name);
	setMapper(diff->creator);

	setLengthMS(beatmap->getLength());
	setBPM(diff->minBPM, diff->maxBPM);
	setNumObjects(diff->numObjects);

	setCS(diff->CS);
	setAR(diff->AR);
	setOD(diff->OD);
	setHP(diff->HP);
	setStars(diff->starsNoMod);

	setLocalOffset(diff->localoffset);
	setOnlineOffset(diff->onlineOffset);
}
Ejemplo n.º 15
0
void OsuUISongBrowserInfoLabel::setFromMissingBeatmap(long beatmapId)
{
	m_iBeatmapId = beatmapId;

	setArtist(m_iBeatmapId > 0 ? "CLICK HERE TO DOWNLOAD" : "MISSING BEATMAP!");
	setTitle("");
	setDiff("no map");
	setMapper("MISSING BEATMAP!");

	setLengthMS(0);
	setBPM(0, 0);
	setNumObjects(0);

	setCS(0);
	setAR(0);
	setOD(0);
	setHP(0);
	setStars(0);

	setLocalOffset(0);
	setOnlineOffset(0);
}
Ejemplo n.º 16
0
void Seq::loadPattern_2()
{
	if(seqInit){
		setBPM(90);
		p[3].note[32] = true;
		p[3].note[96] = true;
		p[3].note[160] = true;
		p[3].note[224] = true;

		p[2].note[0] = true;
		p[2].note[16] = true;
		p[2].note[48] = true;
		p[2].note[64] = true;
		p[2].note[128] = true;
		p[2].note[152] = true;
		p[2].note[192] = true;

		p[0].note[0] = true;
		p[0].note[64] = true;
		p[0].note[128] = true;
	}
}
Ejemplo n.º 17
0
//--------------------------------------------------------------
void testApp::keyPressed(int key){
    
	if(key=='c')
		bpmInt+=10;
	else if(key == 'z')
		bpmInt-=10;
	
	if(key=='x')
		resetSequencer();
	
	setBPM(bpmInt);
    
    if (key==OF_KEY_LEFT || key=='a' || key=='A') {
        moveL = true;
    }
    if (key==OF_KEY_RIGHT || key=='d' || key=='D') {
        moveR = true;
    }
    if (key=='w') {
        jumpTime = ofGetElapsedTimef();
        jump = true;
    }
}
Ejemplo n.º 18
0
int
MidiFile::read(const char *fileName) {
	if (fileName == NULL)
		return 1;
	
	setFileName(fileName);
	_target = openFile(fileName);
	
	if (!_target)
		return 1;

	readFileHeader();
	setType();
	setTrackCount();
	setBPM();
	for (int i = 0; i < _fileHeader._tracks; i++) {
		_curTrack = i;
		readTrack();
		printContour();
	}

	fclose(_target);
   	return 0;
}		
Ejemplo n.º 19
0
void Beats::start(float _bpm) {
    setBPM(_bpm);
    lastTime = (float) millis() / 1000;
    beatsTime = 0;
    triggerBeat();
}