Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Working on Implementation of Panning #1061

Merged
merged 28 commits into from
Feb 2, 2021
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
5703755
Note & Instr. Pan interaction
oddtime Jan 3, 2021
c908c32
pan laws as static member functions of Sampler
oddtime Jan 3, 2021
83db742
add descriptive comments, make getRatioPan() obligatory, avoid the mu…
oddtime Jan 10, 2021
617ffd3
added other pan law functions
oddtime Jan 10, 2021
f847974
select pan Law from preferences
oddtime Jan 10, 2021
60574be
added 3 linear weighted pan laws
oddtime Jan 10, 2021
e977d81
save pan law as integer index in .h2song
oddtime Jan 10, 2021
90bd8a5
added 3 polar pan laws
oddtime Jan 10, 2021
f164f78
add constant k norm pan law
oddtime Jan 10, 2021
6e5cfbc
better manage of GUI pan Law combobox items, add 3 quadratic pan laws
oddtime Jan 11, 2021
cf4f147
add 3 constant Norm pan laws, commented unused method
oddtime Jan 11, 2021
19329e7
translatable, further descriptive comments
oddtime Jan 11, 2021
c7dd952
pan law members moved to Sampler, pan law enum class, save in song as…
oddtime Jan 18, 2021
f1cf556
add PanLawDialog, remove from PreferencesDialog
oddtime Jan 18, 2021
093bb6a
deprecate pointers to pan law static member function
oddtime Jan 18, 2021
7ecf62b
mixerSetting button in mixer master line
oddtime Jan 19, 2021
f606a60
correct and clean
oddtime Jan 19, 2021
2655e93
correct and clean 2
oddtime Jan 19, 2021
dad1cc0
merge master
oddtime Jan 19, 2021
99ae760
sharper icon
oddtime Jan 20, 2021
5089fab
add tooltip in pan law combo box
oddtime Jan 20, 2021
98813cd
headings in pan law combobox
oddtime Jan 23, 2021
9b5a79b
merge master
oddtime Jan 23, 2021
e799a46
typo
oddtime Jan 23, 2021
dc21783
mantainabilty changes
oddtime Jan 28, 2021
07c7afc
a line was missed
oddtime Jan 28, 2021
bface81
changelog, some graphic in doc comments
oddtime Jan 30, 2021
11bb83f
replace test.ref.flac because the new pan law functions introduce neg…
oddtime Feb 1, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added data/img/gray/mixerPanel/openMixerSettings_off.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/img/gray/mixerPanel/openMixerSettings_over.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
48 changes: 48 additions & 0 deletions src/core/Basics/Song.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
#include <core/Helpers/Xml.h>
#include <core/Helpers/Filesystem.h>
#include <core/Hydrogen.h>
#include <core/Sampler/Sampler.h>

#ifdef H2CORE_HAVE_OSC
#include <core/NsmClient.h>
Expand Down Expand Up @@ -725,6 +726,53 @@ Song* SongReader::readSong( const QString& sFileName )
pSong->setPlaybackTrackEnabled( bPlaybackTrackEnabled );
pSong->setPlaybackTrackVolume( fPlaybackTrackVolume );
pSong->setActionMode( actionMode );

// pan law
Sampler* pSampler = AudioEngine::get_instance()->get_sampler();
oddtime marked this conversation as resolved.
Show resolved Hide resolved
QString sPanLawType( LocalFileMng::readXmlString( songNode, "pan_law", "RATIO_STRAIGHT_POLYGONAL" ) );
oddtime marked this conversation as resolved.
Show resolved Hide resolved
if ( sPanLawType == "RATIO_STRAIGHT_POLYGONAL" ) {
pSampler->setPanLawType( pSampler->RATIO_STRAIGHT_POLYGONAL );
oddtime marked this conversation as resolved.
Show resolved Hide resolved
} else if ( sPanLawType == "RATIO_CONST_POWER" ) {
pSampler->setPanLawType( pSampler->RATIO_CONST_POWER );
} else if ( sPanLawType == "RATIO_CONST_SUM" ) {
pSampler->setPanLawType( pSampler->RATIO_CONST_SUM );
} else if ( sPanLawType == "LINEAR_STRAIGHT_POLYGONAL" ) {
pSampler->setPanLawType( pSampler->LINEAR_STRAIGHT_POLYGONAL );
} else if ( sPanLawType == "LINEAR_CONST_POWER" ) {
pSampler->setPanLawType( pSampler->LINEAR_CONST_POWER );
} else if ( sPanLawType == "LINEAR_CONST_SUM" ) {
pSampler->setPanLawType( pSampler->LINEAR_CONST_SUM );
} else if ( sPanLawType == "POLAR_STRAIGHT_POLYGONAL" ) {
pSampler->setPanLawType( pSampler->POLAR_STRAIGHT_POLYGONAL );
} else if ( sPanLawType == "POLAR_CONST_POWER" ) {
pSampler->setPanLawType( pSampler->POLAR_CONST_POWER );
} else if ( sPanLawType == "POLAR_CONST_SUM" ) {
pSampler->setPanLawType( pSampler->POLAR_CONST_SUM );
} else if ( sPanLawType == "QUADRATIC_STRAIGHT_POLYGONAL" ) {
pSampler->setPanLawType( pSampler->QUADRATIC_STRAIGHT_POLYGONAL );
} else if ( sPanLawType == "QUADRATIC_CONST_POWER" ) {
pSampler->setPanLawType( pSampler->QUADRATIC_CONST_POWER );
} else if ( sPanLawType == "QUADRATIC_CONST_SUM" ) {
pSampler->setPanLawType( pSampler->QUADRATIC_CONST_SUM );
} else if ( sPanLawType == "LINEAR_CONST_K_NORM" ) {
pSampler->setPanLawType( pSampler->LINEAR_CONST_K_NORM );
} else if ( sPanLawType == "POLAR_CONST_K_NORM" ) {
pSampler->setPanLawType( pSampler->POLAR_CONST_K_NORM );
} else if ( sPanLawType == "RATIO_CONST_K_NORM" ) {
pSampler->setPanLawType( pSampler->RATIO_CONST_K_NORM );
} else if ( sPanLawType == "QUADRATIC_CONST_K_NORM" ) {
pSampler->setPanLawType( pSampler->QUADRATIC_CONST_K_NORM );
} else {
pSampler->setPanLawType( pSampler->RATIO_STRAIGHT_POLYGONAL );
WARNINGLOG( "Unknown pan law type in import song. Set default." );
}

float fPanLawKNorm = LocalFileMng::readXmlFloat( songNode, "pan_law_k_norm", K_NORM_DEFAULT );
if ( fPanLawKNorm <= 0.0 ) {
fPanLawKNorm = K_NORM_DEFAULT;
oddtime marked this conversation as resolved.
Show resolved Hide resolved
WARNINGLOG( "Invalid pan law k in import song (<= 0). Set default k." );
}
pSampler->setPanLawKNorm( fPanLawKNorm );

QDomNode componentListNode = songNode.firstChildElement( "componentList" );
if ( ( ! componentListNode.isNull() ) ) {
Expand Down
43 changes: 43 additions & 0 deletions src/core/LocalFileMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,49 @@ int SongWriter::writeSong( Song * pSong, const QString& filename )
LocalFileMng::writeXmlString( songNode, "mode", QString( "pattern" ) );
}

Sampler* pSampler = AudioEngine::get_instance()->get_sampler();

QString sPanLawType;
int nPanLawType = pSampler->getPanLawType();
if ( nPanLawType == pSampler->RATIO_STRAIGHT_POLYGONAL ) {
sPanLawType = "RATIO_STRAIGHT_POLYGONAL";
} else if ( nPanLawType == pSampler->RATIO_CONST_POWER ) {
sPanLawType = "RATIO_CONST_POWER";
} else if ( nPanLawType == pSampler->RATIO_CONST_SUM ) {
sPanLawType = "RATIO_CONST_SUM";
} else if ( nPanLawType == pSampler->LINEAR_STRAIGHT_POLYGONAL ) {
sPanLawType = "LINEAR_STRAIGHT_POLYGONAL";
} else if ( nPanLawType == pSampler->LINEAR_CONST_POWER ) {
sPanLawType = "LINEAR_CONST_POWER";
} else if ( nPanLawType == pSampler->LINEAR_CONST_SUM ) {
sPanLawType = "LINEAR_CONST_SUM";
} else if ( nPanLawType == pSampler->POLAR_STRAIGHT_POLYGONAL ) {
sPanLawType = "POLAR_STRAIGHT_POLYGONAL";
} else if ( nPanLawType == pSampler->POLAR_CONST_POWER ) {
sPanLawType = "POLAR_CONST_POWER";
} else if ( nPanLawType == pSampler->POLAR_CONST_SUM ) {
sPanLawType = "POLAR_CONST_SUM";
} else if ( nPanLawType == pSampler->QUADRATIC_STRAIGHT_POLYGONAL ) {
sPanLawType = "QUADRATIC_STRAIGHT_POLYGONAL";
} else if ( nPanLawType == pSampler->QUADRATIC_CONST_POWER ) {
sPanLawType = "QUADRATIC_CONST_POWER";
} else if ( nPanLawType == pSampler->QUADRATIC_CONST_SUM ) {
sPanLawType = "QUADRATIC_CONST_SUM";
} else if ( nPanLawType == pSampler->LINEAR_CONST_K_NORM ) {
sPanLawType = "LINEAR_CONST_K_NORM";
} else if ( nPanLawType == pSampler->POLAR_CONST_K_NORM ) {
sPanLawType = "POLAR_CONST_K_NORM";
} else if ( nPanLawType == pSampler->RATIO_CONST_K_NORM ) {
sPanLawType = "RATIO_CONST_K_NORM";
} else if ( nPanLawType == pSampler->QUADRATIC_CONST_K_NORM ) {
sPanLawType = "QUADRATIC_CONST_K_NORM";
} else {
WARNINGLOG( "Unknown pan law in saving song. Saved default type." );
sPanLawType = "RATIO_STRAIGHT_POLYGONAL";
}
LocalFileMng::writeXmlString( songNode, "pan_law", sPanLawType );
LocalFileMng::writeXmlString( songNode, "pan_law_k_norm", QString("%1").arg( pSampler->getPanLawKNorm() ) );
oddtime marked this conversation as resolved.
Show resolved Hide resolved

LocalFileMng::writeXmlString( songNode, "humanize_time", QString("%1").arg( pSong->getHumanizeTimeValue() ) );
LocalFileMng::writeXmlString( songNode, "humanize_velocity", QString("%1").arg( pSong->getHumanizeVelocityValue() ) );
LocalFileMng::writeXmlString( songNode, "swing_factor", QString("%1").arg( pSong->getSwingFactor() ) );
Expand Down
Loading