/[svn]/libgig/trunk/src/sf2dump.cpp
ViewVC logotype

Diff of /libgig/trunk/src/sf2dump.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2025 by iliev, Fri Oct 30 16:25:27 2009 UTC revision 2026 by iliev, Tue Nov 3 19:08:44 2009 UTC
# Line 34  Line 34 
34  #include <sstream>  #include <sstream>
35    
36  #include "SF.h"  #include "SF.h"
37    #include "helper.h"
38    
39  using namespace std;  using namespace std;
40    
# Line 52  string GetControllerType(sf2::Modulator& Line 53  string GetControllerType(sf2::Modulator&
53  string GetControllerSource(sf2::Modulator& mod);  string GetControllerSource(sf2::Modulator& mod);
54  string GetSampleType(uint16_t type);  string GetSampleType(uint16_t type);
55    
56    template<class T> inline string GetValue(T val) {
57        if (val == sf2::NONE) return "NONE";
58        return ToString(val);
59    }
60    
61  int main(int argc, char *argv[])  int main(int argc, char *argv[])
62  {  {
63      if (argc <= 1) {      if (argc <= 1) {
# Line 115  void PrintSamples(sf2::File* sf) { Line 121  void PrintSamples(sf2::File* sf) {
121      for (int i = 0; i < sf->GetSampleCount(); i++) {      for (int i = 0; i < sf->GetSampleCount(); i++) {
122          sf2::Sample* s = sf->GetSample(i);          sf2::Sample* s = sf->GetSample(i);
123          cout << "\t" << s->Name << " (Depth: " << ((s->GetFrameSize() / s->GetChannelCount()) * 8);          cout << "\t" << s->Name << " (Depth: " << ((s->GetFrameSize() / s->GetChannelCount()) * 8);
124          cout << " SampleRate: " << s->SampleRate;          cout << ", SampleRate: " << s->SampleRate;
125          cout << ", Pitch: " << ((int)s->OriginalPitch);          cout << ", Pitch: " << ((int)s->OriginalPitch);
126          cout << ", Pitch Correction: " << ((int)s->PitchCorrection )<< endl;          cout << ", Pitch Correction: " << ((int)s->PitchCorrection )<< endl;
127          cout << "\t\tStart: " << s->Start << ", End: " << s->End;          cout << "\t\tStart: " << s->Start << ", End: " << s->End;
# Line 171  void PrintRegion(int idx, sf2::Region* r Line 177  void PrintRegion(int idx, sf2::Region* r
177          cout << endl;          cout << endl;
178      }      }
179      cout << "\t\t    Key range=";      cout << "\t\t    Key range=";
180      if (reg->loKey == NONE && reg->hiKey == NONE) cout << "None";      if (reg->loKey == ::sf2::NONE && reg->hiKey == ::sf2::NONE) cout << "None";
181      else cout << reg->loKey << "-" << reg->hiKey;      else cout << reg->loKey << "-" << reg->hiKey;
182      cout << ", Velocity range=";      cout << ", Velocity range=";
183      if (reg->minVel == NONE && reg->maxVel == NONE) cout << "None" << endl;      if (reg->minVel == ::sf2::NONE && reg->maxVel == ::sf2::NONE) cout << "None";
184      else cout << reg->minVel << "-" << reg->maxVel << endl;      else cout << reg->minVel << "-" << reg->maxVel;
185    
186        if (reg->exclusiveClass) cout << ", Exclusive group=" << reg->exclusiveClass;
187        cout << endl;
188    
189      if (reg->pInstrument != NULL) {      if (reg->pInstrument != NULL) {
190          cout << "\t\t    Instrument: " << reg->pInstrument->Name << endl;          cout << "\t\t    Instrument: " << reg->pInstrument->Name << endl;
191      }      }
192    
193      cout << "\t\t\tEG1PreAttackDelay=" << reg->EG1PreAttackDelay << "s, EG1Attack=" << reg->EG1Attack;      cout << "\t\t\tEG1PreAttackDelay=" << GetValue(reg->GetEG1PreAttackDelay());
194      cout << "s, EG1Hold=" << reg->EG1Hold << "s, EG1Decay=" << reg->EG1Decay << "s,  EG1Sustain=";      cout << "s, EG1Attack=" << GetValue(reg->GetEG1Attack());
195      cout << reg->EG1Sustain << "permille, EG1Release=" << reg->EG1Release << "s" << endl;      cout << "s, EG1Hold=" << GetValue(reg->GetEG1Hold()) << "s, EG1Decay=";
196        cout << GetValue(reg->GetEG1Decay()) << "s,  EG1Sustain=" << GetValue(reg->GetEG1Sustain());
197      cout << "\t\t\tEG2PreAttackDelay=" << reg->EG2PreAttackDelay << "s, EG2Attack=" << reg->EG2Attack;      cout << "permille, EG1Release=" << GetValue(reg->GetEG1Release()) << "s" << endl;
198      cout << "s, EG2Hold=" << reg->EG2Hold << "s, EG2Decay=" << reg->EG2Decay << "s,  EG2Sustain=";  
199      cout << reg->EG2Sustain << "permille, EG2Release=" << reg->EG2Release << "s" << endl;      cout << "\t\t\tEG2PreAttackDelay=" << GetValue(reg->GetEG2PreAttackDelay());
200        cout << "s, EG2Attack=" << GetValue(reg->GetEG2Attack());
201        cout << "s, EG2Hold=" << GetValue(reg->GetEG2Hold()) << "s, EG2Decay=";
202        cout << GetValue(reg->GetEG2Decay()) << "s,  EG2Sustain=";
203        cout << GetValue(reg->GetEG2Sustain()) << "permille, EG2Release=";
204        cout << GetValue(reg->GetEG2Release()) << "s" << endl;
205    
206         cout << "\t\t    Modulation LFO: Delay=" << reg->delayModLfo << "s, Frequency=";
207         cout << reg->freqModLfo << "Hz, LFO to Volume=" << reg->modLfoToVolume;
208         cout << ", LFO to Filter Cutoff=" << reg->modLfoToFilterFc;
209         cout << ", LFO to Pitch=" << reg->modLfoToPitch << endl;
210    
211         cout << "\t\t    Vibrato LFO:    Delay=" << reg->delayVibLfo << "s, Frequency=";
212         cout << reg->freqVibLfo << "Hz, LFO to Pitch=" << reg->vibLfoToPitch << endl;
213    
214      cout << "\t\t\tModulators (" << reg->modulators.size() << ")" << endl;      cout << "\t\t\tModulators (" << reg->modulators.size() << ")" << endl;
215    
# Line 269  string GetControllerSource(sf2::Modulato Line 291  string GetControllerSource(sf2::Modulato
291  }  }
292    
293  string Revision() {  string Revision() {
294      string s = "$Revision: 1.2 $";      string s = "$Revision: 1.3 $";
295      return s.substr(11, s.size() - 13); // cut dollar signs, spaces and CVS macro keyword      return s.substr(11, s.size() - 13); // cut dollar signs, spaces and CVS macro keyword
296  }  }
297    

Legend:
Removed from v.2025  
changed lines
  Added in v.2026

  ViewVC Help
Powered by ViewVC