BGE Sound #39122

Closed
opened 2014-03-11 21:50:59 +01:00 by Richard R · 13 comments

System Information
WIndows 7 ult, 2.4ghz celeron cpu, 2gb ram, Geforce 8400 GS

Blender Version
2.7

Short description of error
In python, a call to stopSound just restarts the sound. Calling pauseSound does nothing. Calling deactivate from the controller doesn't stop the sound either.

Exact steps for others to reproduce the error
In the Text Editor, add a new Text and type in the following:

from bge import logic

cont = logic.getCurrentController()
actSound = cont.actuators['Sound']

if cont.sensors['Always'].positive:

  actSound.startSound()

if cont.sensors['Message'].positive:

  actSound.stopSound()

Create any object (an Empty for example). Attach an "Always" sensor, hook it to a "Python" controller, than hook that to a "Sound" actuator. Set the Python Text block to "Text" or whatever you named our script. Set the Sound file to whatever sound you want to use (an mp3 type file since that is what I used). Set the "Play Mode" to "Loop End". Add a "Message" sensor and hook it to the "Python" controller. Set the Subject to "Test" without the quotes.

Create another object. Add a "Delay" sensor. Set the Delay parameter to 200. Attach it to a "And" controller, then attach that to a "Message" actuator. Set the "Message" actuator's "To" block to the first object you made, then type "Test" in the "Subject" field without the quotes. Start the game engine. Your sound will start playing immediately. After a few seconds, it will restart instead of stop.

**System Information** WIndows 7 ult, 2.4ghz celeron cpu, 2gb ram, Geforce 8400 GS **Blender Version** 2.7 **Short description of error** In python, a call to stopSound just restarts the sound. Calling pauseSound does nothing. Calling deactivate from the controller doesn't stop the sound either. **Exact steps for others to reproduce the error** In the Text Editor, add a new Text and type in the following: from bge import logic cont = logic.getCurrentController() actSound = cont.actuators['Sound'] if cont.sensors['Always'].positive: ``` actSound.startSound() ``` if cont.sensors['Message'].positive: ``` actSound.stopSound() ``` Create any object (an Empty for example). Attach an "Always" sensor, hook it to a "Python" controller, than hook that to a "Sound" actuator. Set the Python Text block to "Text" or whatever you named our script. Set the Sound file to whatever sound you want to use (an mp3 type file since that is what I used). Set the "Play Mode" to "Loop End". Add a "Message" sensor and hook it to the "Python" controller. Set the Subject to "Test" without the quotes. Create another object. Add a "Delay" sensor. Set the Delay parameter to 200. Attach it to a "And" controller, then attach that to a "Message" actuator. Set the "Message" actuator's "To" block to the first object you made, then type "Test" in the "Subject" field without the quotes. Start the game engine. Your sound will start playing immediately. After a few seconds, it will restart instead of stop.
Author

Changed status to: 'Open'

Changed status to: 'Open'
Author

Added subscriber: @remnar

Added subscriber: @remnar
Author

This is not the place to post this (don't know where to post) but it needs to be addressed:

My first report had some bad formatting because I didn't know that tabs and using # comment lines would produce an issue. Now that I replaced tabs with spaces, it still formats it wrong.

In the user settings of this website, in the drop down list for what time zone I'm in, there is no setting for United States - Seattle or anything for Pacific Northwest I recognize. I used Vancouver because it was closest.

This is not the place to post this (don't know where to post) but it needs to be addressed: My first report had some bad formatting because I didn't know that tabs and using # comment lines would produce an issue. Now that I replaced tabs with spaces, it still formats it wrong. In the user settings of this website, in the drop down list for what time zone I'm in, there is no setting for United States - Seattle or anything for Pacific Northwest I recognize. I used Vancouver because it was closest.

Added subscriber: @mont29

Added subscriber: @mont29

Added subscriber: @Moguri

Added subscriber: @Moguri

For issues with Phabricator, submit a task under the Websites project: https://developer.blender.org/maniphest/project/31/

For issues with Phabricator, submit a task under the Websites project: https://developer.blender.org/maniphest/project/31/

Could you please provide an example blend file demonstrating the problem?

Could you please provide an example blend file demonstrating the problem?

Added subscriber: @Sergey

Added subscriber: @Sergey

As was mentioned, we do need .blend fiel which demonstrates the issue.

As was mentioned, we do need .blend fiel which demonstrates the issue.
Member

Added subscriber: @JorgeBernalMartinez

Added subscriber: @JorgeBernalMartinez
Member

This is not a bug. I attach the .blend that you are describing.
In that case the "actSound.stopSound()" is called only one time because the menssage sensor is positive when it receive the menssage from message actuator only. The remaining time is false.
Due to this and that we also have an always sensor conected to an "actSound.startSound()" you will have the following procedure:

1º - always.positive -> startsound
2º - when delay = 200 --> stop.sound (only one time)
3º - As always is positive yet -> startsound

file.blend

This is not a bug. I attach the .blend that you are describing. In that case the "actSound.stopSound()" is called only one time because the menssage sensor is positive when it receive the menssage from message actuator only. The remaining time is false. Due to this and that we also have an always sensor conected to an "actSound.startSound()" you will have the following procedure: 1º - always.positive -> startsound 2º - when delay = 200 --> stop.sound (only one time) 3º - As always is positive yet -> startsound [file.blend](https://archive.blender.org/developer/F82334/file.blend)

Changed status from 'Open' to: 'Archived'

Changed status from 'Open' to: 'Archived'
Bastien Montagne self-assigned this 2014-04-01 15:01:03 +02:00

Closing, then (and no answer since over a week anyway)…

Closing, then (and no answer since over a week anyway)…
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
5 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#39122
No description provided.