Skip to content

Commit

Permalink
Probability 2.0: Save and load fill value and fill probability from file
Browse files Browse the repository at this point in the history
  • Loading branch information
elpescado committed Oct 8, 2018
1 parent 3e93408 commit d3b8905
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/core/src/basics/song.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) );

Expand Down Expand Up @@ -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 );
Expand All @@ -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 );
Expand Down
2 changes: 2 additions & 0 deletions src/core/src/local_file_mgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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" );
Expand Down

0 comments on commit d3b8905

Please sign in to comment.