Exemplo n.º 1
0
int main(int argc, char **argv)
{
	VGDevice* dev = gSys.CreateMemoryDevice(kSize, kSize);
    GuidoInitDesc gd = { dev, 0, 0, 0 };
    GuidoInit (&gd);

	for (int i=1; i < argc; i++) {
		GuidoErrCode err;
		ARHandler arh;
		err = GuidoParseFile (argv[i], &arh);
		if (err == guidoNoErr) {
			int n = GuidoCountVoices (arh);
			cout << argv[i] << " : " << n << endl;
			GuidoFreeAR (arh);
		}
		else error (err);
	}
	delete dev;
	return 0;
}
Exemplo n.º 2
0
int main(int argc, char **argv)
{
	VGDevice* dev = gSys.CreateMemoryDevice(kSize, kSize);
    GuidoInitDesc gd = { dev, 0, 0, 0 };
    GuidoInit (&gd);

	for (int i=1; i < argc; i++) {
		cerr << "# get time map for " << argv[i] << endl;
		GuidoErrCode err;
		ARHandler arh;
        GuidoParser *parser = GuidoOpenParser();

        std::ifstream ifs(argv[i], ios::in);
        if (!ifs)
            return 0;

        std::stringstream streamBuffer;
        streamBuffer << ifs.rdbuf();
        ifs.close();

        arh = GuidoString2AR(parser, streamBuffer.str().c_str());

		if (arh)
        {
			TimeMapPrinter mp;
			err = GuidoGetTimeMap(arh, mp);
			if (err != guidoNoErr) error (err);
			GuidoFreeAR (arh);
		}
		else {
			int line, col;
			err = GuidoParserGetErrorCode (parser, line, col, 0);
			error (err);
		}
        GuidoCloseParser(parser);
	}
	delete dev;
	return 0;
}
Exemplo n.º 3
0
int main(int argc, char **argv)
{
	VGDevice* dev = gSys.CreateMemoryDevice(kSize, kSize);
    GuidoInitDesc gd = { dev, 0, 0, 0 };
    GuidoInit (&gd);

	for (int i = 1; i < argc; i++)
    {
		cerr << "# get staff mapping for " << argv[i] << endl;
		GuidoErrCode err;
		ARHandler arh;

        GuidoParser *parser = GuidoOpenParser();

        std::ifstream ifs(argv[i], ios::in);
        if (!ifs)
            return 0;

        std::stringstream streamBuffer;
        streamBuffer << ifs.rdbuf();
        ifs.close();

        arh = GuidoString2AR(parser, streamBuffer.str().c_str());

		if (arh)
        {
			GRHandler grh;
			err = GuidoAR2GR (arh, 0, &grh);

			if (err != guidoNoErr)
                error(err);
			else
            {
				int n = GuidoGetPageCount (grh);
				int voices = GuidoCountVoices (arh);

				for (int page = 1; page <= n; page++)
                {
					draw (grh, page, dev);
					cout << "# page " << page << "/" << n << endl;
					cout << "######################### " << endl;

					for (int v =1; v <= voices; v++)
                    {
						Time2GraphicMap map;
						err = GuidoGetStaffMap( grh, page, kSize, kSize, v, map);

						if (err != guidoNoErr)
                            error (err);
						else if (map.size())
                        {
							cout << "# voice " << v << "/" << voices << endl;
							cout << "######################### " << endl;
							for (Time2GraphicMap::const_iterator m = map.begin(); m != map.end(); m++)
                            {
                                                                //cout << m->first << " " << m->second << endl;
                                                                // ugh - bug
                                                                cout << "[" << m->first.first << ", " << m->first.second << "]";
                                                                cout << " " << m->second << endl; 
                            }
						}
					}
				}
				GuidoFreeGR (grh);
			}
			GuidoFreeAR (arh);
		}
		else {
			int line, col;
			err = GuidoParserGetErrorCode (parser, line, col, 0);
			error (err);
		}

        GuidoCloseParser(parser);
	}

	delete dev;

	return 0;
}