From d3b8905098a84f9414fa80315cc7c8ce29654d52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Przemys=C5=82aw=20Sitek?= Date: Sat, 26 Aug 2017 20:32:50 +0200 Subject: [PATCH] Probability 2.0: Save and load fill value and fill probability from file --- src/core/src/basics/song.cpp | 6 +++++- src/core/src/local_file_mgr.cpp | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/core/src/basics/song.cpp b/src/core/src/basics/song.cpp index 814a07ae1..586e7e95b 100644 --- a/src/core/src/basics/song.cpp +++ b/src/core/src/basics/song.cpp @@ -83,7 +83,7 @@ Song::Song( const QString& name, const QString& author, float bpm, float volume , __playback_track_volume( 0.0 ) , __velocity_automation_path( NULL ) , __fill_value(0.5) - , __fill_randomize(1) + , __fill_randomize(0) { INFOLOG( QString( "INIT '%1'" ).arg( __name ) ); @@ -639,6 +639,8 @@ Song* SongReader::readSong( const QString& filename ) float fHumanizeTimeValue = LocalFileMng::readXmlFloat( songNode, "humanize_time", 0.0 ); float fHumanizeVelocityValue = LocalFileMng::readXmlFloat( songNode, "humanize_velocity", 0.0 ); float fSwingFactor = LocalFileMng::readXmlFloat( songNode, "swing_factor", 0.0 ); + float fFillValue = LocalFileMng::readXmlFloat( songNode, "fillValue", 0.5 ); + float fFillRandomize = LocalFileMng::readXmlFloat( songNode, "fillRandomize", 1.0 ); song = new Song( sName, sAuthor, fBpm, fVolume ); song->set_metronome_volume( fMetronomeVolume ); @@ -649,6 +651,8 @@ Song* SongReader::readSong( const QString& filename ) song->set_humanize_time_value( fHumanizeTimeValue ); song->set_humanize_velocity_value( fHumanizeVelocityValue ); song->set_swing_factor( fSwingFactor ); + song->set_fill_value( fFillValue ); + song->set_fill_randomize( fFillRandomize ); song->set_playback_track_filename( sPlaybackTrack ); song->set_playback_track_enabled( bPlaybackTrackEnabled ); song->set_playback_track_volume( fPlaybackTrackVolume ); diff --git a/src/core/src/local_file_mgr.cpp b/src/core/src/local_file_mgr.cpp index 154ab1d70..a1a03041b 100644 --- a/src/core/src/local_file_mgr.cpp +++ b/src/core/src/local_file_mgr.cpp @@ -366,6 +366,8 @@ int SongWriter::writeSong( Song *song, const QString& filename ) LocalFileMng::writeXmlString( songNode, "humanize_time", QString("%1").arg( song->get_humanize_time_value() ) ); LocalFileMng::writeXmlString( songNode, "humanize_velocity", QString("%1").arg( song->get_humanize_velocity_value() ) ); LocalFileMng::writeXmlString( songNode, "swing_factor", QString("%1").arg( song->get_swing_factor() ) ); + LocalFileMng::writeXmlString( songNode, "fillValue", QString("%1").arg( song->get_fill_value() ) ); + LocalFileMng::writeXmlString( songNode, "fillRandomize", QString("%1").arg( song->get_fill_randomize() ) ); // component List QDomNode componentListNode = doc.createElement( "componentList" );