Subversion Repositories Kolibri OS

Rev

Rev 5291 | Rev 5302 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5291 Rev 5298
Line 183... Line 183...
183
    snd->length_samples = length_samples;
183
    snd->length_samples = length_samples;
184
    snd->data = malloc(length_samples*2);
184
    snd->data = malloc(length_samples*2);
185
    rskos_snd_create_buffer(&snd->hbuf, snd->data, length_samples);
185
    rskos_snd_create_buffer(&snd->hbuf, snd->data, length_samples);
186
};
186
};
Line -... Line 187...
-
 
187
 
-
 
188
void soundbuf_update(rs_soundbuf_t *snd) {
-
 
189
    rskos_snd_update_buffer(&snd->hbuf, snd->data, snd->length_samples);
-
 
190
};
187
 
191
 
188
void soundbuf_free(rs_soundbuf_t *snd) {
192
void soundbuf_free(rs_soundbuf_t *snd) {
189
    snd->status = 0;
193
    snd->status = 0;
190
    free(snd->data);
194
    free(snd->data);
Line 257... Line 261...
257
    
261
    
258
    game.player_x = 0;
262
    game.player_x = 0;
259
    game.player_y = 0;
263
    game.player_y = 0;
Line -... Line 264...
-
 
264
    game.tz = 0;
-
 
265
    
260
    game.tz = 0;
266
    game.bg_color = COLOR_BLACK;
261
 
267
 
262
//    int i;
268
//    int i;
263
//    for (i = 0; i < BULLETS_COUNT; i++) {
269
//    for (i = 0; i < BULLETS_COUNT; i++) {
264
//        game.bullet_x[i] = 0;
270
//        game.bullet_x[i] = 0;
Line 518... Line 524...
518
    soundbuf_init(&game.sound_test3, 1024);
524
    soundbuf_init(&game.sound_test3, 1024);
519
    //soundbuf_fill(&game.sound_test3, 12, 60);
525
    //soundbuf_fill(&game.sound_test3, 12, 60);
520
    soundbuf_sin(&game.sound_test3, 0.24);
526
    soundbuf_sin(&game.sound_test3, 0.24);
Line -... Line 527...
-
 
527
 
-
 
528
 
-
 
529
 
-
 
530
    
-
 
531
    
-
 
532
    int soundlen = 55000;
-
 
533
            
-
 
534
//    int freqs[SOUND_EXPLOSIONS_COUNT] = { 440, 523, 587, 698, 783, 880, 1046, 1174 };
-
 
535
    
-
 
536
    for (i = 0; i < SOUND_EXPLOSIONS_COUNT; i++) {
-
 
537
 
-
 
538
        soundbuf_init(&game.sound_explosions[i], soundlen);
-
 
539
 
-
 
540
        rs_sgen_init(3, soundlen);
-
 
541
 
-
 
542
        rs_sgen_func_noise(2, 1000);
-
 
543
        //rs_sgen_func_phaser(0, 2, 0.9, 15.2 + 1.0*i/SOUND_EXPLOSIONS_COUNT, 6.0, 3.0, 2000.0, 1.73); 
-
 
544
        rs_sgen_func_phaser(0, 2, 0.9, 16.2 + 0.5*i/SOUND_EXPLOSIONS_COUNT, 6.0, 3.0, 900.0, 0.93); 
-
 
545
        rs_sgen_func_normalize(0, 1.0);
-
 
546
 
-
 
547
        rs_sgen_func_lowpass(2, 0, 0.6, 0.0, 20.0);
-
 
548
        rs_sgen_func_normalize(2, 1.0);
-
 
549
 
-
 
550
        rs_sgen_wave_out(2);
-
 
551
 
-
 
552
        memcpy(game.sound_explosions[i].data, (unsigned char*) rs_sgen_reg.wave_out, soundlen*2);
-
 
553
        soundbuf_update(&game.sound_explosions[i]);
-
 
554
 
-
 
555
        rs_sgen_term();
-
 
556
    
-
 
557
    };
-
 
558
 
-
 
559
    soundlen = 17888;
-
 
560
 
-
 
561
    soundbuf_init(&game.sound_hit, soundlen);
-
 
562
 
-
 
563
    rs_sgen_init(3, soundlen);
-
 
564
 
-
 
565
    rs_sgen_func_noise(2, 1000);
-
 
566
    rs_sgen_func_phaser(0, 2, 0.9, 11.5, 16.0, 13.0, 1300.0, 1.93); 
-
 
567
    rs_sgen_func_normalize(0, 1.0);
-
 
568
 
-
 
569
    rs_sgen_func_highpass(2, 0, 1.0, 0.3, 20.0);
-
 
570
    rs_sgen_func_normalize(2, 1.0);
-
 
571
 
-
 
572
    rs_sgen_wave_out(2);
-
 
573
 
-
 
574
    memcpy(game.sound_hit.data, (unsigned char*) rs_sgen_reg.wave_out, soundlen*2);
-
 
575
    soundbuf_update(&game.sound_hit);
-
 
576
 
521
 
577
    rs_sgen_term();
Line 522... Line 578...
522
 
578
 
Line 562... Line 618...
562
 
618
 
Line 563... Line 619...
563
 
619
 
564
 
620
 
565
 
621
 
Line 637... Line 693...
637
                menu_open(0);
693
                menu_open(0);
638
                break;
694
                break;
639
            case RS_KEY_SPACE:
695
            case RS_KEY_SPACE:
Line 640... Line 696...
640
                
696
                
641
                #ifdef RS_LINUX
-
 
-
 
697
                #ifdef RS_LINUX
642
                    game.stage_timer = 0;
698
                    
-
 
699
                    soundbuf_play( &game.sound_hit );
643
                    game.stage = 7;
700
                    
Line 644... Line 701...
644
                #endif
701
                #endif
Line 645... Line 702...
645
                
702