You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

114 lines
3.3KB

  1. /* SpiralSound
  2. * Copyleft (C) 2000 David Griffiths <dave@pawfal.org>
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 2 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, write to the Free Software
  16. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  17. */
  18. #include <iostream>
  19. #include <fstream>
  20. #include <stdlib.h>
  21. #include "FL/fl_draw.h"
  22. #include "FL/fl_message.h"
  23. #include "SpiralInfo.h"
  24. float RandFloat(float s, float e)
  25. {
  26. return s+((rand()%10000/10000.0)*(e-s));
  27. }
  28. void SpiralInfo::LoadPrefs()
  29. {
  30. string rcfn(m_HomeDir+"/"+GetResFileName());
  31. ifstream i(rcfn.c_str());
  32. if (!i)
  33. {
  34. cerr<<"Creating "<<rcfn<<endl;
  35. SavePrefs();
  36. return;
  37. }
  38. StreamInPrefs(i);
  39. }
  40. void SpiralInfo::SavePrefs()
  41. {
  42. string rcfn(m_HomeDir+"/"+GetResFileName());
  43. ofstream o(rcfn.c_str());
  44. StreamOutPrefs(o);
  45. }
  46. void SpiralInfo::StreamInPrefs (istream &s)
  47. {
  48. char temp[256];
  49. s >> temp >> temp >> temp;
  50. s >> temp >> temp >> m_Version;
  51. s >> temp >> temp >> LOCALE;
  52. s >> temp >> temp >> BUFSIZE;
  53. s >> temp >> temp >> FRAGSIZE;
  54. s >> temp >> temp >> FRAGCOUNT;
  55. s >> temp >> temp >> SAMPLERATE;
  56. s >> temp >> temp >> WANTMIDI;
  57. s >> temp >> temp >> FILTERGRAN;
  58. s >> temp >> temp >> OUTPUTFILE;
  59. s >> temp >> temp >> MIDIFILE;
  60. s >> temp >> temp >> USEPLUGINLIST;
  61. s >> temp >> temp >> POLY;
  62. if (m_Version>0) {
  63. s >> temp >> temp >> GUI_COLOUR;
  64. s >> temp >> temp >> SCOPE_BG_COLOUR;
  65. s >> temp >> temp >> SCOPE_FG_COLOUR;
  66. s >> temp >> temp >> SCOPE_SEL_COLOUR;
  67. s >> temp >> temp >> SCOPE_IND_COLOUR;
  68. s >> temp >> temp >> SCOPE_MRK_COLOUR;
  69. }
  70. }
  71. void SpiralInfo::StreamOutPrefs(ostream &s)
  72. {
  73. s << "SpiralSound resource file" << endl << endl;
  74. s << "Version = " << m_Version << endl;
  75. s << "Locale = " << LOCALE << endl;
  76. s << "BufferSize = " << BUFSIZE << endl;
  77. s << "FragmentSize = " << FRAGSIZE << endl;
  78. s << "FragmentCount = " << FRAGCOUNT << endl;
  79. s << "Samplerate = " << SAMPLERATE << endl;
  80. s << "WantMidi = " << WANTMIDI << endl;
  81. s << "FilterGranularity = " << FILTERGRAN << endl;
  82. s << "Output = " << OUTPUTFILE << endl;
  83. s << "Midi = " << MIDIFILE << endl;
  84. s << "UsePluginList = " << USEPLUGINLIST << endl;
  85. s << "Polyphony = " << POLY << endl;
  86. s << "GUIColour = " << GUI_COLOUR << endl;
  87. s << "ScopeBGColour = " << SCOPE_BG_COLOUR << endl;
  88. s << "ScopeFGColour = " << SCOPE_FG_COLOUR << endl;
  89. s << "ScopeSelColour = " << SCOPE_SEL_COLOUR << endl;
  90. s << "ScopeIndColour = " << SCOPE_IND_COLOUR << endl;
  91. s << "ScopeMrkColour = " << SCOPE_MRK_COLOUR << endl;
  92. }
  93. void SpiralInfo::Alert(string Text)
  94. {
  95. //fl_message(Text.c_str());
  96. cerr<<"Spiral alert: "<<Text<<endl;
  97. }
  98. void SpiralInfo::Log(string Text)
  99. {
  100. }