-rw-r--r-- | noncore/multimedia/powerchord/powerchordbase.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/multimedia/powerchord/powerchordbase.cpp b/noncore/multimedia/powerchord/powerchordbase.cpp index 92198bf..98fe3f7 100644 --- a/noncore/multimedia/powerchord/powerchordbase.cpp +++ b/noncore/multimedia/powerchord/powerchordbase.cpp | |||
@@ -336,129 +336,129 @@ PowerchordBase::PowerchordBase( QWidget* parent, const char* name, WFlags fl ) | |||
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 | ||
394 | static int known=0; | 394 | static int known=0; |
395 | #include <qmessagebox.h> | 395 | #include <qmessagebox.h> |
396 | void PowerchordBase::transport_rec_cb(){ | 396 | void 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, tr("Powerchord"), | 399 | QMessageBox::information(this, tr("Powerchord"), |
400 | tr("<P>This chord has been saved into the list of chords, for later playback.<P>"); | 400 | tr("<P>This chord has been saved into the list of chords, for later playback.<P>")); |
401 | known = 1; | 401 | known = 1; |
402 | } | 402 | } |
403 | } | 403 | } |
404 | void PowerchordBase::list_remove_cb(){ | 404 | void PowerchordBase::list_remove_cb(){ |
405 | if (chordlist->count() > 0){ | 405 | if (chordlist->count() > 0){ |
406 | chordlist->removeItem(0); | 406 | chordlist->removeItem(0); |
407 | } | 407 | } |
408 | } | 408 | } |
409 | void PowerchordBase::play_chord_cb(){ | 409 | void PowerchordBase::play_chord_cb(){ |
410 | // 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."); |
411 | 411 | ||
412 | 412 | ||
413 | if (audio_timer){ | 413 | if (audio_timer){ |
414 | audio_timer->stop(); | 414 | audio_timer->stop(); |
415 | // set pixmap? | 415 | // set pixmap? |
416 | synth->Stop(); | 416 | synth->Stop(); |
417 | delete(audio_timer); | 417 | delete(audio_timer); |
418 | audio_timer = 0; | 418 | audio_timer = 0; |
419 | }else{ | 419 | }else{ |
420 | // get notes from chord engine | 420 | // get notes from chord engine |
421 | 421 | ||
422 | int note; | 422 | int note; |
423 | int base; | 423 | int base; |
424 | int octave; | 424 | int octave; |
425 | note = frets->ce.noteindex(0); | 425 | note = frets->ce.noteindex(0); |
426 | if (note >= 0){ | 426 | if (note >= 0){ |
427 | //fprintf(stderr, "Note was %d\n", note); | 427 | //fprintf(stderr, "Note was %d\n", note); |
428 | base = note % 12; | 428 | base = note % 12; |
429 | octave = note / 12; | 429 | octave = note / 12; |
430 | synth->note_start(0, base, octave); | 430 | synth->note_start(0, base, octave); |
431 | }else{ | 431 | }else{ |
432 | // subtle bug here - replay second note if 1st one muted | 432 | // subtle bug here - replay second note if 1st one muted |
433 | note = frets->ce.noteindex(1); | 433 | note = frets->ce.noteindex(1); |
434 | base = note % 12; | 434 | base = note % 12; |
435 | octave = note / 12; | 435 | octave = note / 12; |
436 | synth->note_start(1, base, octave); | 436 | synth->note_start(1, base, octave); |
437 | 437 | ||
438 | } | 438 | } |
439 | 439 | ||
440 | // init synth | 440 | // init synth |
441 | if (synth->Play()){ | 441 | if (synth->Play()){ |
442 | // error | 442 | // error |
443 | QMessageBox::information(this, tr("Powerchord"), | 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>")); | 444 | tr("<P>Unable to open device for sound playback - check that no other application is using it.</P>")); |
445 | return; | 445 | return; |
446 | } | 446 | } |
447 | synth->fill_buffer(); | 447 | synth->fill_buffer(); |
448 | 448 | ||
449 | // start timer | 449 | // start timer |
450 | audio_timer = new QTimer(); | 450 | audio_timer = new QTimer(); |
451 | connect(audio_timer, SIGNAL( timeout() ), this, SLOT( audio_cb() )); | 451 | connect(audio_timer, SIGNAL( timeout() ), this, SLOT( audio_cb() )); |
452 | // set pixmap on player? | 452 | // set pixmap on player? |
453 | audio_timer->start(19); // 19 msec (fudge factor!!) | 453 | audio_timer->start(19); // 19 msec (fudge factor!!) |
454 | } | 454 | } |
455 | } | 455 | } |
456 | 456 | ||
457 | 457 | ||
458 | 458 | ||
459 | void PowerchordBase::audio_cb(){ | 459 | void PowerchordBase::audio_cb(){ |
460 | // play the next bit of audio until quiet | 460 | // play the next bit of audio until quiet |
461 | 461 | ||
462 | // strum timing | 462 | // strum timing |
463 | #define INTERVAL 2 | 463 | #define INTERVAL 2 |
464 | 464 | ||