Esempio n. 1
0
void RA_addNote_FloatPlace(
			   int blocknum,
			   int tracknum,
			   float start,
			   int notenum,
			   float volume,
			   float end)
{
  struct Blocks *block=SWIG_getBlock(blocknum);
  struct Tracks *track=SWIG_getTrack(blocknum,tracknum);
  struct Notes *note;
  Place p2;
  if(track==NULL) return;

  note=NewNote();

  Float2Placement(start,&note->l.p);
  Float2Placement(end,&note->end);
  PlaceSetLastPos(block,&p2);

  if(PlaceGreaterOrEqual(&note->l.p,&p2)) return;
  if(PlaceGreaterOrEqual(&note->end,&p2)){
    PlaceCopy(&note->end,&p2);
  }

  note->note=notenum;
  note->velocity=boundaries(
			    volume*(*track->instrument->getMaxVelocity)(track),
			    0,
			    (*track->instrument->getMaxVelocity)(track)
			    );

  ListAddElement3(&track->notes,&note->l);
}
Esempio n. 2
0
INT_PTR PluginMenuCommandAddNew(WPARAM w, LPARAM l)
{
	STICKYNOTE *PSN = NewNote(0,0,0,0,NULL,NULL,TRUE,TRUE,0);
	if(PSN)
		SetFocus(PSN->REHwnd);
	return 0;
}
Esempio n. 3
0
void JamCracker::Play(void)
{
	if (--waitCnt == 0)
	{
		NewNote();
		waitCnt = wait;
	}

	SetChannel(&variables[0]);
	SetChannel(&variables[1]);
	SetChannel(&variables[2]);
	SetChannel(&variables[3]);
}
Esempio n. 4
0
struct Notes *InsertNote(
	struct WBlocks *wblock,
	struct WTracks *wtrack,
	Place *placement,
        Place *end_placement,
	float notenum,
	int velocity,
	bool polyphonic
){
	struct Blocks *block=wblock->block;
	struct Tracks *track=wtrack->track;

	struct Notes *note=NewNote();

        //((char*)note)[-5] = 'b'; // test memory validator
        
	PlaceCopy(&note->l.p,placement);

	note->note=notenum;
	note->velocity=velocity;
//	note->velocity=(*wtrack->track->instrument->getStandardVelocity)(wtrack->track);
	note->velocity_end=note->velocity;
        
        PLAYER_lock();
        {
          ListAddElement3(&track->notes,&note->l);

          if(polyphonic==false)
            StopAllNotesAtPlace(block,track,placement);

          if (end_placement==NULL)
            SetEndAttributes(block,track,note);
          else
            PlaceCopy(&note->end, end_placement);

          track->notes = NOTES_sort_by_pitch(track->notes);
        }
        PLAYER_unlock();

        NOTE_validate(block, NULL, note);

        return note;
}
Esempio n. 5
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
}