Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - s.baus

Pages: 1 [2] 3
16
DotNet / Performanceproblems with 2.2?
« on: March 18, 2015, 03:11:10 pm »
Hello everybody,

I'm facing performanceproblems when setting the PlayingOffset with 2.2. Is there anything known? With an ogg file with a length of about 2 hours, setting the PlayingOffset to lets say about 1hour 30 minutes, I need to wait about 30 seconds for the code to run on. Is anybody facing this problem?

Thanks for your help
Sven

17
DotNet / Re: Setting PlayingOffset before starting playback
« on: October 30, 2014, 08:04:53 am »
Are you using the latest version of SFML (the C++ version which gets used by the CSFML wrapper)? This issue has been fixed in master, so you might want to upgrade.
I use the SFML Binaries provided by SFML.Net package (in /ext/lib) on Windows, and on Linux the standard package of SFML 2.1. Was the bug fixed in 2.1 already, or is the fix in the master branch beyond version 2.1?

Thanks for your information :).

18
DotNet / Setting PlayingOffset before starting playback
« on: October 28, 2014, 07:34:57 pm »
Hello everybody,

I'm using SFML in my Cuesheet Application and have problem with audio playback. I want to start the playback at an offset, which is not the start of the file. Therefore I use this code:

if (this.music != null)
            {
                this.music.PlayingOffset = offset;
                this.music.Play();
                this.music.Volume = this.fVolume;
                this.tUpdateGUI.Start();
                playing = true;
            }

But the playback starts at the beginning, not the offset. Any idea why? Thanks for your help :).

Sven

19
DotNet / Re: Problems with NLayer: System.IO.EndOfStreamException
« on: September 14, 2014, 07:04:58 pm »
NLayer had a bug with seeking, so the problem was there. Just for your information, everybody having this problem needs to update NLayer ;).

20
DotNet / Re: Problems with NLayer: System.IO.EndOfStreamException
« on: September 11, 2014, 07:53:02 pm »
Thanks for your help. But I already check if the seeking is beyond the end of the file.

What I found out, is that it works, if I reset the reference of this.mp3file everytime "OnSeek" is called. But that is a bit bad, to throw the object away everytime. Also the error comes more often if I trigger seeking faster (more times a second) than if I seek just once every ten seconds. Maybe it has something to do with the threads of SFML? I doesn't really know, how the multithreading of SFML works. Any idea?

Thanks for every help.

21
DotNet / Re: Problems with NLayer: System.IO.EndOfStreamException
« on: September 09, 2014, 07:24:55 pm »
No one any idea? We are searching for the problem, but have no idea, why it sometimes works, sometimes not :(.

22
DotNet / Problems with NLayer: System.IO.EndOfStreamException
« on: September 05, 2014, 11:56:41 am »
Hello,

I implemented a SoundStream which can read MP3 Codec via Nlayer (https://nlayer.codeplex.com/). It works fine, but sometimes I get a System.IO.EndOfStreamException from NLayer. It appers randomly and the developer is not shure, where it comes from, so I wanted to ask here, if you see any errors in my implementation:

namespace AudioCuesheetEditor.AudioBackend.SFML
{
    /// <summary>
    /// Class for mp3 decoded audio files to use in SFML as Soundstream, since SFML doesn't support mp3 decoding (for legal reasons).
    /// </summary>
    public class Mp3StreamSFML : SoundStream
    {
        private static readonly Logfile log = Logfile.getLogfile(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
        private MpegFile mp3file;
        private Mutex mutex;

        /// <summary>
        /// Initializes a new instance of the <see cref="AudioCuesheetEditor.AudioBackend.SFML.Mp3StreamSFML"/> class.
        /// </summary>
        /// <param name="_filename">Full path to the file</param>
        public Mp3StreamSFML(String _filename)
        {
            log.debug("Constructor called with " + _filename);
            this.mp3file = new MpegFile(_filename);
            this.Initialize((uint)this.mp3file.Channels, (uint)this.mp3file.SampleRate);
            this.mutex = new Mutex();
        }

        public TimeSpan Duration
        {
            get
            {
                log.debug("Duration = " + this.mp3file.Duration);
                return this.mp3file.Duration;
            }
        }

        #region implemented abstract members of SoundStream

        protected override bool OnGetData(out short[] samples)
        {
            log.debug("OnGetData called");
            this.mutex.WaitOne();
            //Buffer data for about 1 second
            float[] normalizedaudiodata = new float[48000];
            int readSamples = this.mp3file.ReadSamples(normalizedaudiodata, 0, normalizedaudiodata.Length);
            short[] pcmaudiodata;
            if (readSamples > 0)
            {
                pcmaudiodata = new short[readSamples]; // converted data
                for (int i = 0; i < readSamples; i++)
                {
                    // clip the data
                    if (normalizedaudiodata[i] > 1.0f)
                    {
                        normalizedaudiodata[i] = 1.0f;
                    }
                    else
                    {
                        if (normalizedaudiodata[i] < -1.0f)
                        {
                            normalizedaudiodata[i] = -1.0f;
                        }
                    }
                    // convert to pcm data
                    pcmaudiodata[i] = (short)(normalizedaudiodata[i] * short.MaxValue);
                }
                samples = pcmaudiodata;
                this.mutex.ReleaseMutex();
                return true;
            }
            else
            {
                samples = null;
                this.mutex.ReleaseMutex();
                return false;
            }
        }

        protected override void OnSeek(TimeSpan timeOffset)
        {
            log.debug("OnSeek called with " + timeOffset);
            this.mutex.WaitOne();
            if ((timeOffset <= this.mp3file.Duration) && (timeOffset >= TimeSpan.Zero))
            {
                while (this.mp3file.CanSeek == false)
                {
                    Thread.Sleep(100);
                }
                this.mp3file.Time = timeOffset;
            }
            this.mutex.ReleaseMutex();
        }

        #endregion
    }
}

Exception:

Quote
16.07.2014 15:47:37 AudioCuesheetEditor.AudioBackend.SFML.Mp3StreamSFML: ERROR | System.IO.EndOfStreamException: Es wurde versucht, über das Ende des Datenstroms hinaus zu lesen.
bei NLayer.Decoder.MpegFrame.ReadBits(Int32 bitCount) in d:\tmp\AudioCuesheetEditor\src\NLayer\Decoder\MpegFrame.cs:Zeile 528.
bei NLayer.Decoder.LayerIIIDecoder.ReadSideInfo(IMpegFrame frame) in d:\tmp\AudioCuesheetEditor\src\NLayer\Decoder\LayerIIIDecoder.cs:Zeile 687.
bei NLayer.Decoder.LayerIIIDecoder.DecodeFrame(IMpegFrame frame, Single[] ch0, Single[] ch1) in d:\tmp\AudioCuesheetEditor\src\NLayer\Decoder\LayerIIIDecoder.cs:Zeile 502.
bei NLayer.MpegFrameDecoder.DecodeFrameImpl(IMpegFrame frame, Array dest, Int32 destOffset) in d:\tmp\AudioCuesheetEditor\src\NLayer\MpegFrameDecoder.cs:Zeile 110.
bei NLayer.MpegFrameDecoder.DecodeFrame(IMpegFrame frame, Single[] dest, Int32 destOffset) in d:\tmp\AudioCuesheetEditor\src\NLayer\MpegFrameDecoder.cs:Zeile 74.
bei NLayer.MpegFile.set_Position(Int64 value) in d:\tmp\AudioCuesheetEditor\src\NLayer\MpegFile.cs:Zeile 92.
bei NLayer.MpegFile.set_Time(TimeSpan value) in d:\tmp\AudioCuesheetEditor\src\NLayer\MpegFile.cs:Zeile 107.
bei AudioCuesheetEditor.AudioBackend.SFML.Mp3StreamSFML.OnSeek(TimeSpan timeOffset) in d:\tmp\AudioCuesheetEditor\src\AudioCuesheetEditor\AudioBackend\SFML\Mp3StreamSFML.cs:Zeile 92.

My code can be found here (for further searching): http://sourceforge.net/p/audiocuesheet/code/HEAD/tree/trunk/

I'm looking forward to hearing from you ;).

Greets
Sven

23
DotNet / Re: Update GUI from AudioManager
« on: July 16, 2014, 08:32:57 pm »
Ok, I hope this code helps a bit to understand what I'm trying to achieve:

namespace AudioCuesheetEditor.AudioBackend
{
    public class AudioManagerSFML : AudioManager
    {
[...]
private bool checkAndPlayMusic(TimeSpan offset)
        {
            log.debug("checkAndPlayMusic called with " + offset);
            bool playing = false;
            //Always set the music, because the user might have changed it
            this.setMusic();
            if (this.music != null)
            {
                this.music.PlayingOffset = offset;
                this.music.Play();
                Timer tUpdateGUI = new Timer(1000);
                tUpdateGUI.Elapsed += delegate(object sender, ElapsedEventArgs e)
                {
                    log.debug("updateGUI");
                    Gtk.Application.Invoke(delegate {
                        this.objProgram.getObjMainWindow().updateAudiodataOnGUI();
                    });
                    if ((this.getPlayState() == PlayState.Paused) || (this.getPlayState() == PlayState.Stopped))
                    {
                        this.stop();
                    }
                };
                tUpdateGUI.AutoReset = true;
                tUpdateGUI.Start();
                playing = true;
            }
            return playing;
        }
[...]
    }
}

public partial class MainWindow : Gtk.Window
{
[...]
public void updateAudiodataOnGUI()
    {
        this.entAudiofilePosition.Text = this.objProgram.getAudioManager().getPosition().ToString();
    }
[...]
}

First enter of checkAndPlayMusic works fine, the music starts, the function gets called, and the log messages come. If I want to use this.music.pause(), it doesn't react, the breakpoint is never reached. Any ideas, why?

24
DotNet / Re: Update GUI from AudioManager
« on: July 16, 2014, 12:40:34 pm »
Well it seems like it  just doesn't react to pause() or stop(), but if I ask for play() another thread starts and plays also the music, so that 2 musics are played.

25
DotNet / Update GUI from AudioManager
« on: July 16, 2014, 11:42:08 am »
Hello everybody,

I want to use SFML in my little application, and have done some bindings. The application is written in C#, uses Mono on Linux and .NET on Windows. Now I want to update the GUI (Mainwindow) so it can display the current position. Therefore I wanted to add a thread in my audiomanager, that periodically triggers the GUI to grab new values (1 time a second), but that fails, since the thread of SFML seems to get out of control. Have you ever done something like this? How do others implement audio players? Any examples are welcome.
I hope you understand what I want to achieve, otherwise ask ;).
Greetings
Sven

26
DotNet / Re: EntryPointNotFoundException on Mono (Linux)
« on: July 11, 2014, 02:21:18 pm »
Thanks for the friendly answer. I didn't know, that CSFML != SFML and thought SFML == CSFML. But now I know, they aren't the same, downloaded the C binding for SFML and could get SFML.Net to work on Linux. Thank you and have a great weekend ;).

27
DotNet / Re: EntryPointNotFoundException on Mono (Linux)
« on: July 11, 2014, 01:02:18 pm »
Hello,

thanks for your help. I already installed SFML Package for Fedora provided by Fedora. In the files list, the libraries above are mentioned. They are packaged as the official SFML libraries found here http://sfml-dev.org/download/sfml/2.1/. So, why should I map to libcsfml-xxx instead of libsfml-xxx? This makes no sense in my opinion. Could someone please tell my how to do a correct mapping?

Thanks in advance
Sven

28
DotNet / Re: EntryPointNotFoundException on Mono (Linux)
« on: July 10, 2014, 07:59:27 am »
You need to remap to CSFML, not just SFML.
Well, I install SFML Package from Fedora provided, and there are no csfml libraries:
  • /usr/lib64/libsfml-audio.so.2
    /usr/lib64/libsfml-audio.so.2.0
    /usr/lib64/libsfml-graphics.so.2
    /usr/lib64/libsfml-graphics.so.2.0
    /usr/lib64/libsfml-network.so.2
    /usr/lib64/libsfml-network.so.2.0
    /usr/lib64/libsfml-system.so.2
    /usr/lib64/libsfml-system.so.2.0
    /usr/lib64/libsfml-window.so.2
    /usr/lib64/libsfml-window.so.2.0

If I do the following mapping
Quote
<configuration>
   <dllmap dll="csfml-audio-2" target="libcsfml-audio.so.2" os="linux"/>
   <dllmap dll="csfml-window-2" target="libcsfml-window.so.2" os="linux"/>
   <dllmap dll="csfml-graphics-2" target="libcsfml-graphics.so.2" os="linux" />
</configuration>
I get this exception:
Quote
[sven@localhost AudioCuesheetEditor-linux-v1.1.3]$ mono AudioCuesheetEditor.exe

(AudioCuesheetEditor:1817): GLib-GObject-WARNING **: invalid unclassed pointer in cast to `GdkWindow'

(AudioCuesheetEditor:1817): GLib-GObject-CRITICAL **: g_object_unref: assertion `G_IS_OBJECT (object)' failed
Marshaling clicked signal
Exception in Gtk# callback delegate
  Note: Applications can use GLib.ExceptionManager.UnhandledException to handle the exception.
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.DllNotFoundException: libcsfml-audio.so.2
  at (wrapper managed-to-native) SFML.Audio.Music:sfMusic_createFromFile (string)
  at SFML.Audio.Music..ctor (System.String filename) [0x00000] in <filename unknown>:0
  at AudioCuesheetEditor.AudioBackend.SFML.CustomMusicSFML..ctor (System.String filePath) [0x00000] in <filename unknown>:0
  at AudioCuesheetEditor.AudioBackend.AudioManagerSFML.setMusic () [0x00000] in <filename unknown>:0
  at AudioCuesheetEditor.AudioBackend.AudioManagerSFML.checkAndPlayMusic (TimeSpan offset) [0x00000] in <filename unknown>:0
  at AudioCuesheetEditor.AudioBackend.AudioManagerSFML.play () [0x00000] in <filename unknown>:0
  at MainWindow.btnPlayPauseClicked (System.Object sender, System.EventArgs e) [0x00000] in <filename unknown>:0
  at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0
  --- End of inner exception stack trace ---
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0
  at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in <filename unknown>:0
  at System.Delegate.DynamicInvokeImpl (System.Object[] args) [0x00000] in <filename unknown>:0
  at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x00000] in <filename unknown>:0
  at System.Delegate.DynamicInvoke (System.Object[] args) [0x00000] in <filename unknown>:0
  at GLib.Signal.ClosureInvokedCB (System.Object o, GLib.ClosureInvokedArgs args) [0x00000] in <filename unknown>:0
  at GLib.SignalClosure.Invoke (GLib.ClosureInvokedArgs args) [0x00000] in <filename unknown>:0
  at GLib.SignalClosure.MarshalCallback (IntPtr raw_closure, IntPtr return_val, UInt32 n_param_vals, IntPtr param_values, IntPtr invocation_hint, IntPtr marshal_data) [0x00000] in <filename unknown>:0
   at GLib.ExceptionManager.RaiseUnhandledException(System.Exception e, Boolean is_terminal)
   at GLib.SignalClosure.MarshalCallback(IntPtr raw_closure, IntPtr return_val, UInt32 n_param_vals, IntPtr param_values, IntPtr invocation_hint, IntPtr marshal_data)
   at Gtk.Application.gtk_main()
   at Gtk.Application.Run()
   at AudioCuesheetEditor.MainClass.Main(System.String[] args)
So I wouldn't say its a mapping problem. Or where is the error?

29
DotNet / EntryPointNotFoundException on Mono (Linux)
« on: July 09, 2014, 09:14:26 am »
Hello,

I'm facing a EntryPointNotFoundException, when trying to run SFML.Net on Mono (Fedora Linux). I have installed the SFML package, have packed the SFML.Net libraries with my application and did a dllconfig:

sfmlnet-audio-2.dll.config:
Quote
<configuration>
   <dllmap dll="csfml-audio-2" target="libsfml-audio.so.2" os="linux"/>
   <dllmap dll="csfml-window-2" target="libsfml-window.so.2" os="linux"/>
   <dllmap dll="csfml-graphics-2" target="libsfml-graphics.so.2" os="linux" />
</configuration>

If I enter the code, where sound should be played, I get this Exception:
Quote
[sven@localhost AudioCuesheetEditor-linux-v1.1.3]$ mono AudioCuesheetEditor.exe
Marshaling clicked signal
Exception in Gtk# callback delegate
  Note: Applications can use GLib.ExceptionManager.UnhandledException to handle the exception.
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.EntryPointNotFoundException: sfMusic_createFromFile
  at (wrapper managed-to-native) SFML.Audio.Music:sfMusic_createFromFile (string)
  at SFML.Audio.Music..ctor (System.String filename) [0x00000] in <filename unknown>:0
  at AudioCuesheetEditor.AudioBackend.SFML.CustomMusicSFML..ctor (System.String filePath) [0x00000] in <filename unknown>:0
  at AudioCuesheetEditor.AudioBackend.AudioManagerSFML.setMusic () [0x00000] in <filename unknown>:0
  at AudioCuesheetEditor.AudioBackend.AudioManagerSFML.checkAndPlayMusic (TimeSpan offset) [0x00000] in <filename unknown>:0
  at AudioCuesheetEditor.AudioBackend.AudioManagerSFML.play () [0x00000] in <filename unknown>:0
  at MainWindow.btnPlayPauseClicked (System.Object sender, System.EventArgs e) [0x00000] in <filename unknown>:0
  at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0
  --- End of inner exception stack trace ---
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0
  at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in <filename unknown>:0
  at System.Delegate.DynamicInvokeImpl (System.Object[] args) [0x00000] in <filename unknown>:0
  at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x00000] in <filename unknown>:0
  at System.Delegate.DynamicInvoke (System.Object[] args) [0x00000] in <filename unknown>:0
  at GLib.Signal.ClosureInvokedCB (System.Object o, GLib.ClosureInvokedArgs args) [0x00000] in <filename unknown>:0
  at GLib.SignalClosure.Invoke (GLib.ClosureInvokedArgs args) [0x00000] in <filename unknown>:0
  at GLib.SignalClosure.MarshalCallback (IntPtr raw_closure, IntPtr return_val, UInt32 n_param_vals, IntPtr param_values, IntPtr invocation_hint, IntPtr marshal_data) [0x00000] in <filename unknown>:0
   at GLib.ExceptionManager.RaiseUnhandledException(System.Exception e, Boolean is_terminal)
   at GLib.SignalClosure.MarshalCallback(IntPtr raw_closure, IntPtr return_val, UInt32 n_param_vals, IntPtr param_values, IntPtr invocation_hint, IntPtr marshal_data)
   at Gtk.Application.gtk_main()
   at Gtk.Application.Run()
   at AudioCuesheetEditor.MainClass.Main(System.String[] args)
Has anybody had this? Am I doing something wrong in the dll config? Thanks for any help.

30
DotNet / Re: NLayer MpegFile to SFML.Net SoundStream
« on: July 09, 2014, 09:11:03 am »
No Problem, you helped me really much ;). How can calculate the sound buffer size to have 1 second of data?

Pages: 1 [2] 3
anything