Exemple #1
0
static void check_for_file(bfpath *bfp)
{
    int rc;
    struct stat sb;

    bfp->isdir = bfp->isfile = false;

    rc = stat(bfp->filepath, &sb);
    if (rc == 0) {
	bfp->exists = true;
	xfree(bfp->dirname);
	xfree(bfp->filename);
	if (S_ISDIR(sb.st_mode)) {
	    bfp->isdir = true;
	    bfp->dirname  = xstrdup(bfp->filepath);
	    bfp->filename = NULL;
	}
	if (!S_ISDIR(sb.st_mode)) {
	    bfp->isfile = true;
	    bfp->dirname  = get_directory_from_path(bfp->filepath);
	    bfp->filename = get_file_from_path(bfp->filepath);
	}
    }
    return;
}
Exemple #2
0
int main(int args,char** argv) {
	int ch;
	char script[256] = {0};
	char c_times[64] = {0};
	char buf[256] = { 0 };

	int times = 0;
	//printf("times=%d\n",args);
	get_file_from_path(argv[0], buf);

	if(args == 1) {
		Usage(buf);
		return 1;
	}

	while((ch = getopt(args,argv,"f:t:")) != -1) {
        switch(ch) {
            case 'f':
                strcpy(script,optarg);
                break;
			case 't':
				strcpy(c_times,optarg);
				break;
            default:
                break;
        }
    }
	
	if(script[0] == 0||c_times[0] == 0) {
		Usage(buf);
		return 1;
	}

	times = parse_int_dec(c_times);
	AutoControllerMock contorl;

	if(!contorl.init(script))
		return 1;

	for(int i = 0; i < times;i++) {
		contorl.runController();
	}

	return 0;
}
void SimplerUI::load_sample_slot() {
	
	static QString sample_dir=".";
	
	QString file=QFileDialog::getOpenFileName ( this, "Open Sample",sample_dir, "Waveforms (*.wav *.au *.aif *.WAV);;All Files (*)");
			
	if (file=="")
		return;

	sample_dir=get_dir_from_path(file);
	
	AudioControl::mutex_lock();
			
	if (SampleFile::get_singleton()->load_sample( DeQStrify(file),&simpler->get_sample() )) {
		
		AudioControl::mutex_unlock();
		return;
	}
	
	
	AudioControl::mutex_unlock();
	
	QString preset_name=get_file_from_path(file);
	
	if (preset_name.lastIndexOf(".")!=-1) {
			
		preset_name=preset_name.left(preset_name.lastIndexOf("."));
	}
	
	simpler->set_current_preset_name( DeQStrify(preset_name) );
	
	viewer->set_sample_data( &simpler->get_sample() );	
	
	
	viewer->update();
	
	preset_name_changed_signal();
	
}
Exemple #4
0
static gchar* viewlist_real_get_line (screen* base, guint num) {
	viewlist * self;
	gchar* result = NULL;
	GList* _tmp0_;
	guint _tmp1_;
	gconstpointer _tmp2_ = NULL;
	gchar* _tmp3_ = NULL;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	self = (viewlist*) base;
	_tmp0_ = ((playlist*) self)->entry;
	_tmp1_ = num;
	_tmp2_ = g_list_nth_data (_tmp0_, _tmp1_);
	_tmp3_ = get_file_from_path ((const gchar*) _tmp2_);
	_tmp4_ = _tmp3_;
	_tmp5_ = g_strconcat ("  ", _tmp4_, NULL);
	_tmp6_ = _tmp5_;
	_g_free0 (_tmp4_);
	result = _tmp6_;
	return result;
}
void SoundPluginRack::plugin_action_signal(int p_action,int p_plugin) {
	
	ERR_FAIL_INDEX(p_plugin,track->get_plugin_count());
	int plugin_index=p_plugin;
	SoundPlugin *plugin=track->get_plugin(p_plugin);
	
	switch (p_action) {
		
		case PluginTop::ACTION_INFO: {
			
			QMessageBox *message = new QMessageBox(topLevelOf(this));
			message->setWindowTitle(QStrify( plugin->get_info()->caption ));
			message->setText(QStrify( plugin->get_info()->long_description));
			
			if (plugin->get_info()->xpm_preview)
				message->setIconPixmap(QPixmap((const char**)plugin->get_info()->xpm_preview));
			else 
				message->setIcon( QMessageBox::Information );
			message->exec();
		} break;
		case PluginTop::ACTION_MOVE_LEFT: {
		
			editor->track_move_plugin_left(track,plugin_index);
		} break;		
		case PluginTop::ACTION_MOVE_RIGHT: {
		
			editor->track_move_plugin_right(track,plugin_index);
			
		} break;		
		case PluginTop::ACTION_REMOVE: {
		
			editor->remove_plugin_from_track(track,plugin_index);
			
		} break;		
		
		case PluginTop::ACTION_SKIP_ON: {
			
			editor->set_plugin_skips_processing(plugin, true);
			
		} break;
		case PluginTop::ACTION_SKIP_OFF: {
			
			editor->set_plugin_skips_processing(plugin, false);
			
		} break;
		case PluginTop::ACTION_RENAME: {
		
			QString current=QStrify(plugin->get_current_preset_name());
			bool ok;
			QString text = QInputDialog::getText(this, "Rename Plugin",
					"Name:", QLineEdit::Normal,
					current, &ok);
			
			if (ok)
				editor->set_plugin_preset_name(plugin,DeQStrify(text));

			//editor->track_move_plugin_left(track,plugin_index);
		} break;		
		
		case PluginTop::ACTION_FILE: {
			
			PluginPresetBrowser *ppb = new PluginPresetBrowser(topLevelOf(this),plugin);
			ppb->exec();
			
			switch (ppb->get_action()) {
				
				case PluginPresetBrowser::ACTION_OPEN: {
					
					editor->load_plugin_preset(plugin,DeQStrify( ppb->get_file() ),track,DeQStrify( get_file_from_path( ppb->get_file()) ),ppb->is_reference());
					
				} break;
				case PluginPresetBrowser::ACTION_SAVE: {
					
					if (PluginPresetManager::get_singleton()->save_plugin_preset(DeQStrify( ppb->get_file() ), plugin )) {
						
						QMessageBox::critical ( this, "Error", "Error Saving File." , QMessageBox::Ok,QMessageBox::NoButton);
					} else {
						
						editor->begin_meta_undo_block( "Saved File: " + DeQStrify( get_file_from_path( ppb->get_file()) )) ;
						
						editor->set_plugin_preset_name(plugin,DeQStrify( get_file_from_path( ppb->get_file()) ));
						editor->set_plugin_preset_file(plugin,DeQStrify( ppb->get_file() ),ppb->is_reference());
						
						editor->end_meta_undo_block();
						
					}
					
				} break;
				
			}
		
			delete ppb;
		} break;
	}
}
Exemple #6
0
std::string get_file_name(std::string file)
{
    auto words = split(get_file_from_path(file),'.');
    return reform(words.begin(),words.end()-1,'.');
}