示例#1
0
// start the currently-loaded track playing at beat startbeat.
bool org_start(int startbeat)
{
	org_stop();		// stop any old music
	
	// set all the note-tracking stuff to starting values
	song.beat = startbeat;
	song.haslooped = false;
	
	for(int i=0;i<16;i++)
	{
		song.instrument[i].curnote = 0;
		note_channel[i].volume = ORG_MAX_VOLUME;
		note_channel[i].panning = ORG_PAN_CENTERED;
		note_channel[i].length = 0;
	}
	
	// fill the first buffer and play it to jumpstart the playback cycle
	//lprintf(" ** org_start: Jumpstarting buffer cycle\n");
	
	song.playing = true;
	song.fading = false;
	
	song.volume = OrgVolume;
	SSSetVolume(ORG_CHANNEL, song.volume);
	
	// kickstart the first buffer
	current_buffer = 0;
	generate_music();
	queue_final_buffer();
	buffers_full = 0;				// tell org_run to generate the other buffer right away
	
	return 0;
}
示例#2
0
文件: pmd.cpp 项目: histat/dc-nx
static void queue_and_start_buffer(int bufferno)
{
	stat("Generating %d samples -> %d", BUFFER_SAMPLES, bufferno);
	
	uint8_t *buffer = final_buffer[bufferno].samples;
	generate_music(buffer, BUFFER_SAMPLES);
	
	audio_submit_block(buffer, BUFFER_SAMPLES);
	stat("Buffer %d now playing", bufferno);
	//SSEnqueueChunk(PMD_CHANNEL, buffer, BUFFER_SAMPLES, (void *)bufferno, pmd_buffer_finished);
}