summaryrefslogtreecommitdiff
path: root/liveengine/src/playlist.cpp
blob: af449409391b8d2f23fe1e64bba0f5e469b29a53 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#include "playlist.h"

playlist::playlist()
{
}

void playlist::load(string _name){
    printf("loading %s\n",_name.c_str());


    if( !XML.loadFile(_name) ){
		printf("unable to load %s check data/ folder\n",_name.c_str());
    }else {
        printf("starting loader thread\n");
        loadimg(); //how to do this from the worker thread???
        startThread(false, false); //blocking, verbose
    }



}

void playlist::threadedFunction(){
        if( lock() ){
            loadsvg();
            unlock();
        }
}

void playlist::loadsvg(){
    int numLayers=0;
    layers.clear();
    if(XML.pushTag("playlist")) {
        numLayers=XML.getNumTags("svglayer");
        if(numLayers) {
            for (int i=0;i<numLayers;i++) {
            string s=XML.getAttribute("svglayer", "file", "",i);
            printf("loading %s: ",s.c_str());
            layers[XML.getAttribute("svglayer", "note", 0,i)]=new svglayer(XML.getAttribute("svglayer", "file", "",i));
         }
          }
      else printf("no SVG layers loaded!\n");
      XML.popTag();
     }

}

void playlist::loadimg(){
    int numLayers=0;
    layers.clear();
    if(XML.pushTag("playlist")) {
      numLayers=XML.getNumTags("imglayer");
          if(numLayers) {
                 for (int i=0;i<numLayers;i++) {
             string s=XML.getAttribute("imglayer", "file", "",i);
             printf("%s: ",s.c_str());
            layers[XML.getAttribute("imglayer", "note", 0,i)]=new imglayer(XML.getAttribute("imglayer", "file", "",i));
         }
          }
      else printf("no IMG layers loaded!\n");
      XML.popTag();
     }

}

playlist::~playlist()
{
    //dtor
}