From: Mathias L. <lun...@us...> - 2004-11-09 22:20:53
|
Update of /cvsroot/lmuse/muse/synti/simpledrums In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22868 Modified Files: simpledrums.cpp Log Message: support for mono waves Index: simpledrums.cpp =================================================================== RCS file: /cvsroot/lmuse/muse/synti/simpledrums/simpledrums.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** simpledrums.cpp 9 Nov 2004 21:00:52 -0000 1.2 --- simpledrums.cpp 9 Nov 2004 22:20:43 -0000 1.3 *************** *** 434,452 **** data = channels[ch].sample->data; ! // ! // Stereo sample: ! // ! // Add from sample: ! out1 += (double) (data[channels[ch].playoffset] * channels[ch].volume * channels[ch].balanceFactorL); ! out2 += (double) (data[channels[ch].playoffset + 1] * channels[ch].volume * channels[ch].balanceFactorR); ! channels[ch].playoffset += 2; ! //If we've reached the last sample, set state to inactive if (channels[ch].playoffset >= channels[ch].sample->samples) { channels[ch].state = SS_CHANNEL_INACTIVE; channels[ch].playoffset = 0; } - } } // Add to mix: --- 434,464 ---- data = channels[ch].sample->data; ! if (channels[ch].sample->channels == 2) { ! // ! // Stereo sample: ! // ! // Add from sample: ! out1 += (double) (data[channels[ch].playoffset] * channels[ch].volume * channels[ch].balanceFactorL); ! out2 += (double) (data[channels[ch].playoffset + 1] * channels[ch].volume * channels[ch].balanceFactorR); ! channels[ch].playoffset += 2; ! } ! else { ! // ! // Mono sample: ! // ! out1 += (double) (data[channels[ch].playoffset] * channels[ch].volume * channels[ch].balanceFactorL); ! out2 += (double) (data[channels[ch].playoffset] * channels[ch].volume * channels[ch].balanceFactorR); ! channels[ch].playoffset++; ! } ! // ! // If we've reached the last sample, set state to inactive ! // if (channels[ch].playoffset >= channels[ch].sample->samples) { channels[ch].state = SS_CHANNEL_INACTIVE; channels[ch].playoffset = 0; + } } } // Add to mix: *************** *** 488,492 **** gui->setCaption(name); synth_state = SS_RUNNING; ! //loadSample(&channels[0], TESTSOUNDFILE); //loadSample(&channels[1], TESTSOUNDFILE2); SS_TRACE_OUT --- 500,504 ---- gui->setCaption(name); synth_state = SS_RUNNING; ! //loadSample(&channels[0], TESTSOUNDFILE3); //loadSample(&channels[1], TESTSOUNDFILE2); SS_TRACE_OUT |