You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you call play3d with a volume of 0.0 and then fade the resulting sound, no audio will be heard until a call is made to set3dListenerPosition.
Steps To Reproduce
Enter the following cod.
Run the program.
Click the "Play sound" button.
Hear nothing.
Click the "Set listener position" button.
Hear sound.
import'package:flutter/material.dart';
import'package:flutter_soloud/flutter_soloud.dart';
voidmain() {
runApp(constMyApp());
}
classMyAppextendsStatelessWidget {
constMyApp({super.key});
// This widget is the root of your application.@overrideWidgetbuild(BuildContext context) {
returnMaterialApp(
title:'Flutter Demo',
theme:ThemeData(
// This is the theme of your application.//// TRY THIS: Try running your application with "flutter run". You'll see// the application has a purple toolbar. Then, without quitting the app,// try changing the seedColor in the colorScheme below to Colors.green// and then invoke "hot reload" (save your changes or press the "hot// reload" button in a Flutter-supported IDE, or press "r" if you used// the command line to start the app).//// Notice that the counter didn't reset back to zero; the application// state is not lost during the reload. To reset the state, use hot// restart instead.//// This works for code too, not just values: Most code changes can be// tested with just a hot reload.
colorScheme:ColorScheme.fromSeed(seedColor:Colors.deepPurple),
useMaterial3:true,
),
home:constMyHomePage(),
);
}
}
classMyHomePageextendsStatefulWidget {
/// Create an instance.constMyHomePage({
super.key,
});
/// Create state for this widget.@overrideMyHomePageStatecreateState() =>MyHomePageState();
}
/// State for [MyHomePage].classMyHomePageStateextendsState<MyHomePage> {
/// Build a widget.@overrideWidgetbuild(BuildContext context) {
final soLoud =SoLoud.instance;
returnScaffold(
appBar:AppBar(
title:Text('Example'),
),
body:Column(
children: [
TextButton(
onPressed: () async {
await soLoud.init();
final source =await soLoud.loadUrl(
'https://file-examples.com/storage/fe602ed48f677b2319947f8/2017/11/file_example_MP3_700KB.mp3',
);
final handle =await soLoud.play3d(
source,
0.0,
0.0,
0.0,
looping:true,
volume:0.0,
);
soLoud.fadeVolume(handle, 1.0, Duration(seconds:3));
},
autofocus:true,
child:Text('Play sound'),
),
TextButton(
onPressed: () => soLoud.set3dListenerPosition(0.0, 0.0, 0.0),
child:Text('Set listener position'),
)
],
),
);
}
}
Expected Behavior
You should hear the sound slowly fading up.
Additional Context
There may be a better way to fade sounds up, but I don't know about it.
The text was updated successfully, but these errors were encountered:
this seems a bug in the C++ SoLoud lib. When using 3D sound, the doc says:
By default, if a sound is inaudible, it's paused, and will resume when it becomes audible again.
That setinaudiblebehavior function is already on the main branch, but not yet on pub.dev. This function works when you already have a sound handle, I need to add the counterpart for the AudioSource that should prevent this issue.
A sound becomes inaudible when the volume goes below 0.01 and maybe something wrong happens here when using 0.
To temporarily solve this issue, please play the sound starting with a volume of 0.01.
Description
If you call
play3d
with avolume
of0.0
and then fade the resulting sound, no audio will be heard until a call is made toset3dListenerPosition
.Steps To Reproduce
Expected Behavior
You should hear the sound slowly fading up.
Additional Context
There may be a better way to fade sounds up, but I don't know about it.
The text was updated successfully, but these errors were encountered: