mirror of
https://github.com/sehugg/8bitworkshop.git
synced 2024-12-22 12:30:01 +00:00
POKEY music
This commit is contained in:
parent
29117e7cb6
commit
2ac80509f7
113
presets/vector-z80color/music.c
Normal file
113
presets/vector-z80color/music.c
Normal file
File diff suppressed because one or more lines are too long
@ -191,16 +191,16 @@ var POKEYDeviceChannel = function() {
|
||||
if (d > 0 && d < 1 && v > 0) {
|
||||
var wav = waveforms[i];
|
||||
var cnt = counters[i] += d;
|
||||
if (cnt > POLY17_SIZE+1) {
|
||||
counters[i] -= POLY17_SIZE+1;
|
||||
if (cnt > wav.length) {
|
||||
cnt = counters[i] = cnt - Math.floor(cnt / wav.length) * wav.length;
|
||||
}
|
||||
var on = wav[Math.floor(cnt % wav.length)];
|
||||
var on = wav[Math.floor(cnt)];
|
||||
if (on) {
|
||||
sample += v;
|
||||
}
|
||||
}
|
||||
}
|
||||
sample *= 273;
|
||||
sample *= 128;
|
||||
buffer[s] = sample;
|
||||
buffer[s+1] = sample;
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ var VECTOR_PRESETS = [
|
||||
{id:'font.c', name:'Vector Fonts'},
|
||||
{id:'threed.c', name:'3D Transformations'},
|
||||
{id:'game.c', name:'Space Game'},
|
||||
{id:'music.c', name:'POKEY Music'},
|
||||
]
|
||||
|
||||
var ASTEROIDS_KEYCODE_MAP = makeKeycodeMap([
|
||||
|
@ -12,6 +12,7 @@ args = parser.parse_args()
|
||||
test_notes = args.upper
|
||||
final_notes = args.length
|
||||
basehz = args.freq
|
||||
bias = args.bias
|
||||
|
||||
results = []
|
||||
|
||||
@ -35,6 +36,6 @@ print '//', best_a440, best_error, test_notes
|
||||
print "const int note_table[%d] = {" % final_notes
|
||||
for note in range(0,final_notes):
|
||||
notehz = best_a440 * math.pow(2.0, (note - 49) / 12.0);
|
||||
period = int(round(basehz / notehz))
|
||||
period = int(round(basehz / notehz)) - bias
|
||||
print '%d,' % period,
|
||||
print "};"
|
||||
|
Loading…
Reference in New Issue
Block a user