class MusicBeeIPC
Constants
- WM_COPYDATA
- WM_USER
Window Message
Public Instance Methods
@return [MBError]
# File lib/musicbeeipc.rb, line 545 def clear_now_playing_list() send_message(find_hwnd(), WM_USER, MBC_ClearNowPlayingList, 0) end
@return [MBError]
# File lib/musicbeeipc.rb, line 65 def end_auto_dj() send_message(find_hwnd(), WM_USER, MBC_EndAutoDj, 0) end
@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
@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
@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
@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
@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
@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
@return [bool]
# File lib/musicbeeipc.rb, line 293 def get_crossfade() to_b(send_message(find_hwnd(), WM_USER, MBC_GetCrossfade, 0)) end
@return [int]
# File lib/musicbeeipc.rb, line 506 def get_current_index() send_message(find_hwnd(), WM_USER, MBC_GetCurrentIndex, 0) end
@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
@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
@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
@return [bool]
# File lib/musicbeeipc.rb, line 249 def get_dsp_enabled() to_b(send_message(find_hwnd(), WM_USER, MBC_GetDspEnabled, 0)) end
@return [int]
# File lib/musicbeeipc.rb, line 321 def get_duration() send_message(find_hwnd(), WM_USER, MBC_GetDuration, 0) end
@return [bool]
# File lib/musicbeeipc.rb, line 238 def get_equalizer_enabled() to_b(send_message(find_hwnd(), WM_USER, MBC_GetEqualizerEnabled, 0)) end
@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
@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
@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
@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
@return [MBMusicBeeVersion]
# File lib/musicbeeipc.rb, line 1369 def get_music_bee_version() send_message(find_hwnd(), WM_USER, MBC_MusicBeeVersion, 0) end
@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
@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
@return [bool]
# File lib/musicbeeipc.rb, line 205 def get_mute() to_b(send_message(find_hwnd(), WM_USER, MBC_GetMute, 0)) end
@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
@return [MBPlayState]
# File lib/musicbeeipc.rb, line 70 def get_play_state() send_message(find_hwnd(), WM_USER, MBC_GetPlayState, 0) end
@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
@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
@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
@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
@return [int]
# File lib/musicbeeipc.rb, line 107 def get_position() send_message(find_hwnd(), WM_USER, MBC_GetPosition, 0) end
@return [MBRepeatMode]
# File lib/musicbeeipc.rb, line 227 def get_repeat() send_message(find_hwnd(), WM_USER, MBC_GetRepeat, 0) end
@return [MBReplayGainMode]
# File lib/musicbeeipc.rb, line 304 def get_replay_gain_mode() send_message(find_hwnd(), WM_USER, MBC_GetReplayGainMode, 0) end
@return [bool]
# File lib/musicbeeipc.rb, line 260 def get_scrobble_enabled() to_b(send_message(find_hwnd(), WM_USER, MBC_GetScrobbleEnabled, 0)) end
@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
@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
@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
@return [bool]
# File lib/musicbeeipc.rb, line 216 def get_shuffle() to_b(send_message(find_hwnd(), WM_USER, MBC_GetShuffle, 0)) end
@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
@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
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
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
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
@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
@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
@return [bool]
# File lib/musicbeeipc.rb, line 486 def is_soundtrack() to_b(send_message(find_hwnd(), WM_USER, MBC_IsSoundtrack, 0)) end
@param index [int] @return [MBError]
# File lib/musicbeeipc.rb, line 591 def jump(index) send_message(find_hwnd(), WM_USER, MBC_Jump, index) end
@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
@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
@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
@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
@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
@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
@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
@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
@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
@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
@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
@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
@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
@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
@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
@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
@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
@param query [String] @param comparison [String] @param fields [Array<String>] @return [Array<String>]
# File lib/musicbeeipc.rb, line 1197 def library_search(query, comparison="Contains", fields=["ArtistPeople", "Title", "Album"]) hwnd = find_hwnd() lr = send_message(hwnd, WM_COPYDATA, MBC_Library_Search, pack_sssa(query, comparison, fields)) r = unpack_sa(lr) send_message(hwnd, WM_USER, MBC_FreeLRESULT, lr) r end
@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
@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
@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
@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
@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
@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
@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
@return [MBError]
# File lib/musicbeeipc.rb, line 55 def next_track() send_message(find_hwnd(), WM_USER, MBC_NextTrack, 0) end
@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
@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
@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
@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
@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
@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
@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
@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
@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
@return [MBError]
# File lib/musicbeeipc.rb, line 35 def pause() send_message(find_hwnd(), WM_USER, MBC_Pause, 0) end
@return [MBError]
# File lib/musicbeeipc.rb, line 30 def play() send_message(find_hwnd(), WM_USER, MBC_Play, 0) end
@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
@return [MBError]
# File lib/musicbeeipc.rb, line 25 def play_pause() send_message(find_hwnd(), WM_USER, MBC_PlayPause, 0) end
@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
@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
@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
@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
@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
@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
@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
@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
@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
@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
@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
@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
@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
@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
@return [MBError]
# File lib/musicbeeipc.rb, line 809 def playlist_query_playlists() send_message(find_hwnd(), WM_USER, MBC_Playlist_QueryPlaylists, 0) end
@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
@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
@return [int]
# File lib/musicbeeipc.rb, line 118 def position send_message(find_hwnd(), WM_USER, MBC_GetPosition, 0) end
@param position [int]
# File lib/musicbeeipc.rb, line 123 def position=(position) send_message(find_hwnd(), WM_USER, MBC_SetPosition, position) end
@return [MBError]
# File lib/musicbeeipc.rb, line 50 def previous_track() send_message(find_hwnd(), WM_USER, MBC_PreviousTrack, 0) end
@return [bool]
# File lib/musicbeeipc.rb, line 20 def probe() send_message(find_hwnd(), WM_USER, MBC_Probe, 0) != MBE_Error end
@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
@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
@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
@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
@param query [String] @param comparison [String] @param fields [Array<String>] @return [Array<String>]
# File lib/musicbeeipc.rb, line 599 def search(query, comparison="Contains", fields=["ArtistPeople", "Title", "Album"]) hwnd = find_hwnd() lr = send_message(hwnd, WM_COPYDATA, MBC_Search, pack_sssa(query, comparison, fields)) r = unpack_sa(lr) send_message(hwnd, WM_USER, MBC_FreeLRESULT, lr) r end
@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
@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
@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
@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
@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
@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
@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
@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
@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
@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
@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
@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
@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
@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
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
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
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
@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
@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
@return [MBError]
# File lib/musicbeeipc.rb, line 271 def show_equalizer() send_message(find_hwnd(), WM_USER, MBC_ShowEqualiser, 0) end
@return [MBError]
# File lib/musicbeeipc.rb, line 564 def show_now_playing_assistant() send_message(find_hwnd(), WM_USER, MBC_ShowNowPlayingAssistant, 0) end
@return [MBError]
# File lib/musicbeeipc.rb, line 60 def start_auto_dj() send_message(find_hwnd(), WM_USER, MBC_StartAutoDj, 0) end
@return [MBError]
# File lib/musicbeeipc.rb, line 40 def stop() send_message(find_hwnd(), WM_USER, MBC_Stop, 0) end
@return [MBError]
# File lib/musicbeeipc.rb, line 45 def stop_after_current() send_message(find_hwnd(), WM_USER, MBC_StopAfterCurrent, 0) end
@return [MBError]
# File lib/musicbeeipc.rb, line 1432 def test() send_message(find_hwnd(), WM_USER, MBC_Test, 0) end
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
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 - 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 - 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
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
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
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
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
@return [MBError]
# File lib/musicbeeipc.rb, line 1336 def window_bring_to_front() send_message(find_hwnd(), WM_USER, MBC_Window_BringToFront, 0) end
@return [MBError]
# File lib/musicbeeipc.rb, line 1302 def window_close() send_message(find_hwnd(), WM_USER, MBC_Window_Close, 0) end
@return [HWND (long)]
# File lib/musicbeeipc.rb, line 1292 def window_get_handle() send_message(find_hwnd(), WM_USER, MBC_Window_GetHandle, 0) end
@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
@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
@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
@return [MBError]
# File lib/musicbeeipc.rb, line 1317 def window_maximize() send_message(find_hwnd(), WM_USER, MBC_Window_Maximize, 0) end
@return [MBError]
# File lib/musicbeeipc.rb, line 1312 def window_minimize() send_message(find_hwnd(), WM_USER, MBC_Window_Minimize, 0) end
@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
@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
@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
# File lib/unpack.rb, line 186 def close_mmf(mmf) close_handle(mmf) end
@return [HWND (pointer)]
# File lib/musicbeeipc.rb, line 1466 def find_hwnd() find_window(nil, "MusicBee IPC Interface\0".encode("UTF-16LE")) end
# 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
# 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
-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
-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
-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
-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
-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
-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
-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
-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
-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
-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
# File lib/musicbeeipc.rb, line 1470 def to_b(i) i == 0 ? false : true end
# File lib/musicbeeipc.rb, line 1474 def to_i(b) b ? 1 : 0 end
# File lib/unpack.rb, line 201 def unmap_mmf_view(view) unmap_view_of_file(view) end
-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
-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
-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
-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