|
From: <pst...@us...> - 2008-04-11 17:26:45
|
Revision: 457
http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=457&view=rev
Author: pstieber
Date: 2008-04-11 10:26:33 -0700 (Fri, 11 Apr 2008)
Log Message:
-----------
1. Changed JZConfigurationEntry::GetStrValue to return a constant std::string reference
instead of a constant character pointer.
2. Changed JZConfiguration::GetStrValue to return a constant std::string reference
instead of a constant character pointer.
3. Changed some debug output when reading an included file.
4. Updated other code to deal with #2 above.
5. Fixed a comparison bug in NewSynth that resulted in the wrong synthesizer type
being used.
Modified Paths:
--------------
trunk/jazz/src/Configuration.cpp
trunk/jazz/src/Configuration.h
trunk/jazz/src/Dialogs/SynthesizerSettingsDialog.cpp
trunk/jazz/src/Project.cpp
trunk/jazz/src/Synth.cpp
trunk/jazz/src/Synth.h
Modified: trunk/jazz/src/Configuration.cpp
===================================================================
--- trunk/jazz/src/Configuration.cpp 2008-04-11 17:22:07 UTC (rev 456)
+++ trunk/jazz/src/Configuration.cpp 2008-04-11 17:26:33 UTC (rev 457)
@@ -785,17 +785,27 @@
case C_SynthConfig:
case C_Include:
{
- // include file
- wxString pathname = FindFile(GetStrValue(entry));
- cout << "include " << entry << endl;
- if (pathname)
+ if (entry == C_SynthConfig)
{
- FileDescriptors.push(fopen(pathname, "r"));
+ cout << "Include synthesizer configuration file \"";
}
else
{
+ cout << "Include file \"";
+ }
+ cout << GetStrValue(entry) << '"' << endl;
+
+ // Get the name of the include file.
+ wxString IncludeFileName = FindFile(GetStrValue(entry));
+
+ if (IncludeFileName.empty())
+ {
FileDescriptors.push(NULL);
}
+ else
+ {
+ FileDescriptors.push(fopen(IncludeFileName, "r"));
+ }
if (FileDescriptors.top() == NULL)
{
Modified: trunk/jazz/src/Configuration.h
===================================================================
--- trunk/jazz/src/Configuration.h 2008-04-11 17:22:07 UTC (rev 456)
+++ trunk/jazz/src/Configuration.h 2008-04-11 17:26:33 UTC (rev 457)
@@ -150,7 +150,7 @@
void SetValue(const int& Value);
- const char* GetStrValue() const;
+ const std::string& GetStrValue() const;
void SetStrValue(const char* pStringValue);
@@ -201,9 +201,9 @@
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
inline
-const char* JZConfigurationEntry::GetStrValue() const
+const std::string& JZConfigurationEntry::GetStrValue() const
{
- return mStrValue.c_str();
+ return mStrValue;
}
//*****************************************************************************
@@ -231,7 +231,7 @@
const char* GetName(int entry) const;
- const char* GetStrValue(int entry) const;
+ const std::string& GetStrValue(int entry) const;
const int& GetValue(const char* pName) const;
const int& GetValue(int Index) const;
@@ -291,7 +291,7 @@
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
inline
-const char* JZConfiguration::GetStrValue(int entry) const
+const std::string& JZConfiguration::GetStrValue(int entry) const
{
assert((entry >= 0) && (entry < NumConfigNames));
return mNames[entry]->GetStrValue();
Modified: trunk/jazz/src/Dialogs/SynthesizerSettingsDialog.cpp
===================================================================
--- trunk/jazz/src/Dialogs/SynthesizerSettingsDialog.cpp 2008-04-11 17:22:07 UTC (rev 456)
+++ trunk/jazz/src/Dialogs/SynthesizerSettingsDialog.cpp 2008-04-11 17:26:33 UTC (rev 457)
@@ -115,7 +115,7 @@
iPair != gSynthesizerTypes.end();
++iPair, ++Index)
{
- if (strcmp(iPair->first.c_str(), gpConfig->GetStrValue(C_SynthType)) == 0)
+ if (iPair->first == gpConfig->GetStrValue(C_SynthType))
{
mOldSynthTypeName = iPair->first;
Selection = Index;
Modified: trunk/jazz/src/Project.cpp
===================================================================
--- trunk/jazz/src/Project.cpp 2008-04-11 17:22:07 UTC (rev 456)
+++ trunk/jazz/src/Project.cpp 2008-04-11 17:26:33 UTC (rev 457)
@@ -143,13 +143,13 @@
mMetronomeInfo.ReadFromConfiguration();
- if (mpConfig->GetStrValue(C_SynthType))
+ if (mpConfig->GetStrValue(C_SynthType).empty())
{
- mpSynth = NewSynth(mpConfig->GetStrValue(C_SynthType));
+ mpSynth = NewSynth("GM");
}
else
{
- mpSynth = NewSynth("GM");
+ mpSynth = NewSynth(mpConfig->GetStrValue(C_SynthType));
}
gpSynth = mpSynth;
Modified: trunk/jazz/src/Synth.cpp
===================================================================
--- trunk/jazz/src/Synth.cpp 2008-04-11 17:22:07 UTC (rev 456)
+++ trunk/jazz/src/Synth.cpp 2008-04-11 17:26:33 UTC (rev 457)
@@ -53,12 +53,12 @@
#define XG_NAT 0x43,0x10,0x4c
#define XG_NAT_LEN 8 // no command ID or checksum for XG native!
-JZSynth* NewSynth(const char* pType)
+JZSynth* NewSynth(const string& Type)
{
int i;
for (i = 0; i < NumSynthTypes; i++)
{
- if (gSynthesizerTypes[i].first != string(pType))
+ if (gSynthesizerTypes[i].first == Type)
{
break;
}
Modified: trunk/jazz/src/Synth.h
===================================================================
--- trunk/jazz/src/Synth.h 2008-04-11 17:22:07 UTC (rev 456)
+++ trunk/jazz/src/Synth.h 2008-04-11 17:26:33 UTC (rev 457)
@@ -364,7 +364,7 @@
};
-JZSynth* NewSynth(const char* pType);
+JZSynth* NewSynth(const std::string& Type);
class tGM : public JZSynth
{
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|