ziggurat_sounds 0.29.0 copy "ziggurat_sounds: ^0.29.0" to clipboard
ziggurat_sounds: ^0.29.0 copied to clipboard

discontinuedreplaced by: ziggurat

Provide sound support for [Ziggurat](https://github.com/chrisnorman7/ziggurat).

ziggurat_sounds #

Description #

This package provides sound support for the ziggurat package.

It works by way of the SoundManager class:

import 'dart:math';

import 'package:dart_sdl/dart_sdl.dart';
import 'package:dart_synthizer/dart_synthizer.dart';
import 'package:ziggurat/ziggurat.dart';
import 'package:ziggurat_sounds/src/buffer_cache.dart';
import 'package:ziggurat_sounds/src/sound_manager.dart';

final synthizer = Synthizer()..initialize();
final context = synthizer.createContext();
final sdl = Sdl()..init();
final game = Game(
  title: 'ziggurat_sounds example',
  sdl: sdl,
);
final bufferCache = BufferCache(
  synthizer: synthizer,
  maxSize: pow(1024, 3).floor(),
  random: game.random,
);
final soundManager = SoundManager(
  game: game,
  context: context,
  bufferCache: bufferCache,
);

You can then attach your SoundManager instance to your Game instance:

void main() {
  game.sounds.listen(
    (final event) {
      print('Sound: $event');
      soundManager.handleEvent(event);
    },
    onDone: () => print('Sound done.'),
    onError: (e, s) {
      print('Sound error: $e');
      if (s != null) {
        print(s);
      }
    },
  );
}
1
likes
135
points
147
downloads

Publisher

verified publisherbackstreets.site

Weekly Downloads

Provide sound support for [Ziggurat](https://github.com/chrisnorman7/ziggurat).

Repository (GitHub)
View/report issues

Documentation

API reference

License

MPL-2.0 (license)

Dependencies

dart_synthizer, encrypt, json_annotation, path, ziggurat

More

Packages that depend on ziggurat_sounds