World: r4wp
[Rebol School] REBOL School
older newer | first last |
Arnold 7-Sep-2012 [942] | The script name is the script name of the script that is being executed, I knew that one already I redirected to it, not the requested page. |
Kaj 8-Sep-2012 [943] | Ah, so REBOL does follow the major rule of other software: it does everything except the thing you need |
Arnold 11-Sep-2012 [944x2] | Found some code/documentation about playing a sound (wav) on www.rebol.com/docs/sound.html but although rebol/view 2.7.8 (Win XP) has Sound 1.4.0 on board it seems using the sound:// port is reserved for use by the SDK version? ** Access Error: Cannot open sound ** Where: halt-view ** Near: sound-port: open sound:// on MacOSX I get ** Access Error: Invalid port spec: sound:// ** Where: halt-view ** Near: sound-port: open sound:// But that is less surprising since there is no Sound module available there. So what is Sound (1.4.0) about? |
Kaj is right again | |
Kaj 11-Sep-2012 [946x2] | Sound in REBOL is primitive, but I thought it had been in the free versions for many years |
Did you initialise events like the doc says? | |
Arnold 11-Sep-2012 [948] | could be a rights issue? That the port may not be freely accessible. |
Kaj 11-Sep-2012 [949] | That was a long time ago, and it should say "Feature not available in this REBOL" |
james_nak 11-Sep-2012 [950] | Arnold, I've been using sound in a recent app with 2.7.8.3.1 with no issues (on XP too). I use a version of Nick's code http://musiclessonz.com/rebol_tutorial.html. Look for "play-sound" |
Endo 11-Sep-2012 [951] | this works for me on free version of View: (XP) sound-port: open sound:// play: func [file] [ wait sound-port clear sound-port insert sound-port file wait sound-port ] |
Maxim 12-Sep-2012 [952] | yes enabled in View. not core (like all /pro features) . |
Kaj 12-Sep-2012 [953] | Ah, is that the problem again. Sigh |
Arnold 12-Sep-2012 [954] | An answer in a not web public group -> Chit chat |
Arnold 13-Sep-2012 [955] | Somehow indeed I managed to mix up core and view console so sound did work afterall. Sorry for the noise :( But still a wish for sound in REBOL on other platforms. |
Maxim 13-Sep-2012 [956] | in R3 we can add sound support via the host-kit, but its not as good as it could be because we cannot add devices and/or any new type of event to easily (asynchronously) signal audio-related events. |
Kaj 13-Sep-2012 [957] | Devices cannot be added? |
BrianH 13-Sep-2012 [958] | Not at the moment, as far as we know. At least if there's a workaround noone has figured it out yet. You can signal asynchronous events with callbacks though, afaik. |
Kaj 13-Sep-2012 [959] | I never realised, because I only looked at them in the C code. I suppose devices can be added there, but not yet afterwards from REBOL |
BrianH 13-Sep-2012 [960] | They can't necessarily be added in the C code either. IIRC the devices table is fixed-sixe and allocated in the core code. I welcome evidence to the contrary. |
Maxim 13-Sep-2012 [961x4] | even the event list is a hard-coded list. which is part of the problem. |
there is no device code in the host-kit (which is the C api to rebol) | |
callbacks do have issues which make them unusable in the real-world IIRC (its been a while) | |
wasn't there a bug wrt errors and stuff like that? | |
BrianH 13-Sep-2012 [965x2] | There was a plan to make device extensions, but Carl didn't know what API to use. He did a callout for advice, but that didn't get much response. |
There are bugs and design flaws in R2's callbacks, but I'm not sure there still are in R3's. Robert's group uses them IIRC, and might have fixed the bug. They'd have to chime in here. | |
Maxim 13-Sep-2012 [967] | people who where able to help did respond and he liked a few of the ideas, he just never acted on it or actualy start a real discussion. |
Kaj 13-Sep-2012 [968] | I thought devices were always built on top of extensions. Anyway, the devices are in the host kit, about six of them |
Maxim 13-Sep-2012 [969] | you can only implement the devices which are built-in, you cannot add your own. |
Kaj 13-Sep-2012 [970] | OK, but the implementations are in the host kit |
BrianH 13-Sep-2012 [971] | All of the implementations of the current devices are built into the host portion of the C code, but are not made with extensions. |
Kaj 13-Sep-2012 [972] | As far as I know, Saphirion hasn't been able to solve the threading and callback problems |
Maxim 13-Sep-2012 [973] | yes, cause they are platform dependent. The latest host-kits merged two projects... the command! interface (extensions) and the platform abstraction (host) |
BrianH 13-Sep-2012 [974] | IIRC they had some success with the pattern of using a callback to signal R3 to grab data using a synchronous call. |
Maxim 13-Sep-2012 [975] | to allow full (run-time) extensibility of R3 as it is, it needs two other apis: -a decent event registration mechanism (add new types and specs) -a device registration system (so we can link schemes and protocols to them). |
Kaj 13-Sep-2012 [976] | Hm, my Atari 8-bit already had that. I guess that's progress these days |
Maxim 13-Sep-2012 [977] | I must admit that if you can receive events in the host, you can just execute a code string within the root ( just like if one enters a command in the prompt). It worked very well for interfacing with GLUT ... I had just built a little pseudo event system which I called from within the glut callback and it was fast enough to handle all events in real-time. |
Marco 16-Sep-2012 [978] | How can I convert an integer! that is a pointer to a C struct returned by a library function to a binary! ? |
BrianH 16-Sep-2012 [979x2] | With more C code that copies the binary to a REBOL-allocated buffer. You can't deallocate a pointer in REBOL. |
I mean dereference. | |
Gregg 16-Sep-2012 [981] | Will this work? LPINT-def: [value [integer!]] none LPINT: make struct! LPINT-def none make-LPINT: does [make struct! LPINT-def none] get-dereferenced-data: func [ {Given a pointer to memory, copy the target data into a REBOL struct.} pointer [struct!] "LPINT structure" struct-def [block!] "Contains a sub-struct that is the real struct you want." /local struct data orig-pointer result ] [ struct: make struct! compose/deep/only [ ; make wrapper struct sub [struct! (struct-def)] ] none orig-pointer: third struct ; store original inner pointer change third struct third pointer ; change inner pointer to ref'd data data: copy third struct/sub ; copy data from the inner struct ;print mold data change third struct orig-pointer ; restore inner pointer result: make struct! struct-def none ; make result struct change third result data ; change data in result struct ;probe result struct: data: orig-pointer: none ;recycle result ] It's from some old code, so no guarantees. |
Marco 16-Sep-2012 [982] | @BrianH I am writing in Rebol, I am not able to write C code. @Gregg I need to pass an integer! to a function that converts it to a binary, and your function expects a struct! how do I change it? |
Gregg 16-Sep-2012 [983x2] | Put the integer value in an LPINT struct. |
That is, use make-LPINT, set the /value, and pass that. | |
Marco 16-Sep-2012 [985] | Ok, thanks. |
Gregg 16-Sep-2012 [986] | Also, get-dereferenced-data maps the buffer into another REBOL struct. If you just want the binary data, you can adapt it not to do that. |
Marco 16-Sep-2012 [987] | ok it seems to work. it becomes: integer-address: get-address "hello" ; function courtesy of Anton Rolls pointer: make-LPINT pointer/value: integer-address probe third get-dereferenced-data pointer [l1 [int] l2 [int]] |
Kaj 16-Sep-2012 [988x2] | In my 0MQ binding, I import the memory copying function from the C library: |
http://rebol.esperconsultancy.nl/REBOL-2-ZeroMQ-binding/dir?ci=tip | |
Ladislav 16-Sep-2012 [990] | You can't deallocate a pointer in REBOL. - that is false, use the http://www.fm.tul.cz/~ladislav/rebol/library-utils.r |
BrianH 16-Sep-2012 [991] | I meant defererence, but I'm sure you're right. |
older newer | first last |