Search
 
SCRIPT & CODE EXAMPLE
 

DART

flutter button sound effects

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);
  }
}
Comment

PREVIOUS NEXT
Code Example
Dart :: Flutter find if offset inside a polygon 
Dart :: how to get current timezone flutter 
Dart :: flutter cupertino theme 
Dart :: flutter constructors keep properties private with constructor 
Dart :: unexpected text late flutter 
Dart :: dart set union 
Dart :: flutter string add , for 1000 
Dart :: random element from list dart 
Dart :: constructor with different name flutter 
Dart :: return type of a function 
Dart :: flutter const advantag 
Dart :: package:grpc/grpc.dart import target uri doesnt exist 
Dart :: dart list get by index 
Swift :: swift uiview add tap gesture 
Swift :: Split a String into an array in Swift 
Swift :: show alert with textfield swift 
Swift :: swift ui image on button 
Swift :: swft imageä 
Swift :: change selection color uitableviewcell swift 
Swift :: white or light ASAuthorizationAppleIDButton “Sign in with Apple” button - Swift 
Swift :: save Codable in userdefaults and fetch codable from userdefaults ios swift 
Swift :: hide bottom tab bar swift 
Swift :: remove padding hstack swiftui 
Swift :: link swiftui 
Swift :: struct vs enum swift 
Swift :: swift get "system" asset image 
Swift :: swift 5 get app version 
Swift :: sf symbols 
Swift :: guard let swift 
Swift :: how to center vertically scrollview swiftui 
ADD CONTENT
Topic
Content
Source link
Name
4+1 =