@@ -446,132 +446,57 @@ void adldune2filestest()
446
446
SDL_QuitSubSystem (SDL_INIT_EVENTS);
447
447
}
448
448
449
- /* *
450
- * @brief Plays VOC files through an Adlib/OPL-backed PCM driver using SDL for event handling.
451
- *
452
- * Initializes an SDL-backed audio mixer and Adlib/OPL device, scans the local "voc/" directory,
453
- * and plays each VOC file's PCM sound multiple times. While a sound is playing the function
454
- * processes SDL events so the user can quit (window close or Escape) or stop the current playback
455
- * early (Enter). A small SDL window is created for event delivery and destroyed on exit.
456
- *
457
- * This is a test/harness routine with side effects: it initializes SDL subsystems, creates an
458
- * audio mixer and device, opens a window, iterates the filesystem, and drives playback via a
459
- * PCMDriver. It does not return any value.
460
- */
461
- void vocdune2filestest ()
462
- {
463
- auto mixer = audio::make_mixer<audio::sdl2::Mixer>(8 , 44100 , 1024 );
464
- mixer->init ();
465
-
466
- void adldune2filestest ()
467
- {
468
- auto mixer = audio::make_mixer<audio::sdl2::Mixer>(8 , 44100 , 1024 );
469
- mixer->init ();
470
- // utils::ILogger::instance->setLevelAll(utils::ILogger::eLevel::Debug);
471
- auto device = devices::make_device<devices::Adlib, devices::Opl>(mixer);
472
- drivers::westwood::ADLDriver drv (device, audio::mixer::eChannelGroup::Music);
473
-
474
- SDL_InitSubSystem (SDL_INIT_EVENTS);
475
- SDL_InitSubSystem (SDL_INIT_VIDEO);
476
-
477
- auto window = SDL_CreateWindow (" a" , 0 , 0 , 320 , 200 , 0 );
478
-
479
- for (int f = 0 ; f <= 0 ; f++)
480
- {
481
- // const std::string fn = "adl/DUNE" + std::to_string(f) + ".ADL";
482
- const std::string fn = " adl/KYRA1A.ADL" ;
483
- utils::ILogger::instance->info (std::format (" opening file: {}" , fn), utils::ILogger::eCategory::Application);
484
- auto adlf = std::make_shared<files::westwood::ADLFile>(fn);
485
- drv.setADLFile (adlf);
486
- for (int i = 1 ; i < adlf->getNumTracks (); i++)
487
- {
488
- utils::ILogger::instance->info (std::format (" playing track: {}" , i), utils::ILogger::eCategory::Application);
489
- for (int j = 0 ; j < 3 ; j++)
490
- {
491
- utils::ILogger::instance->info (std::format (" times: {}" , j), utils::ILogger::eCategory::Application);
492
-
493
- drv.play (i);
494
- while (drv.isPlaying ())
495
- {
496
- utils::delayMillis (200 );
497
- SDL_Event e;
498
- while (SDL_PollEvent (&e))
499
- switch (e.type )
500
- {
501
- case SDL_QUIT:
502
- goto QUIT;
503
- case SDL_KEYDOWN:
504
- // case SDL_KEYUP:
505
- if (e.key .keysym .sym == SDLK_ESCAPE)
506
- goto QUIT;
507
- if (e.key .keysym .sym == SDLK_RETURN)
508
- drv.stop ();
509
- break ;
510
-
511
- default :
512
- std::cout << " event: " << e.type << std::endl;
513
- }
514
- }
515
- }
516
- drv.stopAllChannels ();
517
- utils::delayMillis (1000 );
518
- }
519
- }
520
- QUIT:
521
- SDL_DestroyWindow (window);
522
- }
523
-
524
- void vocdune2filestest ()
525
- {
526
- auto mixer = audio::make_mixer<audio::sdl2::Mixer>(8 , 44100 , 1024 );
527
- mixer->init ();
528
-
529
- auto device = devices::make_device<devices::Adlib, devices::Opl>(mixer);
530
- drivers::PCMDriver drv (mixer);
531
-
532
- SDL_InitSubSystem (SDL_INIT_EVENTS);
533
- SDL_InitSubSystem (SDL_INIT_VIDEO);
534
-
535
- auto window = SDL_CreateWindow (" a" , 0 , 0 , 320 , 200 , 0 );
536
-
537
- for (auto const & dir_entry : std::filesystem::directory_iterator{ " voc/" })
538
- {
539
- const std::string fn = dir_entry.path ().string ();
540
- utils::ILogger::instance->info (std::format (" opening file: {}" , fn), utils::ILogger::eCategory::Application);
541
- auto vocf = std::make_shared<files::VOCFile>(fn);
542
-
543
- for (int j = 0 ; j < 10 ; j++)
544
- {
545
- utils::ILogger::instance->info (std::format (" times: {}" , j), utils::ILogger::eCategory::Application);
546
-
547
- drv.play (vocf->getSound ());
548
- while (drv.isPlaying ())
549
- {
550
- // utils::delayMillis(200);
551
- SDL_Event e;
552
- while (SDL_PollEvent (&e))
553
- switch (e.type )
554
- {
555
- case SDL_QUIT:
556
- goto QUIT;
557
- case SDL_KEYDOWN:
558
- // case SDL_KEYUP:
559
- if (e.key .keysym .sym == SDLK_ESCAPE)
560
- goto QUIT;
561
- if (e.key .keysym .sym == SDLK_RETURN)
562
- drv.stop ();
563
- break ;
564
-
565
- default :
566
- std::cout << " event: " << e.type << std::endl;
567
- }
568
- }
569
- }
570
- utils::delayMillis (1000 );
571
- }
572
- QUIT:
573
- SDL_DestroyWindow (window);
574
- }
449
+ // void vocdune2filestest()
450
+ // {
451
+ // auto mixer = audio::make_mixer<audio::sdl2::Mixer>(8, 44100, 1024);
452
+ // mixer->init();
453
+ //
454
+ // auto device = devices::make_device<devices::Adlib, devices::Opl>(mixer);
455
+ // drivers::PCMDriver drv(mixer);
456
+ //
457
+ // SDL_InitSubSystem(SDL_INIT_EVENTS);
458
+ // SDL_InitSubSystem(SDL_INIT_VIDEO);
459
+ //
460
+ // auto window = SDL_CreateWindow("a", 0, 0, 320, 200, 0);
461
+ //
462
+ // for (auto const& dir_entry : std::filesystem::directory_iterator{ "voc/" })
463
+ // {
464
+ // const std::string fn = dir_entry.path().string();
465
+ // utils::ILogger::instance->info(std::format("opening file: {}", fn), utils::ILogger::eCategory::Application);
466
+ // auto vocf = std::make_shared<files::VOCFile>(fn);
467
+ //
468
+ // for (int j = 0; j < 10; j++)
469
+ // {
470
+ // utils::ILogger::instance->info(std::format("times: {}", j), utils::ILogger::eCategory::Application);
471
+ //
472
+ // drv.play(vocf->getSound());
473
+ // while (drv.isPlaying())
474
+ // {
475
+ // //utils::delayMillis(200);
476
+ // SDL_Event e;
477
+ // while (SDL_PollEvent(&e))
478
+ // switch (e.type)
479
+ // {
480
+ // case SDL_QUIT:
481
+ // goto QUIT;
482
+ // case SDL_KEYDOWN:
483
+ // //case SDL_KEYUP:
484
+ // if (e.key.keysym.sym == SDLK_ESCAPE)
485
+ // goto QUIT;
486
+ // if (e.key.keysym.sym == SDLK_RETURN)
487
+ // drv.stop();
488
+ // break;
489
+ //
490
+ // default:
491
+ // std::cout << "event: " << e.type << std::endl;
492
+ // }
493
+ // }
494
+ // }
495
+ // utils::delayMillis(1000);
496
+ // }
497
+ // QUIT:
498
+ // SDL_DestroyWindow(window);
499
+ // }
575
500
576
501
/* *
577
502
* @brief Program entry point that runs selected test routines.
0 commit comments