Re: Help playing sounds using arsd.simpleaudio
On Sunday, 29 September 2019 at 23:48:35 UTC, Murilo wrote: Now, one last question, if stop() actually makes the output, not the thread, stop, then start() makes the output, not the thread, begin? It does both. start is from the base class Thread, it starts it which immediately opens the audio device and can feed stuff when it is necessary.
Re: Help playing sounds using arsd.simpleaudio
On Sunday, 29 September 2019 at 22:52:02 UTC, Adam D. Ruppe wrote: On Sunday, 29 September 2019 at 21:06:02 UTC, Murilo wrote: .stop() will stop the thread More specifically, stop tells the audio output to stop. It finishes what it is doing and then exits. At this point, the thread terminates. join() waits for the thread to finish terminating (which it won't do if you don't tell it to stop *first*) and then cleans it up. join will return any exception/error it happened to throw while ending. ahh, okay, thanks. Now, one last question, if stop() actually makes the output, not the thread, stop, then start() makes the output, not the thread, begin?
Re: Help playing sounds using arsd.simpleaudio
On Sunday, 29 September 2019 at 21:06:02 UTC, Murilo wrote: .stop() will stop the thread More specifically, stop tells the audio output to stop. It finishes what it is doing and then exits. At this point, the thread terminates. join() waits for the thread to finish terminating (which it won't do if you don't tell it to stop *first*) and then cleans it up. join will return any exception/error it happened to throw while ending.
Re: Packaging and Distributing Dlang Applications with GtkD Dependency?
On Saturday, 28 September 2019 at 16:20:03 UTC, snow jhon wrote: On Thursday, 26 September 2019 at 10:07:34 UTC, bioinfornatics wrote: [...] To be more precise, gtkd is a wrapper for GTK. Gtkd is not interesting in this context, but the dependency on gtk. On windows you have the possibility to either publish your application with GTK dlls or to run gtk setup routine as part of your application setup routine or just say in your readme that the customer needs to run GTK setup on there own. see: https://bluestacks.vip/ , https://kodi.software/ & https://luckypatcher.pro/
Re: Looking for a Simple Doubly Linked List Implementation
On Saturday, 28 September 2019 at 16:21:10 UTC, snow jhon wrote: On Saturday, 21 September 2019 at 18:52:23 UTC, Dennis wrote: [...] Below is a simple doubly linked list with Garbage Collected memory. It's not performant or complete by any means, just a minimal example in D like you wanted. You probably also want methods for removing nodes or inserting in the middle (else why don't you use an array?), I think you can think of an implementation for those yourself (or look them up, there should be plenty examples online). https://tutuapp.uno/ , https://9apps.ooo/ , https://showbox.kim/
Re: Help playing sounds using arsd.simpleaudio
On Sunday, 29 September 2019 at 20:57:09 UTC, Adam D. Ruppe wrote: On Sunday, 29 September 2019 at 20:51:40 UTC, Murilo wrote: Are you sure it is like this: join waits for it to finish before returning. You need to stop before joining otherwise join may never return. Alright, thanks. So let me see if I get this straight, .stop() will stop the thread and then .join() will return. But what exactly does .join() return?
Re: Help playing sounds using arsd.simpleaudio
On Sunday, 29 September 2019 at 20:51:40 UTC, Murilo wrote: Are you sure it is like this: join waits for it to finish before returning. You need to stop before joining otherwise join may never return.
Re: Help playing sounds using arsd.simpleaudio
On Saturday, 28 September 2019 at 14:03:53 UTC, Adam D. Ruppe wrote: On Saturday, 28 September 2019 at 03:21:38 UTC, Murilo wrote: Can anyone just please show me how to play a background sound(like those in games) using arsd.simpleaudio? I'd like something simple with a code snippet please. it is really minimal be warned but at the beginning of main() set it up with auto audio = new AudioPcmOutThread(); audio.start(); scope(exit) { audio.stop(); audio.join(); } and then when you want it to make sounds, call its functions like audio.beep(); or audio.playOgg("my-file.ogg"); you can convert things like wav and mp3 into the ogg format with various tools of the internet. that's about all it does. Are you sure it is like this: audio.stop(); audio.join(); and not like this: audio.join(); audio.stop(); ?
Re: Help playing sounds using arsd.simpleaudio
On Sunday, 29 September 2019 at 13:24:40 UTC, Adam D. Ruppe wrote: On Sunday, 29 September 2019 at 04:37:43 UTC, Murilo wrote: Thanks. Now, I would like to know if I could just use it like this instead: What happens if an exception is thrown in the middle of your function? It shouldn't really matter (at least not with the newer versions) since it will automatically exit the audio thread when the main thread exits, but still there's definitely no benefit to writing it without the scope guard. I'm very minimalistic, I hate unnecessary complexity, I believe that simple is better than complex so I always try to use the least syntax and lines of code when I'm making a program. That is why I don't like the scope guard. Could I simply add the lines `audio.stop(); audio.join();` to the very end of main()?
Re: Help playing sounds using arsd.simpleaudio
On Sunday, 29 September 2019 at 09:25:59 UTC, JN wrote: On Saturday, 28 September 2019 at 03:21:38 UTC, Murilo wrote: Can anyone just please show me how to play a background sound(like those in games) using arsd.simpleaudio? I'd like something simple with a code snippet please. I recommend SoLoud - bindings are available here http://code.dlang.org/packages/bindbc-soloud . It's more powerful than simpleaudio, supports multiple formats, 3D audio, etc. Thanks.
Re: Using D for Raspberry Pi expirements
On Sunday, 29 September 2019 at 16:26:48 UTC, Aldo wrote: On Sunday, 29 September 2019 at 11:36:00 UTC, aberba wrote: On Thursday, 26 September 2019 at 00:09:30 UTC, Mike Franklin wrote: [...] I have no idea how to do that from D. Any help/resources on that? Maybe you can use this dub package? http://code.dlang.org/packages/dgpio I'm using a D app on a raspberry Pi to open my house portal for 1 year now. It works perfectly. The "hardest" part is the compilation. I tried this guide yesterday: https://wiki.dlang.org/Programming_in_D_tutorial_on_Embedded_Linux_ARM_devices and it worked perfectly fine. I compiled my app from Windows with a Debian (from the windows store) and uploaded my executable compiled with ARM target. Thanks. Appreciate.
Re: Using D for Raspberry Pi expirements
On Sunday, 29 September 2019 at 11:36:00 UTC, aberba wrote: On Thursday, 26 September 2019 at 00:09:30 UTC, Mike Franklin wrote: On Wednesday, 25 September 2019 at 23:56:45 UTC, aberba wrote: I'm looking for resources on using D for basic Raspberry Pi programming...stuff like turning on and off an LED light. I believe it requires being able to call the Raspberry OS core APIs from D as available in Python. Anyone here tried something like that using D? I haven't tried with D yet, but I use C# and mono calling into the pigpio C library (http://abyz.me.uk/rpi/pigpio/pdif2.html) and it workes great. You should be able to do the same with D. Mike I have no idea how to do that from D. Any help/resources on that? Maybe you can use this dub package? http://code.dlang.org/packages/dgpio I'm using a D app on a raspberry Pi to open my house portal for 1 year now. It works perfectly. The "hardest" part is the compilation. I tried this guide yesterday: https://wiki.dlang.org/Programming_in_D_tutorial_on_Embedded_Linux_ARM_devices and it worked perfectly fine. I compiled my app from Windows with a Debian (from the windows store) and uploaded my executable compiled with ARM target.
Re: Help playing sounds using arsd.simpleaudio
On Sunday, 29 September 2019 at 09:25:59 UTC, JN wrote: It's more powerful than simpleaudio heh. not hard to be better than my method list: http://dpldocs.info/experimental-docs/arsd.simpleaudio.AudioPcmOutThread.html#members beep boop blip noise playOgg it is meant to be something more like an Atari 2600 than a modern movie theater :)
Re: Help playing sounds using arsd.simpleaudio
On Sunday, 29 September 2019 at 04:37:43 UTC, Murilo wrote: Thanks. Now, I would like to know if I could just use it like this instead: What happens if an exception is thrown in the middle of your function? It shouldn't really matter (at least not with the newer versions) since it will automatically exit the audio thread when the main thread exits, but still there's definitely no benefit to writing it without the scope guard.
Re: Using D for Raspberry Pi expirements
On Sunday, 29 September 2019 at 11:36:00 UTC, aberba wrote: I have no idea how to do that from D. Any help/resources on that? You should be able to use the techniques at https://dlang.org/spec/interfaceToC.html to declare the C functions that you wish to use in your *.d source files, and then, when you compile, pass `-lpigpiod_if2` to the linker. Mike
Re: Packaging and Distributing Dlang Applications with GtkD Dependency?
On Thursday, 26 September 2019 at 16:30:39 UTC, Andre Pany wrote: On Wednesday, 25 September 2019 at 17:03:51 UTC, Ron Tarrant wrote: On Wednesday, 25 September 2019 at 13:52:48 UTC, bioinfornatics wrote: I think I misunderstood your need but are lo looking for dub tool with its repository https://code.dlang.org/ I don't think so, but I could be wrong. I tried reading up on dub, but got lost in the docs, so I really don't understand what all it can do. Dub is a tool for developers, I understand your requirements that you want target end customers of your applications. Therefore dub is the wrong tool for this job. To be more precise, gtkd is a wrapper for GTK. Gtkd is not interesting in this context, but the dependency on gtk. On windows you have the possibility to either publish your application with GTK dlls or to run gtk setup routine as part of your application setup routine or just say in your readme that the customer needs to run GTK setup on there own. On posix (linus, macos) of course you can also say in your readme that the customer should run apt-get ... to install gtk (here I do not have much knowledge on packaging). Kind regards Andre I will immediately abandon any app that provides this sort of incomplete experience to use unless I have my developer hats on...or I really have not other choice.
Re: Using D for Raspberry Pi expirements
On Thursday, 26 September 2019 at 00:09:30 UTC, Mike Franklin wrote: On Wednesday, 25 September 2019 at 23:56:45 UTC, aberba wrote: I'm looking for resources on using D for basic Raspberry Pi programming...stuff like turning on and off an LED light. I believe it requires being able to call the Raspberry OS core APIs from D as available in Python. Anyone here tried something like that using D? I haven't tried with D yet, but I use C# and mono calling into the pigpio C library (http://abyz.me.uk/rpi/pigpio/pdif2.html) and it workes great. You should be able to do the same with D. Mike I have no idea how to do that from D. Any help/resources on that?
Re: Using D for Raspberry Pi expirements
On Thursday, 26 September 2019 at 17:26:25 UTC, Dave Chapman wrote: On Thursday, 26 September 2019 at 00:10:40 UTC, aberba wrote: [...] I've been using https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git/ . It is a C library written by Bartosz Golaszewski. He is actively working on it. The latest update is a week old. It has the advantage that you don't have to use sudo to access the gpio pins. It comes with a set of tools written in C that I have been converting to D. Since my knowledge of both D and C is weak it has taken me some time to get things going. I have a hand written D bindings file that is incomplete and of amateur quality. So far I have converted 2 of the 6 command line tools that Bartosz Golaszewski provided to to work with the library. David Chapman your code... can you push it to GitHub so I can check it out?
Re: Help playing sounds using arsd.simpleaudio
On Saturday, 28 September 2019 at 03:21:38 UTC, Murilo wrote: Can anyone just please show me how to play a background sound(like those in games) using arsd.simpleaudio? I'd like something simple with a code snippet please. I recommend SoLoud - bindings are available here http://code.dlang.org/packages/bindbc-soloud . It's more powerful than simpleaudio, supports multiple formats, 3D audio, etc.