IPB

Welcome Guest ( Log In | Register )

> foobar2000 General Forum Rules

This is NOT a tech support forum.
Tech support questions go to foobar2000 Tech Support forum instead.

See also: Hydrogenaudio Terms of Service.

 
Reply to this topicStart new topic
immediately playing sound, [moved from Development/TOS #6]
fbb
post Apr 13 2014, 09:03
Post #1





Group: Members
Posts: 6
Joined: 13-April 14
Member No.: 115490



Hallo people,

i have a lot of short sounds in Playlist.
do you see a posibility to adress each one over item index to play immediately?
I would prefer to start the sound from autohotkey!

The following tests i have made:
1) Start each sound from autohotkey via run, ...
>>> This works, but there is a delay from about 2s.
2) To get direct access to listview to set the cursor.
>>> This fails.

Thank you,
Frank
Go to the top of the page
+Quote Post
A_Man_Eating_Duc...
post Apr 13 2014, 11:30
Post #2





Group: Members
Posts: 925
Joined: 21-December 01
From: New Zealand
Member No.: 705



Are you using any digital outputs in your playback chain? e.g. optical out from computer to amp.

This can cause a 0.5 - 1 second delay when you start playing.


--------------------
Who are you and how did you get in here ?
I'm a locksmith, I'm a locksmith.
Go to the top of the page
+Quote Post
fbb
post Apr 13 2014, 12:55
Post #3





Group: Members
Posts: 6
Joined: 13-April 14
Member No.: 115490



No this it not the point. My delay is caused by starting a completly new instance from foobar for each sound.
Better would be to held one instance with all sounds in it and then trigger each sound from an extern programm.
Go to the top of the page
+Quote Post
vsub
post Apr 13 2014, 14:10
Post #4





Group: Members
Posts: 16
Joined: 11-April 14
Member No.: 115469



Run,Foobar path\foobar2000.exe /add /immediate "song path" /context_command:play "song path"

The problem with this is that,you will add the same song again and again.
Maybe adding a command line(if there is)that removes the duplicates but I don't know what command line that is.

Btw Autohotkey can play audio files too and if they are short sounds,it even preferable to use it rather than starting a program,wait for it to load and play the file

http://www.autohotkey.com/docs/commands/SoundPlay.htm
Use the "wait" parameter too.
Go to the top of the page
+Quote Post
db1989
post Apr 13 2014, 14:57
Post #5





Group: Super Moderator
Posts: 5275
Joined: 23-June 06
Member No.: 32180



QUOTE ( [url="http://www.hydrogenaudio.org/forums/index.php?showforum=34")
http://www.hydrogenaudio.org/forums/index.php?showforum=34[/url] ]foobar2000 Development Forum Rules

This forum is for developer discussions only. If you have a problem / bug report / idea / feature request that isn't related to foobar2000 SDK, post it in an appropiate forum instead - tech support questions go to support forum, everything else goes to general forum.
All non-developer posts on this forum will be removed. Continued abuse of this forum will result in admin actions (warnings, account suspension).

Edit: It became Develop-y but not sure whether to move it back wacko.gif

This post has been edited by db1989: Apr 26 2014, 20:17
Go to the top of the page
+Quote Post
fbb
post Apr 13 2014, 19:21
Post #6





Group: Members
Posts: 6
Joined: 13-April 14
Member No.: 115490



@db1989
Your a realy quick guy - what have I asked that makes you angry to throw me out of forum for developer discussions.
May be its my bad englisch. I have got 2 answers to my question but unfortunately without any solution.

So I ask again. Is it possible to get the windowhandle from foobar-listbox to place the cursor directly to a track. For example to track 5.
After 0,5s I want to play the next sound, for examlple track 45 and so on. Important is to play the sounds directly - without delaytimes from 1s or more.

@vsub
Thank you for nswering, probaby you can't find this text because of forum shift.
Yes I play sounds directly with autohotkey but with foobar-indirektion here would be 2 smart advantages (and some more..)
1) I can regulate volume independent from system-volume
2) I can rearrange sounds in tracklist

thank you,
Frank
Go to the top of the page
+Quote Post
Zao
post Apr 14 2014, 08:27
Post #7





Group: Members (Donating)
Posts: 899
Joined: 25-September 03
From: Umeň, Sweden
Member No.: 9001



The elegant solution would be to write a component that listened on some sort of IPC mechanism and changed the track on request.
This could be as simple as having a message-only window that waited for a WM_USER message, using the fb2k API to change the track or playback state.

Additionally, something like foo_httpcontrol may even expose enough of a surface for you to interact with the player if you can make HTTP requests and can tolerate a component listening on a socket.


--------------------
Zao shang yong zao nong zao rang zao ren zao.
To, early in the morning, use a chisel to build a bathtub makes impatient people hot-tempered.
Go to the top of the page
+Quote Post
foosion
post Apr 14 2014, 09:40
Post #8





Group: FB2K Moderator (Donating)
Posts: 4409
Joined: 24-February 03
Member No.: 5153



QUOTE (Zao @ Apr 14 2014, 08:27) *
The elegant solution would be to write a component that listened on some sort of IPC mechanism and changed the track on request.
If a component provided the ability to play specific tracks, it could also offer commands in the main menu to start these tracks. The user could then bind these commands to (global) keyboard shortcuts in foobar2000. This could make AutoHotkey unnecessary for the simple purpose of playing individual tracks.

Leaving hypothetical components which are yet to be developed aside, I agree about checking whether foo_httpcontrol provides the necessary functionality.


--------------------
http://foosion.foobar2000.org/ - my components for foobar2000
Go to the top of the page
+Quote Post
Zao
post Apr 14 2014, 10:00
Post #9





Group: Members (Donating)
Posts: 899
Joined: 25-September 03
From: Umeň, Sweden
Member No.: 9001



If it's a 1:1 correspondence between tracks and buttons, sure.
As AHK is essentially a full-blown programming platform, the actual use case may be much more complex and it seems like OP wants to play track by computed ordinal.

We could at least agree on that manipulating UI elements by sending messages to them is a horrible horrible idea.


--------------------
Zao shang yong zao nong zao rang zao ren zao.
To, early in the morning, use a chisel to build a bathtub makes impatient people hot-tempered.
Go to the top of the page
+Quote Post
foosion
post Apr 14 2014, 10:40
Post #10





Group: FB2K Moderator (Donating)
Posts: 4409
Joined: 24-February 03
Member No.: 5153



QUOTE (Zao @ Apr 14 2014, 10:00) *
If it's a 1:1 correspondence between tracks and buttons, sure.
As AHK is essentially a full-blown programming platform, the actual use case may be much more complex and it seems like OP wants to play track by computed ordinal.
I know. I guess I didn't make this clear enough in my previous post.

QUOTE (Zao @ Apr 14 2014, 10:00) *
We could at least agree on that manipulating UI elements by sending messages to them is a horrible horrible idea.
Definitely.


--------------------
http://foosion.foobar2000.org/ - my components for foobar2000
Go to the top of the page
+Quote Post
Robertina
post Apr 14 2014, 15:18
Post #11





Group: Members
Posts: 1306
Joined: 4-January 09
Member No.: 65169



QUOTE (foosion @ Apr 13 2014, 21:40) *
If a component provided the ability to play specific tracks,

foo_scheduler is able to change a track on request (create a new Action lists entry > Start playback from track [choose freely definable track]).

However in the manner the OP would need it to work it cannot be utilized.
Go to the top of the page
+Quote Post
fbb
post Apr 14 2014, 20:55
Post #12





Group: Members
Posts: 6
Joined: 13-April 14
Member No.: 115490



ok, thanks a lot for inspiration.
the solution with a view lines of ahk-code is working very well.

; |----------------------------------------------
; |foo-direct-sound-access ahk-solution 14.4.2014
; |----------------------------------------------
; |
; |- playing soundpatterns with foo triggered by an extern ahk-interface
; |- each sound can bind to keyboard-button
; |- sounds can simply be rearranged to another key without programing
; |
; | this framework was testet with: XP SP3 / ahk v1.0.48.05 / foo v1.3.1
; | have fun,
; | frank
; |
; |1) playlist handling
; |--------------------
; |get current order in listview
;ControlSend, {4B94B650-C2D8-40de-A0AD-E8FADF62D56C}1, ^a^c{home}{space}, foobar2000
; |convert multselect clipbord-format to plain-text. cb.bat with following 2 lines
; |cd C:\pv\System\CygwinPortable\App\Cygwin\bin\
; |getclip.exe | putclip.exe
;RunWait, C:\pv\System\CygwinPortable\cb.bat,, hide
; |rename soundfiles
;..
; |start new playlist
;run, C:\pv\zw\foobar2000\foobar2000.exe "C:\Dokumente und Einstellungen\frank\Desktop\x.m3u"
; |get window-handle for handling several instances of foo
;WinWait, foobar2000
;WinGet, hfoo_01, ID, foobar2000
;..
; |
; |2) start sound by "name-appended-id"
; |------------------------------------
;ControlSend, {4B94B650-C2D8-40de-A0AD-E8FADF62D56C}1, [01]{enter}, foobar2000
;ControlSend, {4B94B650-C2D8-40de-A0AD-E8FADF62D56C}1, [02]{enter}, foobar2000
;..
; |
; |----------------------------------------------
; |foo-direct-sound-access ahk-solution 14.4.2014
; |----------------------------------------------
Go to the top of the page
+Quote Post
fbb
post Apr 26 2014, 19:48
Post #13





Group: Members
Posts: 6
Joined: 13-April 14
Member No.: 115490



... in the last post I've basically explaint my solution. However, this was still a bit abstract. Now I show you a screenshot with a little description.

Direct-Sound-Access
Development for XP SP3 / ahk v1.0.48.05 / foo v1.3.1

Attention: This approach does not claim to an exemplary solution because it bypasses a few common conventions. But no matter - the main thing is that's working. It's just fun quickly implement an idea into action and not stuck in the jungle of opinions and guidelines.


2 x foobar2000 players on the right side of the desktop and 2 tray icons with functions.

Main-Features
A) 2 x foobar2000 instances (green + blue)
B) Controlmenus in systray
C) Indexhandling for Direct-Sound-Access

@ A)
The green player is intended for the ordinary operation - listen to musicfiles. The blue player is intended to play soundfiles. These sounds are triggered by an external program. Both players can be hidden via the tray icons. The volume can be controlled via mouse wheel independently even if the players are hidden.

;(I) Send information to foobar2000
;2 possibilities to trigger the sound via Name-Index from an extern program.
;-----------------------------------------------------------------------------------------
;The sondfile "on.wav" will be renamed from Indexfunction to ",001~~~on.wav"
;If you know, when typing buttons ",001" listcontrol will mark the corresponding sound.
;The program simulates such key inputs. Via Index ,001 the sound will be started.
;-----------------------------------------------------------------------------------------

;1) Start Soundfile via AHK-command ControlSend
ControlSend, {4B94B650-C2D8-40de-A0AD-E8FADF62D56C}1, `,001{enter}, ahk_id %foo2_gh%

;2)Start Soundfile via AHK-commands PostMessage
;This code you can convert more easier to other languages than example 1).
;foo2_gh = handle from blue foobar2000
co = {4B94B650-C2D8-40de-A0AD-E8FADF62D56C}1
id = ,001

loop, parse, id
{
zk := asc( a_loopfield)
PostMessage, 0x102, %zk%, 1, %co%, ahk_id %foo2_gh%
}
PostMessage, 0x100, 0x0d, 0, %co%, ahk_id %foo2_gh%
PostMessage, 0x101, 0x0d, 0, %co%, ahk_id %foo2_gh%

;(II) Get information from foobar2000
;To get some Infos from Playlist use the clipboard.
;Start with the clipboardtool insideclipboard or something similar for looking what clipboard has captured.
;In custom format "foobar_2000_playable_location_format" you will find well formated playlist entries.
;For example: With this data you can generate a playlist of marked entries on desktop with a RightClick to TrayIcon.


@ B)
The control menus are customized for the use of each player. In addition, 8 various click events on the tray icon will be distinguished.

Examples for the green player (Music):
Click on trayIcon: next song
Double click on trayIcon: next song + delete running song from playlist
... some more events are availible

Examples for the blue player (Soundfiles):
Click on trayIcon: index soundfiles new
Double click on trayIcon: play marked soundfiles
... some more events are availible

All functions work regardless the players are visible or hidden.

@ C)
Similar to the sound scheme of the windows operating system, I use a separate sound scheme for other purposes. An external program produces some events. Each event has an associated sound. In this example, the event # 1 would start the sound "on.wav". Thanks foobar2000 the assignment of sounds can be changed quickly. To associate the sound "off.wav" (in screenshot #10) with the event # 1, "off.wav" must simply pushed over the sound "on.wav". Via tray menu, the list can then be reindexed and immediately event # 1 triggers the sound "off.wav". Of course, differnet playlists can be used for different sound schemes.


When a musikfreak meet's a programmer it's foobar2000 time,
Frank

Go to the top of the page
+Quote Post
fbb
post May 10 2014, 19:04
Post #14





Group: Members
Posts: 6
Joined: 13-April 14
Member No.: 115490



Direct-Sound/Song-Access
Development for XP SP3 / ahk v1.0.48.05 / foo v1.3.1

An extension for indexing
To access the sounds an index at the beginning of the file name has been added so far. This index may be hidden. For that I use the datetime-stamp of the file.

With the following pattern you can produce indexnumbers 0-99.
,$pad_right($add($mul($substr(%last_modified%,15,16),60),$right(%last_modified%,2)),2,0)

Format for datetime-stamp is YYYYMMDDHH24MISS. For the index only use the 4 last digits ...MISS.
Examples: ...0000 > 0 / ...0139 > 99

With a slightly modified pattern indexfield ranges from 0 to 3599.
Examples: ...0000 > 0 / ...0140 > 100 /...5959 > 3599


Sound-list with indexes fixed in datetime-stamp

If a sound is replaced by another sound, it may be useful to keep the index change visible in the list. That's why I add an info at the old place. In the picture above the Sound #1 was replaced by the Sound #5.

It's funny to deal with foobar2000,
Frank
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 25th July 2014 - 15:17