public SoundfontSfz(SfzRegion sfzData) { byte lokey = sfzData.lokey; byte hikey = sfzData.hikey; bool loopMode = sfzData.loop_mode; int loopStart = sfzData.loop_start - 1; int loopEnd = sfzData.loop_end; int offset = sfzData.offset; int end = sfzData.end; int tune = sfzData.tune; int pitchKeyCenter = sfzData.pitch_keycenter; float volume = sfzData.volume; soundinfo = new Soundinfo(lokey, hikey, loopMode, loopStart, loopEnd, offset, end, tune, pitchKeyCenter, 0, 0, volume); ampeg = new Ampeg(sfzData.ampeg_delay, sfzData.ampeg_start / 100.0f, sfzData.ampeg_attack, sfzData.ampeg_hold, sfzData.ampeg_decay, sfzData.ampeg_sustain / 100.0f, sfzData.ampeg_release); waveform = new WaveformReaderPcm(PoolCollection.GetRiffWave(sfzData.sample), true); }
public SoundfontDls(RiffChunkListRgn2 rgn2List, List <WaveformReaderPcm> waveformList, int tuning) { RiffDls_Rgnh rgnhChunk = rgn2List.rgnhBody; RiffDls_Wsmp wsmpChunk = rgn2List.wsmpBody; RiffDls_Wlnk wlnkChunk = rgn2List.wlnkBody; byte lokey = ( byte )rgnhChunk.rangeKey.low; byte hikey = ( byte )rgnhChunk.rangeKey.high; bool loopMode = wsmpChunk.GetLoopType() != 0 ? true : false; int loopStart = ( int )wsmpChunk.GetLoopStart(); int loopEnd = ( int )(wsmpChunk.GetLoopStart() + wsmpChunk.GetLoopLength()); int tune = wsmpChunk.fineTune; int pitchKeyCenter = wsmpChunk.unityNote; float volume = 0.0f; soundinfo = new Soundinfo(lokey, hikey, loopMode, loopStart, loopEnd, 0, 0x7FFFFFFF, tune, pitchKeyCenter, 0, 0, volume); ampeg = new Ampeg(0.0d, 0.0d, 0.0d, 0.0d, 0.0d, 1.0d, 0.25d); waveform = waveformList[( int )wlnkChunk.tableIndex]; }
public SoundfontSfbk(RiffChunkListSdta[] sdtaBodyList, ShdrData shdrData, byte aLowKey, byte aHighKey, byte aKeyCenter, int aTune, bool aLoopMode, int startAddrsOffset, int endAddrsOffset, int startLoopAddrsOffset, int endLoopAddrsOffset, int modEnvToPitch, Instrument instrument, string aName) { byte lokey = aLowKey; byte hikey = aHighKey; bool loopMode = aLoopMode; int loopStart = ( int )((shdrData.startLoop + startLoopAddrsOffset) - (shdrData.start + startAddrsOffset)); int loopEnd = ( int )((shdrData.endLoop + endLoopAddrsOffset) - (shdrData.start + startAddrsOffset)); int pitchKeyCenter = shdrData.originalPitch; int tune = shdrData.pitchCorrection; int pitchEnvelope = instrument.modEnvToPitch; int pitchAdd = instrument.fineTune; float volume = 0.0f; if (instrument.rootKey != 0) { pitchKeyCenter = instrument.rootKey; } if (aTune != 0) { pitchAdd = aTune; } if (modEnvToPitch != 0) { pitchEnvelope = modEnvToPitch; } if (aKeyCenter != 0) { pitchKeyCenter = aKeyCenter; } soundinfo = new Soundinfo(lokey, hikey, loopMode, loopStart, loopEnd, 0, 0x7FFFFFFF, tune, pitchKeyCenter, 0, 0, volume); ampeg = new Ampeg(0.0d, 0.0d, 0.0d, 0.0d, 0.0d, 1.0d, 0.25d); waveform = new WaveformReaderPcm(sdtaBodyList, shdrData, startAddrsOffset, endAddrsOffset, aName); }