summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/powerchord/powerchordbase.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/noncore/multimedia/powerchord/powerchordbase.cpp b/noncore/multimedia/powerchord/powerchordbase.cpp
index 0694ba3..92198bf 100644
--- a/noncore/multimedia/powerchord/powerchordbase.cpp
+++ b/noncore/multimedia/powerchord/powerchordbase.cpp
@@ -271,319 +271,323 @@ PowerchordBase::PowerchordBase( QWidget* parent, const char* name, WFlags fl )
271 tuning->insertItem( tr( "EADF#BE" ) ); 271 tuning->insertItem( tr( "EADF#BE" ) );
272 tuning->insertItem( tr( "EADGCF" ) ); 272 tuning->insertItem( tr( "EADGCF" ) );
273 tuning->insertItem( tr( "DADGAD" ) ); 273 tuning->insertItem( tr( "DADGAD" ) );
274 tuning->insertItem( tr( "DGCGCD" ) ); 274 tuning->insertItem( tr( "DGCGCD" ) );
275 tuning->insertItem( tr( "DADF#AD" ) ); 275 tuning->insertItem( tr( "DADF#AD" ) );
276 tuning->insertItem( tr( "DADGBE" ) ); 276 tuning->insertItem( tr( "DADGBE" ) );
277 tuning->insertItem( tr( "DGDGBD" ) ); 277 tuning->insertItem( tr( "DGDGBD" ) );
278 tuning->insertItem( tr( "DADACD" ) ); 278 tuning->insertItem( tr( "DADACD" ) );
279 tuning->insertItem( tr( "CGCGAE" ) ); 279 tuning->insertItem( tr( "CGCGAE" ) );
280 tuning->insertItem( tr( "FADGBE" ) ); 280 tuning->insertItem( tr( "FADGBE" ) );
281 tuning->insertItem( tr( "G minor" ) ); 281 tuning->insertItem( tr( "G minor" ) );
282 tuning->setGeometry( QRect( 140, 70, 91, 21 ) ); 282 tuning->setGeometry( QRect( 140, 70, 91, 21 ) );
283 283
284 optlab1 = new QLabel( tab_2, "optlab1" ); 284 optlab1 = new QLabel( tab_2, "optlab1" );
285 optlab1->setGeometry( QRect( 8, 8, 160, 40 ) ); 285 optlab1->setGeometry( QRect( 8, 8, 160, 40 ) );
286 optlab1->setText( tr( "Span: the greatest number of frets over which you want chords to be generated" ) ); 286 optlab1->setText( tr( "Span: the greatest number of frets over which you want chords to be generated" ) );
287 optlab1->setAlignment( int( QLabel::WordBreak | QLabel::AlignVCenter | QLabel::AlignLeft ) ); 287 optlab1->setAlignment( int( QLabel::WordBreak | QLabel::AlignVCenter | QLabel::AlignLeft ) );
288 tabs->insertTab( tab_2, tr( "Options" ) ); 288 tabs->insertTab( tab_2, tr( "Options" ) );
289 289
290 Tuner = new QWidget( tabs, "Tuner" ); 290 Tuner = new QWidget( tabs, "Tuner" );
291 291
292 Frame4 = new QFrame( Tuner, "Frame4" ); 292 Frame4 = new QFrame( Tuner, "Frame4" );
293 Frame4->setGeometry( QRect( 0, 0, 230, 126 ) ); 293 Frame4->setGeometry( QRect( 0, 0, 230, 126 ) );
294 Frame4->setFrameShape( QFrame::Box ); 294 Frame4->setFrameShape( QFrame::Box );
295 Frame4->setFrameShadow( QFrame::Raised ); 295 Frame4->setFrameShadow( QFrame::Raised );
296 296
297 vu = new VUMeter( Frame4, "vu" ); 297 vu = new VUMeter( Frame4, "vu" );
298 vu->setGeometry( QRect( 5, 5, 220, 115 ) ); 298 vu->setGeometry( QRect( 5, 5, 220, 115 ) );
299 299
300 tuner_note = new QComboBox( FALSE, Tuner, "tuner_note" ); 300 tuner_note = new QComboBox( FALSE, Tuner, "tuner_note" );
301 tuner_note->insertItem( tr( "auto" ) ); 301 tuner_note->insertItem( tr( "auto" ) );
302 tuner_note->insertItem( tr( "E" ) ); 302 tuner_note->insertItem( tr( "E" ) );
303 tuner_note->insertItem( tr( "D" ) ); 303 tuner_note->insertItem( tr( "D" ) );
304 tuner_note->insertItem( tr( "G" ) ); 304 tuner_note->insertItem( tr( "G" ) );
305 tuner_note->insertItem( tr( "A" ) ); 305 tuner_note->insertItem( tr( "A" ) );
306 tuner_note->insertItem( tr( "B" ) ); 306 tuner_note->insertItem( tr( "B" ) );
307 tuner_note->insertItem( tr( "C" ) ); 307 tuner_note->insertItem( tr( "C" ) );
308 tuner_note->insertItem( tr( "F" ) ); 308 tuner_note->insertItem( tr( "F" ) );
309 tuner_note->setGeometry( QRect( 5, 160, 90, 20 ) ); 309 tuner_note->setGeometry( QRect( 5, 160, 90, 20 ) );
310 310
311 Frame8 = new QFrame( Tuner, "Frame8" ); 311 Frame8 = new QFrame( Tuner, "Frame8" );
312 Frame8->setGeometry( QRect( -2, 188, 231, 10 ) ); 312 Frame8->setGeometry( QRect( -2, 188, 231, 10 ) );
313 Frame8->setFrameShape( QFrame::HLine ); 313 Frame8->setFrameShape( QFrame::HLine );
314 Frame8->setFrameShadow( QFrame::Raised ); 314 Frame8->setFrameShadow( QFrame::Raised );
315 315
316 tuner_start = new QPushButton( Tuner, "tuner_start" ); 316 tuner_start = new QPushButton( Tuner, "tuner_start" );
317 tuner_start->setGeometry( QRect( 100, 155, 91, 30 ) ); 317 tuner_start->setGeometry( QRect( 100, 155, 91, 30 ) );
318 tuner_start->setText( tr( "Start" ) ); 318 tuner_start->setText( tr( "Start" ) );
319 319
320 tuner_lab1 = new QLabel( Tuner, "tuner_lab1" ); 320 tuner_lab1 = new QLabel( Tuner, "tuner_lab1" );
321 tuner_lab1->setGeometry( QRect( 10, 130, 100, 21 ) ); 321 tuner_lab1->setGeometry( QRect( 10, 130, 100, 21 ) );
322 tuner_lab1->setText( tr( "Tuner operation" ) ); 322 tuner_lab1->setText( tr( "Tuner operation" ) );
323 323
324 tuner_lab2 = new QLabel( Tuner, "tuner_lab2" ); 324 tuner_lab2 = new QLabel( Tuner, "tuner_lab2" );
325 tuner_lab2->setGeometry( QRect( 10, 200, 100, 16 ) ); 325 tuner_lab2->setGeometry( QRect( 10, 200, 100, 16 ) );
326 tuner_lab2->setText( tr( "Pitch calibration" ) ); 326 tuner_lab2->setText( tr( "Pitch calibration" ) );
327 327
328 tuner_calib_note = new QComboBox( FALSE, Tuner, "tuner_calib_note" ); 328 tuner_calib_note = new QComboBox( FALSE, Tuner, "tuner_calib_note" );
329 tuner_calib_note->insertItem( tr( "A" ) ); 329 tuner_calib_note->insertItem( tr( "A" ) );
330 tuner_calib_note->insertItem( tr( "C" ) ); 330 tuner_calib_note->insertItem( tr( "C" ) );
331 tuner_calib_note->setGeometry( QRect( 5, 225, 90, 21 ) ); 331 tuner_calib_note->setGeometry( QRect( 5, 225, 90, 21 ) );
332 332
333 tuner_calib_freq = new QSpinBox( Tuner, "tuner_calib_freq" ); 333 tuner_calib_freq = new QSpinBox( Tuner, "tuner_calib_freq" );
334 tuner_calib_freq->setGeometry( QRect( 105, 225, 71, 21 ) ); 334 tuner_calib_freq->setGeometry( QRect( 105, 225, 71, 21 ) );
335 tuner_calib_freq->setSuffix( tr( "Hz" ) ); 335 tuner_calib_freq->setSuffix( tr( "Hz" ) );
336 tuner_calib_freq->setWrapping( TRUE ); 336 tuner_calib_freq->setWrapping( TRUE );
337 tuner_calib_freq->setMaxValue( 500 ); 337 tuner_calib_freq->setMaxValue( 500 );
338 tuner_calib_freq->setMinValue( 300 ); 338 tuner_calib_freq->setMinValue( 300 );
339 tuner_calib_freq->setValue( 440 ); 339 tuner_calib_freq->setValue( 440 );
340 340
341 tuner_lab3 = new QLabel( Tuner, "tuner_lab3" ); 341 tuner_lab3 = new QLabel( Tuner, "tuner_lab3" );
342 tuner_lab3->setGeometry( QRect( 185, 225, 40, 21 ) ); 342 tuner_lab3->setGeometry( QRect( 185, 225, 40, 21 ) );
343 tuner_lab3->setText( tr( "Pitch" ) ); 343 tuner_lab3->setText( tr( "Pitch" ) );
344 344
345 tuner_pic1 = new QLabel( Tuner, "tuner_pic1" ); 345 tuner_pic1 = new QLabel( Tuner, "tuner_pic1" );
346 tuner_pic1->setGeometry( QRect( 195, 155, 31, 31 ) ); 346 tuner_pic1->setGeometry( QRect( 195, 155, 31, 31 ) );
347 tuner_pic1->setFrameShape( QLabel::NoFrame ); 347 tuner_pic1->setFrameShape( QLabel::NoFrame );
348 tuner_pic1->setPixmap( image6 ); 348 tuner_pic1->setPixmap( image6 );
349 tuner_pic1->setScaledContents( TRUE ); 349 tuner_pic1->setScaledContents( TRUE );
350 tabs->insertTab( Tuner, tr( "Tuner" ) ); 350 tabs->insertTab( Tuner, tr( "Tuner" ) );
351 351
352 tab_3 = new QWidget( tabs, "tab_3" ); 352 tab_3 = new QWidget( tabs, "tab_3" );
353 353
354 chordlistlab1 = new QLabel( tab_3, "chordlistlab1" ); 354 chordlistlab1 = new QLabel( tab_3, "chordlistlab1" );
355 chordlistlab1->setGeometry( QRect( 5, 5, 216, 16 ) ); 355 chordlistlab1->setGeometry( QRect( 5, 5, 216, 16 ) );
356 chordlistlab1->setText( tr( "Chord list" ) ); 356 chordlistlab1->setText( tr( "Chord list" ) );
357 357
358 chordlist = new QListBox( tab_3, "chordlist" ); 358 chordlist = new QListBox( tab_3, "chordlist" );
359 chordlist->setGeometry( QRect( 5, 25, 220, 200 ) ); 359 chordlist->setGeometry( QRect( 5, 25, 220, 200 ) );
360 360
361 list_remove_btn = new QPushButton( tab_3, "list_remove_btn" ); 361 list_remove_btn = new QPushButton( tab_3, "list_remove_btn" );
362 list_remove_btn->setGeometry( QRect( 150, 230, 71, 25 ) ); 362 list_remove_btn->setGeometry( QRect( 150, 230, 71, 25 ) );
363 list_remove_btn->setText( tr( "Remove" ) ); 363 list_remove_btn->setText( tr( "Remove" ) );
364 tabs->insertTab( tab_3, tr( "Chords" ) ); 364 tabs->insertTab( tab_3, tr( "Chords" ) );
365 365
366 // hope this does what it's supposed to!! 366 // hope this does what it's supposed to!!
367 // setPalette( QPalette( QColor( 232, 227, 215) ) ); 367 // setPalette( QPalette( QColor( 232, 227, 215) ) );
368 368
369 // signals and slots connections 369 // signals and slots connections
370 370
371 //cxm 371 //cxm
372 connect( tuning, SIGNAL( activated(int) ), frets, SLOT( Tune(int) ) ); 372 connect( tuning, SIGNAL( activated(int) ), frets, SLOT( Tune(int) ) );
373 connect( span, SIGNAL( activated(int) ), frets, SLOT( Span(int) ) ); 373 connect( span, SIGNAL( activated(int) ), frets, SLOT( Span(int) ) );
374 connect( transport_rec, SIGNAL( clicked() ), this, SLOT( transport_rec_cb() )); 374 connect( transport_rec, SIGNAL( clicked() ), this, SLOT( transport_rec_cb() ));
375 connect( play_sound, SIGNAL( clicked() ), this, SLOT( play_chord_cb() )); 375 connect( play_sound, SIGNAL( clicked() ), this, SLOT( play_chord_cb() ));
376 connect( tuner_start, SIGNAL( clicked() ), this, SLOT( tuner_start_cb() )); 376 connect( tuner_start, SIGNAL( clicked() ), this, SLOT( tuner_start_cb() ));
377 connect( tuner_note, SIGNAL( textChanged(const QString&) ), vu, SLOT( AnnotL(const QString&) )); 377 connect( tuner_note, SIGNAL( textChanged(const QString&) ), vu, SLOT( AnnotL(const QString&) ));
378 connect( this, SIGNAL( frequency_change(int) ), vu, SLOT( Value(int) )); 378 connect( this, SIGNAL( frequency_change(int) ), vu, SLOT( Value(int) ));
379 379
380 connect( chordnote, SIGNAL( activated(int) ), frets, SLOT( Base(int) ) ); 380 connect( chordnote, SIGNAL( activated(int) ), frets, SLOT( Base(int) ) );
381 connect( chordkey, SIGNAL( activated(int) ), frets, SLOT( Chord(int) ) ); 381 connect( chordkey, SIGNAL( activated(int) ), frets, SLOT( Chord(int) ) );
382 connect( chordfret, SIGNAL( activated(int) ), frets, SLOT( Fret(int) ) ); 382 connect( chordfret, SIGNAL( activated(int) ), frets, SLOT( Fret(int) ) );
383 connect( list_remove_btn, SIGNAL( clicked() ), this, SLOT( list_remove_cb() ) ); 383 connect( list_remove_btn, SIGNAL( clicked() ), this, SLOT( list_remove_cb() ) );
384 connect( frets, SIGNAL( s1nameChanged(const QString&) ), s1_1, SLOT( setText(const QString&) ) ); 384 connect( frets, SIGNAL( s1nameChanged(const QString&) ), s1_1, SLOT( setText(const QString&) ) );
385 connect( frets, SIGNAL( s2nameChanged(const QString&) ), s1_2, SLOT( setText(const QString&) ) ); 385 connect( frets, SIGNAL( s2nameChanged(const QString&) ), s1_2, SLOT( setText(const QString&) ) );
386 connect( frets, SIGNAL( s3nameChanged(const QString&) ), s1_3, SLOT( setText(const QString&) ) ); 386 connect( frets, SIGNAL( s3nameChanged(const QString&) ), s1_3, SLOT( setText(const QString&) ) );
387 connect( frets, SIGNAL( s4nameChanged(const QString&) ), s1_4, SLOT( setText(const QString&) ) ); 387 connect( frets, SIGNAL( s4nameChanged(const QString&) ), s1_4, SLOT( setText(const QString&) ) );
388 connect( frets, SIGNAL( s5nameChanged(const QString&) ), s1_5, SLOT( setText(const QString&) ) ); 388 connect( frets, SIGNAL( s5nameChanged(const QString&) ), s1_5, SLOT( setText(const QString&) ) );
389 connect( frets, SIGNAL( s6nameChanged(const QString&) ), s1_6, SLOT( setText(const QString&) ) ); 389 connect( frets, SIGNAL( s6nameChanged(const QString&) ), s1_6, SLOT( setText(const QString&) ) );
390 connect( frets, SIGNAL( nameChanged(const QString&) ), chordname, SLOT( setText(const QString&) ) ); 390 connect( frets, SIGNAL( nameChanged(const QString&) ), chordname, SLOT( setText(const QString&) ) );
391} 391}
392 392
393 393
394static int known=0; 394static int known=0;
395#include <qmessagebox.h> 395#include <qmessagebox.h>
396void PowerchordBase::transport_rec_cb(){ 396void PowerchordBase::transport_rec_cb(){
397 chordlist->insertItem(chordname->text(),-1); 397 chordlist->insertItem(chordname->text(),-1);
398 if (!known){ 398 if (!known){
399 QMessageBox::information(this, "Powerchord", "This chord has been saved\ninto the list of chords,\nfor later playback."); 399 QMessageBox::information(this, tr("Powerchord"),
400 tr("<P>This chord has been saved into the list of chords, for later playback.<P>");
400 known = 1; 401 known = 1;
401 } 402 }
402} 403}
403void PowerchordBase::list_remove_cb(){ 404void PowerchordBase::list_remove_cb(){
404 if (chordlist->count() > 0){ 405 if (chordlist->count() > 0){
405 chordlist->removeItem(0); 406 chordlist->removeItem(0);
406 } 407 }
407} 408}
408void PowerchordBase::play_chord_cb(){ 409void PowerchordBase::play_chord_cb(){
409 // QMessageBox::information(this, "Coming soon!", "This button plays\nthe chord by synthesizing\nthe sound of the notes."); 410 // QMessageBox::information(this, "Coming soon!", "This button plays\nthe chord by synthesizing\nthe sound of the notes.");
410 411
411 412
412 if (audio_timer){ 413 if (audio_timer){
413 audio_timer->stop(); 414 audio_timer->stop();
414 // set pixmap? 415 // set pixmap?
415 synth->Stop(); 416 synth->Stop();
416 delete(audio_timer); 417 delete(audio_timer);
417 audio_timer = 0; 418 audio_timer = 0;
418 }else{ 419 }else{
419 // get notes from chord engine 420 // get notes from chord engine
420 421
421 int note; 422 int note;
422 int base; 423 int base;
423 int octave; 424 int octave;
424 note = frets->ce.noteindex(0); 425 note = frets->ce.noteindex(0);
425 if (note >= 0){ 426 if (note >= 0){
426 //fprintf(stderr, "Note was %d\n", note); 427 //fprintf(stderr, "Note was %d\n", note);
427 base = note % 12; 428 base = note % 12;
428 octave = note / 12; 429 octave = note / 12;
429 synth->note_start(0, base, octave); 430 synth->note_start(0, base, octave);
430 }else{ 431 }else{
431 // subtle bug here - replay second note if 1st one muted 432 // subtle bug here - replay second note if 1st one muted
432 note = frets->ce.noteindex(1); 433 note = frets->ce.noteindex(1);
433 base = note % 12; 434 base = note % 12;
434 octave = note / 12; 435 octave = note / 12;
435 synth->note_start(1, base, octave); 436 synth->note_start(1, base, octave);
436 437
437 } 438 }
438 439
439 // init synth 440 // init synth
440 if (synth->Play()){ 441 if (synth->Play()){
441 // error 442 // error
442 QMessageBox::information(this, "Powerchord", "Unable to open device for sound playback - check that no other application is using it."); 443 QMessageBox::information(this, tr("Powerchord"),
444 tr("<P>Unable to open device for sound playback - check that no other application is using it.</P>"));
443 return; 445 return;
444 } 446 }
445 synth->fill_buffer(); 447 synth->fill_buffer();
446 448
447 // start timer 449 // start timer
448 audio_timer = new QTimer(); 450 audio_timer = new QTimer();
449 connect(audio_timer, SIGNAL( timeout() ), this, SLOT( audio_cb() )); 451 connect(audio_timer, SIGNAL( timeout() ), this, SLOT( audio_cb() ));
450 // set pixmap on player? 452 // set pixmap on player?
451 audio_timer->start(19); // 19 msec (fudge factor!!) 453 audio_timer->start(19); // 19 msec (fudge factor!!)
452 } 454 }
453} 455}
454 456
455 457
456 458
457void PowerchordBase::audio_cb(){ 459void PowerchordBase::audio_cb(){
458 // play the next bit of audio until quiet 460 // play the next bit of audio until quiet
459 461
460 // strum timing 462 // strum timing
461#define INTERVAL 2 463#define INTERVAL 2
462 464
463 if ((synth->Frames() % INTERVAL) == 0){ 465 if ((synth->Frames() % INTERVAL) == 0){
464 int string = synth->Frames() / INTERVAL; 466 int string = synth->Frames() / INTERVAL;
465 if (string <= 5){ 467 if (string <= 5){
466 int note; 468 int note;
467 int base; 469 int base;
468 int octave; 470 int octave;
469 note = frets->ce.noteindex(string); 471 note = frets->ce.noteindex(string);
470 // check not muted... 472 // check not muted...
471 if (note > 0){ 473 if (note > 0){
472 base = note % 12; 474 base = note % 12;
473 octave = note / 12; 475 octave = note / 12;
474 synth->note_start(string, base, octave); 476 synth->note_start(string, base, octave);
475 } 477 }
476 } 478 }
477 } 479 }
478 480
479 if (synth->Playing()){ 481 if (synth->Playing()){
480 synth->write_buffer(); 482 synth->write_buffer();
481 synth->fill_buffer(); 483 synth->fill_buffer();
482 }else{ 484 }else{
483 audio_timer->stop(); 485 audio_timer->stop();
484 // set pixmap? 486 // set pixmap?
485 synth->Stop(); 487 synth->Stop();
486 delete(audio_timer); 488 delete(audio_timer);
487 audio_timer = 0; 489 audio_timer = 0;
488 } 490 }
489} 491}
490 492
491// the real tuner 493// the real tuner
492// void PowerchordBase::tuner_start_cb(){ 494// void PowerchordBase::tuner_start_cb(){
493 495
494// if (tuner->Listening()){ 496// if (tuner->Listening()){
495// simulation_timer->stop(); 497// simulation_timer->stop();
496// tuner->Stop(); 498// tuner->Stop();
497// tuner_pic1->setPixmap( *image6 ); 499// tuner_pic1->setPixmap( *image6 );
498 500
499// }else{ 501// }else{
500// tuner_pic1->setPixmap( *image_open ); 502// tuner_pic1->setPixmap( *image_open );
501 503
502// if (!simulation_timer){ 504// if (!simulation_timer){
503// simulation_timer = new QTimer(); 505// simulation_timer = new QTimer();
504 506
505 507
506// connect(simulation_timer, SIGNAL( timeout() ), this, SLOT( tuner_cb() )); 508// connect(simulation_timer, SIGNAL( timeout() ), this, SLOT( tuner_cb() ));
507// } 509// }
508 510
509// simulation_timer->start(50); 511// simulation_timer->start(50);
510// tuner->Listen(); 512// tuner->Listen();
511 513
512// } 514// }
513// } 515// }
514 516
515void PowerchordBase::tuner_cb(){ 517void PowerchordBase::tuner_cb(){
516 if (tuner->Listening()){ 518 if (tuner->Listening()){
517 tuner->read_buffer(); 519 tuner->read_buffer();
518 tuner->process_buffer(); 520 tuner->process_buffer();
519 521
520 // update gui 522 // update gui
521 // do something with the note: tuner->Note() 523 // do something with the note: tuner->Note()
522 emit frequency_change(tuner->Tuning()); 524 emit frequency_change(tuner->Tuning());
523 525
524 }else{ 526 }else{
525 simulation_timer->stop(); 527 simulation_timer->stop();
526 tuner->Stop(); 528 tuner->Stop();
527 tuner_pic1->setPixmap( image6 ); 529 tuner_pic1->setPixmap( image6 );
528 } 530 }
529} 531}
530 532
531 533
532void PowerchordBase::tuner_start_cb(){ 534void PowerchordBase::tuner_start_cb(){
533 if (0 == QMessageBox::information(this, "Powerchord", "Using the microphone,\nthe note's frequency\nis analysed. This\nis a simulation.", "OK", "Cancel", 0, 1)){ 535 if (0 == QMessageBox::information(this, tr("Powerchord"),
536 tr("<P>Using the microphone, the note's frequency is analysed. This is a simulation.</P>"),
537 tr("OK"), tr("Cancel"), 0, 1)){
534 if (simulation_timer){ 538 if (simulation_timer){
535 simulation_timer->stop(); 539 simulation_timer->stop();
536 }else{ 540 }else{
537 simulation_timer = new QTimer(); 541 simulation_timer = new QTimer();
538 connect(simulation_timer, SIGNAL( timeout() ), this, SLOT( tuner_simulation_cb() )); 542 connect(simulation_timer, SIGNAL( timeout() ), this, SLOT( tuner_simulation_cb() ));
539 543
540 } 544 }
541 simulation_x = -45; 545 simulation_x = -45;
542 simulation_v = 0; 546 simulation_v = 0;
543 simulation_iter = 0; 547 simulation_iter = 0;
544 548
545 tuner_pic1->setPixmap( image_open ); 549 tuner_pic1->setPixmap( image_open );
546 simulation_timer->start(100); 550 simulation_timer->start(100);
547 } 551 }
548} 552}
549 553
550#include <stdio.h> 554#include <stdio.h>
551 555
552void PowerchordBase::tuner_simulation_cb(){ 556void PowerchordBase::tuner_simulation_cb(){
553 if (simulation_x < -10 || simulation_x > 10){ 557 if (simulation_x < -10 || simulation_x > 10){
554 simulation_v = (simulation_v/2)-(simulation_x/5); 558 simulation_v = (simulation_v/2)-(simulation_x/5);
555 } 559 }
556 560
557 simulation_x += simulation_v; 561 simulation_x += simulation_v;
558 simulation_iter++; 562 simulation_iter++;
559 563
560 if (simulation_x > 50){ 564 if (simulation_x > 50){
561 simulation_x = 50; 565 simulation_x = 50;
562 } 566 }
563 567
564 if (simulation_x < -50){ 568 if (simulation_x < -50){
565 simulation_x = -50; 569 simulation_x = -50;
566 } 570 }
567 571
568 if (simulation_iter > 50){ 572 if (simulation_iter > 50){
569 simulation_timer->stop(); 573 simulation_timer->stop();
570 emit frequency_change(0); 574 emit frequency_change(0);
571 tuner_pic1->setPixmap( image6 ); 575 tuner_pic1->setPixmap( image6 );
572 }else{ 576 }else{
573 emit frequency_change(simulation_x); 577 emit frequency_change(simulation_x);
574 } 578 }
575} 579}
576 580
577/* 581/*
578 * Destroys the object and frees any allocated resources 582 * Destroys the object and frees any allocated resources
579 */ 583 */
580PowerchordBase::~PowerchordBase() 584PowerchordBase::~PowerchordBase()
581{ 585{
582 // no need to delete child widgets, Qt does it all for us 586 // no need to delete child widgets, Qt does it all for us
583} 587}
584 588
585void PowerchordBase::change_handler() 589void PowerchordBase::change_handler()
586{ 590{
587 owarn << "PowerchordBase::change_handler(): Not implemented yet!" << oendl; 591 owarn << "PowerchordBase::change_handler(): Not implemented yet!" << oendl;
588} 592}
589 593