import 'package:soundpool/soundpool.dart';
import 'package:get/get.dart';
class PcmController extends GetxController {
Soundpool _pool;
int idMicUp;
SoundpoolOptions _soundpoolOptions =
SoundpoolOptions(streamType: StreamType.notification);
@override
void onInit() {
_pool = Soundpool.fromOptions(options: _soundpoolOptions);
_loadSounds();
super.onInit();
}
_loadSounds() async {
var asset = await rootBundle.load("assets/sounds/micUp.m4a");
idMicUp = await _pool.load(asset);
}
playSound() async {
await _pool.play(idMicUp);
}
}