示例#1
0
void ofxGuido::loadString(const char * s){
	ARHandler arh = GuidoString2AR(mGuidoParser, s);
	int l, c;
	const char * errstr;
	GuidoErrCode err = GuidoParserGetErrorCode(mGuidoParser, l, c, &errstr);
	if(err != guidoNoErr){
		GuidoFreeAR(arh);
		ofLogError("ofxGuido") << "GuidoParser error: " << errstr;
	}
	else{
		GRHandler grh;
		err = GuidoAR2GR(arh, &mGuidoLayoutSettings, &grh);
		if(err == guidoNoErr){
			if(mGRHandler){
				GuidoFreeGR(mGRHandler);
			}
			mGRHandler = grh;
			mARHandler = arh;
			GuidoResizePageToMusic(mGRHandler);
			mGuidoOnDrawDesc.handle = mGRHandler;
		}
		else{
			errstr = GuidoGetErrorString(err);
			ofLogError("ofxGuido") << "GuidoAR2GR error: " << errstr;
			GuidoFreeAR(arh);
		}
	}
}
示例#2
0
//-------------------------------------------------------------------------
bool QGuidoPainter::setGMNData( const QString& dataSource , GuidoParseFunction parseFunction )
{
	// Read the gmnCode and build the score's Abstract Representation,
	// containing all the notes, rests, staffs, lyrics ...
	ARHandler arh;
	GRHandler grh;
	mLastErr = parseFunction( dataSource.toAscii().data(), &arh );		
	if ( mLastErr != guidoNoErr )
		return false;

	// Build a new score Graphic Representation according the score's Abstract Representation.
	GuidoPageFormat currentFormat;
	GuidoGetDefaultPageFormat ( &currentFormat );
	GuidoSetDefaultPageFormat( &mPageFormat );

	mLastErr = GuidoAR2GR (arh, &mLayoutSettings , &grh);

	GuidoSetDefaultPageFormat( &currentFormat );
	if (mLastErr == guidoNoErr)
	{
		GuidoFreeGR( mDesc.handle );
		mDesc.handle = grh;
		GuidoFreeAR( mARHandler );
		mARHandler = arh;
		if ( mResizePageToMusic )
			mLastErr = GuidoResizePageToMusic( mDesc.handle );
	}
	return (mLastErr == guidoNoErr);
}
示例#3
0
ofxGuido::~ofxGuido(){
	GuidoFreeGR(mGRHandler);
	GuidoFreeAR(mARHandler);
	GuidoCloseParser(mGuidoParser);
	if(mGuidoDevice){
		delete mGuidoDevice;
	}
}
示例#4
0
//-------------------------------------------------------------------------
void QGuidoPainter::setARHandler( ARHandler ar )
{
	if (!ar) return;
	if (mDesc.handle)	GuidoFreeGR( mDesc.handle );
	if (mARHandler)		GuidoFreeAR( mARHandler );

	// Build a new score Graphic Representation according the score's Abstract Representation.
	mARHandler = ar;
	mGMNCode = "";
	GuidoPageFormat currentFormat;
	GuidoGetDefaultPageFormat ( &currentFormat );
	GuidoSetDefaultPageFormat( &mPageFormat );
	GuidoAR2GR (mARHandler, &mLayoutSettings , &mDesc.handle);
	GuidoSetDefaultPageFormat( &currentFormat );
	if ( mResizePageToMusic )
		mLastErr = GuidoResizePageToMusic( mDesc.handle );
}
示例#5
0
//-------------------------------------------------------------------------
QGuidoPainter::~QGuidoPainter()
{
	GuidoFreeGR( mDesc.handle );
	GuidoFreeAR( mARHandler );
}