Beispiel #1
0
/*! \brief Close the file, overrides IoInterface::close().
	\returns XRV_OK if the file was closed successfully
*/
XsResultValue IoInterfaceFile::close(void) { return closeFile(); }
Beispiel #2
0
cRecPlayer::~cRecPlayer()
{
  cleanup();
  closeFile();
  free(m_recordingFilename);
}
Beispiel #3
0
void EngineRecord::process(const CSAMPLE* pBuffer, const int iBufferSize) {

    float recordingStatus = m_pRecReady->get();

    if (recordingStatus == RECORD_OFF) {
        //qDebug("Setting record flag to: OFF");
        if (fileOpen()) {
            Event::end("EngineRecord recording");
            closeFile();  // Close file and free encoder.
            if (m_bCueIsEnabled) {
                closeCueFile();
            }
            emit(isRecording(false, false));
        }
    } else if (recordingStatus == RECORD_READY) {
        // If we are ready for recording, i.e, the output file has been selected, we
        // open a new file.
        updateFromPreferences();  // Update file location from preferences.
        if (openFile()) {
            Event::start("EngineRecord recording");
            qDebug("Setting record flag to: ON");
            m_pRecReady->set(RECORD_ON);
            emit(isRecording(true, false));  // will notify the RecordingManager

            // Since we just started recording, timeout and clear the metadata.
            m_iMetaDataLife = kMetaDataLifeTimeout;
            m_pCurrentTrack.reset();

            // clean frames couting and get current sample rate.
            m_frames = 0;
            m_sampleRate = m_pSamplerate->get();

            if (m_bCueIsEnabled) {
                openCueFile();
                m_cueTrack = 0;
            }
        } else {  // Maybe the encoder could not be initialized
            qDebug() << "Could not open" << m_fileName << "for writing.";
            qDebug("Setting record flag to: OFF");
            m_pRecReady->slotSet(RECORD_OFF);
            // An error occurred.
            emit(isRecording(false, true));
        }
    } else if (recordingStatus == RECORD_SPLIT_CONTINUE) {
        if (fileOpen()) {
            closeFile();  // Close file and free encoder.
            if (m_bCueIsEnabled) {
                closeCueFile();
            }
        }
        updateFromPreferences();  // Update file location from preferences.
        if (openFile()) {
            qDebug() << "Splitting to a new file: "<< m_fileName;
            m_pRecReady->set(RECORD_ON);
            emit(isRecording(true, false));  // will notify the RecordingManager

            // Since we just started recording, timeout and clear the metadata.
            m_iMetaDataLife = kMetaDataLifeTimeout;
            m_pCurrentTrack.reset();

            // clean frames counting and get current sample rate.
            m_frames = 0;
            m_sampleRate = m_pSamplerate->get();
            m_recordedDuration = 0;

            if (m_bCueIsEnabled) {
                openCueFile();
                m_cueTrack = 0;
            }
        } else {  // Maybe the encoder could not be initialized
            qDebug() << "Could not open" << m_fileName << "for writing.";
            Event::end("EngineRecord recording");
            qDebug("Setting record flag to: OFF");
            m_pRecReady->slotSet(RECORD_OFF);
            // An error occurred.
            emit(isRecording(false, true));
        }
    }

    // Checking again from m_pRecReady since its status might have changed
    // in the previous "if" blocks.
    if (m_pRecReady->get() == RECORD_ON) {
        // Compress audio. Encoder will call method 'write()' below to
        // write a file stream and emit bytesRecorded.
        m_pEncoder->encodeBuffer(pBuffer, iBufferSize);
        
        //Writing cueLine before updating the time counter since we preffer to be ahead
        //rather than late.
        if (m_bCueIsEnabled && metaDataHasChanged()) {
            m_cueTrack++;
            writeCueLine();
            m_cueFile.flush();
        }

        // update frames counting and recorded duration (seconds)
        m_frames += iBufferSize / 2;
        unsigned long lastDuration = m_recordedDuration;
        m_recordedDuration = m_frames / m_sampleRate;

        // gets recorded duration and emit signal that will be used
        // by RecordingManager to update the label besides start/stop button
        if (lastDuration != m_recordedDuration) {
            emit(durationRecorded(m_recordedDuration));
        }
    }
}
Beispiel #4
0
void CardReader::stopPrint() {
  sdprinting = false;
  closeFile();
}
Beispiel #5
0
//---------------------------------------------------//
clFile::~clFile()
{
	//- close file
	closeFile();
}
static void onewire_closefile_work_func(struct work_struct *work)
{
	if(fp)
		closeFile(fp);
}
Beispiel #7
0
GraphVizContext::~GraphVizContext()
{
  closeFile();
}
Beispiel #8
0
CLogFileWriter::~CLogFileWriter()
{
	closeFile();
}
Beispiel #9
0
/**
 * Constructor.
 * @param window The main application window.
 * @param toolbar The main toolbar
 * @param fileDescription The description of the document file type as it is
 *                        to appear in file dialogs
 * @param fileExtension The file extension of the document file type (do not
 *                      include the period)
 * @param newFileLaunchesDialog True if creating a new file launches a dialog
 *                              to set additional parameters, false otherwise
 */
QQMenuHelper::QQMenuHelper(QMainWindow *window, QToolBar *toolbar,
                           const QString &fileDescription,
                           const QString &fileExtension,
                           bool newFileLaunchesDialog)
 : QObject(window), mainWindow(window), mainToolBar(toolbar),
   description(fileDescription), extension(fileExtension), file(0), help(0)
{
    QChar ellipsis(8230);

    // Some phrases need to be handled differently on Mac OS X
    QString prefsText = menuText(tr("Pr&eferences"));
    QString macPrefsText = QMenuBar::tr("Preferences");
    QString quitText = menuText(tr("&Quit"));
    QString macQuitText = QMenuBar::tr("Quit %1");
    QString helpText = tr("Help Contents");
    QString macHelpText = tr("%1 Help").arg(qApp->applicationName());
    QString aboutText = menuText(tr("&About %1")).arg(qApp->applicationName());
    QString macAboutText = QMenuBar::tr("About %1");
    QString aboutQtText = menuText(tr("About &Qt"));
    QString macAboutQtText = QMenuBar::tr("About Qt");
#ifdef Q_WS_MAC
    prefsText = macPrefsText;
    quitText = macQuitText;
    helpText = macHelpText;
    aboutText = macAboutText;
    aboutQtText = macAboutQtText;
#endif

    // File menu actions
    QString fileNewText(tr("&New"));
    if (newFileLaunchesDialog) {
      fileNewText += ellipsis;
    }
    fileNewAction = new QAction(QIcon(":/icons/new.png"), menuText(fileNewText), window);
    fileNewAction->setStatusTip(tr("Create a new file"));
    fileNewAction->setToolTip(fileNewAction->statusTip());
    fileNewAction->setShortcut(QKeySequence::New);
    connect(fileNewAction, SIGNAL(triggered()), this, SLOT(emitNewFile()));

    fileOpenAction = new QAction(QIcon(":/icons/open.png"), menuText(tr("&Open")) + ellipsis, window);
    fileOpenAction->setStatusTip(tr("Open an existing file"));
    fileOpenAction->setToolTip(fileOpenAction->statusTip());
    fileOpenAction->setShortcut(QKeySequence::Open);
    connect(fileOpenAction, SIGNAL(triggered()), this, SLOT(emitOpenFile()));

    quitAction = new QAction(QIcon(":/icons/quit.png"), quitText, window);
    quitAction->setStatusTip(tr("Quit the application"));
#if !defined(Q_WS_HILDON)
    quitAction->setShortcut(QKeySequence::Quit);
#endif
    quitAction->setMenuRole(QAction::QuitRole);
    connect(quitAction, SIGNAL(triggered()), this, SIGNAL(quit()));

    fileSaveAction = new QAction(QIcon(":/icons/save.png"), menuText(tr("&Save")), window);
    fileSaveAction->setStatusTip(tr("Save the current file"));
    fileSaveAction->setToolTip(fileSaveAction->statusTip());
    fileSaveAction->setShortcut(QKeySequence::Save);
    connect(fileSaveAction, SIGNAL(triggered()), this, SIGNAL(saveFile()));

    for (int i = 0; i < MAX_RECENT_FILES; i++) {
        // we'll set the actual paths later; just need actions that stick
        // around after a file is opened
        recentActions[i] = new QAction("", window);
        connect(recentActions[i], SIGNAL(triggered()), this, SLOT(openRecent()));
    }

    fileSeparatorAction = new QAction(this);
    fileSeparatorAction->setSeparator(true);

    closeAction = new QAction(QIcon(":/icons/close.png"), menuText(tr("&Close")), window);
    closeAction->setStatusTip(tr("Close the current file"));
    closeAction->setShortcut(QKeySequence::Close);
    connect(closeAction, SIGNAL(triggered()), this, SIGNAL(closeFile()));

    prefsAction = new QAction(prefsText, window);
    prefsAction->setStatusTip(tr("Change the application settings"));
#if !defined(Q_WS_HILDON)
    prefsAction->setShortcut(QKeySequence::Preferences);
#endif
    prefsAction->setMenuRole(QAction::PreferencesRole);
    connect(prefsAction, SIGNAL(triggered()), this, SIGNAL(editPreferences()));

#if defined(Q_WS_MAC) || defined(Q_WS_HILDON) || defined(Q_WS_MAEMO_5)
    fileNewAction->setIconVisibleInMenu(false);
    fileOpenAction->setIconVisibleInMenu(false);
    quitAction->setIconVisibleInMenu(false);
    fileSaveAction->setIconVisibleInMenu(false);
    closeAction->setIconVisibleInMenu(false);
#endif
#if defined(Q_WS_MAC)
    docIcon = QIcon(":/icons/document_small.png");
    modifiedDocIcon = QIcon(darkenPixmap(QPixmap(":/icons/document_small.png")));
#endif

    // File menu basic setup
    file = new QMenu(menuText(tr("&File")), window);
    recent = new QMenu(menuText(tr("Open &Recent")), window);
    file->addAction(fileNewAction);
    file->addAction(fileOpenAction);
    file->addMenu(recent);
    file->addAction(fileSaveAction);
    file->addAction(fileSeparatorAction);
    file->addAction(closeAction);
    file->addAction(prefsAction);
    insertionPoint = fileSeparatorAction;
#if !defined(Q_WS_MAC)
    file->addSeparator();
#endif
    file->addAction(quitAction);
#if !defined(Q_WS_HILDON) && !defined(Q_WS_MAEMO_5)
    window->menuBar()->addMenu(file);
#endif

    // Help menu actions
    helpAction = new QAction(helpText, window);
    helpAction->setStatusTip(helpText);
    helpAction->setShortcut(QKeySequence::HelpContents);
    connect(helpAction, SIGNAL(triggered()), this, SLOT(showHelp()));

    aboutAction = new QAction(aboutText, window);
    aboutAction->setStatusTip(aboutText);
    aboutAction->setMenuRole(QAction::AboutRole);
    connect(aboutAction, SIGNAL(triggered()), this, SIGNAL(aboutApplication()));

    aboutQtAction = new QAction(aboutQtText, window);
    aboutQtAction->setStatusTip(aboutQtText);
    aboutQtAction->setMenuRole(QAction::AboutQtRole);
    connect(aboutQtAction, SIGNAL(triggered()), this, SLOT(aboutQt()));

    // Help menu setup
    help = new QMenu(menuText(tr("&Help")), window);
#if !defined(Q_WS_HILDON) && !defined(Q_WS_MAEMO_5)
    help->addAction(helpAction);
#if !defined(Q_WS_MAC)
    // skip this on the mac, since both "About.." actions get moved elsewhere
    help->addSeparator();
#endif
    help->addAction(aboutAction);
    help->addAction(aboutQtAction);
    window->menuBar()->addMenu(help);
#endif

    // toolbar setup
    addToToolBar(fileNewAction);
    addToToolBar(fileOpenAction);
    addToToolBar(fileSaveAction);

    // build the actions hash
    actions[New] = fileNewAction;
    actions[Open] = fileOpenAction;
    actions[Save] = fileSaveAction;
    actions[Recent1] = recentActions[0];
    actions[Recent2] = recentActions[1];
    actions[Recent3] = recentActions[2];
    actions[Recent4] = recentActions[3];
    actions[Recent5] = recentActions[4];
    actions[Separator] = fileSeparatorAction;
    actions[Close] = closeAction;
    actions[Preferences] = prefsAction;
    actions[Quit] = quitAction;
    actions[Help] = helpAction;
    actions[About] = aboutAction;
    actions[AboutQt] = aboutQtAction;
}
Beispiel #10
0
FileWriter::~FileWriter()
{
	closeFile();
}
int main(){
	srand(time(0));

	int facultyCount = rand() % 2000 + 1000;	//average 2500 faculty
	int studentCount = facultyCount * 5 + rand() % 1000 - rand() % 1000;	//average 12.5k students
	int organizationCount = studentCount / 25 + rand() % 200 - rand() % 200;//average 500 organizations
	int courseCount = facultyCount / 5;			//average 500 courses offered

	cout<<facultyCount<<"  Faculty\n"<<studentCount<<"  Students \n"<<organizationCount<<"  Groups\n"<<courseCount<<"  Courses\n";

	//create our base objects for the university
	cout<<"Hiring Faculty..."<<endl;
	for(int i = 0; i < facultyCount; i++){
		faculty.push_back(Faculty());
	}
	cout<<"Accepting Student Applications..."<<endl;
	for(int i = 0; i < studentCount; i++){
		students.push_back(Student());
	}
	cout<<"Founding Organizations..."<<endl;
	for(int i = 0; i < organizationCount; i++){
		organizations.push_back(Organization());
	}
	cout<<"Designing Curriculum..."<<endl;
	unordered_set<string> uniqueCourses;	//the set stores only unique values and determines duplicates in O(1) time.  This is how we keep from regenerating the same class twice
	for(int i = 0; i < courseCount; i++){

		Class newClass;
		string key;
		do{
			newClass = Class();	//regenerate a class if it already exists
			key = newClass.subject + itos(newClass.number);
		}while(uniqueCourses.find(key) != uniqueCourses.end());	//loop until we fail to find a course with this key value.  then we'll know it's unique

		uniqueCourses.insert(uniqueCourses.begin(), key);
		courses.push_back(newClass);
	}

	//create relations between these base objects (a.k.a the hard part).
	cout<<"Opening Registration & Open House..."<<endl;
	for(int i = 0; i < studentCount; i++){
		for(int j = 0; j < (rand() % 20)+1; j++){//average 10 enrollments over the course of 4 semesters
			enrollment.push_back(EnrolledIn(students[i]));
		}

		for(int j = 0; j < rand() % 4; j++){	//up to 3 memberships per student
			membership.push_back(MemberOf(students[i]));
		}
	}
	cout<<"Assigning Professors..."<<endl;
	for(int i = 0; i < facultyCount; i++){
		for(int j = 0; j < rand() % 4; j++){	//faculty can teach up to 3 courses
			instruction.push_back(Teaches(faculty[i]));
		}		
	}
	cout<<"Volunteering Faculty to Organizations..."<<endl;
	for(int i = 0; i < organizationCount; i++){
		if(rand() % 5 == 0) leadership.push_back(Leads());	//a quarter of organizations have faculty leadership
	}

	cout<<"Checking constraints..."<<endl;

	for(int i = 0; i < courseCount; i++){
		if(courses[i].size == 0){
			cout<<"Empty course fixed\n";
			enrollment.push_back(EnrolledIn(&courses[i]));
		}
		if(!courses[i].hasProf){
			cout<<"Untaught course fixed\n";
			instruction.push_back(Teaches(&courses[i]));
		}
	}
	for(int i = 0; i < organizationCount; i++){
		if(organizations[i].size == 0){
			cout<<"Empty organization fixed\n";
			membership.push_back(MemberOf(&organizations[i]));
		}
	}

	cout<<"Writing data to file...\n"<<endl;	//self explanatory vvvvvv
	openFile();

	for(int i = 0; i < facultyCount; i++){
		writeFaculty(faculty[i].ID, faculty[i].name, faculty[i].salary);
	}
	for(int i = 0; i < studentCount; i++){
		writeStudent(students[i].UIN, students[i].name, students[i].major, students[i].advisorID);
	}
	for(int i = 0; i < organizationCount; i++){
		writeStudentOrganization(organizations[i].ID, organizations[i].name, organizations[i].category);
	}
	for(int i = 0; i < courseCount; i++){
		writeCourse(courses[i].subject, courses[i].number, courses[i].hours, courses[i].title);
	}
	for(int i = 0; i < enrollment.size(); i++){
		writeEnrolledIn(itosem(enrollment[i].semester), enrollment[i].subject, enrollment[i].number, enrollment[i].UIN, itograde(enrollment[i].grade));
	}
	for(int i = 0; i < instruction.size(); i++){
		writeTeaches(instruction[i].subject, instruction[i].number, instruction[i].facultyID, itosem(instruction[i].semester));
	}
	for(int i = 0; i < leadership.size(); i++){
		writeLeads(leadership[i].facultyID ,leadership[i].studentOrgID, itos(leadership[i].joinedMo)+"/"+itos(leadership[i].joinedYr));
	}
	for(int i = 0; i < membership.size(); i++){
		writeMemberOf(membership[i].UIN, membership[i].studentOrgID, itos(membership[i].joinedMo)+"/"+itos(membership[i].joinedYr));
	}
	
	closeFile();
	cout<<"All data generated"<<endl;
}
Beispiel #12
0
//
// Desturctor
//
SystemFile::~SystemFile()
{
	closeFile();
}
Beispiel #13
0
/**
  @return true if all the files were closed. false if cancelled
*/
bool GData::closeAllFiles() {
  while(!soundFiles.empty()) {
    if(closeFile(soundFiles.at(0), gdata->savingMode()) == 1) return false; //cancelled
  }
  return true;
}
Beispiel #14
0
retCode connectRemote(char *where, int port,
                      ioEncoding encoding, logical waitForMe,
                      ioPo *inC, ioPo *outC) {
  int sock;
  struct sockaddr_in serv_addr;
  char *host = getHostname(where);
  struct in_addr *addr = host != NULL ? getHostIP(host, 0) : NULL;

  if (addr != NULL) {
    /* Attempt to establish links to the server */
    memset((char *) &serv_addr, 0, sizeof(serv_addr));
    serv_addr.sin_family = AF_INET;
    serv_addr.sin_addr = *addr;
    serv_addr.sin_port = htons((u_short) port);

    /* Create the socket ... */
    if ((sock = socket(AF_INET, SOCK_STREAM, 0)) == INVALID_SOCKET) {
      return Error;
    } else {
      ioPo conn = O_IO(newObject(sockClass, host, sock, encoding, ioREAD | ioWRITE));

      configureIo(O_FILE(conn), (waitForMe ? turnOnBlocking : turnOffBlocking));

      while (connect(sock, (struct sockaddr *) &serv_addr, sizeof(serv_addr)) != 0) {
        switch (errno) {    //  Unix version
          case EACCES:
          case EADDRNOTAVAIL:
            outMsg(logFile, "Address %U not available", host);
            markHostUnavail(host);
            closeFile(O_IO(conn));
            return Error;
          case ECONNREFUSED:
            outMsg(logFile, "Connection to %U refused", host);
            markHostUnavail(host);
            closeFile(O_IO(conn));
            return Error;
          case ETIMEDOUT:
            outMsg(logFile, "Connection to %U timed out", host);
            markHostUnavail(host);
            closeFile(O_IO(conn));
            return Error;
          case ENETUNREACH:
            outMsg(logFile, "Network down or %U unreachable", host);
            markHostUnavail(host);
            closeFile(O_IO(conn));
            return Error;
          case EALREADY:
          case EINTR:
          case EWOULDBLOCK:
          case EINPROGRESS:
            closeFile(O_IO(conn));
            return Fail;
          default:
            outMsg(logFile, "Connection to %U refused", host);
            markHostUnavail(host);
            closeFile(O_IO(conn));
            return Error;
        }
      }

      *inC = conn;
      *outC = conn;
      return Ok;
    }
  } else {
    outMsg(logFile, "cant resolve host %U", where);
    return Error;
  }
}
Beispiel #15
0
void FormattedFile::openFile(string filename)
{
	closeFile();
	mStream.open(filename);
}
Beispiel #16
0
FileV2::~FileV2()
{
	if (m_poFp != NULL) 
		closeFile();
}
Beispiel #17
0
bool MidiImport::readSMF( TrackContainer* tc )
{
	QString filename = file().fileName();
	closeFile();

	const int preTrackSteps = 2;
	QProgressDialog pd( TrackContainer::tr( "Importing MIDI-file..." ),
	TrackContainer::tr( "Cancel" ), 0, preTrackSteps, gui->mainWindow() );
	pd.setWindowTitle( TrackContainer::tr( "Please wait..." ) );
	pd.setWindowModality(Qt::WindowModal);
	pd.setMinimumDuration( 0 );

	pd.setValue( 0 );

	Alg_seq_ptr seq = new Alg_seq(filename.toLocal8Bit(), true);
	seq->convert_to_beats();

	pd.setMaximum( seq->tracks()  + preTrackSteps );
	pd.setValue( 1 );
	
	// 128 CC + Pitch Bend
	smfMidiCC ccs[129];
	smfMidiChannel chs[256];

	MeterModel & timeSigMM = Engine::getSong()->getTimeSigModel();
	AutomationPattern * timeSigNumeratorPat = 
		AutomationPattern::globalAutomationPattern( &timeSigMM.numeratorModel() );
	AutomationPattern * timeSigDenominatorPat = 
		AutomationPattern::globalAutomationPattern( &timeSigMM.denominatorModel() );
	
	// TODO: adjust these to Time.Sig changes
	double beatsPerTact = 4; 
	double ticksPerBeat = DefaultTicksPerTact / beatsPerTact;

	// Time-sig changes
	Alg_time_sigs * timeSigs = &seq->time_sig;
	for( int s = 0; s < timeSigs->length(); ++s )
	{
		Alg_time_sig timeSig = (*timeSigs)[s];
		// Initial timeSig, set song-default value
		if(/* timeSig.beat == 0*/ true )
		{
			// TODO set song-global default value
			printf("Another timesig at %f\n", timeSig.beat);
			timeSigNumeratorPat->putValue( timeSig.beat*ticksPerBeat, timeSig.num );
			timeSigDenominatorPat->putValue( timeSig.beat*ticksPerBeat, timeSig.den );
		}
		else
		{
		}

	}

	pd.setValue( 2 );

	// Tempo stuff
	AutomationPattern * tap = tc->tempoAutomationPattern();
	if( tap )
	{
		tap->clear();
		Alg_time_map * timeMap = seq->get_time_map();
		Alg_beats & beats = timeMap->beats;
		for( int i = 0; i < beats.len - 1; i++ )
		{
			Alg_beat_ptr b = &(beats[i]);
			double tempo = ( beats[i + 1].beat - b->beat ) /
						   ( beats[i + 1].time - beats[i].time );
			tap->putValue( b->beat * ticksPerBeat, tempo * 60.0 );
		}
		if( timeMap->last_tempo_flag )
		{
			Alg_beat_ptr b = &( beats[beats.len - 1] );
			tap->putValue( b->beat * ticksPerBeat, timeMap->last_tempo * 60.0 );
		}
	}

	// Song events
	for( int e = 0; e < seq->length(); ++e )
	{
		Alg_event_ptr evt = (*seq)[e];

		if( evt->is_update() )
		{
			printf("Unhandled SONG update: %d %f %s\n", 
					evt->get_type_code(), evt->time, evt->get_attribute() );
		}
	}

	// Tracks
	for( int t = 0; t < seq->tracks(); ++t )
	{
		QString trackName = QString( tr( "Track" ) + " %1" ).arg( t );
		Alg_track_ptr trk = seq->track( t );
		pd.setValue( t + preTrackSteps );

		for( int c = 0; c < 129; c++ )
		{
			ccs[c].clear();
		}

		// Now look at events
		for( int e = 0; e < trk->length(); ++e )
		{
			Alg_event_ptr evt = (*trk)[e];

			if( evt->chan == -1 )
			{
				bool handled = false;
                if( evt->is_update() )
				{
					QString attr = evt->get_attribute();
                    if( attr == "tracknames" && evt->get_update_type() == 's' ) {
						trackName = evt->get_string_value();
						handled = true;
					}
				}
                if( !handled ) {
                    // Write debug output
                    printf("MISSING GLOBAL HANDLER\n");
                    printf("     Chn: %d, Type Code: %d, Time: %f", (int) evt->chan,
                           evt->get_type_code(), evt->time );
                    if ( evt->is_update() )
                    {
                        printf( ", Update Type: %s", evt->get_attribute() );
                        if ( evt->get_update_type() == 'a' )
                        {
                            printf( ", Atom: %s", evt->get_atom_value() );
                        }
                    }
                    printf( "\n" );
				}
			}
			else if( evt->is_note() && evt->chan < 256 )
			{
				smfMidiChannel * ch = chs[evt->chan].create( tc, trackName );
				Alg_note_ptr noteEvt = dynamic_cast<Alg_note_ptr>( evt );
				int ticks = noteEvt->get_duration() * ticksPerBeat;
				Note n( (ticks < 1 ? 1 : ticks ),
						noteEvt->get_start_time() * ticksPerBeat,
						noteEvt->get_identifier() - 12,
						noteEvt->get_loud());
				ch->addNote( n );
				
			}
			
			else if( evt->is_update() )
			{
				smfMidiChannel * ch = chs[evt->chan].create( tc, trackName );

				double time = evt->time*ticksPerBeat;
				QString update( evt->get_attribute() );

				if( update == "programi" )
				{
					long prog = evt->get_integer_value();
					if( ch->isSF2 )
					{
						ch->it_inst->childModel( "bank" )->setValue( 0 );
						ch->it_inst->childModel( "patch" )->setValue( prog );
					}
					else {
						const QString num = QString::number( prog );
						const QString filter = QString().fill( '0', 3 - num.length() ) + num + "*.pat";
						const QString dir = "/usr/share/midi/"
								"freepats/Tone_000/";
						const QStringList files = QDir( dir ).
						entryList( QStringList( filter ) );
						if( ch->it_inst && !files.empty() )
						{
							ch->it_inst->loadFile( dir+files.front() );
						}
					}
				}

				else if( update.startsWith( "control" ) || update == "bendr" )
				{
					int ccid = update.mid( 7, update.length()-8 ).toInt();
					if( update == "bendr" )
					{
						ccid = 128;
					}
					if( ccid <= 128 )
					{
						double cc = evt->get_real_value();
						AutomatableModel * objModel = NULL;

						switch( ccid ) 
						{
							case 0:
								if( ch->isSF2 && ch->it_inst )
								{
									objModel = ch->it_inst->childModel( "bank" );
									printf("BANK SELECT %f %d\n", cc, (int)(cc*127.0));
									cc *= 127.0f;
								}
								break;

							case 7:
								objModel = ch->it->volumeModel();
								cc *= 100.0f;
								break;

							case 10:
								objModel = ch->it->panningModel();
								cc = cc * 200.f - 100.0f;
								break;

							case 128:
								objModel = ch->it->pitchModel();
								cc = cc * 100.0f;
								break;
							default:
								//TODO: something useful for other CCs
								break;
						}

						if( objModel )
						{
							if( time == 0 && objModel )
							{
								objModel->setInitValue( cc );
							}
							else
							{
								if( ccs[ccid].at == NULL ) {
									ccs[ccid].create( tc, trackName + " > " + (
										  objModel != NULL ? 
										  objModel->displayName() : 
										  QString("CC %1").arg(ccid) ) );
								}
								ccs[ccid].putValue( time, objModel, cc );
							}
						}
					}
				}
				else {
					printf("Unhandled update: %d %d %f %s\n", (int) evt->chan, 
							evt->get_type_code(), evt->time, evt->get_attribute() );
				}
			}
		}
	}

	delete seq;
	
	
	for( int c=0; c < 256; ++c )
	{
		if( !chs[c].hasNotes && chs[c].it )
		{
			printf(" Should remove empty track\n");
			// must delete trackView first - but where is it?
			//tc->removeTrack( chs[c].it );
			//it->deleteLater();
		}
	}

	// Set channel 10 to drums as per General MIDI's orders
	if( chs[9].hasNotes && chs[9].it_inst && chs[9].isSF2 )
	{
		// AFAIK, 128 should be the standard bank for drums in SF2.
		// If not, this has to be made configurable.
		chs[9].it_inst->childModel( "bank" )->setValue( 128 );
		chs[9].it_inst->childModel( "patch" )->setValue( 0 );
	}

	return true;
}
Beispiel #18
0
Logger::~Logger()
{
    closeFile();
    SDL_DestroyMutex(mMutex);
}
Beispiel #19
0
FileIO::~FileIO()
{
   closeFile(true);
};
Beispiel #20
0
int main(int argc, char* argv[])
{
    int     i;
    FILE*   pFile;
    size_t  iLineSize;
    bool    bInitSuccess;
    int     iCurrLine;
    struct sigaction  sSigAct;

    memset(&sSigAct,0,sizeof(struct sigaction));
    sSigAct.sa_handler = inrptHandler;
    if ( 0 != sigaction(SIGINT, &sSigAct,NULL))
    {
        DEBUG_PRINT("Signal Handler Registration Failed\n");
        return 0;
    }

    bInitSuccess = false;
    iCurrLine = 0,i = 0,pFile = NULL;
    iLineSize = MAX_CONFIG_LINE;
    memset(m_apArgs,0,sizeof(void*)*MAX_NUMBER_STREAMS);
    memset(m_apStreamContext,0,sizeof(void*)*MAX_NUMBER_STREAMS);

    pFile = openFile(CONFIG_FILE_NAME,"r");
    if (pFile)
    {
        char* pcLine = malloc(iLineSize);

        bInitSuccess = true;
        while((iCurrLine<MAX_NUMBER_STREAMS) && (getline((char**)&pcLine,&iLineSize,pFile) != -1))
        {
            m_apArgs[iCurrLine] = (ThreadArgs*)malloc(sizeof(ThreadArgs));
            memset(m_apArgs[iCurrLine],0,sizeof(ThreadArgs));

            m_apStreamContext[iCurrLine] = (StreamContext*)malloc(sizeof(StreamContext));
            memset(m_apStreamContext[iCurrLine],0,sizeof(StreamContext));

            parseConfigLine(pcLine,m_apArgs[iCurrLine]);
            /*assign cmd args to thread context*/
            m_apStreamContext[iCurrLine]->psArgs = m_apArgs[iCurrLine];
            printArg(m_apArgs[iCurrLine]);
            /*get MPEG2TS data from file*/
            if (!getStreamInfo(m_apArgs[iCurrLine]->acFileName,&(m_apStreamContext[iCurrLine]->iBitrate),
                              &(m_apStreamContext[iCurrLine]->dDuration),
                              &(m_apStreamContext[iCurrLine]->dAvgPeriod)))
            {
                DEBUG_PRINT("Failed to retriev MPEG2TS data for %s\n",m_apArgs[iCurrLine]->acFileName);
                bInitSuccess = false;
                break;
            }

            /*create queue names*/
            memset(m_apStreamContext[iCurrLine]->acStreamQueueName,0,MAX_QUEUE_NAME);
            sprintf(m_apStreamContext[iCurrLine]->acStreamQueueName,"/StreamingQueue%d",iCurrLine);

            memset(m_apStreamContext[iCurrLine]->acEmptyQueueName,0,MAX_QUEUE_NAME);
            sprintf(m_apStreamContext[iCurrLine]->acEmptyQueueName,"/EmptyQueue%d",iCurrLine);

            if (createQueue(m_apStreamContext[iCurrLine]->acStreamQueueName,sizeof(AppMsg),MAX_DATA_MSG + 1,&(m_apStreamContext[iCurrLine]->iStreamQid)) < 0)
            {
                DEBUG_PRINT("Failed to create %s queue\n",m_apStreamContext[iCurrLine]->acStreamQueueName);
                bInitSuccess = false;
                break;
            }
            if (createQueue(m_apStreamContext[iCurrLine]->acEmptyQueueName,sizeof(AppMsg),MAX_DATA_MSG + 1,&(m_apStreamContext[iCurrLine]->iEmptyQid)) < 0)
            {
                DEBUG_PRINT("Failed to create %s queue\n",m_apStreamContext[iCurrLine]->acEmptyQueueName);
                bInitSuccess = false;
                break;
            }

            iCurrLine+=1;
            memset(pcLine,0,iLineSize);
        }
        free(pcLine);
    }
    closeFile(pFile);

    if (!m_apArgs[0])
    {
        DEBUG_PRINT("No configuration found\n");
        return 0;
    }

    if (!bInitSuccess)
    {
        DEBUG_PRINT("The Application will exit\n");
        cleanUp();
        return 0;
    }

    while (m_apStreamContext[i]!=NULL)
    {
        populateFileReaderEmptyQueue(m_apStreamContext[i]->iEmptyQid);
        startFileReader(m_apStreamContext[i]);
        startStreamer(m_apStreamContext[i]);
        i+=1;
    }

    i=0;
    /*join threads here until the end*/
    while (m_apStreamContext[i]!=NULL)
    {
        joinPosixThread(m_apStreamContext[i]->lStreamerId,NULL);
        joinPosixThread(m_apStreamContext[i]->lReaderId,NULL);
        i+=1;
    }

    cleanUp();
    return 0;
}
Beispiel #21
0
/**
* Destructor
*/
Traza::~Traza(){
    closeFile();
}
Beispiel #22
0
// new xmas network
bool model::Network::newFile() {
    return closeFile();
}
Beispiel #23
0
int main (int argc, char *argv[]) {
  FILE *fileImgPtr;
  Directory currentDir;
  OpenFileTable ofTable;
  unsigned int currentDirCluster;
  int flag = -1;
  int runLoop = 1;

  // Check for correct number of arguments.
  if (argc != 2) {
    printf("Error: Incorrect number of arguments.\n");
    printf("Expected: osmagicFAT <file image>\n");
    return 1;
  }

  // Open the file image.
  fileImgPtr = fopen(argv[1], "rb+");
    if (fileImgPtr == NULL) {
      printf("Error: could not open file image\n.");
      return 1;
    }

  // Read and store the boot sector data.
  readBootSector(fileImgPtr);

  // Set current directory to the root directory.
  currentDirCluster = fsMetadata[ROOT_CLUSTER];

  // Initialize open file table.
  ofTable.entries = (OpenFileEntry*) malloc(sizeof(OpenFileEntry));
  ofTable.size = 0;

  printf("Please input a command. Type 'quit' to quit program.\n");
  //Loop to perform commands until user exits.
  while(runLoop) {
    // Allocate memory to hold commands.
    char input[256];
    // Save the number of tokens(arguments) in each input.
    int tokCount = 0;
    char **cmds = (char**) malloc(6*sizeof(char*));
    for (int itr = 0; itr < 6; itr++)
      cmds[itr]=(char*) malloc(1*sizeof(char));
    // Initialize current directory data
    currentDir.dirEntries = (unsigned char **) malloc(sizeof(unsigned char *));
    currentDir.size = 0;

    // Read and store the current directory.
    getDirEntries(fileImgPtr, currentDirCluster, &currentDir);

    // Print prompt and get user input.
    printf("=>");
    if (fgets(input, 256, stdin) == NULL){
      printf("Error! Invalid input!\n");
      exit(-1);
    }
    tokCount = tokenize(input,cmds);

    // Compare first argument to perform command.
    if (strcmp(cmds[0], "quit") == 0){
      runLoop = 0;
    }

    else if (strcmp(cmds[0], "open") == 0) {
      if (tokCount != 3) {
        printf("Error: Invalid arguments.\n");
        printf("Expected: open <filename> <flag>\n");
      }
      else {
        // Convert flag input string to int.
        if(strcmp(cmds[2], "r") == 0)
          flag = READ;
        else if(strcmp(cmds[2], "w") == 0)
          flag = WRITE;
        else if(strcmp(cmds[2], "rw") == 0)
          flag = READWRITE;
        else if(strcmp(cmds[2], "wr") == 0)
          flag = READWRITE;
        else {
          printf("Error: Invalid flag.\n");
          continue;
        }

        open(currentDir, fileImgPtr, &ofTable, cmds[1], flag);
      }
    }

    else if (strcmp(cmds[0], "close") == 0) {
      if(tokCount != 2) {
        printf("Error: Invalid arguments.\n");
        printf("Expected: close <filename>\n");
      }
      else {
        if(!closeFile(&ofTable, cmds[1]))
          printf("Error: File has not been opened.\n");
      }
    } // open

    else if (strcmp(cmds[0], "close") == 0) {

    } // close

    else if (strcmp(cmds[0], "create") == 0) {
      if (tokCount != 2) {
        printf("Error: Invalid arguments.\n");
        printf("Expected: create <filename>.\n");
      } // if
      else if (strcmp(cmds[1], ".") == 0
          || strcmp(cmds[1], "..") == 0) {
        printf("Error: Invalid arguments.\n");
        printf("\'%s\' is not a valid name\n", cmds[1]);
      }
      else {
        create(currentDir, currentDirCluster, fileImgPtr, cmds[1], 0);
      }
    } // create

    else if (strcmp(cmds[0], "rm") == 0) {
      if (tokCount != 2) {
        printf("Error: Invalid arguments.\n");
        printf("Expected: create <dirname>.\n");
      }
      // using . or .. is not allowed
      else if (strcmp(cmds[1], ".") == 0
          || strcmp(cmds[1], "..") == 0) {
        printf("Error: Invalid arguments.\n");
        printf("\'%s\' is not a valid name\n", cmds[1]);
      }
      else {
        int flag = 0;
        if(rm(currentDir, currentDirCluster, fileImgPtr, &ofTable, cmds[1], flag))
          printf("File has been removed.\n");
      }
    } // rm

    else if (strcmp(cmds[0], "size") == 0) {
      if(tokCount != 2) {
        printf("Error: Invalid arguments.\n");
        printf("Expected: size <filename>\n");
      }
      else {
        printf("%d bytes\n", size(currentDir, cmds[1]));
      }
    } // size

    else if (strcmp(cmds[0], "cd") == 0) {
      if(tokCount != 2) {
        printf("Error: Invalid arguments.\n");
        printf("Expected: cd <directory>\n");
      }
      else {
        // Find the cluster number of the desired directory and set the current
        // directory to that cluster.
        unsigned int newClusterNum = 0;
        unsigned int *newClusterPtr = &newClusterNum;
        if(cd(currentDir, cmds[1], newClusterPtr)) {
          currentDirCluster = *newClusterPtr;
        }
      }
    } // cd

    else if (strcmp(cmds[0], "ls") == 0) {
      //If only 1 argument, lists the current directory
      if(cmds[1] == NULL)
      	ls(currentDir);
      else {
    	  unsigned int newDirCluster;
    	  //newDir will be populated with entries from the specified directory
    	  Directory newDir;

    	  newDir.dirEntries = (unsigned char **) malloc(sizeof(unsigned char *));
    	  newDir.size = 0;
    	  unsigned int newClusterNum = 0;
    	  unsigned int *newClusterPtr = &newClusterNum;

    	  //Checks if specified directory exists
    	  if(cd(currentDir, cmds[1], newClusterPtr))
    	    {
    	      newDirCluster = *newClusterPtr;
    	      getDirEntries(fileImgPtr, newDirCluster, &newDir);
    	      ls(newDir);
    	    }

    	  // Free the dynamically allocated new directory.
    	  for(int i = 0; i < newDir.size; ++i)
    	    {
    	      free(newDir.dirEntries[i]);
    	    }
    	  free(newDir.dirEntries);
    	}
    } // ls

    else if (strcmp(cmds[0], "read") == 0) {
      if(tokCount != 4) {
        printf("Error: Invalid arguments.\n");
        printf("Expected: read <filename> <position> <number of bytes>\n");
      }
      else {
        int pos, numBytes;
        pos = atoi(cmds[2]);
        numBytes = atoi(cmds[3]);
        readFile(currentDir, &ofTable, fileImgPtr, cmds[1], pos, numBytes);
      }
    } // read

    else if (strcmp(cmds[0], "write") == 0) {
      if(tokCount != 5) {
        printf("Error: Invalid arguments.\n");
        printf("Expected: write <filename> <position> <number of bytes> <string>\n");
      }
      else {
        int pos, numBytes;
        pos = atoi(cmds[2]);
        numBytes = atoi(cmds[3]);
        writeFile(currentDir, currentDirCluster, &ofTable, fileImgPtr, cmds[1],
                  pos, numBytes, cmds[4]);
      }
    } // write

    else if (strcmp(cmds[0], "mkdir") == 0) {
      if (tokCount != 2) {
        printf("Error: Invalid arguments.\n");
        printf("Expected: create <dirname>.\n");
      }
      else if (strcmp(cmds[1], ".") == 0
          || strcmp(cmds[1], "..") == 0) {
        printf("Error: Invalid arguments.\n");
        printf("\'%s\' is not a valid name\n", cmds[1]);
      }
      else {
        create(currentDir, currentDirCluster, fileImgPtr, cmds[1], 1);
      }
    } // mkdir

    else if (strcmp(cmds[0], "rmdir") == 0) {
      if (tokCount != 2) {
        printf("Error: Invalid arguments.\n");
        printf("Expected: create <dirname>.\n");
      }
      else if (strcmp(cmds[1], ".") == 0
          || strcmp(cmds[1], "..") == 0) {
        printf("Error: Invalid arguments.\n");
        printf("\'%s\' is not a valid name\n", cmds[1]);
      }
      else {
        int flag = 0;
        if(rmDirectory(currentDir, currentDirCluster, fileImgPtr, cmds[1], flag))
          printf("Directory has been removed.\n");
      }
    } // rmdir

    else {
      printf("Invalid command. Please try again.\n");
    } // invalid

    // Free dynamically-allocated memory.
    for (int itr = 0; itr < 6; itr++)
      free(cmds[itr]);
    free(cmds);

    // Free the dynamically allocated current directory.
    for (int i = 0; i < currentDir.size; ++i) {
      free(currentDir.dirEntries[i]);
    }
    free(currentDir.dirEntries);

  } // while input

  //Close the file image.
  fclose(fileImgPtr);
  printf("Exiting program...\n");

  // Free the dynamically allocated open file table.
  // Free the cluster chains.
  for (int i = 0; i < ofTable.size; ++i) {
    free(ofTable.entries[i].clusterOffsets);
  }
  // Free the table.
  free(ofTable.entries);

  return 0;
}
Beispiel #24
0
GCodeParser::~GCodeParser()
{
   closeFile();
}
AudioStreamOGG::~AudioStreamOGG()
{
    closeFile();
}
Beispiel #26
0
void PluginStream::destroyStream()
{
    if (m_streamState == StreamStopped)
        return;

    ASSERT(m_reason != WebReasonNone);
    ASSERT(!m_deliveryData || m_deliveryData->size() == 0);

    closeFile(m_tempFileHandle);

    bool newStreamCalled = m_stream.ndata;

    // Protect from destruction if:
    //  NPN_DestroyStream is called from NPP_NewStream or
    //  PluginStreamClient::streamDidFinishLoading() removes the last reference
    RefPtr<PluginStream> protect(this);

    if (newStreamCalled) {
        if (m_reason == NPRES_DONE && (m_transferMode == NP_ASFILE || m_transferMode == NP_ASFILEONLY)) {
            ASSERT(!m_path.isNull());

            if (m_loader)
                m_loader->setDefersLoading(true);
            m_pluginFuncs->asfile(m_instance, &m_stream, m_path.utf8().data());
            if (m_loader)
                m_loader->setDefersLoading(false);
        }

        if (m_streamState != StreamBeforeStarted) {
            if (m_loader)
                m_loader->setDefersLoading(true);

            NPError npErr = m_pluginFuncs->destroystream(m_instance, &m_stream, m_reason);

            if (m_loader)
                m_loader->setDefersLoading(false);

            LOG_NPERROR(npErr);
        }

        m_stream.ndata = 0;
    }

    if (m_sendNotification) {
        // Flash 9 can dereference null if we call NPP_URLNotify without first calling NPP_NewStream
        // for requests made with NPN_PostURLNotify; see <rdar://5588807>
        if (m_loader)
            m_loader->setDefersLoading(true);
        if (!newStreamCalled && m_quirks.contains(PluginQuirkFlashURLNotifyBug) &&
            equalIgnoringCase(m_resourceRequest.httpMethod(), "POST")) {
            m_transferMode = NP_NORMAL;
            m_stream.url = "";
            m_stream.notifyData = m_notifyData;

            static char emptyMimeType[] = "";
            m_pluginFuncs->newstream(m_instance, emptyMimeType, &m_stream, false, &m_transferMode);
            m_pluginFuncs->destroystream(m_instance, &m_stream, m_reason);

            // in successful requests, the URL is dynamically allocated and freed in our
            // destructor, so reset it to 0
            m_stream.url = 0;
        }
        m_pluginFuncs->urlnotify(m_instance, m_resourceRequest.url().string().utf8().data(), m_reason, m_notifyData);
        if (m_loader)
            m_loader->setDefersLoading(false);
    }

    m_streamState = StreamStopped;

    if (!m_loadManually && m_client)
        m_client->streamDidFinishLoading(this);

    if (!m_path.isNull())
        deleteFile(m_path);
}
Beispiel #27
0
void PluginDatabase::loadPersistentMetadataCache()
{
    if (!isPersistentMetadataCacheEnabled() || persistentMetadataCachePath().isEmpty())
        return;

    PlatformFileHandle file;
    String absoluteCachePath = pathByAppendingComponent(persistentMetadataCachePath(), persistentPluginMetadataCacheFilename);
    file = openFile(absoluteCachePath, OpenForRead);

    if (!isHandleValid(file))
        return;

    // Mark cache as loaded regardless of success or failure. If
    // there's error in the cache, we won't try to load it anymore.
    m_persistentMetadataCacheIsLoaded = true;

    Vector<char> fileContents;
    fillBufferWithContentsOfFile(file, fileContents);
    closeFile(file);

    if (fileContents.size() < 2 || fileContents.first() != schemaVersion || fileContents.last() != '\0') {
        LOG_ERROR("Unable to read plugin metadata cache: corrupt schema");
        deleteFile(absoluteCachePath);
        return;
    }

    char* bufferPos = fileContents.data() + 1;
    char* end = fileContents.data() + fileContents.size();

    PluginSet cachedPlugins;
    HashMap<String, time_t> cachedPluginPathsWithTimes;
    HashMap<String, RefPtr<PluginPackage> > cachedPluginsByPath;

    while (bufferPos < end) {
        String path;
        time_t lastModified;
        String name;
        String desc;
        String mimeDesc;
        if (!(readUTF8String(path, bufferPos, end)
              && readTime(lastModified, bufferPos, end)
              && readUTF8String(name, bufferPos, end)
              && readUTF8String(desc, bufferPos, end)
              && readUTF8String(mimeDesc, bufferPos, end))) {
            LOG_ERROR("Unable to read plugin metadata cache: corrupt data");
            deleteFile(absoluteCachePath);
            return;
        }

        // Skip metadata that points to plugins from directories that
        // are not part of plugin directory list anymore.
        String pluginDirectoryName = directoryName(path);
        if (m_pluginDirectories.find(pluginDirectoryName) == WTF::notFound)
            continue;

        RefPtr<PluginPackage> package = PluginPackage::createPackageFromCache(path, lastModified, name, desc, mimeDesc);

        if (package && cachedPlugins.add(package).isNewEntry) {
            cachedPluginPathsWithTimes.add(package->path(), package->lastModified());
            cachedPluginsByPath.add(package->path(), package);
        }
    }

    m_plugins.swap(cachedPlugins);
    m_pluginsByPath.swap(cachedPluginsByPath);
    m_pluginPathsWithTimes.swap(cachedPluginPathsWithTimes);
}
Beispiel #28
0
FormattedFile::~FormattedFile()
{
	closeFile();
}
Beispiel #29
0
EngineRecord::~EngineRecord() {
    closeCueFile();
    closeFile();
    delete m_pRecReady;
    delete m_pSamplerate;
}
Beispiel #30
0
bool App::load(int argc, char** argv)
{
	RESULT r = S_OK;

	// Parse arguments
	if (argc < 1) { return false; }
	char* filename = argv[0];

	// Load Model
	OpenedFile* file = openFile(filename);
	if(file)
    {
		char fourcc[4];
		fread(fourcc, 1, 4, file->f);
		if (memcmp(fourcc, "J3D", 3) == 0)
		{
			fseek(file->f, 0, SEEK_SET);
			BModel* bdl = loadBmd(file->f);
			GDModel::Load(&m_GDModel, bdl);
			delete bdl;
		}
		else if (memcmp(fourcc, "bmd1", 4) == 0)
		{
			WARN("bmd1 format no longer supported\n");
			closeFile(file);
			return false;
		}
	}
	else
	{
		return false;
	}
	closeFile(file);

	// @HACK: If we're loading Link, load his walk animation
	char* filenameWoPath = strrchr(filename, '\\') + 1;
	if (strcmp(filenameWoPath, "cl.bdl") == 0)
	{
		filename = "../../Data/Scratch/LkAnm/archive/bcks/walk.bck";
		file = openFile(filename);
		if (file)
		{
			char fourcc[4];
			fread(fourcc, 1, 4, file->f);
			if (memcmp(fourcc, "J3D", 3) == 0)
			{
				fseek(file->f, 0, SEEK_SET);
				Bck* bck = readBck(file->f);
				GDAnim::Load(&m_restAnim, bck);
				animLoaded = true;
				delete bck;
			}
			else
			{
				WARN("Unsupported animation format\n");
			}
			closeFile(file);
		}
	}

	// Load Font
	defaultFont = renderer->addFont("../../Data/Fonts/Future.dds", "../../Data/Fonts/Future.font", linearClamp);

cleanup:
	return SUCCEEDED(r);
}