class MusicBeeIPC

Constants

WM_COPYDATA
WM_USER

Window Message

Public Instance Methods

clear_now_playing_list() click to toggle source

@return [MBError]

# File lib/musicbeeipc.rb, line 545
def clear_now_playing_list()
  send_message(find_hwnd(), WM_USER, MBC_ClearNowPlayingList, 0)
end
end_auto_dj() click to toggle source

@return [MBError]

# File lib/musicbeeipc.rb, line 65
def end_auto_dj()
  send_message(find_hwnd(), WM_USER, MBC_EndAutoDj, 0)
end
get_artist_picture(fading_percent) click to toggle source

@param fading_percent [int] @return [String]

# File lib/musicbeeipc.rb, line 446
def get_artist_picture(fading_percent)
  hwnd = find_hwnd()
  
  lr = send_message(hwnd, WM_USER, MBC_GetArtistPicture, fading_percent)
  
  r = unpack_s(lr)
  
  send_message(hwnd, WM_USER, MBC_FreeLRESULT, lr)
  
  r
end
get_artist_picture_thumb() click to toggle source

@return [String]

# File lib/musicbeeipc.rb, line 473
def get_artist_picture_thumb()
  hwnd = find_hwnd()
  
  lr = send_message(hwnd, WM_USER, MBC_GetArtistPictureThumb, 0)
  
  r = unpack_s(lr)
  
  send_message(hwnd, WM_USER, MBC_FreeLRESULT, lr)
  
  r
end
get_artist_picture_urls(local_only) click to toggle source

@param local_only [bool] @return [String]

# File lib/musicbeeipc.rb, line 460
def get_artist_picture_urls(local_only)
  hwnd = find_hwnd()
  
  lr = send_message(hwnd, WM_USER, MBC_GetArtistPictureUrls, to_i(local_only))
  
  r = unpack_sa(lr)
  
  send_message(hwnd, WM_USER, MBC_FreeLRESULT, lr)
  
  r
end
get_artwork() click to toggle source

@return [String]

# File lib/musicbeeipc.rb, line 393
def get_artwork()
  hwnd = find_hwnd()
  
  lr = send_message(hwnd, WM_USER, MBC_GetArtwork, 0)
  
  r = unpack_s(lr)
  
  send_message(hwnd, WM_USER, MBC_FreeLRESULT, lr)
  
  r
end
get_artwork_url() click to toggle source

@return [String]

# File lib/musicbeeipc.rb, line 406
def get_artwork_url()
  hwnd = find_hwnd()
  
  lr = send_message(hwnd, WM_USER, MBC_GetArtworkUrl, 0)
  
  r = unpack_s(lr)
  
  send_message(hwnd, WM_USER, MBC_FreeLRESULT, lr)
  
  r
end
get_auto_dj_enabled() click to toggle source

@return [bool]

# File lib/musicbeeipc.rb, line 276
def get_auto_dj_enabled()
  to_b(send_message(find_hwnd(), WM_USER, MBC_GetAutoDjEnabled, 0))
end
get_button_enabled(button) click to toggle source

@param button [MBPlayButtonType] @return [bool]

# File lib/musicbeeipc.rb, line 585
def get_button_enabled(button)
  to_b(send_message(find_hwnd(), WM_USER, MBC_GetButtonEnabled, button))
end
get_crossfade() click to toggle source

@return [bool]

# File lib/musicbeeipc.rb, line 293
def get_crossfade()
  to_b(send_message(find_hwnd(), WM_USER, MBC_GetCrossfade, 0))
end
get_current_index() click to toggle source

@return [int]

# File lib/musicbeeipc.rb, line 506
def get_current_index()
  send_message(find_hwnd(), WM_USER, MBC_GetCurrentIndex, 0)
end
get_downloaded_artwork() click to toggle source

@return [String]

# File lib/musicbeeipc.rb, line 419
def get_downloaded_artwork()
  hwnd = find_hwnd()
  
  lr = send_message(hwnd, WM_USER, MBC_GetDownloadedArtwork, 0)
  
  r = unpack_s(lr)
  
  send_message(hwnd, WM_USER, MBC_FreeLRESULT, lr)
  
  r
end
get_downloaded_artwork_url() click to toggle source

@return [String]

# File lib/musicbeeipc.rb, line 432
def get_downloaded_artwork_url()
  hwnd = find_hwnd()
  
  lr = send_message(hwnd, WM_USER, MBC_GetDownloadedArtworkUrl, 0)
  
  r = unpack_s(lr)
  
  send_message(hwnd, WM_USER, MBC_FreeLRESULT, lr)
  
  r
end
get_downloaded_lyrics() click to toggle source

@return [String]

# File lib/musicbeeipc.rb, line 380
def get_downloaded_lyrics()
  hwnd = find_hwnd()
  
  lr = send_message(hwnd, WM_USER, MBC_GetDownloadedLyrics, 0)
  
  r = unpack_s(lr)
  
  send_message(hwnd, WM_USER, MBC_FreeLRESULT, lr)
  
  r
end
get_dsp_enabled() click to toggle source

@return [bool]

# File lib/musicbeeipc.rb, line 249
def get_dsp_enabled()
  to_b(send_message(find_hwnd(), WM_USER, MBC_GetDspEnabled, 0))
end
get_duration() click to toggle source

@return [int]

# File lib/musicbeeipc.rb, line 321
def get_duration()
  send_message(find_hwnd(), WM_USER, MBC_GetDuration, 0)
end
get_equalizer_enabled() click to toggle source

@return [bool]

# File lib/musicbeeipc.rb, line 238
def get_equalizer_enabled()
  to_b(send_message(find_hwnd(), WM_USER, MBC_GetEqualizerEnabled, 0))
end
get_file_property(file_property) click to toggle source

@param file_property [MBFileProperty] @return [String]

# File lib/musicbeeipc.rb, line 340
def get_file_property(file_property)
  hwnd = find_hwnd()
  
  lr = send_message(hwnd, WM_USER, MBC_GetFileProperty, file_property)
  
  r = unpack_s(lr)
  
  send_message(hwnd, WM_USER, MBC_FreeLRESULT, lr)
  
  r
end
get_file_tag(field) click to toggle source

@param field [MBMetaData] @return [String]

# File lib/musicbeeipc.rb, line 354
def get_file_tag(field)
  hwnd = find_hwnd()
  
  lr = send_message(hwnd, WM_USER, MBC_GetFileTag, field)
  
  r = unpack_s(lr)
  
  send_message(hwnd, WM_USER, MBC_FreeLRESULT, lr)
  
  r
end
get_file_url() click to toggle source

@return [String]

# File lib/musicbeeipc.rb, line 326
def get_file_url()
  hwnd = find_hwnd()
  
  lr = send_message(hwnd, WM_USER, MBC_GetFileUrl, 0)
  
  r = unpack_s(lr)
  
  send_message(hwnd, WM_USER, MBC_FreeLRESULT, lr)
  
  r
end
get_lyrics() click to toggle source

@return [String]

# File lib/musicbeeipc.rb, line 367
def get_lyrics()
  hwnd = find_hwnd()
  
  lr = send_message(hwnd, WM_USER, MBC_GetLyrics, 0)
  
  r = unpack_s(lr)
  
  send_message(hwnd, WM_USER, MBC_FreeLRESULT, lr)
  
  r
end
get_music_bee_version() click to toggle source

@return [MBMusicBeeVersion]

# File lib/musicbeeipc.rb, line 1369
def get_music_bee_version()
  send_message(find_hwnd(), WM_USER, MBC_MusicBeeVersion, 0)
end
get_music_bee_version_str() click to toggle source

@return [String]

# File lib/musicbeeipc.rb, line 1374
def get_music_bee_version_str()
  case send_message(find_hwnd(), WM_USER, MBC_MusicBeeVersion, 0)
  when MBMBV_v2_0
    "2.0"
  when MBMBV_v2_1
    "2.1"
  when MBMBV_v2_2
    "2.2"
  when MBMBV_v2_3
    "2.3"
  else
    "Unknown"
  end
end
get_music_bee_version_sym() click to toggle source

@return [String]

# File lib/musicbeeipc.rb, line 1390
def get_music_bee_version_sym()
  case send_message(find_hwnd(), WM_USER, MBC_MusicBeeVersion, 0)
  when MBMBV_v2_0
    :v2_0
  when MBMBV_v2_1
    :v2_1
  when MBMBV_v2_2
    :v2_2
  when MBMBV_v2_3
    :v2_3
  else
    :Unknown
  end
end
get_mute() click to toggle source

@return [bool]

# File lib/musicbeeipc.rb, line 205
def get_mute()
  to_b(send_message(find_hwnd(), WM_USER, MBC_GetMute, 0))
end
get_next_index(offset) click to toggle source

@param offset [int] @return [int]

# File lib/musicbeeipc.rb, line 512
def get_next_index(offset)
  send_message(find_hwnd(), WM_USER, MBC_GetNextIndex, offset)
end
get_play_state() click to toggle source

@return [MBPlayState]

# File lib/musicbeeipc.rb, line 70
def get_play_state()
  send_message(find_hwnd(), WM_USER, MBC_GetPlayState, 0)
end
get_play_state_str() click to toggle source

@return [String]

# File lib/musicbeeipc.rb, line 75
def get_play_state_str()
  case send_message(find_hwnd(), WM_USER, MBC_GetPlayState, 0)
  when MBPS_Loading
    "Loading"
  when MBPS_Playing
    "Playing"
  when MBPS_Paused
    "Paused"
  when MBPS_Stopped
    "Stopped"
  else
    "Undefined"
  end
end
get_play_state_sym() click to toggle source

@return [String]

# File lib/musicbeeipc.rb, line 91
def get_play_state_sym()
  case send_message(find_hwnd(), WM_USER, MBC_GetPlayState, 0)
  when MBPS_Loading
    :Loading
  when MBPS_Playing
    :Playing
  when MBPS_Paused
    :Paused
  when MBPS_Stopped
    :Stopped
  else
    :Undefined
  end
end
get_plugin_version() click to toggle source

@return [Array<int>]

# File lib/musicbeeipc.rb, line 1419
def get_plugin_version()
  hwnd = find_hwnd()
  
  lr = send_message(hwnd, WM_USER, MBC_PluginVersion, 0)
  
  r = unpack_s(lr)
  
  send_message(hwnd, WM_USER, MBC_FreeLRESULT, lr)
  
  r.split(".").map { |s| s.to_i }
end
get_plugin_version_str() click to toggle source

@return [String]

# File lib/musicbeeipc.rb, line 1406
def get_plugin_version_str()
  hwnd = find_hwnd()
  
  lr = send_message(hwnd, WM_USER, MBC_PluginVersion, 0)
  
  r = unpack_s(lr)
  
  send_message(hwnd, WM_USER, MBC_FreeLRESULT, lr)
  
  r
end
get_position() click to toggle source

@return [int]

# File lib/musicbeeipc.rb, line 107
def get_position()
  send_message(find_hwnd(), WM_USER, MBC_GetPosition, 0)
end
get_repeat() click to toggle source

@return [MBRepeatMode]

# File lib/musicbeeipc.rb, line 227
def get_repeat()
  send_message(find_hwnd(), WM_USER, MBC_GetRepeat, 0)
end
get_replay_gain_mode() click to toggle source

@return [MBReplayGainMode]

# File lib/musicbeeipc.rb, line 304
def get_replay_gain_mode()
  send_message(find_hwnd(), WM_USER, MBC_GetReplayGainMode, 0)
end
get_scrobble_enabled() click to toggle source

@return [bool]

# File lib/musicbeeipc.rb, line 260
def get_scrobble_enabled()
  to_b(send_message(find_hwnd(), WM_USER, MBC_GetScrobbleEnabled, 0))
end
get_show_rating_love() click to toggle source

@return [bool]

# File lib/musicbeeipc.rb, line 579
def get_show_rating_love()
  to_b(send_message(find_hwnd(), WM_USER, MBC_GetShowRatingLove, 0))
end
get_show_rating_track() click to toggle source

@return [bool]

# File lib/musicbeeipc.rb, line 574
def get_show_rating_track()
  to_b(send_message(find_hwnd(), WM_USER, MBC_GetShowRatingTrack, 0))
end
get_show_time_remaining() click to toggle source

@return [bool]

# File lib/musicbeeipc.rb, line 569
def get_show_time_remaining()
  to_b(send_message(find_hwnd(), WM_USER, MBC_GetShowTimeRemaining, 0))
end
get_shuffle() click to toggle source

@return [bool]

# File lib/musicbeeipc.rb, line 216
def get_shuffle()
  to_b(send_message(find_hwnd(), WM_USER, MBC_GetShuffle, 0))
end
get_soundtrack_picture_urls(local_only) click to toggle source

@param local_only [bool] @return [String]

# File lib/musicbeeipc.rb, line 492
def get_soundtrack_picture_urls(local_only)
  hwnd = find_hwnd()
  
  lr = send_message(hwnd, WM_USER, MBC_GetSoundtrackPictureUrls,
                    to_i(local_only))
  
  r = unpack_sa(lr)
  
  send_message(hwnd, WM_USER, MBC_FreeLRESULT, lr)
  
  r
end
get_stop_after_current_enabled() click to toggle source

@return [bool]

# File lib/musicbeeipc.rb, line 281
def get_stop_after_current_enabled()
  to_b(send_message(find_hwnd(), WM_USER, MBC_GetStopAfterCurrentEnabled, 0))
end
get_volume() click to toggle source

Volume - Value between 0 - 100 @return [int]

# File lib/musicbeeipc.rb, line 129
def get_volume()
  send_message(find_hwnd(), WM_USER, MBC_GetVolume, 0)
end
get_volumef() click to toggle source

Floating point volume - Value between 0.0 - 1.0 @return [float]

# File lib/musicbeeipc.rb, line 179
def get_volumef()
  FloatInt.new(i:send_message(find_hwnd(), WM_USER, MBC_GetVolumef, 0))[:f]
end
get_volumep() click to toggle source

Precise volume - Value between 0 - 10000 @return [int]

# File lib/musicbeeipc.rb, line 154
def get_volumep()
  send_message(find_hwnd(), WM_USER, MBC_GetVolumep, 0)
end
is_any_following_tracks() click to toggle source

@return [bool]

# File lib/musicbeeipc.rb, line 522
def is_any_following_tracks()
  to_b(send_message(find_hwnd(), WM_USER, MBC_IsAnyFollowingTracks, 0))
end
is_any_prior_tracks() click to toggle source

@return [bool]

# File lib/musicbeeipc.rb, line 517
def is_any_prior_tracks()
  to_b(send_message(find_hwnd(), WM_USER, MBC_IsAnyPriorTracks, 0))
end
is_soundtrack() click to toggle source

@return [bool]

# File lib/musicbeeipc.rb, line 486
def is_soundtrack()
  to_b(send_message(find_hwnd(), WM_USER, MBC_IsSoundtrack, 0))
end
jump(index) click to toggle source

@param index [int] @return [MBError]

# File lib/musicbeeipc.rb, line 591
def jump(index)
  send_message(find_hwnd(), WM_USER, MBC_Jump, index)
end
library_add_file_to_library(file_url, category) click to toggle source

@param file_url [String] @param category [MBLibraryCategory] @return [String]

# File lib/musicbeeipc.rb, line 1094
def library_add_file_to_library(file_url, category)
  hwnd = find_hwnd()
  
  lr = send_message(hwnd, WM_COPYDATA, MBC_Library_AddFileToLibrary,
                    pack_si(file_url, category))
  
  r = unpack_s(lr)
  
  send_message(hwnd, WM_USER, MBC_FreeLRESULT, lr)
  
  r
end
library_commit_tags_to_file(file_url) click to toggle source

@param file_url [String] @return [MBError]

# File lib/musicbeeipc.rb, line 990
def library_commit_tags_to_file(file_url)
  send_message(find_hwnd(), WM_COPYDATA, MBC_Library_CommitTagsToFile,
               pack_s(file_url))
end
library_get_artist_picture(artist_name, fading_percent, fading_color) click to toggle source

@param artist_name [String] @param fading_percent [int] @param fading_color [int] @return [String]

# File lib/musicbeeipc.rb, line 1047
def library_get_artist_picture(artist_name, fading_percent, fading_color)
  hwnd = find_hwnd()
  
  lr = send_message(hwnd, WM_COPYDATA, MBC_Library_GetArtistPicture,
                    pack_si(artist_name, fading_percent, fading_color))
  
  r = unpack_s(lr)
  
  send_message(hwnd, WM_USER, MBC_FreeLRESULT, lr)
  
  r
end
library_get_artist_picture_thumb(artist_name) click to toggle source

@param artist_name [String] @return [String]

# File lib/musicbeeipc.rb, line 1078
def library_get_artist_picture_thumb(artist_name)
  hwnd = find_hwnd()
  
  lr = send_message(hwnd, WM_COPYDATA, MBC_Library_GetArtistPictureThumb,
                    pack_s(artist_name))
  
  r = unpack_s(lr)
  
  send_message(hwnd, WM_USER, MBC_FreeLRESULT, lr)
  
  r
end
library_get_artist_picture_urls(artist_name, local_only) click to toggle source

@param artist_name [String] @param local_only [int] @return [String]

# File lib/musicbeeipc.rb, line 1063
def library_get_artist_picture_urls(artist_name, local_only)
  hwnd = find_hwnd()
  
  lr = send_message(hwnd, WM_COPYDATA, MBC_Library_GetArtistPictureUrls,
                    pack_sb(artist_name, local_only))
  
  r = unpack_sa(lr)
  
  send_message(hwnd, WM_USER, MBC_FreeLRESULT, lr)
  
  r
end
library_get_artwork(file_url, index) click to toggle source

@param file_url [String] @param index [int] @return [String]

# File lib/musicbeeipc.rb, line 1014
def library_get_artwork(file_url, index)
  hwnd = find_hwnd()
  
  lr = send_message(hwnd, WM_COPYDATA, MBC_Library_GetArtwork,
                    pack_si(file_url, index))
  
  r = unpack_s(lr)
  
  send_message(hwnd, WM_USER, MBC_FreeLRESULT, lr)
  
  r
end
library_get_artwork_url(file_url, index) click to toggle source

@param file_url [String] @param index [int] @return [String]

# File lib/musicbeeipc.rb, line 1030
def library_get_artwork_url(file_url, index)
  hwnd = find_hwnd()
  
  lr = send_message(hwnd, WM_COPYDATA, MBC_Library_GetArtworkUrl,
                    pack_si(file_url, index))
  
  r = unpack_s(lr)
  
  send_message(hwnd, WM_USER, MBC_FreeLRESULT, lr)
  
  r
end
library_get_file_property(file_url, file_property) click to toggle source

@param file_url [String] @param file_property [MBFileProperty] @return [String]

# File lib/musicbeeipc.rb, line 950
def library_get_file_property(file_url, file_property)
  hwnd = find_hwnd()
  
  lr = send_message(hwnd, WM_COPYDATA, MBC_Library_GetFileProperty,
                    pack_si(file_url, file_property))
  
  r = unpack_s(lr)
  
  send_message(hwnd, WM_USER, MBC_FreeLRESULT, lr)
  
  r
end
library_get_file_tag(file_url, field) click to toggle source

@param file_url [String] @param field [MBMetaData] @return [String]

# File lib/musicbeeipc.rb, line 966
def library_get_file_tag(file_url, field)
  hwnd = find_hwnd()
  
  lr = send_message(hwnd, WM_COPYDATA, MBC_Library_GetFileTag,
                    pack_si(file_url, field))
  
  r = unpack_s(lr)
  
  send_message(hwnd, WM_USER, MBC_FreeLRESULT, lr)
  
  r
end
library_get_lyrics(file_url, lyrics_type) click to toggle source

@param file_url [String] @param lyrics_type [MBLyricsType] @return [String]

# File lib/musicbeeipc.rb, line 998
def library_get_lyrics(file_url, lyrics_type)
  hwnd = find_hwnd()
  
  lr = send_message(hwnd, WM_COPYDATA, MBC_Library_GetLyrics,
                    pack_si(file_url, lyrics_type))
  
  r = unpack_s(lr)
  
  send_message(hwnd, WM_USER, MBC_FreeLRESULT, lr)
  
  r
end
library_jump(index) click to toggle source

@param index [int] @return [MBError]

# File lib/musicbeeipc.rb, line 1189
def library_jump(index)
  send_message(find_hwnd(), WM_USER, MBC_Library_Jump, index)
end
library_query_files(query) click to toggle source

@param query [String] @return [MBError]

# File lib/musicbeeipc.rb, line 1109
def library_query_files(query)
  send_message(find_hwnd(), WM_COPYDATA, MBC_Library_QueryFiles,
               pack_s(query))
end
library_query_files_ex(query) click to toggle source

@param query [String] @return [Array<String>]

# File lib/musicbeeipc.rb, line 1142
def library_query_files_ex(query)
  hwnd = find_hwnd()
  
  lr = send_message(hwnd, WM_COPYDATA, MBC_Library_QueryFilesEx,
                    pack_s(query))
  
  r = unpack_sa(lr)
  
  send_message(hwnd, WM_USER, MBC_FreeLRESULT, lr)
  
  r
end
library_query_get_all_files() click to toggle source

@return [String]

# File lib/musicbeeipc.rb, line 1128
def library_query_get_all_files()
  hwnd = find_hwnd()
  
  lr = send_message(hwnd, WM_USER, MBC_Library_QueryGetAllFiles, 0)
  
  r = unpack_s(lr)
  
  send_message(hwnd, WM_USER, MBC_FreeLRESULT, lr)
  
  r
end
library_query_get_lookup_table_value(key) click to toggle source

@param key [String] @return [Array<String>]

# File lib/musicbeeipc.rb, line 1174
def library_query_get_lookup_table_value(key)
  hwnd = find_hwnd()
  
  lr = send_message(hwnd, WM_COPYDATA, MBC_Library_QueryGetLookupTableValue,
                    pack_s(key))
  
  r = unpack_s(lr)
  
  send_message(hwnd, WM_USER, MBC_FreeLRESULT, lr)
  
  r
end
library_query_get_next_file() click to toggle source

@return [String]

# File lib/musicbeeipc.rb, line 1115
def library_query_get_next_file()
  hwnd = find_hwnd()
  
  lr = send_message(hwnd, WM_USER, MBC_Library_QueryGetNextFile, 0)
  
  r = unpack_s(lr)
  
  send_message(hwnd, WM_USER, MBC_FreeLRESULT, lr)
  
  r
end
library_query_lookup_table(key_tags, value_tags, query) click to toggle source

@param key_tags [String] @param value_tags [String] @param query [String] @return [MBError]

# File lib/musicbeeipc.rb, line 1167
def library_query_lookup_table(key_tags, value_tags, query)
  send_message(find_hwnd(), WM_COPYDATA, MBC_Library_QueryLookupTable,
               pack_s(key_tags, value_tags, query))
end
library_query_similar_artists(artist_name, minimum_artist_similarity_rating) click to toggle source

@param artist_name [String] @param minimum_artist_similarity_rating [double] @return [MBError]

# File lib/musicbeeipc.rb, line 1158
def library_query_similar_artists(artist_name, minimum_artist_similarity_rating)
  send_message(find_hwnd(), WM_COPYDATA, MBC_Library_QueryLookupTable,
               pack_sd(artist_name, minimum_artist_similarity_rating))
end
library_search_and_play_first(query, comparison="Contains", fields=["ArtistPeople", "Title", "Album"]) click to toggle source

@param query [String] @param comparison [String] @param fields [Array<String>] @return [MBError]

# File lib/musicbeeipc.rb, line 1261
def library_search_and_play_first(query, comparison="Contains",
                                  fields=["ArtistPeople", "Title", "Album"])
  send_message(find_hwnd(), WM_COPYDATA, MBC_Library_SearchAndPlayFirst,
               pack_sssa(query, comparison, fields))
end
library_search_first(query, comparison="Contains", fields=["ArtistPeople", "Title", "Album"]) click to toggle source

@param query [String] @param comparison [String] @param fields [Array<String>] @return [String]

# File lib/musicbeeipc.rb, line 1215
def library_search_first(query, comparison="Contains",
                         fields=["ArtistPeople", "Title", "Album"])
  hwnd = find_hwnd()
  
  lr = send_message(hwnd, WM_COPYDATA, MBC_Library_SearchFirst,
                    pack_sssa(query, comparison, fields))
  
  r = unpack_s(lr)
  
  send_message(hwnd, WM_USER, MBC_FreeLRESULT, lr)
  
  r
end
library_search_first_index(query, comparison="Contains", fields=["ArtistPeople", "Title", "Album"]) click to toggle source

@param query [String] @param comparison [String] @param fields [Array<String>] @return [int]

# File lib/musicbeeipc.rb, line 1251
def library_search_first_index(query, comparison="Contains",
                               fields=["ArtistPeople", "Title", "Album"])
  send_message(find_hwnd(), WM_COPYDATA, MBC_Library_SearchFirstIndex,
               pack_sssa(query, comparison, fields))
end
library_search_indices(query, comparison="Contains", fields=["ArtistPeople", "Title", "Album"]) click to toggle source

@param query [String] @param comparison [String] @param fields [Array<String>] @return [Array<int>]

# File lib/musicbeeipc.rb, line 1233
def library_search_indices(query, comparison="Contains",
                           fields=["ArtistPeople", "Title", "Album"])
  hwnd = find_hwnd()
  
  lr = send_message(hwnd, WM_COPYDATA, MBC_Library_SearchIndices,
                    pack_sssa(query, comparison, fields))
  
  r = unpack_ia(lr)
  
  send_message(hwnd, WM_USER, MBC_FreeLRESULT, lr)
  
  r
end
library_set_file_tag(file_url, field, value) click to toggle source

@param file_url [String] @param field [MBMetaData] @param value [String] @return [MBError]

# File lib/musicbeeipc.rb, line 983
def library_set_file_tag(file_url, field, value)
  send_message(find_hwnd(), WM_COPYDATA, MBC_Library_SetFileTag,
               pack_sis(file_url, field, value))
end
message_box(text, caption) click to toggle source

@param text [String] @param caption [String] @return [MBError]

# File lib/musicbeeipc.rb, line 1439
def message_box(text, caption)
  send_message(find_hwnd(), WM_COPYDATA, MBC_MessageBox,
               pack_s(text, caption))
end
move_files(from_indices, to_index) click to toggle source

@param from_indices [Array<int>] @param to_index [int] @return [MBError]

# File lib/musicbeeipc.rb, line 558
def move_files(from_indices, to_index)
  send_message(find_hwnd(), WM_COPYDATA, MBC_MoveFiles,
               pack_iai(from_indices, to_index))
end
next_track() click to toggle source

@return [MBError]

# File lib/musicbeeipc.rb, line 55
def next_track()
  send_message(find_hwnd(), WM_USER, MBC_NextTrack, 0)
end
now_playing_list_get_file_property(index, file_property) click to toggle source

@param index [int] @param file_property [MBFileProperty] @return [String]

# File lib/musicbeeipc.rb, line 688
def now_playing_list_get_file_property(index, file_property)
  hwnd = find_hwnd()
  
  lr = send_message(hwnd, WM_COPYDATA, MBC_NowPlayingList_GetFileProperty,
                    pack_i(index, file_property))
  
  r = unpack_s(lr)
  
  send_message(hwnd, WM_USER, MBC_FreeLRESULT, lr)
  
  r
end
now_playing_list_get_file_tag(index, field) click to toggle source

@param index [int] @param field [MBMetaData] @return [String]

# File lib/musicbeeipc.rb, line 704
def now_playing_list_get_file_tag(index, field)
  hwnd = find_hwnd()
  
  lr = send_message(hwnd, WM_COPYDATA, MBC_NowPlayingList_GetFileTag,
                    pack_i(index, field))
  
  r = unpack_s(lr)
  
  send_message(hwnd, WM_USER, MBC_FreeLRESULT, lr)
  
  r
end
now_playing_list_get_item_count() click to toggle source

@return [int]

# File lib/musicbeeipc.rb, line 772
def now_playing_list_get_item_count()
  send_message(find_hwnd(), WM_USER, MBC_NowPlayingList_GetItemCount, 0)
end
now_playing_list_get_list_file_url(index) click to toggle source

@param index [int] @return [String]

# File lib/musicbeeipc.rb, line 673
def now_playing_list_get_list_file_url(index)
  hwnd = find_hwnd()
  
  lr = send_message(hwnd, WM_USER, MBC_NowPlayingList_GetListFileUrl, index)
  
  r = unpack_s(lr)
  
  send_message(hwnd, WM_USER, MBC_FreeLRESULT, lr)
  
  r
end
now_playing_list_play_library_shuffled() click to toggle source

@return [MBError]

# File lib/musicbeeipc.rb, line 766
def now_playing_list_play_library_shuffled()
  send_message(find_hwnd(), WM_USER,
               MBC_NowPlayingList_PlayLibraryShuffled, 0)
end
now_playing_list_query_files(query) click to toggle source

@param query [String] @return [MBError]

# File lib/musicbeeipc.rb, line 719
def now_playing_list_query_files(query)
  send_message(find_hwnd(), WM_COPYDATA, MBC_NowPlayingList_QueryFiles,
               pack_s(query))
end
now_playing_list_query_files_ex(query) click to toggle source

@param query [String] @return [Array<String>]

# File lib/musicbeeipc.rb, line 752
def now_playing_list_query_files_ex(query)
  hwnd = find_hwnd()
  
  lr = send_message(hwnd, WM_COPYDATA, MBC_NowPlayingList_QueryFilesEx,
                    pack_s(query))
  
  r = unpack_sa(lr)
  
  send_message(hwnd, WM_USER, MBC_FreeLRESULT, lr)
  
  r
end
now_playing_list_query_get_all_files() click to toggle source

@return [String]

# File lib/musicbeeipc.rb, line 738
def now_playing_list_query_get_all_files()
  hwnd = find_hwnd()
  
  lr = send_message(hwnd, WM_USER, MBC_NowPlayingList_QueryGetAllFiles, 0)
  
  r = unpack_s(lr)
  
  send_message(hwnd, WM_USER, MBC_FreeLRESULT, lr)
  
  r
end
now_playing_list_query_get_next_file() click to toggle source

@return [String]

# File lib/musicbeeipc.rb, line 725
def now_playing_list_query_get_next_file()
  hwnd = find_hwnd()
  
  lr = send_message(hwnd, WM_USER, MBC_NowPlayingList_QueryGetNextFile, 0)
  
  r = unpack_s(lr)
  
  send_message(hwnd, WM_USER, MBC_FreeLRESULT, lr)
  
  r
end
pause() click to toggle source

@return [MBError]

# File lib/musicbeeipc.rb, line 35
def pause()
  send_message(find_hwnd(), WM_USER, MBC_Pause, 0)
end
play() click to toggle source

@return [MBError]

# File lib/musicbeeipc.rb, line 30
def play()
  send_message(find_hwnd(), WM_USER, MBC_Play, 0)
end
play_now(fileurl) click to toggle source

@param fileurl [String] @return [MBError]

# File lib/musicbeeipc.rb, line 528
def play_now(fileurl)
  send_message(find_hwnd(), WM_COPYDATA, MBC_PlayNow, pack_s(fileurl))
end
play_pause() click to toggle source

@return [MBError]

# File lib/musicbeeipc.rb, line 25
def play_pause()
  send_message(find_hwnd(), WM_USER, MBC_PlayPause, 0)
end
playlist_append_files(playlist_url, filenames) click to toggle source

@param playlist_url [String] @param filenames [Array<String>] @return [MBError]

# File lib/musicbeeipc.rb, line 909
def playlist_append_files(playlist_url, filenames)
  send_message(find_hwnd(), WM_COPYDATA, MBC_Playlist_AppendFiles,
               pack_ssa(playlist_url, filenames))
end
playlist_create_playlist(folder_name, playlist_name, filenames) click to toggle source

@param folder_name [String] @param playlist_name [String] @param filenames [Array<String>] @return [String]

# File lib/musicbeeipc.rb, line 878
def playlist_create_playlist(folder_name, playlist_name, filenames)
  hwnd = find_hwnd()
  
  lr = send_message(hwnd, WM_COPYDATA, MBC_Playlist_CreatePlaylist,
                    pack_sssa(folder_name, playlist_name, filenames))
  
  r = unpack_s(lr)
  
  send_message(hwnd, WM_USER, MBC_FreeLRESULT, lr)
  
  r
end
playlist_delete_playlist(playlist_url) click to toggle source

@param playlist_url [String] @return [MBError]

# File lib/musicbeeipc.rb, line 893
def playlist_delete_playlist(playlist_url)
  send_message(find_hwnd(), WM_COPYDATA, MBC_Playlist_DeletePlaylist,
               pack_s(playlist_url))
end
playlist_get_item_count(playlist_url) click to toggle source

@param playlist_url [String] @return [int]

# File lib/musicbeeipc.rb, line 940
def playlist_get_item_count(playlist_url)
  send_message(find_hwnd(), WM_COPYDATA, MBC_Playlist_GetItemCount,
               pack_s(playlist_url))
end
playlist_get_name(playlist_url) click to toggle source

@param playlist_url [String] @return [String]

# File lib/musicbeeipc.rb, line 780
def playlist_get_name(playlist_url)
  hwnd = find_hwnd()
  
  lr = send_message(hwnd, WM_COPYDATA, MBC_Playlist_GetName,
                    pack_s(playlist_url))
  
  r = unpack_s(lr)
  
  send_message(hwnd, WM_USER, MBC_FreeLRESULT, lr)
  
  r
end
playlist_get_type(playlist_url) click to toggle source

@param playlist_url [String] @return [MBPlaylistFormat]

# File lib/musicbeeipc.rb, line 795
def playlist_get_type(playlist_url)
  send_message(find_hwnd(), WM_COPYDATA, MBC_Playlist_GetType,
               pack_s(playlist_url))
end
playlist_is_in_list(playlist_url, filename) click to toggle source

@param playlist_url [String] @param filename [String] @return [bool]

# File lib/musicbeeipc.rb, line 803
def playlist_is_in_list(playlist_url, filename)
  send_message(find_hwnd(), WM_COPYDATA, MBC_Playlist_IsInList,
               pack_s(playlist_url, filename))
end
playlist_move_files(playlist_url, from_indices, to_index) click to toggle source

@param playlist_url [String] @param from_indices [Array<int>] @param to_index [int] @return [MBError]

# File lib/musicbeeipc.rb, line 926
def playlist_move_files(playlist_url, from_indices, to_index)
  send_message(find_hwnd(), WM_COPYDATA, MBC_Playlist_MoveFiles,
               pack_siai(playlist_url, from_indices, to_index))
end
playlist_play_now(playlist_url) click to toggle source

@param playlist_url [String] @return [MBError]

# File lib/musicbeeipc.rb, line 933
def playlist_play_now(playlist_url)
  send_message(find_hwnd(), WM_COPYDATA, MBC_Playlist_PlayNow,
               pack_s(playlist_url))
end
playlist_query_files(playlist_url) click to toggle source

@param playlist_url [String] @return [MBError]

# File lib/musicbeeipc.rb, line 828
def playlist_query_files(playlist_url)
  send_message(find_hwnd(), WM_COPYDATA, MBC_Playlist_QueryFiles,
               pack_s(playlist_url))
end
playlist_query_files_ex(playlist_url) click to toggle source

@param playlist_url [String] @return [Array<String>]

# File lib/musicbeeipc.rb, line 861
def playlist_query_files_ex(playlist_url)
  hwnd = find_hwnd()
  
  lr = send_message(hwnd, WM_COPYDATA, MBC_Playlist_QueryFilesEx,
                    pack_s(playlist_url))
  
  r = unpack_sa(lr)
  
  send_message(hwnd, WM_USER, MBC_FreeLRESULT, lr)
  
  r
end
playlist_query_get_all_files() click to toggle source

@return [String]

# File lib/musicbeeipc.rb, line 847
def playlist_query_get_all_files()
  hwnd = find_hwnd()
  
  lr = send_message(hwnd, WM_USER, MBC_Playlist_QueryGetAllFiles, 0)
  
  r = unpack_s(lr)
  
  send_message(hwnd, WM_USER, MBC_FreeLRESULT, lr)
  
  r
end
playlist_query_get_next_file() click to toggle source

@return [String]

# File lib/musicbeeipc.rb, line 834
def playlist_query_get_next_file()
  hwnd = find_hwnd()
  
  lr = send_message(hwnd, WM_USER, MBC_Playlist_QueryGetNextFile, 0)
  
  r = unpack_s(lr)
  
  send_message(hwnd, WM_USER, MBC_FreeLRESULT, lr)
  
  r
end
playlist_query_get_next_playlist() click to toggle source

@return [String]

# File lib/musicbeeipc.rb, line 814
def playlist_query_get_next_playlist()
  hwnd = find_hwnd()
  
  lr = send_message(hwnd, WM_USER, MBC_Playlist_QueryGetNextPlaylist, 0)
  
  r = unpack_s(lr)
  
  send_message(hwnd, WM_USER, MBC_FreeLRESULT, lr)
  
  r
end
playlist_query_playlists() click to toggle source

@return [MBError]

# File lib/musicbeeipc.rb, line 809
def playlist_query_playlists()
  send_message(find_hwnd(), WM_USER, MBC_Playlist_QueryPlaylists, 0)
end
playlist_remove_at(playlist_url, index) click to toggle source

@param playlist_url [String] @param index [int] @return [MBError]

# File lib/musicbeeipc.rb, line 917
def playlist_remove_at(playlist_url, index)
  send_message(find_hwnd(), WM_COPYDATA, MBC_Playlist_RemoveAt,
               pack_si(playlist_url, index))
end
playlist_set_files(playlist_url, filenames) click to toggle source

@param playlist_url [String] @param filenames [Array<String>] @return [MBError]

# File lib/musicbeeipc.rb, line 901
def playlist_set_files(playlist_url, filenames)
  send_message(find_hwnd(), WM_COPYDATA, MBC_Playlist_SetFiles,
               pack_ssa(playlist_url, filenames))
end
position() click to toggle source

@return [int]

# File lib/musicbeeipc.rb, line 118
def position
  send_message(find_hwnd(), WM_USER, MBC_GetPosition, 0)
end
position=(position) click to toggle source

@param position [int]

# File lib/musicbeeipc.rb, line 123
def position=(position)
  send_message(find_hwnd(), WM_USER, MBC_SetPosition, position)
end
previous_track() click to toggle source

@return [MBError]

# File lib/musicbeeipc.rb, line 50
def previous_track()
  send_message(find_hwnd(), WM_USER, MBC_PreviousTrack, 0)
end
probe() click to toggle source

@return [bool]

# File lib/musicbeeipc.rb, line 20
def probe()
  send_message(find_hwnd(), WM_USER, MBC_Probe, 0) != MBE_Error
end
queue_last(fileurl) click to toggle source

@param fileurl [String] @return [MBError]

# File lib/musicbeeipc.rb, line 540
def queue_last(fileurl)
  send_message(find_hwnd(), WM_COPYDATA, MBC_QueueLast, pack_s(fileurl))
end
queue_next(fileurl) click to toggle source

@param fileurl [String] @return [MBError]

# File lib/musicbeeipc.rb, line 534
def queue_next(fileurl)
  send_message(find_hwnd(), WM_COPYDATA, MBC_QueueNext, pack_s(fileurl))
end
queue_random_tracks() click to toggle source

@param count [int] @return [MBError]

# File lib/musicbeeipc.rb, line 316
def queue_random_tracks()
  send_message(find_hwnd(), WM_USER, MBC_QueueRandomTracks, count)
end
remove_at(index) click to toggle source

@param index [int] @return [MBError]

# File lib/musicbeeipc.rb, line 551
def remove_at(index)
  send_message(find_hwnd(), WM_USER, MBC_RemoveAt, index)
end
search_and_play_first(query, comparison="Contains", fields=["ArtistPeople", "Title", "Album"]) click to toggle source

@param query [String] @param comparison [String] @param fields [Array<String>] @return [MBError]

# File lib/musicbeeipc.rb, line 663
def search_and_play_first(query, comparison="Contains",
                          fields=["ArtistPeople", "Title", "Album"])
  send_message(find_hwnd(), WM_COPYDATA, MBC_SearchAndPlayFirst,
               pack_sssa(query, comparison, fields))
end
search_first(query, comparison="Contains", fields=["ArtistPeople", "Title", "Album"]) click to toggle source

@param query [String] @param comparison [String] @param fields [Array<String>] @return [String]

# File lib/musicbeeipc.rb, line 617
def search_first(query, comparison="Contains",
                 fields=["ArtistPeople", "Title", "Album"])
  hwnd = find_hwnd()
  
  lr = send_message(hwnd, WM_COPYDATA, MBC_SearchFirst,
                    pack_sssa(query, comparison, fields))
  
  r = unpack_s(lr)
  
  send_message(hwnd, WM_USER, MBC_FreeLRESULT, lr)
  
  r
end
search_first_index(query, comparison="Contains", fields=["ArtistPeople", "Title", "Album"]) click to toggle source

@param query [String] @param comparison [String] @param fields [Array<String>] @return [int]

# File lib/musicbeeipc.rb, line 653
def search_first_index(query, comparison="Contains",
                       fields=["ArtistPeople", "Title", "Album"])
  send_message(find_hwnd(), WM_COPYDATA, MBC_SearchFirstIndex,
               pack_sssa(query, comparison, fields))
end
search_indices(query, comparison="Contains", fields=["ArtistPeople", "Title", "Album"]) click to toggle source

@param query [String] @param comparison [String] @param fields [Array<String>] @return [Array<int>]

# File lib/musicbeeipc.rb, line 635
def search_indices(query, comparison="Contains",
                   fields=["ArtistPeople", "Title", "Album"])
  hwnd = find_hwnd()
  
  lr = send_message(hwnd, WM_COPYDATA, MBC_SearchIndices,
                    pack_sssa(query, comparison, fields))
  
  r = unpack_ia(lr)
  
  send_message(hwnd, WM_USER, MBC_FreeLRESULT, lr)
  
  r
end
set_crossfade(crossfade) click to toggle source

@param crossfade [bool] @return [MBError]

# File lib/musicbeeipc.rb, line 299
def set_crossfade(crossfade)
  send_message(find_hwnd(), WM_USER, MBC_SetCrossfade, to_i(crossfade))
end
set_dsp_enabled(enabled) click to toggle source

@param enabled [bool] @return [MBError]

# File lib/musicbeeipc.rb, line 255
def set_dsp_enabled(enabled)
  send_message(find_hwnd(), WM_USER, MBC_SetDspEnabled, to_i(enabled))
end
set_equalizer_enabled(enabled) click to toggle source

@param enabled [bool] @return [MBError]

# File lib/musicbeeipc.rb, line 244
def set_equalizer_enabled(enabled)
  send_message(find_hwnd(), WM_USER, MBC_SetEqualizerEnabled, to_i(enabled))
end
set_mute(mute) click to toggle source

@param mute [bool] @return [MBError]

# File lib/musicbeeipc.rb, line 211
def set_mute(mute)
  send_message(find_hwnd(), WM_USER, MBC_SetMute, to_i(mute))
end
set_position(position) click to toggle source

@param position [int] @return [MBError]

# File lib/musicbeeipc.rb, line 113
def set_position(position)
  send_message(find_hwnd(), WM_USER, MBC_SetPosition, position)
end
set_repeat(repeat) click to toggle source

@param repeat [MBRepeatMode] @return [MBError]

# File lib/musicbeeipc.rb, line 233
def set_repeat(repeat)
  send_message(find_hwnd(), WM_USER, MBC_SetRepeat, repeat)
end
set_replay_gain_mode(mode) click to toggle source

@param mode [MBReplayGainMode] @return [MBError]

# File lib/musicbeeipc.rb, line 310
def set_replay_gain_mode(mode)
  send_message(find_hwnd(), WM_USER, MBC_SetReplayGainMode, mode)
end
set_scrobble_enabled(enabled) click to toggle source

@param enabled [bool] @return [MBError]

# File lib/musicbeeipc.rb, line 266
def set_scrobble_enabled(enabled)
  send_message(find_hwnd(), WM_USER, MBC_SetScrobbleEnabled, to_i(enabled))
end
set_shuffle(shuffle) click to toggle source

@param shuffle [bool] @return [MBError]

# File lib/musicbeeipc.rb, line 222
def set_shuffle(shuffle)
  send_message(find_hwnd(), WM_USER, MBC_SetShuffle, to_i(shuffle))
end
set_stop_after_current_enabled(enabled) click to toggle source

@param enabled [bool] @return [bool]

# File lib/musicbeeipc.rb, line 287
def set_stop_after_current_enabled(enabled)
  send_message(find_hwnd(), WM_USER, MBC_SetStopAfterCurrentEnabled,
               to_i(enabled))
end
set_volume(volume) click to toggle source

Volume - Value between 0 - 100 @param volume [int] @return [MBError]

# File lib/musicbeeipc.rb, line 136
def set_volume(volume)
  send_message(find_hwnd(), WM_USER, MBC_SetVolume, volume)
end
set_volumef(volume) click to toggle source

Floating point volume - Value between 0.0 - 1.0 @param volume [float] @return [MBError]

# File lib/musicbeeipc.rb, line 186
def set_volumef(volume)
  send_message(find_hwnd(), WM_USER, MBC_SetVolumef,
               FloatInt.new(f:volume)[:i])
end
set_volumep(volume) click to toggle source

Precise volume - Value between 0 - 10000 @param volume [int] @return [MBError]

# File lib/musicbeeipc.rb, line 161
def set_volumep(volume)
  send_message(find_hwnd(), WM_USER, MBC_SetVolumep, volume)
end
setting_get_data_type(field) click to toggle source

@param field [MBMetaData] @return [MBDataType]

# File lib/musicbeeipc.rb, line 1285
def setting_get_data_type(field)
  send_message(find_hwnd(), WM_USER, MBC_Setting_GetDataType, field)
end
setting_get_field_name(field) click to toggle source

@param field [MBMetaData] @return [String]

# File lib/musicbeeipc.rb, line 1271
def setting_get_field_name(field)
  hwnd = find_hwnd()
  
  lr = send_message(hwnd, WM_COPYDATA, MBC_Setting_GetFieldName, field)
  
  r = unpack_s(lr)
  
  send_message(hwnd, WM_USER, MBC_FreeLRESULT, lr)
  
  r
end
show_equalizer() click to toggle source

@return [MBError]

# File lib/musicbeeipc.rb, line 271
def show_equalizer()
  send_message(find_hwnd(), WM_USER, MBC_ShowEqualiser, 0)
end
show_now_playing_assistant() click to toggle source

@return [MBError]

# File lib/musicbeeipc.rb, line 564
def show_now_playing_assistant()
  send_message(find_hwnd(), WM_USER, MBC_ShowNowPlayingAssistant, 0)
end
start_auto_dj() click to toggle source

@return [MBError]

# File lib/musicbeeipc.rb, line 60
def start_auto_dj()
  send_message(find_hwnd(), WM_USER, MBC_StartAutoDj, 0)
end
stop() click to toggle source

@return [MBError]

# File lib/musicbeeipc.rb, line 40
def stop()
  send_message(find_hwnd(), WM_USER, MBC_Stop, 0)
end
stop_after_current() click to toggle source

@return [MBError]

# File lib/musicbeeipc.rb, line 45
def stop_after_current()
  send_message(find_hwnd(), WM_USER, MBC_StopAfterCurrent, 0)
end
test() click to toggle source

@return [MBError]

# File lib/musicbeeipc.rb, line 1432
def test()
  send_message(find_hwnd(), WM_USER, MBC_Test, 0)
end
to_byte_array(str) click to toggle source

Converts returned String to byte array @param str [String to convert] @return [Array<uint8>]

# File lib/musicbeeipc.rb, line 1455
def to_byte_array(str)
  str.encode("UTF-16LE").force_encoding("BINARY").unpack("C*")
end
to_bytes(str) click to toggle source

Converts returned String to bytes @param str [String to convert] @return [String]

# File lib/musicbeeipc.rb, line 1448
def to_bytes(str)
  str.encode("UTF-16LE").force_encoding("BINARY")
end
volume() click to toggle source

Volume - Value between 0 - 100 @return [int]

# File lib/musicbeeipc.rb, line 142
def volume
  send_message(find_hwnd(), WM_USER, MBC_GetVolume, 0)
end
volume=(volume) click to toggle source

Volume - Value between 0 - 100 @param volume [int]

# File lib/musicbeeipc.rb, line 148
def volume=(volume)
  send_message(find_hwnd(), WM_USER, MBC_SetVolume, volume)
end
volumef() click to toggle source

Floating point volume - Value between 0.0 - 1.0 @return [float]

# File lib/musicbeeipc.rb, line 193
def volumef
  FloatInt.new(i:send_message(find_hwnd(), WM_USER, MBC_GetVolumef, 0))[:f]
end
volumef=(volume) click to toggle source

Floating point volume - Value between 0.0 - 1.0 @param volume [float]

# File lib/musicbeeipc.rb, line 199
def volumef=(volume)
  send_message(find_hwnd(), WM_USER, MBC_SetVolumef,
               FloatInt.new(f:volume)[:i])
end
volumep() click to toggle source

Precise volume - Value between 0 - 10000 @return [int]

# File lib/musicbeeipc.rb, line 167
def volumep
  send_message(find_hwnd(), WM_USER, MBC_GetVolumep, 0)
end
volumep=(volume) click to toggle source

Precise volume - Value between 0 - 10000 @param volume [int]

# File lib/musicbeeipc.rb, line 173
def volumep=(volume)
  send_message(find_hwnd(), WM_USER, MBC_SetVolumep, volume)
end
window_bring_to_front() click to toggle source

@return [MBError]

# File lib/musicbeeipc.rb, line 1336
def window_bring_to_front()
  send_message(find_hwnd(), WM_USER, MBC_Window_BringToFront, 0)
end
window_close() click to toggle source

@return [MBError]

# File lib/musicbeeipc.rb, line 1302
def window_close()
  send_message(find_hwnd(), WM_USER, MBC_Window_Close, 0)
end
window_get_handle() click to toggle source

@return [HWND (long)]

# File lib/musicbeeipc.rb, line 1292
def window_get_handle()
  send_message(find_hwnd(), WM_USER, MBC_Window_GetHandle, 0)
end
window_get_handle_ptr() click to toggle source

@return [HWND (pointer)]

# File lib/musicbeeipc.rb, line 1297
def window_get_handle_ptr()
  send_message_ptr(find_hwnd(), WM_USER, MBC_Window_GetHandle, 0)
end
window_get_position() click to toggle source

@return [Array<int>]

# File lib/musicbeeipc.rb, line 1341
def window_get_position()
  hwnd = find_hwnd()
  
  lr = send_message(hwnd, WM_USER, MBC_Window_GetPosition, 0)
  
  r = unpack_ii(lr)
  
  send_message(hwnd, WM_USER, MBC_FreeLRESULT, lr)
  
  r
end
window_get_size() click to toggle source

@return [Array<int>]

# File lib/musicbeeipc.rb, line 1354
def window_get_size()
  hwnd = find_hwnd()
  
  lr = send_message(hwnd, WM_USER, MBC_Window_GetSize, 0)
  
  r = unpack_ii(lr)
  
  send_message(hwnd, WM_USER, MBC_FreeLRESULT, lr)
  
  r
end
window_maximize() click to toggle source

@return [MBError]

# File lib/musicbeeipc.rb, line 1317
def window_maximize()
  send_message(find_hwnd(), WM_USER, MBC_Window_Maximize, 0)
end
window_minimize() click to toggle source

@return [MBError]

# File lib/musicbeeipc.rb, line 1312
def window_minimize()
  send_message(find_hwnd(), WM_USER, MBC_Window_Minimize, 0)
end
window_move() click to toggle source

@param x [int] @param y [int] @return [MBError]

# File lib/musicbeeipc.rb, line 1324
def window_move()
  send_message(find_hwnd(), WM_USER, MBC_Window_Move, pack_i(x, y))
end
window_resize() click to toggle source

@param w [int] @param h [int] @return [MBError]

# File lib/musicbeeipc.rb, line 1331
def window_resize()
  send_message(find_hwnd(), WM_USER, MBC_Window_Resize, pack_i(w, h))
end
window_restore() click to toggle source

@return [MBError]

# File lib/musicbeeipc.rb, line 1307
def window_restore()
  send_message(find_hwnd(), WM_USER, MBC_Window_Restore, 0)
end

Private Instance Methods

close_mmf(mmf) click to toggle source
# File lib/unpack.rb, line 186
def close_mmf(mmf)
  close_handle(mmf)
end
find_hwnd() click to toggle source

@return [HWND (pointer)]

# File lib/musicbeeipc.rb, line 1466
def find_hwnd()
  find_window(nil, "MusicBee IPC Interface\0".encode("UTF-16LE"))
end
map_mmf_view(mmf, lr) click to toggle source
# File lib/unpack.rb, line 190
def map_mmf_view(mmf, lr)
  ls = LRUShort.new(lr)
  
  # FILE_MAP_READ = 0x0004 = 4
  view = map_view_of_file(mmf, 4, 0, 0, 0)
  
  ptr = FFI::Pointer.new(:char, view + ls[:high] + MBIPC_SIZEOFLONG)
  
  return [view, ptr]
end
open_mmf(lr) click to toggle source
# File lib/unpack.rb, line 174
def open_mmf(lr)
  return nil if !lr || lr == 0
  
  ls = LRUShort.new(lr)
  
  name = ("mbipc_mmf_" + ls[:low].to_s + "\0").encode("UTF-16LE")

  # FILE_MAP_READ = 0x0004 = 4
  # FALSE = 0
  open_file_mapping(4, 0, name)
end
pack_i(*int32s) click to toggle source

-Int32: 32 bit integer -Int32: 32 bit integer -…

# File lib/pack.rb, line 23
def pack_i(*int32s)
  cds = COPYDATASTRUCT.new
  cds[:dwData] = 0
  
  num = int32s.length
  
  cds[:cbData] = MBIPC_SIZEOFINT * num
  
  data = int32s.pack("l" + num.to_s)
  
  cds[:lpData] = FFI::MemoryPointer.from_string(data)
  
  return cds.to_ptr.address
end
pack_iai(int32s, int32_1) click to toggle source

-Int32: Number of integers in integer array -Int32: 32 bit integer -Int32: 32 bit integer -… -Int32: 32 bit integer

# File lib/pack.rb, line 242
def pack_iai(int32s, int32_1)
  cds = COPYDATASTRUCT.new
  cds[:dwData] = 0
  
  num = int32s.length
  
  cds[:cbData] = MBIPC_SIZEOFINT * (num + 2)
  
  data = ([num] + int32s + [int32_1]).pack("l" + (num + 2).to_s)
  
  cds[:lpData] = FFI::MemoryPointer.from_string(data)
  
  return cds.to_ptr.address
end
pack_s(*strings) click to toggle source

-Int32: Byte count of string -byte[]: String data -Int32: Byte count of string -byte[]: String data -…

# File lib/pack.rb, line 43
def pack_s(*strings)
  cds = COPYDATASTRUCT.new
  cds[:dwData] = 0
  
  num = strings.length
  
  cds[:cbData] = MBIPC_SIZEOFINT * num
  
  encoded = strings.map do |s|
    e = s.encode("UTF-16LE").force_encoding("BINARY")
    cds[:cbData] += e.length
    e
  end
  
  data = ""
  encoded.each { |e| data += [e.length].pack("l") + e }
  
  cds[:lpData] = FFI::MemoryPointer.from_string(data)
  
  return cds.to_ptr.address
end
pack_sb(string_1, *bools) click to toggle source

-Int32: Byte count of string -byte[]: String data -Int32: bool -Int32: bool -…

# File lib/pack.rb, line 94
def pack_sb(string_1, *bools)
  cds = COPYDATASTRUCT.new
  cds[:dwData] = 0
  
  encoded = string_1.encode("UTF-16LE").force_encoding("BINARY")
  byte_count = encoded.length
  
  bools_i = bools.map { |b| b ? 1 : 0 }
  
  num = bools_i.length
  
  cds[:cbData] = MBIPC_SIZEOFINT * (num + 1) + byte_count
  
  data = [byte_count].pack("l") + encoded +
         bools_i.pack("l" + bools_i.length.to_s)
  
  cds[:lpData] = FFI::MemoryPointer.from_string(data)
  
  return cds.to_ptr.address
end
pack_sd(string_1, *doubles) click to toggle source

-Int32: Byte count of string -byte[]: String data -double: 64-bit floating-point value -double: 64-bit floating-point value -…

# File lib/pack.rb, line 120
def pack_sd(string_1, *doubles)
  cds = COPYDATASTRUCT.new
  cds[:dwData] = 0
  
  encoded = string_1.encode("UTF-16LE").force_encoding("BINARY")
  byte_count = encoded.length
  
  num = doubles.length
  
  cds[:cbData] = MBIPC_SIZEOFDOUBLE * num + MBIPC_SIZEOFINT + byte_count
  
  data = [byte_count].pack("l") + encoded +
         doubles.pack("d" + doubles.length.to_s)
  
  cds[:lpData] = FFI::MemoryPointer.from_string(data)
  
  return cds.to_ptr.address
end
pack_si(string_1, *int32s) click to toggle source

-Int32: Byte count of string -byte[]: String data -Int32: 32 bit integer -Int32: 32 bit integer -…

# File lib/pack.rb, line 70
def pack_si(string_1, *int32s)
  cds = COPYDATASTRUCT.new
  cds[:dwData] = 0
  
  encoded = string_1.encode("UTF-16LE").force_encoding("BINARY")
  byte_count = encoded.length
  
  num = int32s.length
  
  cds[:cbData] = MBIPC_SIZEOFINT * (num + 1) + byte_count
  
  data = [byte_count].pack("l") + encoded +
         int32s.pack("l" + int32s.length.to_s)
  
  cds[:lpData] = FFI::MemoryPointer.from_string(data)
  
  return cds.to_ptr.address
end
pack_siai(string_1, int32s, int32_1) click to toggle source

-Int32: Byte count of string -byte[]: String data -Int32: Number of integers in integer array -Int32: 32 bit integer -Int32: 32 bit integer -… -Int32: 32 bit integer

# File lib/pack.rb, line 264
def pack_siai(string_1, int32s, int32_1)
  cds = COPYDATASTRUCT.new
  cds[:dwData] = 0
  
  encoded = string_1.encode("UTF-16LE").force_encoding("BINARY")
  byte_count = encoded.length
  
  num = int32s.length
  
  cds[:cbData] = MBIPC_SIZEOFINT * (num + 3) + byte_count
  
  data = [byte_count].pack("l") + encoded +
         ([num] + int32s + [int32_1]).pack("l" + (num + 2).to_s)
  
  cds[:lpData] = FFI::MemoryPointer.from_string(data)
  
  return cds.to_ptr.address
end
pack_sis(string_1, int32_1, string_2) click to toggle source

-Int32: Byte count of string -byte[]: String data -Int32: 32 bit integer -Int32: Byte count of string -byte[]: String data -…

# File lib/pack.rb, line 217
def pack_sis(string_1, int32_1, string_2)
  cds = COPYDATASTRUCT.new
  cds[:dwData] = 0
  
  encoded_1 = string_1.encode("UTF-16LE").force_encoding("BINARY")
  byte_count_1 = encoded_1.length
  
  encoded_2 = string_2.encode("UTF-16LE").force_encoding("BINARY")
  byte_count_2 = encoded_2.length
  
  cds[:cbData] = MBIPC_SIZEOFINT * 3 + byte_count_1 + byte_count_2
  
  data = [byte_count_1].pack("l") + encoded_1 +
         [int32_1, byte_count_2].pack("ll") + encoded_2
  
  cds[:lpData] = FFI::MemoryPointer.from_string(data)
  
  return cds.to_ptr.address
end
pack_ssa(string_1, strings) click to toggle source

-Int32: Byte count of string -byte[]: String data -Int32: Number of strings in string array -Int32: Byte count of string in string array -byte[]: String data in string array -Int32: Byte count of string in string array -byte[]: String data in string array -…

# File lib/pack.rb, line 147
def pack_ssa(string_1, strings)
  cds = COPYDATASTRUCT.new
  cds[:dwData] = 0
  
  encoded_1 = string_1.encode("UTF-16LE").force_encoding("BINARY")
  byte_count_1 = encoded_1.length
  
  num = strings.length
  
  cds[:cbData] = MBIPC_SIZEOFINT * (num + 2) + byte_count_1
  
  encoded = strings.map do |s|
    e = s.encode("UTF-16LE").force_encoding("BINARY")
    cds[:cbData] += e.length
    e
  end
  
  data = [byte_count_1].pack("l") + encoded_1 + [num].pack("l")
  encoded.each { |e| data += [e.length].pack("l") + e }
  
  cds[:lpData] = FFI::MemoryPointer.from_string(data)
  
  return cds.to_ptr.address
end
pack_sssa(string_1, string_2, strings) click to toggle source

-Int32: Byte count of string -byte[]: String data -Int32: Byte count of string -byte[]: String data -Int32: Number of strings in string array -Int32: Byte count of string in string array -byte[]: String data in string array -Int32: Byte count of string in string array -byte[]: String data in string array -…

# File lib/pack.rb, line 182
def pack_sssa(string_1, string_2, strings)
  cds = COPYDATASTRUCT.new
  cds[:dwData] = 0
  
  encoded_1 = string_1.encode("UTF-16LE").force_encoding("BINARY")
  byte_count_1 = encoded_1.length
  
  encoded_2 = string_2.encode("UTF-16LE").force_encoding("BINARY")
  byte_count_2 = encoded_2.length
  
  num = strings.length
  
  cds[:cbData] = MBIPC_SIZEOFINT * (num + 3) + byte_count_1 + byte_count_2
  
  encoded = strings.map do |s|
    e = s.encode("UTF-16LE").force_encoding("BINARY")
    cds[:cbData] += e.length
    e
  end
  
  data = [byte_count_1].pack("l") + encoded_1 +
         [byte_count_2].pack("l") + encoded_2 + [num].pack("l")
  encoded.each { |e| data += [e.length].pack("l") + e }
  
  cds[:lpData] = FFI::MemoryPointer.from_string(data)
  
  return cds.to_ptr.address
end
to_b(i) click to toggle source
# File lib/musicbeeipc.rb, line 1470
def to_b(i)
  i == 0 ? false : true
end
to_i(b) click to toggle source
# File lib/musicbeeipc.rb, line 1474
def to_i(b)
  b ? 1 : 0
end
unmap_mmf_view(view) click to toggle source
# File lib/unpack.rb, line 201
def unmap_mmf_view(view)
  unmap_view_of_file(view)
end
unpack_ia(lr) click to toggle source

-Int32: Number of integers -Int32: 1st 32 bit integer -Int32: 2nd 32 bit integer -… Free lr after use

@return [Array<int>]

# File lib/unpack.rb, line 144
def unpack_ia(lr)
  begin
    mmf = open_mmf(lr)
    raise "Failed to open MMF." if !mmf
    
    view, ptr = map_mmf_view(mmf, lr)
    raise "Failed to map MMF view." if !view
  rescue
    return []
  ensure
    close_mmf(mmf) if mmf
  end
  
  begin
    int_count = ptr.read_string(MBIPC_SIZEOFINT).unpack("l")[0]
    ptr += MBIPC_SIZEOFINT
    
    ints = ptr.read_string(MBIPC_SIZEOFINT * int_count).
               unpack("l" + int_count.to_s)
  rescue
    return []
  ensure
    unmap_mmf_view(view)
    close_mmf(mmf)
  end
  
  return ints
end
unpack_ii(lr) click to toggle source

-Int32: 1st 32 bit integer -Int32: 2nd 32 bit integer Free lr after use

@return [Array<int>]

# File lib/unpack.rb, line 112
def unpack_ii(lr)
  begin
    mmf = open_mmf(lr)
    raise "Failed to open MMF." if !mmf
    
    view, ptr = map_mmf_view(mmf, lr)
    raise "Failed to map MMF view." if !view
  rescue
    return [-1, -1]
  ensure
    close_mmf(mmf) if mmf
  end
  
  begin
    ints = ptr.read_string(MBIPC_SIZEOFINT * 2).unpack("ll")
  rescue
    return [-1, -1]
  ensure
    unmap_mmf_view(view)
    close_mmf(mmf)
  end
  
  return ints
end
unpack_s(lr) click to toggle source

-Int32: Byte count of the string -byte[]: String data Free lr after use

@return [String]

# File lib/unpack.rb, line 25
def unpack_s(lr)
  string_1 = ""
  
  begin
    mmf = open_mmf(lr)
    raise "Failed to open MMF." if !mmf
    
    view, ptr = map_mmf_view(mmf, lr)
    raise "Failed to map MMF view." if !view
  rescue
    return ""
  ensure
    close_mmf(mmf) if mmf
  end
  
  begin
    byte_count = ptr.read_string(MBIPC_SIZEOFINT).unpack("l")[0]
    ptr += MBIPC_SIZEOFINT
    
    if byte_count > 0
      string_1 = ptr.read_string(byte_count).force_encoding("UTF-16LE").
                 encode(__ENCODING__)
    end
  rescue
    return ""
  ensure
    unmap_mmf_view(view)
    close_mmf(mmf)
  end
  
  return string_1
end
unpack_sa(lr) click to toggle source

-Int32: Number of strings -Int32: Byte count of 1st string -byte[]: 1st string data -Int32: Byte count of 2nd string -byte[]: 2nd string data -… Free lr after use

@return [Array<String>]

# File lib/unpack.rb, line 67
def unpack_sa(lr)
  begin
    mmf = open_mmf(lr)
    raise "Failed to open MMF." if !mmf
    
    view, ptr = map_mmf_view(mmf, lr)
    raise "Failed to map MMF view." if !view
  rescue
    return []
  ensure
    close_mmf(mmf) if mmf
  end
  
  begin
    str_count = ptr.read_string(MBIPC_SIZEOFINT).unpack("l")[0]
    ptr += MBIPC_SIZEOFINT
    
    strings = Array.new(str_count)
    
    strings.map! do |s|
      byte_count = ptr.read_string(MBIPC_SIZEOFINT).unpack("l")[0]
      ptr += MBIPC_SIZEOFINT
    
      if byte_count > 0
        s = ptr.read_string(byte_count).force_encoding("UTF-16LE").
            encode(__ENCODING__)
        ptr += byte_count
        s
      end
    end
  rescue
    return []
  ensure
    unmap_mmf_view(view)
    close_mmf(mmf)
  end
  
  return strings
end