diff options
Diffstat (limited to 'noatun-plugins/tyler')
-rw-r--r-- | noatun-plugins/tyler/file.cpp | 65 | ||||
-rw-r--r-- | noatun-plugins/tyler/tyler.cpp | 9 |
2 files changed, 48 insertions, 26 deletions
diff --git a/noatun-plugins/tyler/file.cpp b/noatun-plugins/tyler/file.cpp index 432a7be..79fb663 100644 --- a/noatun-plugins/tyler/file.cpp +++ b/noatun-plugins/tyler/file.cpp @@ -39,43 +39,62 @@ static TQString getSavePath(void) return dirs.saveLocation("data", "noatun/") + "tylerstates"; } -extern "C" void save_effect(t_effect *effect) +extern "C" { - TQFile file(getSavePath()); - if(!file.open(IO_WriteOnly)) - return; + KDE_EXPORT void save_effect(t_effect *effect) + { + TQFile file(getSavePath()); + if(!file.open(IO_WriteOnly)) + { + return; + } - for(unsigned i = 0; i < sizeof(t_effect); i++) - file.putch( *((byte *)effect + i) ); + for(unsigned i = 0; i < sizeof(t_effect); i++) + { + file.putch( *((byte *)effect + i) ); + } + } } t_effect effects[100]; int nb_effects=0; -extern "C" void load_effects() +extern "C" { - TQFile file(getDataPath()); - if(!file.open(IO_ReadOnly)) - exit(1); - - unsigned int i; - nb_effects = 0; - while(!file.atEnd()) + KDE_EXPORT void load_effects() { - byte* ptr_effect = (byte *)&effects[nb_effects++]; - for(i = 0; i < sizeof(t_effect); i++) - ptr_effect[i] = file.getch(); + TQFile file(getDataPath()); + if(!file.open(IO_ReadOnly)) + { + exit(1); + } + + unsigned int i; + nb_effects = 0; + while(!file.atEnd()) + { + byte* ptr_effect = (byte *)&effects[nb_effects++]; + for(i = 0; i < sizeof(t_effect); i++) + { + ptr_effect[i] = file.getch(); + } + } } } -extern "C" void load_random_effect(t_effect *effect) +extern "C" { - if(nb_effects > 0) + KDE_EXPORT void load_random_effect(t_effect *effect) { - int num_effect = rand() % nb_effects; - unsigned int i; + if(nb_effects > 0) + { + int num_effect = rand() % nb_effects; + unsigned int i; - for(i = 0; i < sizeof(t_effect) ; i++) - *((byte*)effect+i)=*((byte*)(&effects[num_effect])+i); + for(i = 0; i < sizeof(t_effect) ; i++) + { + *((byte*)effect+i) = *((byte*)(&effects[num_effect])+i); + } + } } } diff --git a/noatun-plugins/tyler/tyler.cpp b/noatun-plugins/tyler/tyler.cpp index 022f22a..d7690bb 100644 --- a/noatun-plugins/tyler/tyler.cpp +++ b/noatun-plugins/tyler/tyler.cpp @@ -12,10 +12,13 @@ #include <noatun/app.h> #include <kdebug.h> -extern "C" Plugin *create_plugin() +extern "C" { - TDEGlobal::locale()->insertCatalogue("tyler"); - return new Tyler(); + KDE_EXPORT Plugin* create_plugin() + { + TDEGlobal::locale()->insertCatalogue("tyler"); + return new Tyler(); + } } const int Tyler::bufferSize = 512; |