Example #1
0
void squeezeLiteGui::setupInterfaceConnections(void)
{
    DEBUGF("Initialize Interface Connections");

    QQuickItem *v = rootObject();
    // interface signals to application
    connect(v,SIGNAL(play(int)), this,SLOT(playState(int)));
    connect(v,SIGNAL(nextTrack()), this,SLOT(nextTrackClicked()));
    connect(v,SIGNAL(prevTrack()), this,SLOT(prevTrackClicked()));
    connect(v,SIGNAL(volUp()), this,SLOT(volUp()));
    connect(v,SIGNAL(volDown()), this,SLOT(volDown()));
    connect(v,SIGNAL(setVolume(int)), this,SLOT(setVolume(int)));
    connect(v,SIGNAL(controlClicked(QString)), this,SLOT(controlViewClicked(QString)));
    connect(v,SIGNAL(shuffle(int)), this,SLOT(shuffleState(int)));
    connect(v,SIGNAL(repeat(int)), this,SLOT(repeatState(int)));
//    connect(v,SIGNAL(playButtonClicked()),this,SLOT(playPauseToggle()));

    // application signals to interface
    connect(this,SIGNAL(playlistIndexChange(QVariant)), v, SLOT(setControlViewListIndex(QVariant)));
    connect(this,SIGNAL(updateAlbumCover(QVariant)), v,SLOT(updateAlbumCover(QVariant)));
    connect(this,SIGNAL(playStatus(QVariant)), v, SLOT(updatePlayMode(QVariant)));
    connect(this,SIGNAL(VolumeChange(QVariant)), v,SLOT(setMainVolume(QVariant)));
    connect(this,SIGNAL(songDuration(QVariant)), v,SLOT(setSongDuration(QVariant)));
    connect(this,SIGNAL(progress(QVariant)), v,SLOT(updateProgress(QVariant)));
    connect(m_playerInfo,SIGNAL(PlayingTime(QVariant,QVariant)),
            v,SLOT(setupSongTimes(QVariant,QVariant)));
    connect(m_playerInfo,SIGNAL(TimeText(QVariant)),v,SLOT(setTimeText(QVariant)));

    connect(m_playerInfo,SIGNAL(NewSong()),this,SLOT(NewSong()));
    connect(&m_tick,SIGNAL(timeout()),m_playerInfo,SLOT(tick()));

    m_tick.start(1000);

/*
 *  messages from device that need to be connected to slots
    void playlistIndexChange(QVariant newidx);
    void NewSong(int newPlayListIndex);
    void NewPlaylist(void);
    void Mute(bool);
    void VolumeChange(int);
    void ModeChange(QString);
*/
}
Example #2
0
void squeezeLiteGui::loadNowPlayingScreen(void)
{
    DEBUGF("LOAD NOW PLAYING SCREEN");
    if( !controlHierarchy.contains("NowPlaying")) {
        updateNowPlayingScreen();
    }
    else {
        rootContext()->setContextProperty("controlListModel", controlHierarchy["NowPlaying"]);
    }
    NewSong();
}
Example #3
0
GForce::~GForce() {

	// Rewrite the prefs to disk...
	mPrefs.SetPref( VAL('S','S','v','r'), mScrnSaverDelay / 60.0 );
	mPrefs.SetPref( VAL('T','r','H','i'), mTransitionHi );
	mPrefs.SetPref( VAL('T','r','L','o'), mTransitionLo );
	mPrefs.SetPref( VAL('M','S','c','l'), mMagScale * 1000 );
	mPrefs.SetPref( VAL('C','I','n','t'), mColorIntervalStr );
	mPrefs.SetPref( VAL('W','I','n','t'), mShapeIntervalStr );
	mPrefs.SetPref( VAL('D','I','n','t'), mFieldIntervalStr );
	mPrefs.SetPref( VAL('S','t','p','s'), mNum_S_Steps );
	mPrefs.SetPref( VAL('P','D','u','r'), mParticleDuration );
	mPrefs.SetPref( VAL('P','P','r','b'), mParticleProbability );
	mPrefs.SetPref( VAL('N','o','B','o'), mBorderlessWind );
	mPrefs.SetPref( VAL('K','y','b','d'), mHandleKeys	);
	mPrefs.SetPref( VAL('F','S','_','X'), mFullscreenSize.h );
	mPrefs.SetPref( VAL('F','S','_','Y'), mFullscreenSize.v );
	mPrefs.SetPref( VAL('F','S','_','D'), mFullscreenDepth );
	mPrefs.SetPref( VAL('F','S','_','#'), mFullscreenDevice );
	mPrefs.SetPref( VAL('N','o','r','m'), mNormalizeInput );
	mPrefs.SetPref( VAL('M','a','x','Y'), mMaxSize.v );
	mPrefs.SetPref( VAL('M','a','x','X'), mMaxSize.h );
	mPrefs.SetPref( VAL('T','P','o','s'), mTrackTextPosMode );
	mPrefs.SetPref( VAL('T','S','z','e'), mTrackTextSize );
	mPrefs.SetPref( VAL('T','F','n','t'), mTrackFont );
	mPrefs.SetPref( VAL('T','S','t','r'), mTrackMetaText );
	mPrefs.SetPref( VAL2('T','?'), mTrackTextStartStr );
	mPrefs.SetPref( VAL('T','D','u','r'), mTrackTextDurationStr );
	mPrefs.SetPref( VAL('K','M','a','p'), mKeyMap );
	mPrefs.SetPref( VAL('P','_','O','n'), mParticlesOn ? 1 : 0 );
	mPrefs.SetPref( VAL('S','h','w','T'), mNewConfigNotify ? 1 : 0 );
	mPrefs.SetPref( VAL('C','D','u','r'), mConsoleDelay );
	mPrefs.SetPref( VAL('C','L','i','n'), mConsoleLineDur );

	// Init the track text info
	NewSong();

	mPrefs.Store();

}
Example #4
0
bool InitProgram(void){
//	GC_INIT();
  bool ret;

#if !defined(FOR_MACOSX)
  RADIUM_ensure_bin_packages_gc_is_used();
#endif
  
  printf("Initializing...\n");

	printf("...Error handler\n");
	Error_init();

	printf("...Memory handler\n");
	init_memory();

	root=tralloc(sizeof(struct Root));

	if(root==NULL){
		fprintf(stderr,"Not enough memory\n");
		return false;
	}

	root->keyoct=36;
        root->quantitize_options = Quantitize_get_default_options();
        root->grid_numerator=1;
        root->grid_denominator=1;
        root->min_standardvel=MAX_VELOCITY*40/100;
	root->standardvel=MAX_VELOCITY*80/100;
        ATOMIC_SET(root->editonoff, true);
        ATOMIC_SET(root->play_cursor_onoff, false);
        ATOMIC_SET(root->editor_follows_play_cursor_onoff, true);

	root->song=talloc(sizeof(struct Song));

	pc=tralloc(sizeof(PlayerClass));

	if(root->song==NULL || pc==NULL){
		fprintf(stderr,"Not enough memory\n");
		return false;
	}

        pc->pfreq = 48000; // Default value. Should be overridden in MIXER_start().

/*
	if( ( ! InitPEQmempool(1000) )  || ( ! Input_Init(4000) ) ){	// 1000 and 4000 are hardcoded values. Not good.
		return false;
	}
*/

        printf("...Midi\n");
        MIDI_input_init();

        SCHEDULER_init();

        PATCH_init();

	printf("...Sound\n");
        if(MIXER_start()==false){
          fprintf(stderr,"Could not open Sound\n");
          return false;
        }

	printf("...Player 1/2\n");

	if( ( ! InitPEQmempool() )   ){	// 1000 and 4000 are hardcoded values. Not good.
		return false;
	}


	printf("...Clock handler\n");

	if( ! InitClock() ) return false;

	printf("...Player 2/2\n");

	PEQ_GetType_Init();

	printf("...Instrument\n");

	if( OpenInstruments()==false ){
          return false;
        }

	printf("...Kebang\n");

	ret=NewSong();

#if !USE_OPENGL
	printf("...Blitting\n");

	if(ret==true){
	  Blt_blt(root->song->tracker_windows);
	}
#endif

	printf("Initialization finished.\n");

	return ret;
}
Example #5
0
// delete the current song
void GlobalData::DelSong()
{
	structSongData *songtrav = songdata;
	structSongData *deletesong = NULL;
	
	// if we even have any songs (which we should always have becuase there's at least a blank song)
	if (songtrav)
	{
		debug("Deleting a song.");

		// if the first loop is the selected loop
		if (songtrav == currentsong)
		{
			debug("[First song]");
			
			// set the current song's loops to point to the next one (NULL is ok)
			songdata = songtrav->next;
			
			// remember what we want to delete
			deletesong = currentsong;			
			
			// set the traveller to point at something sane
			songtrav = songdata;
		}
		else
		{
			debug("[Finding song]");
			
			// find the current song
			while (songtrav->next != currentsong)
			{
				songtrav = songtrav->next;
			}
			
			// remember what we want to delete
			deletesong = songtrav->next;
			
			// unlink the song to be deleted
			songtrav->next = songtrav->next->next;
		}
		
		// delete all the loops associated with the deleted song
		while (deletesong->loops)
		{
			DelLoop();
		}

		// set currentsong to be the song we're on now
		currentsong = songtrav;
		
		// delete the name array associated
		delete[] deletesong->name;
		
		// delete the song itself
		delete deletesong;
	}
	
	// if we've run out of songs (our current song is null) then make sure we have one blank song
	if (!songdata)
	{
		NewSong();
	}
}
Example #6
0
// load all songs from ROM into memory
void GlobalData::LoadSongs()
{
	u16 checkmagic=0;
	offset = 0;
	
	REG_IME = 0; // disable interrupts
	
	debug("Loading songs.");

	// black = starting
	SetBG(0, 0, 0);
	
	ReadNumber(&checkmagic, sizeof(u16));
	
	// check first if there is any saved data in the databank
	if (checkmagic == magic)
	{
		// until we find the end of the songs
		while (!CheckMagic())
		{
			// red = song
			SetBG(10, 0, 0);
			
			// start a new song
			debug("Creating a new song struct.");
			NewSong();
			
			debug("Reading basic song data.");
			
			// read in the song name
			ReadString(&currentsong->name);
			debug("Song Name: %s", currentsong->name);

			// write bpm
			ReadNumber(&currentsong->bpm, sizeof(u16));
			debug("Song Speed: %d", currentsong->bpm);
			
			// until we find the end of the loops
			while (!CheckMagic())
			{
				// green = loop
				SetBG(0, 10, 0);
				
				// create a new loop
				debug("Creating a new loop struct.");
				NewLoop();
				
				debug("Reading basic loop data.");
				
				// write the loop name
				ReadString(&currentloop->name);
				// write the sample number
				ReadNumber(&currentloop->sample, sizeof(u16));
				// write the panning direction
				ReadNumber(&currentloop->pan, sizeof(bool));
				// write the pitch
				ReadNumber(&currentloop->pitch, sizeof(u16));
				// write the number of divisions
				ReadNumber(&currentloop->divisions, sizeof(u16));
				
				while (!CheckMagic())
				{
					// blue = note
					SetBG(0, 0, 10);
					
					// create a new note
					debug("Creating a new note struct.");
					NewNote();
					
					debug("Reading basic note data.");
					
					// write the note end action;
					ReadNumber(&currentnote->noteEnd, sizeof(u8));
					// write the beat offset
					ReadNumber(&currentnote->offset, sizeof(u8));
					// write the pitch
					ReadNumber(&currentnote->pitch, sizeof(u8));
					// write the swing
					ReadNumber(&currentnote->swing, sizeof(u8));
				}
			}
		}
	}

	// if we don't have a default song set yet
	if (!songdata)
	{
		debug("No load data; creating a new song.");
		NewSong();
	}

	REG_IME = 1; // enable interrupts
}