function handlechunk(song, type, chunk) {
		if (type === MThd) {
			song.format = vtos(chunk.subarray(0));
			song.numtracks = vtos(chunk.subarray(2));
			song.divisions = vtos(chunk.subarray(4));
			return;
		}

		if (type == MTrk) {
			try {
				song.tracks.push(parseevents(chunk));
			} catch (e) {
				console.warn.apply(console, e);
			}
			return;
		}

		console.warn('discarding unknown chunk', type, chunk);
	}
/*
	given a song and chunk, parse and add the chunk to the song
	*/
given a song and chunk, parse and add the chunk to the song
given a song and chunk parse and add the chunk to the song
function handlechunk(song, type, chunk) {
		if (type === MThd) {
			song.format = vtos(chunk.subarray(0));
			song.numtracks = vtos(chunk.subarray(2));
			song.divisions = vtos(chunk.subarray(4));
			return;
		}
		if (type == MTrk) {
			try {
				song.tracks.push(parseevents(chunk));
			} catch (e) {
				console.warn.apply(console, e);
			}
			return;
		}
		console.warn('discarding unknown chunk', type, chunk);
	}
function handlechunk ( song , type , chunk ) { if ( type === MThd ) { song . format = vtos ( chunk . subarray ( 0 ) ) ; song . numtracks = vtos ( chunk . subarray ( 2 ) ) ; song . divisions = vtos ( chunk . subarray ( 4 ) ) ; return ; } if ( type == MTrk ) { try { song . tracks . push ( parseevents ( chunk ) ) ; } catch ( e ) { console . warn . apply ( console , e ) ; } return ; } console . warn ( 'discarding unknown chunk' , type , chunk ) ; }
given a song and chunk, parse and add the chunk to the song
given a song and chunk parse and add the chunk to the song