nativemind_sound_generator 1.1.0
nativemind_sound_generator: ^1.1.0 copied to clipboard
Tone generator plugin of NativeMind: sound_generator 0.0.5 by Mert Güner (MIT) with Anton Dodonov's MULTI generator (Android DSP, 2021–22, harmonics gain 2025) and the iOS AudioKit settings of 2021; i [...]
example/lib/main.dart
// Harness: renders the iScillator editions (vl / pro / lite / dev) of Anton Dodonov's configuration (trimmed, neutral
// fixture) through core NmConfigs on the carried widgets of nativemind_sound and plays through the plugin.
// Edition: --dart-define=NM_EDITION=<bundle id> (Anton's config_current), or the chooser in the app bar.
// written by Claude Code (generated by Claude Code), 2026-10-13; SDD: flows/sdd-widgets-handmade
import 'package:flutter/material.dart';
import 'package:nativemind_core/nativemind_core.dart';
import 'package:nativemind_sound/nativemind_sound.dart';
import 'package:nativemind_sound_generator/nativemind_sound_generator.dart';
import 'iscillator_editions.dart' as fx;
/// Editions of the fixture.
final editions = NmConfigs({for (final e in fx.configs.entries) e.key: e.value as Map<String, dynamic>});
/// Edition names → bundle ids (Anton's `set_version_<ed>.sh`).
const editionIds = {'vl': 'com.iscillator', 'pro': 'com.soundhealer.pro', 'lite': 'com.soundhealer', 'dev': 'com.soundhealer.dev'};
// written by Claude Code (generated by Claude Code), 2026-10-13; SDD: flows/sdd-widgets-handmade
void main() => runApp(HarnessApp(engine: NmSoundGeneratorEngine()));
/// The harness app; [engine] is the plugin (tests pass a silent one).
// written by Claude Code (generated by Claude Code), 2026-10-13; SDD: flows/sdd-widgets-handmade
class HarnessApp extends StatefulWidget {
// written by Claude Code (generated by Claude Code), 2026-10-13; SDD: flows/sdd-widgets-handmade
const HarnessApp({super.key, required this.engine, this.edition});
/// Tone generator.
final NmSoundEngine engine;
/// Bundle id of the first edition (default: NM_EDITION or vl).
final String? edition;
// written by Claude Code (generated by Claude Code), 2026-10-13; SDD: flows/sdd-widgets-handmade
@override
State<HarnessApp> createState() => _HarnessAppState();
}
// written by Claude Code (generated by Claude Code), 2026-10-13; SDD: flows/sdd-widgets-handmade
class _HarnessAppState extends State<HarnessApp> {
late String _id = widget.edition ?? (NmConfigCurrent.id.isNotEmpty ? NmConfigCurrent.id : editionIds['vl']!);
late NmGlobals _globals = _make(_id);
// written by Claude Code (generated by Claude Code), 2026-10-13; SDD: flows/sdd-widgets-handmade
NmGlobals _make(String id) => NmGlobals.fromConfig(
editions.current(id: id),
buildName: '1.0.0',
buildNumber: 1,
strings: const NmSoundStrings(),
);
// written by Claude Code (generated by Claude Code), 2026-10-13; SDD: flows/sdd-widgets-handmade
void _switch(String id) => setState(() {
_id = id;
_globals = _make(id);
});
// written by Claude Code (generated by Claude Code), 2026-10-13; SDD: flows/sdd-widgets-handmade
@override
Widget build(BuildContext context) => MaterialApp(
debugShowCheckedModeBanner: false,
theme: ThemeData(primarySwatch: Colors.indigo),
builder: (context, child) => NmSoundScope(key: ValueKey(_id), globals: _globals, engine: widget.engine, child: child!),
home: HarnessScreen(edition: _id, onEdition: _switch),
);
}
/// Anton's _MainScreen.build (app bar, bottom bar, gradient body) plus an edition chooser.
// written by Claude Code (generated by Claude Code), 2026-10-13; SDD: flows/sdd-widgets-handmade
class HarnessScreen extends StatelessWidget {
// written by Claude Code (generated by Claude Code), 2026-10-13; SDD: flows/sdd-widgets-handmade
const HarnessScreen({super.key, required this.edition, required this.onEdition});
/// Current bundle id.
final String edition;
/// Switches the edition.
final ValueChanged<String> onEdition;
// written by Claude Code (generated by Claude Code), 2026-10-13; SDD: flows/sdd-widgets-handmade
@override
Widget build(BuildContext context) {
final g = NmGlobals.of(context);
final bar = nmMainAppBar(context);
return Scaffold(
appBar: AppBar(
title: bar.title,
actions: [
PopupMenuButton<String>(
key: const Key('edition'),
icon: const Icon(Icons.layers),
onSelected: onEdition,
itemBuilder: (_) => [for (final e in editionIds.entries) CheckedPopupMenuItem(value: e.value, checked: e.value == edition, child: Text(e.key))],
),
],
),
bottomNavigationBar: nmMyBottomNavigationBar(context),
body: Container(
alignment: Alignment.center,
decoration: BoxDecoration(gradient: g.config['gradient'] as Gradient?),
child: nmMainBody(context),
),
);
}
}