comparison widgets/PropertyBox.cpp @ 946:36cddc3de023 alignment_view

Merge from default branch
author Chris Cannam
date Mon, 20 Apr 2015 09:19:52 +0100
parents 4a578a360011
children 98827470ada2 66da6f009edd
comparison
equal deleted inserted replaced
897:499b637f2a26 946:36cddc3de023
687 } 687 }
688 688
689 void 689 void
690 PropertyBox::playGainChanged(float gain) 690 PropertyBox::playGainChanged(float gain)
691 { 691 {
692 int dialValue = lrint(log10(gain) * 20.0); 692 int dialValue = int(lrint(log10(gain) * 20.0));
693 if (dialValue < -50) dialValue = -50; 693 if (dialValue < -50) dialValue = -50;
694 if (dialValue > 50) dialValue = 50; 694 if (dialValue > 50) dialValue = 50;
695 emit changePlayGainDial(dialValue); 695 emit changePlayGainDial(dialValue);
696 } 696 }
697 697
701 QObject *obj = sender(); 701 QObject *obj = sender();
702 702
703 PlayParameters *params = m_container->getPlayParameters(); 703 PlayParameters *params = m_container->getPlayParameters();
704 if (!params) return; 704 if (!params) return;
705 705
706 float gain = pow(10, float(dialValue) / 20.0); 706 float gain = float(pow(10, float(dialValue) / 20.0));
707 707
708 if (params->getPlayGain() != gain) { 708 if (params->getPlayGain() != gain) {
709 PlayParameterRepository::EditCommand *command = 709 PlayParameterRepository::EditCommand *command =
710 new PlayParameterRepository::EditCommand(params); 710 new PlayParameterRepository::EditCommand(params);
711 command->setPlayGain(gain); 711 command->setPlayGain(gain);
716 } 716 }
717 717
718 void 718 void
719 PropertyBox::playPanChanged(float pan) 719 PropertyBox::playPanChanged(float pan)
720 { 720 {
721 int dialValue = lrint(pan * 50.0); 721 int dialValue = int(lrint(pan * 50.0));
722 if (dialValue < -50) dialValue = -50; 722 if (dialValue < -50) dialValue = -50;
723 if (dialValue > 50) dialValue = 50; 723 if (dialValue > 50) dialValue = 50;
724 emit changePlayPanDial(dialValue); 724 emit changePlayPanDial(dialValue);
725 } 725 }
726 726
730 QObject *obj = sender(); 730 QObject *obj = sender();
731 731
732 PlayParameters *params = m_container->getPlayParameters(); 732 PlayParameters *params = m_container->getPlayParameters();
733 if (!params) return; 733 if (!params) return;
734 734
735 float pan = float(dialValue) / 50.0; 735 float pan = float(dialValue) / 50.f;
736 if (pan < -1.0) pan = -1.0; 736 if (pan < -1.f) pan = -1.f;
737 if (pan > 1.0) pan = 1.0; 737 if (pan > 1.f) pan = 1.f;
738 738
739 if (params->getPlayPan() != pan) { 739 if (params->getPlayPan() != pan) {
740 PlayParameterRepository::EditCommand *command = 740 PlayParameterRepository::EditCommand *command =
741 new PlayParameterRepository::EditCommand(params); 741 new PlayParameterRepository::EditCommand(params);
742 command->setPlayPan(pan); 742 command->setPlayPan(pan);
830 QString wname = w->objectName(); 830 QString wname = w->objectName();
831 831
832 QString extraText; 832 QString extraText;
833 AudioDial *dial = dynamic_cast<AudioDial *>(w); 833 AudioDial *dial = dynamic_cast<AudioDial *>(w);
834 if (dial) { 834 if (dial) {
835 float mv = dial->mappedValue(); 835 double mv = dial->mappedValue();
836 QString unit = ""; 836 QString unit = "";
837 if (dial->rangeMapper()) unit = dial->rangeMapper()->getUnit(); 837 if (dial->rangeMapper()) unit = dial->rangeMapper()->getUnit();
838 if (unit != "") { 838 if (unit != "") {
839 extraText = tr(" (current value: %1%2)").arg(mv).arg(unit); 839 extraText = tr(" (current value: %1%2)").arg(mv).arg(unit);
840 } else { 840 } else {